Skip to content

Commit

Permalink
Merge pull request #228 from Invertus/SL-271/c2p-blik-integrate
Browse files Browse the repository at this point in the history
SL-271 New payment methods integration
  • Loading branch information
MarijusCoding authored Nov 29, 2024
2 parents da24530 + c6b1dab commit c5f7cd7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
5 changes: 4 additions & 1 deletion saferpayofficial.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*@license SIX Payment Services
*/

use Invertus\SaferPay\Config\SaferPayConfig;

if (!defined('_PS_VERSION_')) {
exit;
}
Expand Down Expand Up @@ -220,7 +222,8 @@ public function hookPaymentOptions($params)
continue;
}

if (!in_array($this->context->currency->iso_code, $paymentMethods[$paymentMethod['paymentMethod']]['currencies'])) {
if (!in_array($this->context->currency->iso_code, $paymentMethods[$paymentMethod['paymentMethod']]['currencies'])
&& !in_array($paymentMethod['paymentMethod'], SaferPayConfig::WALLET_PAYMENT_METHODS)) {
continue;
}

Expand Down
12 changes: 10 additions & 2 deletions src/Config/SaferPayConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SaferPayConfig
const RESTRICT_REFUND_AMOUNT_TO_CAPTURED_AMOUNT = 'SAFERPAY_RESTRICT_REFUND_AMOUNT_TO_CAPTURED_AMOUNT';
const CONFIGURATION_NAME = 'SAFERPAY_CONFIGURATION_NAME';
const TEST_SUFFIX = '_TEST';
const API_VERSION = '1.40';
const API_VERSION = '1.43';
const PAYMENT_METHODS = [
self::PAYMENT_ALIPAY,
self::PAYMENT_AMEX,
Expand Down Expand Up @@ -78,6 +78,7 @@ class SaferPayConfig
self::PAYMENT_WLCRYPTOPAYMENTS,
self::PAYMENT_WECHATPAY,
self::PAYMENT_ACCOUNTTOACCOUNT,
self::PAYMENT_CLICKTOPAY,
];

const PAYMENT_ALIPAY = 'ALIPAY';
Expand Down Expand Up @@ -113,10 +114,13 @@ class SaferPayConfig
const PAYMENT_CARD = 'CARD';
const PAYMENT_POSTFINANCE_PAY = 'POSTFINANCEPAY';
const PAYMENT_WECHATPAY = 'WECHATPAY';
const PAYMENT_CLICKTOPAY = 'CLICKTOPAY';
const PAYMENT_BLIK = 'BLIK';

const WALLET_PAYMENT_METHODS = [
self::PAYMENT_APPLEPAY,
self::PAYMENT_GOOGLEPAY,
self::PAYMENT_CLICKTOPAY
];

const PAYMENT_METHODS_KEYS = [
Expand Down Expand Up @@ -144,6 +148,8 @@ class SaferPayConfig
'Card' => self::PAYMENT_CARD,
'PostFinancePay' => self::PAYMENT_POSTFINANCE_PAY,
'WeChatPay' => self::PAYMENT_WECHATPAY,
'ClickToPay' => self::PAYMENT_CLICKTOPAY,
'Blik' => self::PAYMENT_BLIK,
];

const FIELD_SUPPORTED_PAYMENT_METHODS = [
Expand Down Expand Up @@ -315,7 +321,9 @@ public static function isRedirectPayment($paymentMethod)
self::PAYMENT_POSTFINANCE_PAY,
self::PAYMENT_DIRECTDEBIT,
self::PAYMENT_SOFORT,
self::PAYMENT_PAYPAL
self::PAYMENT_PAYPAL,
self::PAYMENT_CLICKTOPAY,
self::PAYMENT_BLIK,
];

return in_array($paymentMethod, $paymentsAlwaysRedirect);
Expand Down
4 changes: 4 additions & 0 deletions src/Service/LegacyTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

use Invertus\SaferPay\Config\SaferPayConfig;
use Invertus\SaferPay\Factory\ModuleFactory;
use PrestaShop\Module\PsAccounts\Vendor\phpseclib\Net\SSH1;
use SaferPayOfficial;

if (!defined('_PS_VERSION_')) {
Expand Down Expand Up @@ -82,6 +83,9 @@ private function getTranslations()
SaferPayConfig::PAYMENT_CARD => $this->module->l('Card', self::FILE_NAME),
SaferPayConfig::PAYMENT_POSTFINANCE_PAY => $this->module->l('PostFinancePay', self::FILE_NAME),
SaferPayConfig::PAYMENT_WECHATPAY => $this->module->l('WeChatPay', self::FILE_NAME),
SaferPayConfig::PAYMENT_BLIK => $this->module->l('Blik', self::FILE_NAME),
SaferPayConfig::PAYMENT_GOOGLEPAY => $this->module->l('Googlepay'),
SaferPayConfig::PAYMENT_CLICKTOPAY => $this->module->l('Clicktopay', self::FILE_NAME),
];
}
}
1 change: 0 additions & 1 deletion src/Service/SaferPayObtainPaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public function obtainPaymentMethods()
$paymentMethods[$wallet->WalletName] = [
'paymentMethod' => $wallet->WalletName,
'logoUrl' => $wallet->LogoUrl,
'currencies' => $paymentMethodObject->Currencies,
];
}
}
Expand Down

0 comments on commit c5f7cd7

Please sign in to comment.