Skip to content

Commit

Permalink
Merge branch 'RC/rc-1.2.4' of github.com:Invertus/saferpayofficial in…
Browse files Browse the repository at this point in the history
…to SV-29/checkoutps
  • Loading branch information
MarijusCoding committed Oct 22, 2024
2 parents 066d638 + a53468a commit c2b0d5c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
14 changes: 13 additions & 1 deletion controllers/admin/AdminSaferPayOfficialSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions controllers/front/return.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 3 additions & 1 deletion src/Config/SaferPayConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,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);
Expand Down
20 changes: 19 additions & 1 deletion src/DTO/Response/PaymentMeans.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,23 @@ class PaymentMeans
* @var Card
*/
private $card;
/**
* @var string
*/
private $wallet;

/**
* PaymentMeans constructor.
* @param Brand|null $brand
* @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;
}

/**
Expand Down Expand Up @@ -97,11 +102,24 @@ public function getCard()
return $this->card;
}

/**
* @return string
*/
public function getWallet()
{
return $this->wallet;
}

/**
* @param Card $card
*/
public function setCard($card)
{
$this->card = $card;
}

public function setWallet($wallet)
{
$this->wallet = $wallet;
}
}
3 changes: 3 additions & 0 deletions src/Service/Response/ResponseObjectCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c2b0d5c

Please sign in to comment.