Skip to content

Commit

Permalink
QA: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Dec 13, 2022
1 parent 317de42 commit 1625a7f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 22 deletions.
12 changes: 12 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon

parameters:
level: 9
phpVersion: 80000

scanDirectories:
- src

fileExtensions:
- php

paths:
- src

ignoreErrors:
-
message: "#^Call to deprecated method validateConfig\\(\\) of class Nette\\\\DI\\\\CompilerExtension\\:\nuse getConfigSchema\\(\\)$#"
Expand Down
2 changes: 1 addition & 1 deletion src/DI/ComgateExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Contributte\Comgate\Http\HttpClient;
use GuzzleHttp\Client;
use Nette\DI\CompilerExtension;
use Nette\DI\Statement;
use Nette\DI\Definitions\Statement;
use Nette\Schema\Expect;
use Nette\Schema\Schema;
use stdClass;
Expand Down
2 changes: 1 addition & 1 deletion src/DI/ComgateExtension24.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Contributte\Comgate\Http\HttpClient;
use GuzzleHttp\Client;
use Nette\DI\CompilerExtension;
use Nette\DI\Statement;
use Nette\DI\Definitions\Statement;

class ComgateExtension24 extends CompilerExtension
{
Expand Down
19 changes: 9 additions & 10 deletions src/Entity/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class Refund extends AbstractEntity
/** @var string */
private $transId;

/** @var null|string */
private $refId;
/** @var string|null */
private $refId;

final private function __construct()
{
Expand All @@ -27,14 +27,14 @@ final private function __construct()
public static function of(
Money $money,
string $transId,
string $refId = null
?string $refId = null
): self
{
$p = new static();
$p->amount = $money->multipliedBy(100, RoundingMode::UNNECESSARY)->getAmount()->toInt();
$p->curr = $money->getCurrency()->getCurrencyCode();
$p->transId = $transId;
$p->refId = $refId;
$p->refId = $refId;

return $p;
}
Expand All @@ -54,11 +54,10 @@ public function getTransId(): string
return $this->transId;
}

public function getRefId(): string
{
return $this->refId;
}

public function getRefId(): ?string
{
return $this->refId;
}

/**
* @return mixed[]
Expand All @@ -69,7 +68,7 @@ public function toArray(): array
'amount' => $this->amount,
'curr' => $this->curr,
'transId' => $this->transId,
'refId' => $this->refId,
'refId' => $this->refId,
];
}

Expand Down
21 changes: 11 additions & 10 deletions src/Gateway/PaymentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@ public function status(PaymentStatus $status): Response
return $this->client->post('status', $status->toArray());
}

public function refund(Refund $payment): Response
{
$data = $payment->toArray();
public function refund(Refund $payment): Response
{
$data = $payment->toArray();

return $this->client->post('refund', $data);
}
return $this->client->post('refund', $data);
}

public function storno(Storno $payment): Response
{
$data = $payment->toArray();
public function storno(Storno $payment): Response
{
$data = $payment->toArray();

return $this->client->post('cancel', $data);
}

return $this->client->post('cancel', $data);
}
}

0 comments on commit 1625a7f

Please sign in to comment.