Skip to content

Commit

Permalink
Merge branch 'release-v1.2.5' into password_input
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijusCoding authored Dec 12, 2024
2 parents a77ad83 + 2b16baf commit 694d636
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 12 deletions.
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Self-Checks
- [ ] I have performed a self-review of my code.
- [ ] I have updated/added necessary technical documentation in the [README](/README.md) file.

## Summary
<!-- Briefly explain the purpose of this PR in 1-2 sentences -->

## QA Checklist Labels
- [ ] Bug fix? <!-- Maps to "bug" label -->
- [ ] New feature? <!-- Maps to "feature" label -->
- [ ] Improvement? <!-- Maps to "improvement" label -->
- [ ] Technical debt? <!-- Maps to "debt" label -->
- [ ] Reusable? <!-- Maps to "reuse" label -->
- [ ] Covered by tests? <!-- Maps to "tested" label -->

## QA Checklist
<!-- Provide related ticket/PR's -->

## Additional Context
<!-- Provide a concise description of the changes made in this PR. -->

## Frontend Changes
<!-- If applicable, provide visual elements such as screenshots, GIFs, or videos to demonstrate frontend changes. -->
10 changes: 10 additions & 0 deletions .github/workflows/PULL_REQUEST_LABELS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Apply Labels Based on PR Template

on:
pull_request:
types: [opened, edited]

jobs:
label-management:
uses: Invertus/github-templates/.github/workflows/[email protected]
secrets: inherit
12 changes: 12 additions & 0 deletions .github/workflows/PULL_REQUEST_NAMING_RULES.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Names rules

on: [pull_request, workflow_dispatch]

jobs:
branch-name-check:
uses: Invertus/github-templates/.github/workflows/[email protected]
secrets: inherit

pr-title-check:
uses: Invertus/github-templates/.github/workflows/[email protected]
secrets: inherit
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,5 @@
- Compatibility with most popular OPC modules (The Checkout, Super Checkout, One Page Checkout PS)

## [1.2.5]
- Fixed issue with JSON API Password escaping HTML entities
- Fixed issue with JSON API Password escaping HTML entities
- Added new payment methods: Blik, ClickToPay
14 changes: 7 additions & 7 deletions controllers/admin/AdminSaferPayOfficialPaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ protected function renderShoppingPointOptions()
$fieldsForm = [];
$fieldsForm[0]['form'] = $this->fields_form;

/** @var \Invertus\SaferPay\Service\SaferPayObtainPaymentMethods $saferPayObtainPaymentMethods */
$saferPayObtainPaymentMethods = $this->module->getService(SaferPayObtainPaymentMethods::class);

$paymentMethodsList = $saferPayObtainPaymentMethods->obtainPaymentMethods();

foreach ($paymentMethods as $paymentMethod) {
$isActive = $paymentRepository->isActiveByName($paymentMethod);
$isLogoActive = $logoRepository->isActiveByName($paymentMethod);
Expand All @@ -184,7 +189,7 @@ protected function renderShoppingPointOptions()
'paymentMethod' => $paymentMethod,
'countryOptions' => $this->getActiveCountriesList(),
'countrySelect' => $selectedCountries,
'currencyOptions' => $this->getActiveCurrenciesList($paymentMethod),
'currencyOptions' => $this->getActiveCurrenciesList($paymentMethod, $paymentMethodsList),
'currencySelect' => $selectedCurrencies,
'is_field_active' => $isFieldActive,
'supported_field_payments' => SaferPayConfig::FIELD_SUPPORTED_PAYMENT_METHODS,
Expand Down Expand Up @@ -219,13 +224,8 @@ public function getActiveCountriesList($onlyActive = true)
return $countriesWithNames;
}

public function getActiveCurrenciesList($paymentMethod)
public function getActiveCurrenciesList($paymentMethod, $paymentMethods)
{
/** @var \Invertus\SaferPay\Service\SaferPayObtainPaymentMethods $saferPayObtainPaymentMethods */
$saferPayObtainPaymentMethods = $this->module->getService(SaferPayObtainPaymentMethods::class);

$paymentMethods = $saferPayObtainPaymentMethods->obtainPaymentMethods();

$currencyOptions[0] = $this->l('All');
foreach ($paymentMethods[$paymentMethod]['currencies'] as $currencyIso) {
if (Currency::getIdByIsoCode($currencyIso)) {
Expand Down
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
11 changes: 9 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,7 @@ class SaferPayConfig
'Card' => self::PAYMENT_CARD,
'PostFinancePay' => self::PAYMENT_POSTFINANCE_PAY,
'WeChatPay' => self::PAYMENT_WECHATPAY,
'Blik' => self::PAYMENT_BLIK,
];

const FIELD_SUPPORTED_PAYMENT_METHODS = [
Expand Down Expand Up @@ -315,7 +320,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
3 changes: 3 additions & 0 deletions src/Service/LegacyTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,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
6 changes: 6 additions & 0 deletions views/js/front/hosted-templates/hosted_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ $(document).ready(function () {
$('body').on('submit', '[id^=pay-with-][id$=-form] form', function (event) {
event.preventDefault();

var isSaferPayMethodSelected = $('[data-module-name*="saferpayofficial"]:checked').length;

if (!isSaferPayMethodSelected) {
event.target.submit();
}

var selectedCardMethod = $(this).find("[name=saved_card_method]").val();
var selectedCard = $(this).find("[name=selectedCreditCard_" + selectedCardMethod + "]").val();

Expand Down

0 comments on commit 694d636

Please sign in to comment.