Skip to content

Commit

Permalink
Merge branch 'hotfix/2.6.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Alima Grine committed Jan 23, 2023
2 parents 52591fa + 3fb7964 commit 226f7e3
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 30 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2.6.5, 2023-01-23:
- Bug fix: Fix payment in iframe mode when JavaScript minification is enabled in Magento.
- Update list of supported payment means.
- Update list of supported currencies.

2.6.4, 2022-11-24:
- [embedded] Bug fix: Fix error related to invalid email format when customer checkout as guest.
- Minor code fixes.
Expand Down
2 changes: 1 addition & 1 deletion COPYING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2016-2022 Lyra Network.
Copyright © 2016-2023 Lyra Network.

PayZen plugin for Magento 2 is licensed under the
Open Software License version 3.0 that is bundled with
Expand Down
25 changes: 25 additions & 0 deletions Controller/Plugin/JsExcluder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* Copyright © Lyra Network.
* This file is part of PayZen plugin for Magento 2. See COPYING.md for license details.
*
* @author Lyra Network (https://www.lyra.com/)
* @copyright Lyra Network
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
namespace Lyranetwork\Payzen\Controller\Plugin;

use Magento\Framework\View\Asset\Minification;

class JsExcluder
{
public function aroundGetExcludes(Minification $subject, callable $proceed, $contentType)
{
$result = $proceed($contentType);
if ($contentType == 'js') {
$result[] = 'Lyranetwork_Payzen/js/support.js';
}

return $result;
}
}
4 changes: 2 additions & 2 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@ public function explode($separator, $string)
if ($string === null) {
return [];
}
return explode($separator, $string);

return explode($separator, $string);
}

/**
Expand Down
34 changes: 18 additions & 16 deletions Model/Api/Form/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public static function getSupportedCurrencies()
{
$currencies = array(
array('ARS', '032', 2), array('AUD', '036', 2), array('BRL', '986', 2), array('CAD', '124', 2),
array('CHF', '756', 2), array('CNY', '156', 1), array('COP', '170', 2), array('CZK', '203', 2),
array('CHF', '756', 2), array('CNY', '156', 2), array('COP', '170', 2), array('CZK', '203', 2),
array('DKK', '208', 2), array('EUR', '978', 2), array('GBP', '826', 2), array('HKD', '344', 2),
array('HUF', '348', 2), array('IDR', '360', 2), array('INR', '356', 2), array('JPY', '392', 0),
array('HUF', '348', 2), array('IDR', '360', 0), array('INR', '356', 2), array('JPY', '392', 0),
array('KHR', '116', 0), array('KRW', '410', 0), array('KWD', '414', 3), array('MAD', '504', 2),
array('MXN', '484', 2), array('MYR', '458', 2), array('NOK', '578', 2), array('NZD', '554', 2),
array('PEN', '604', 2), array('PHP', '608', 2), array('PLN', '985', 2), array('RUB', '643', 2),
Expand Down Expand Up @@ -212,9 +212,10 @@ public static function getSupportedCardTypes()
'ACCORD_STORE' => 'Cartes Enseignes Partenaires', 'ACCORD_STORE_SB' => 'Cartes Enseignes Partenaires (sandbox)',
'ALINEA' => 'Carte myalinea', 'ALINEA_CDX' => 'Carte Cadeau Alinéa', 'ALINEA_CDX_SB' => 'Carte Cadeau Alinéa (sandbox)',
'ALINEA_SB' => 'Carte myalinea (sandbox)', 'ALIPAY' => 'Alipay', 'ALLOBEBE_CDX' => 'Carte Cadeau Allobébé',
'ALLOBEBE_CDX_SB' => 'Carte Cadeau Allobébé (sandbox)', 'APETIZ' => 'Apetiz', 'AUCHAN' => 'Carte Auchan',
'AUCHAN_SB' => 'Carte Auchan (sandbox)', 'AURORE-MULTI' => 'Cpay Aurore', 'BANCONTACT' => 'Bancontact Mistercash',
'BIZZBEE_CDX' => 'Carte Cadeau Bizzbee', 'BIZZBEE_CDX_SB' => 'Carte Cadeau Bizzbee (sandbox)', 'BOULANGER' => 'Carte b+',
'ALLOBEBE_CDX_SB' => 'Carte Cadeau Allobébé (sandbox)', 'APETIZ' => 'Apetiz', 'APPLE_PAY' => 'Apple Pay',
'AUCHAN' => 'Carte Auchan', 'AUCHAN_SB' => 'Carte Auchan (sandbox)', 'AURORE-MULTI' => 'Cpay Aurore',
'BANCONTACT' => 'Bancontact Mistercash', 'BIZUM' => 'Bizum', 'BIZZBEE_CDX' => 'Carte Cadeau Bizzbee',
'BIZZBEE_CDX_SB' => 'Carte Cadeau Bizzbee (sandbox)', 'BOULANGER' => 'Carte b+',
'BOULANGER_SB' => 'Carte b+ (sandbox)', 'BRICE_CDX' => 'Carte Cadeau Brice', 'BRICE_CDX_SB' => 'Carte Cadeau Brice (sandbox)',
'BUT' => 'But', 'CA_DO_CARTE' => 'CA DO Carte', 'CABAL' => 'Cabal', 'CARNET' => 'Carnet', 'CASINO' => 'Banque Casino',
'CDGP' => 'Carte Privilège', 'CDISCOUNT' => 'CDiscount', 'CHQ_DEJ' => 'Chèque Déjeuner', 'COF3XCB' => 'Cofinoga 3 fois CB',
Expand All @@ -226,22 +227,23 @@ public static function getSupportedCardTypes()
'EDENRED_TC' => 'Ticket Compliments', 'EDENRED_TR' => 'Ticket Restaurant', 'ELO' => 'Elo', 'ELV' => 'ELV',
'FRANFINANCE_3X' => 'Paiement en 3 fois', 'FRANFINANCE_4X' => 'Paiement en 4 fois', 'FULLCB3X' => 'Paiement en 3 fois CB',
'FULLCB4X' => 'Paiement en 4 fois CB', 'GEMO_CDX' => 'Carte Cadeau Gémo', 'GEMO_CDX_SB' => 'Carte Cadeau Gémo (sandbox)',
'GIROPAY' => 'Giropay', 'GOOGLEPAY' => 'Google Pay', 'HIPER' => 'Hiper', 'HIPERCARD' => 'Hipercard', 'IDEAL' => 'iDEAL',
'GIROPAY' => 'Giropay', 'HIPER' => 'Hiper', 'HIPERCARD' => 'Hipercard', 'IDEAL' => 'iDEAL',
'ILLICADO' => 'Carte Illicado', 'ILLICADO_SB' => 'Carte Illicado (sandbox)', 'IP_WIRE' => 'Virement SEPA',
'IP_WIRE_INST' => 'Virement SEPA Instantané', 'JCB' => 'JCB', 'JOUECLUB_CDX' => 'Carte Cadeau Joué Club',
'JOUECLUB_CDX_SB' => 'Carte Cadeau Joué Club (sandbox)', 'JULES_CDX' => 'Carte Cadeau Jules',
'JULES_CDX_SB' => 'Carte Cadeau Jules (sandbox)', 'LEROY-MERLIN' => 'Carte Maison Financement',
'LEROY-MERLIN_SB' => 'Carte Maison Financement (sandbox)', 'MASTERPASS' => 'MasterPass',
'MC_CORDOBESA' => 'Mastercard Cordobesa', 'MULTIBANCO' => 'Multibanco', 'MYBANK' => 'MyBank', 'NARANJA' => 'Naranja',
'NORAUTO' => 'Carte Norauto option Financement', 'NORAUTO_SB' => 'Carte Norauto option Financement (sandbox)',
'ONEY' => 'Paiement en 3 ou 4 fois par CB', 'ONEY_3X_4X' => 'Paiement en 3 ou 4 fois Oney',
'ONEY_ENSEIGNE' => 'Cartes enseignes Oney', 'ONEY_SANDBOX' => 'Paiement en 3 ou 4 fois par CB (sandbox)',
'PAYBOX' => 'Paybox', 'PAYDIREKT' => 'Paydirekt', 'PAYPAL' => 'PayPal',
'JULES_CDX_SB' => 'Carte Cadeau Jules (sandbox)', 'KLARNA' => 'Klarna', 'LECLERC' => 'Carte Reglo',
'LEROY-MERLIN' => 'Carte Maison Financement', 'LEROY-MERLIN_SB' => 'Carte Maison Financement (sandbox)',
'MASTERPASS' => 'MasterPass', 'MC_CORDOBESA' => 'Mastercard Cordobesa', 'MULTIBANCO' => 'Multibanco', 'MYBANK' => 'MyBank',
'NARANJA' => 'Naranja', 'NORAUTO' => 'Carte Norauto option Financement', 'NORAUTO_SB' => 'Carte Norauto option Financement (sandbox)',
'ONEY' => 'Paiement en 3 ou 4 fois par CB', 'ONEY_10X_12X' => 'Paiement en 10 ou 12 fois Oney',
'ONEY_3X_4X' => 'Paiement en 3 ou 4 fois Oney', 'ONEY_ENSEIGNE' => 'Cartes enseignes Oney', 'ONEY_PAYLATER' => 'Pay Later Oney',
'ONEY_SANDBOX' => 'Paiement en 3 ou 4 fois par CB (sandbox)', 'PAYBOX' => 'Paybox', 'PAYDIREKT' => 'Paydirekt', 'PAYPAL' => 'PayPal',
'PAYPAL_SB' => 'PayPal Sandbox', 'PICWIC' => 'Carte Picwic', 'PICWIC_SB' => 'Carte Picwic (sandbox)',
'POSTFINANCE' => 'PostFinance Card', 'POSTFINANCE_EFIN' => 'PostFinance E-Finance', 'PRESTO' => 'Presto',
'PRZELEWY24' => 'Przelewy24', 'SDD' => 'Prélèvement SEPA', 'SODEXO' => 'Pass Restaurant', 'SOFICARTE' => 'Soficarte',
'SOFORT_BANKING' => 'Sofort', 'SOROCRED' => 'Sorocred', 'SYGMA' => 'Sygma', 'UNION_PAY' => 'UnionPay',
'VILLAVERDE' => 'Carte Cadeau VillaVerde', 'VILLAVERDE_SB' => 'Carte Cadeau VillaVerde (sandbox)', 'WECHAT' => 'WeChat Pay'
'PRZELEWY24' => 'Przelewy24', 'S-MONEY' => 'S-money', 'SCT' => 'Virement SEPA', 'SDD' => 'Prélèvement SEPA',
'SODEXO' => 'Pass Restaurant', 'SOFICARTE' => 'Soficarte', 'SOFORT_BANKING' => 'Sofort', 'SOROCRED' => 'Sorocred',
'SYGMA' => 'Sygma', 'TRUFFAUT_CDX' => 'Carte Cadeau Truffaut', 'UNION_PAY' => 'UnionPay', 'VILLAVERDE' => 'Carte Cadeau VillaVerde',
'VILLAVERDE_SB' => 'Carte Cadeau VillaVerde (sandbox)', 'WECHAT' => 'WeChat Pay'
);
}

Expand Down
5 changes: 4 additions & 1 deletion Model/Api/Form/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public function __construct($encoding = 'UTF-8')
$this->addField('vads_cust_status', 'Customer status (private or company)', '#^PRIVATE|COMPANY$#u', false, 7);
$this->addField('vads_cust_title', 'Customer title', '#^' . $ans . '{0,63}$#u', false, 63);
$this->addField('vads_cust_zip', 'Customer zip code', $an63, false, 63);
$this->addField('vads_cust_national_id', 'Customer national id', $ans255);
$this->addField('vads_cust_address_number', 'Customer address number', '#^' . $ans . '{0,64}$#u', false, 64);
$this->addField('vads_cust_district', 'Customer district', $ans127, false, 127);
$this->addField('vads_cvv', 'Card verification number', '#^\d{3,4}$#u');
$this->addField('vads_expiry_month', 'Month of card expiration', '#^\d[0-2]{1}$#u');
$this->addField('vads_expiry_year', 'Year of card expiration', '#^20[0-9]{2}$#u');
Expand Down Expand Up @@ -693,7 +696,7 @@ public function getRequestFieldsArray($for_log = false, $escape = true)
{
$fields = $this->getRequestFields();

$sensitive_data = array('vads_card_number', 'vads_cvv', 'vads_expiry_month', 'vads_expiry_year');
$sensitive_data = array('vads_card_number', 'vads_cvv', 'vads_expiry_month', 'vads_expiry_year', 'vads_cust_national_id');

$result = array();
foreach ($fields as $field) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"php" : "~7|~8"
},
"type" : "magento2-module",
"version" : "2.6.4",
"version" : "2.6.5",
"license" : "OSL-3.0",
"autoload" : {
"files" : [
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<payzen>
<general>
<support_email><![CDATA[[email protected]]]></support_email>
<plugin_version>2.6.4</plugin_version>
<plugin_version>2.6.5</plugin_version>
<gateway_version>V2</gateway_version>
<cms_identifier>Magento_2.x</cms_identifier>
<enable_logs>1</enable_logs>
Expand Down
4 changes: 4 additions & 0 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@
<type name="Magento\Framework\Session\SessionStartChecker">
<plugin name="payzen_session_checker" type="Lyranetwork\Payzen\Controller\Plugin\SessionChecker" />
</type>

<type name="Magento\Framework\View\Asset\Minification">
<plugin name="payzen_exclude_js" type="Lyranetwork\Payzen\Controller\Plugin\JsExcluder" />
</type>
</config>
12 changes: 4 additions & 8 deletions view/frontend/templates/payment/redirect.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@
</form>

<script>
require([
'jquery'
], function($) {
$(function() {
$('#payzen_payment_form').submit(function() {
$('#payzen_payment_form_btn').prop('disabled', true);
});
$('#payzen_payment_form').submit();
document.addEventListener("DOMContentLoaded", () => {
document.getElementById("payzen_payment_form").submit(function() {
document.getElementById("payzen_payment_form_btn").prop('disabled', true);
});
document.getElementById("payzen_payment_form").submit();
});
</script>

0 comments on commit 226f7e3

Please sign in to comment.