From fad0c018300771757ac8425e7c7ab7a0484f9408 Mon Sep 17 00:00:00 2001 From: MarijusCoding Date: Mon, 21 Oct 2024 19:09:26 +0300 Subject: [PATCH 1/3] added more redirect payment to prevent double statuses --- src/Config/SaferPayConfig.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Config/SaferPayConfig.php b/src/Config/SaferPayConfig.php index 89fc5845..0490cfad 100755 --- a/src/Config/SaferPayConfig.php +++ b/src/Config/SaferPayConfig.php @@ -304,7 +304,9 @@ public static function isRedirectPayment($paymentMethod) self::PAYMENT_APPLEPAY, self::PAYMENT_GOOGLEPAY, self::PAYMENT_TWINT, - self::PAYMENT_POSTFINANCE_PAY + self::PAYMENT_POSTFINANCE_PAY, + self::PAYMENT_DIRECTDEBIT, + self::PAYMENT_SOFORT ]; return in_array($paymentMethod, $paymentsAlwaysRedirect); From 3ce7e633256574a64bbc1fe322a4266dea799554 Mon Sep 17 00:00:00 2001 From: MarijusCoding Date: Tue, 22 Oct 2024 09:37:12 +0300 Subject: [PATCH 2/3] update --- .../AdminSaferPayOfficialSettingsController.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminSaferPayOfficialSettingsController.php b/controllers/admin/AdminSaferPayOfficialSettingsController.php index 794cb4b4..76a449d7 100755 --- a/controllers/admin/AdminSaferPayOfficialSettingsController.php +++ b/controllers/admin/AdminSaferPayOfficialSettingsController.php @@ -56,12 +56,24 @@ public function postProcess() { parent::postProcess(); - $isCreditCardSaveEnabled = Configuration::get(SaferPayConfig::CREDIT_CARD_SAVE); + /** @var \Invertus\SaferPay\Adapter\Configuration $configuration */ + $configuration = $this->module->getService(\Invertus\SaferPay\Adapter\Configuration::class); + + $isCreditCardSaveEnabled = $configuration->get(SaferPayConfig::CREDIT_CARD_SAVE); + if (!$isCreditCardSaveEnabled) { /** @var SaferPaySavedCreditCardRepository $cardRepo */ $cardRepo = $this->module->getService(SaferPaySavedCreditCardRepository::class); $cardRepo->deleteAllSavedCreditCards(); } + + $haveFieldToken = $configuration->get(SaferPayConfig::FIELDS_ACCESS_TOKEN . SaferPayConfig::getConfigSuffix()); + $haveBusinessLicense = $configuration->get(SaferPayConfig::BUSINESS_LICENSE . SaferPayConfig::getConfigSuffix()); + + if (!$haveFieldToken && $haveBusinessLicense) { + $configuration->set(SaferPayConfig::BUSINESS_LICENSE . SaferPayConfig::getConfigSuffix(), 0); + $this->errors[] = $this->module->l('Field Access Token is required to use business license'); + } } public function initOptions() From a53468a68b8a6db66ad2bd2937aff5ba14922500 Mon Sep 17 00:00:00 2001 From: MarijusCoding Date: Tue, 22 Oct 2024 10:35:02 +0300 Subject: [PATCH 3/3] fixed google apple status --- controllers/front/return.php | 4 ++++ src/DTO/Response/PaymentMeans.php | 20 ++++++++++++++++++- .../Response/ResponseObjectCreator.php | 3 +++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/controllers/front/return.php b/controllers/front/return.php index cebbb441..27fd10b9 100755 --- a/controllers/front/return.php +++ b/controllers/front/return.php @@ -87,6 +87,10 @@ public function postProcess() $orderPayment = $assertResponseBody->getPaymentMeans()->getBrand()->getPaymentMethod(); + if (!empty($assertResponseBody->getPaymentMeans()->getWallet())) { + $orderPayment = $assertResponseBody->getPaymentMeans()->getWallet(); + } + /** @var SaferPayFieldRepository $saferPayFieldRepository */ $saferPayFieldRepository = $this->module->getService(SaferPayFieldRepository::class); diff --git a/src/DTO/Response/PaymentMeans.php b/src/DTO/Response/PaymentMeans.php index c80990e7..21bdc750 100755 --- a/src/DTO/Response/PaymentMeans.php +++ b/src/DTO/Response/PaymentMeans.php @@ -43,6 +43,10 @@ class PaymentMeans * @var Card */ private $card; + /** + * @var string + */ + private $wallet; /** * PaymentMeans constructor. @@ -50,11 +54,12 @@ class PaymentMeans * @param string $displayText * @param Card|null $card */ - public function __construct(Brand $brand = null, $displayText = null, Card $card = null) + public function __construct(Brand $brand = null, $displayText = null, Card $card = null, $wallet = null) { $this->brand = $brand; $this->displayText = $displayText; $this->card = $card; + $this->wallet = $wallet; } /** @@ -97,6 +102,14 @@ public function getCard() return $this->card; } + /** + * @return string + */ + public function getWallet() + { + return $this->wallet; + } + /** * @param Card $card */ @@ -104,4 +117,9 @@ public function setCard($card) { $this->card = $card; } + + public function setWallet($wallet) + { + $this->wallet = $wallet; + } } diff --git a/src/Service/Response/ResponseObjectCreator.php b/src/Service/Response/ResponseObjectCreator.php index 6db2cd0e..38c4b882 100755 --- a/src/Service/Response/ResponseObjectCreator.php +++ b/src/Service/Response/ResponseObjectCreator.php @@ -89,6 +89,9 @@ protected function createPaymentMeans($paymentMeans) } $paymentMeansObj->setBrand($brandObj); $paymentMeansObj->setDisplayText($paymentMeans->DisplayText); + if (isset($paymentMeans->Wallet)) { + $paymentMeansObj->setWallet($paymentMeans->Wallet); + } return $paymentMeansObj; }