Skip to content

Commit

Permalink
Fix constructing PayPal class
Browse files Browse the repository at this point in the history
  • Loading branch information
budziam committed Jan 22, 2023
1 parent 17dfc49 commit 70537de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 27 deletions.
23 changes: 1 addition & 22 deletions includes/Verification/PaymentModules/HotPay.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?php
namespace App\Verification\PaymentModules;

use App\Loggers\FileLogger;
use App\Managers\ServiceManager;
use App\Models\FinalizedPayment;
use App\Models\PaymentPlatform;
use App\Models\Purchase;
use App\Payment\General\PaymentResult;
use App\Payment\General\PaymentResultType;
use App\Requesting\Requester;
use App\Routing\UrlGenerator;
use App\Support\Money;
use App\Verification\Abstracts\PaymentModule;
use App\Verification\Abstracts\SupportSms;
Expand All @@ -31,19 +26,6 @@ class HotPay extends PaymentModule implements SupportSms, SupportTransfer
{
const MODULE_ID = "hotpay";

private ServiceManager $serviceManager;

public function __construct(
Requester $requester,
PaymentPlatform $paymentPlatform,
UrlGenerator $url,
FileLogger $fileLogger,
ServiceManager $serviceManager
) {
parent::__construct($requester, $paymentPlatform, $url, $fileLogger);
$this->serviceManager = $serviceManager;
}

public static function getDataFields(): array
{
return [
Expand Down Expand Up @@ -108,17 +90,14 @@ private function isValidNumber($number, $netValue): bool

public function prepareTransfer(Money $price, Purchase $purchase): array
{
$service = $this->serviceManager->get($purchase->getServiceId());
assert($service);

return [
"url" => "https://platnosc.hotpay.pl",
"method" => "POST",
"data" => [
"SEKRET" => $this->getTransferSecret(),
"KWOTA" => $price->asPrice(),
"ID_ZAMOWIENIA" => $purchase->getId(),
"NAZWA_USLUGI" => $service->getNameI18n(),
"NAZWA_USLUGI" => __($purchase->getServiceName()),
"EMAIL" => $purchase->getEmail(),
"ADRES_WWW" => $this->url->to("/page/payment_success"),
],
Expand Down
12 changes: 7 additions & 5 deletions includes/Verification/PaymentModules/PayPal.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace App\Verification\PaymentModules;

use App\Loggers\DatabaseLogger;
use App\Loggers\FileLogger;
use App\Models\FinalizedPayment;
use App\Models\PaymentPlatform;
Expand All @@ -25,14 +26,15 @@ class PayPal extends PaymentModule implements SupportTransfer
private Translator $lang;

public function __construct(
Requester $requester,
PaymentPlatform $paymentPlatform,
UrlGenerator $url,
DatabaseLogger $databaseLogger,
FileLogger $fileLogger,
PaymentPlatform $paymentPlatform,
Requester $requester,
Settings $settings,
TranslationManager $translationManager
TranslationManager $translationManager,
UrlGenerator $url
) {
parent::__construct($requester, $paymentPlatform, $url, $fileLogger);
parent::__construct($databaseLogger, $fileLogger, $paymentPlatform, $requester, $url);
$this->settings = $settings;
$this->lang = $translationManager->user();
}
Expand Down

0 comments on commit 70537de

Please sign in to comment.