Skip to content

Commit 8972c2a

Browse files
author
Nabil Berhouche
committed
Merge branch 'hotfix/2.0.2'
2 parents 457fead + 5bd1d3a commit 8972c2a

16 files changed

Lines changed: 595 additions & 711 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2.0.2, 2020-12-02:
2+
- Bug fix: Avoid error when billing address is not collected.
3+
- Update translations.
4+
15
2.0.1, 2019-01-14:
26
- Bug fix: siganture error when using special characters as ' and ".
37
- Compatibility with Drupal Commerce 2.10 (fix error at the end of the payment).

COPYING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2018-2019 Lyra Network.
1+
Copyright © 2018-2020 Lyra Network.
22

33
PayZen for Drupal Commerce is free software; you can redistribute it and/or
44
modify it under the terms of the GNU General Public License

commerce_payzen/commerce_payzen.info.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
core: 8.x
88

99
# information about project
10-
version: "8.x-2.0.1"
10+
version: "8.x-2.0.2"
1111
core: "8.x"
1212
project: "commerce_payzen"
1313
datestamp: "1511970023"

commerce_payzen/includes/PayzenApi.php

Lines changed: 84 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function generateTransId($timestamp = null)
6262
}
6363

6464
/**
65-
* Returns an array of languages accepted by the PayZen payment platform.
65+
* Returns an array of languages accepted by the payment gateway.
6666
*
6767
* @return array[string][string]
6868
*/
@@ -103,7 +103,7 @@ public static function isSupportedLanguage($lang)
103103
}
104104

105105
/**
106-
* Return the list of currencies recognized by the PayZen platform.
106+
* Return the list of currencies recognized by the payment gateway.
107107
*
108108
* @return array[int][PayzenCurrency]
109109
*/
@@ -118,7 +118,7 @@ public static function getSupportedCurrencies()
118118
array('SGD', '702', 2), array('ZAR', '710', 2), array('SEK', '752', 2), array('CHF', '756', 2),
119119
array('THB', '764', 2), array('TND', '788', 3), array('GBP', '826', 2), array('USD', '840', 2),
120120
array('TWD', '901', 2), array('TRY', '949', 2), array('EUR', '978', 2), array('PLN', '985', 2),
121-
array('BRL', '986', 2)
121+
array('BRL', '986', 2), array('ARS', '032', 2), array('COP', '170', 2), array('PEN', '604', 2)
122122
);
123123

124124
$payzen_currencies = array();
@@ -206,54 +206,98 @@ public static function getCurrencyNumCode($alpha3)
206206
}
207207

208208
/**
209-
* Returns an array of card types accepted by the PayZen payment platform.
209+
* Returns an array of card types accepted by the payment gateway.
210210
*
211211
* @return array[string][string]
212212
*/
213213
public static function getSupportedCardTypes()
214214
{
215215
return array(
216-
'CB' => 'CB', 'E-CARTEBLEUE' => 'e-Carte Bleue', 'MAESTRO' => 'Maestro', 'MASTERCARD' => 'MasterCard',
216+
'CB' => 'CB', 'E-CARTEBLEUE' => 'e-Carte Bleue', 'MAESTRO' => 'Maestro', 'MASTERCARD' => 'Mastercard',
217217
'VISA' => 'Visa', 'VISA_ELECTRON' => 'Visa Electron', 'VPAY' => 'V PAY', 'AMEX' => 'American Express',
218-
'ACCORD_STORE' => 'Carte enseigne Accord', 'ACCORD_STORE_SB' => 'Carte enseigne Accord - Sandbox',
219-
'ALINEA' => 'Carte enseigne Alinéa', 'ALINEA_CDX' => 'Carte cadeau Alinéa',
220-
'ALINEA_CDX_SB' => 'Carte cadeau Alinéa - Sandbox', 'ALINEA_SB' => 'Carte enseigne Alinéa - Sandbox',
221-
'ALIPAY' => 'Alipay', 'ALLOBEBE_CDX' => 'Carte cadeau AlloBébé', 'ALLOBEBE_CDX_SB' => 'Carte cadeau AlloBébé - Sandbox',
222-
'AUCHAN' => 'Carte enseigne Auchan', 'AUCHAN_SB' => 'Carte enseigne Auchan - Sandbox', 'AURORE_MULTI' => 'Carte Aurore',
223-
'BANCONTACT' => 'Bancontact Mistercash', 'BIZZBEE_CDX' => 'Carte cadeau BizzBee',
224-
'BIZZBEE_CDX_SB' => 'Carte cadeau BizzBee - Sandbox', 'BOULANGER' => 'Carte enseigne Boulanger',
225-
'BOULANGER_SB' => 'Carte enseigne Boulanger - Sandbox', 'BRICE_CDX' => 'Carte cadeau Brice',
226-
'BRICE_CDX_SB' => 'Carte cadeau Brice - Sandbox', 'COFINOGA' => 'Carte Cofinoga Be Smart',
227-
'CONECS' => 'Titre-Restaurant Dématérialisé Conecs', 'CONECS_APETIZ' => 'Titre-Restaurant Dématérialisé Apetiz',
228-
'CONECS_CHQ_DEJ' => 'Titre-Restaurant Dématérialisé Chèque Déjeuner',
229-
'CONECS_SODEXO' => 'Titre-Restaurant Dématérialisé Sodexo', 'CONECS_EDENRED' => 'Ticket Restaurant',
230-
'DINERS' => 'Carte Diners Club', 'DISCOVER' => 'Carte Discover', 'E_CV' => 'e-Chèque-Vacances', 'ECCARD' => 'Euro-Cheque card',
231-
'EDENRED_EC' => 'Ticket Eco Chèque Edenred', 'EDENRED_TC' => 'Ticket Culture Edenred',
232-
'EDENRED_TR' => 'Ticket Restaurant Edenred', 'ELV' => 'Prélèvement Bancaire Hobex',
233-
'EPS' => 'EPS Online Überweisung', 'EPS_GIROPAY' => 'EPS Online Überweisung',
234-
'FULLCB_3X' => 'Paiement en 3x sans frais par BNPP PF', 'FULLCB_4X' => 'Paiement en 4x sans frais par BNPP PF',
235-
'GIROPAY' => 'Giropay', 'IDEAL' => 'iDEAL', 'ILLICADO' => 'Cartes Cadeau Illicado',
236-
'ILLICADO_SB' => 'Cartes Cadeau Illicado - Sandbox - Sandbox', 'JCB' => 'JCB',
237-
'JOUECLUB_CDX' => 'Carte cadeau JouéClub', 'JOUECLUB_CDX_SB' => 'Carte cadeau JouéClub - Sandbox',
238-
'KLARNA' => 'Klarna Internet Banking', 'LEROY-MERLIN' => 'Carte enseigne Leroy-Merlin',
239-
'LEROY-MERLIN_SB' => 'Carte enseigne Leroy-Merlin - Sandbox', 'MASTERPASS' => 'MasterPass',
240-
'MULTIBANCO' => 'Multibanco', 'NORAUTO' => 'Carte enseigne Norauto', 'NORAUTO_SB' => 'Carte enseigne Norauto - Sandbox',
241-
'ONEY' => 'FacilyPay Oney', 'ONEY_SANDBOX' => 'FacilyPay Oney - Sandbox', 'PAYDIREKT' => 'PayDirekt',
242-
'PAYLIB' => 'Wallet Paylib', 'PAYPAL' => 'PayPal', 'PAYPAL_SB' => 'PayPal - Sandbox',
243-
'PAYSAFECARD' => 'Carte prépayée paysafecard', 'PICWIC' => 'Carte enseigne PicWic',
244-
'PICWIC_SB' => 'Carte enseigne PicWic - Sandbox', 'POSTFINANCE' => 'PostFinance',
245-
'POSTFINANCE_EFIN' => 'PostFinance E-finance', 'SCT' => 'Virement SEPA Credit Transfer',
246-
'SDD' => 'Prélèvement SEPA Direct Debit', 'SOFICARTE' => 'Carte Soficarte',
247-
'SOFORT_BANKING' => 'Sofort', 'TRUFFAUX_CDX' => 'Carte Cadeau Truffaut', 'UNION_PAY' => 'UnionPay',
248-
'VILLAVERDE' => 'Carte enseigne Villaverde', 'VILLAVERDE_SB' => 'Carte enseigne Villaverde - Sandbox',
249-
'WECHAT' => 'WeChat Pay', 'MYBANK' => 'MyBank', 'PRZELEWY24' => 'Przelewy24'
218+
'ACCORD_STORE' => 'Cartes Enseignes Partenaires', 'ACCORD_STORE_SB' => 'Cartes Enseignes Partenaires (sandbox)',
219+
'ALINEA_CDX' => 'Carte Cadeau Alinéa', 'ALINEA_CDX_SB' => 'Carte Cadeau Alinéa (sandbox)', 'ALIPAY' => 'Alipay',
220+
'ALLOBEBE_CDX' => 'Carte Cadeau Allobébé', 'ALLOBEBE_CDX_SB' => 'Carte Cadeau Allobébé (sandbox)', 'APETIZ' => 'Apetiz',
221+
'AUCHAN' => 'Carte Auchan', 'AUCHAN_SB' => 'Carte Auchan (sandbox)', 'AURORE-MULTI' => 'Cpay Aurore',
222+
'BANCONTACT' => 'Bancontact Mistercash', 'BIZZBEE_CDX' => 'Carte Cadeau Bizzbee',
223+
'BIZZBEE_CDX_SB' => 'Carte Cadeau Bizzbee (sandbox)', 'BOULANGER' => 'Carte b+', 'BOULANGER_SB' => 'Carte b+ (sandbox)',
224+
'BRICE_CDX' => 'Carte Cadeau Brice', 'BRICE_CDX_SB' => 'Carte Cadeau Brice (sandbox)', 'BUT' => 'But', 'CABAL' => 'Cabal',
225+
'CARNET' => 'Carnet', 'CA_DO_CARTE' => 'CA DO Carte', 'CHQ_DEJ' => 'Chèque Déjeuner', 'CONECS' => 'Conecs',
226+
'CONFORAMA' => 'Conforama', 'CORA' => 'Cora', 'CORA_BLANCHE' => 'Cora blanche', 'CORA_PREM' => 'Cora Visa Premier',
227+
'CORA_VISA' => 'Cora Visa', 'CVCO' => 'Chèque-Vacances Connect', 'DINERS' => 'Diners', 'DISCOVER' => 'Discover',
228+
'ECCARD' => 'EC Card', 'EDENRED' => 'Ticket Restaurant', 'EDENRED_EC' => 'Ticket EcoCheque',
229+
'EDENRED_SC' => 'Ticket Sport & Culture', 'EDENRED_TC' => 'Ticket Compliments', 'EDENRED_TR' => 'Ticket Restaurant',
230+
'ELO' => 'Elo', 'E_CV' => 'e-Chèque-Vacances', 'FRANFINANCE_3X' => 'Paiement en 3 fois',
231+
'FRANFINANCE_4X' => 'Paiement en 4 fois', 'FULLCB3X' => 'Paiement en 3 fois CB', 'FULLCB4X' => 'Paiement en 4 fois CB',
232+
'GEMO_CDX' => 'Carte Cadeau Gémo', 'GEMO_CDX_SB' => 'Carte Cadeau Gémo (sandbox)', 'GIROPAY' => 'Giropay',
233+
'GOOGLEPAY' => 'Google Pay', 'HIPER' => 'Hiper', 'HIPERCARD' => 'Hipercard', 'IDEAL' => 'iDEAL', 'JCB' => 'JCB',
234+
'JOUECLUB_CDX' => 'Carte Cadeau Joué Club', 'JOUECLUB_CDX_SB' => 'Carte Cadeau Joué Club (sandbox)',
235+
'JULES_CDX' => 'Carte Cadeau Jules', 'JULES_CDX_SB' => 'Carte Cadeau Jules (sandbox)', 'KLARNA' => 'Klarna',
236+
'LECLERC' => 'Carte Reglo', 'MC_CORDOBESA' => 'Mastercard Cordobesa',
237+
'MULTIBANCO' => 'Multibanco', 'MYBANK' => 'MyBank', 'NARANJA' => 'Naranja', 'NORAUTO' => 'Carte Norauto option Financement',
238+
'NORAUTO_SB' => 'Carte Norauto option Financement (sandbox)', 'ONEY_3X_4X' => 'Paiement en 3 ou 4 fois Oney',
239+
'ONEY_ENSEIGNE' => 'Cartes enseignes Oney', 'PAYDIREKT' => 'Paydirekt', 'PAYLIB' => 'Paylib', 'PAYPAL' => 'PayPal',
240+
'PAYPAL_SB' => 'PayPal Sandbox', 'PICWIC' => 'Carte Picwic', 'PICWIC_SB' => 'Carte Picwic (sandbox)',
241+
'POSTFINANCE' => 'PostFinance Card', 'POSTFINANCE_EFIN' => 'PostFinance E-Finance', 'PRESTO' => 'Presto',
242+
'PRZELEWY24' => 'Przelewy24', 'S-MONEY' => 'S-money', 'SCT' => 'Virement SEPA', 'SDD' => 'Prélèvement SEPA',
243+
'SODEXO' => 'Pass Restaurant', 'SOFORT_BANKING' => 'Sofort', 'SOROCRED' => 'Sorocred',
244+
'TRUFFAUT_CDX' => 'Carte Cadeau Truffaut', 'UNION_PAY' => 'UnionPay', 'WECHAT' => 'WeChat Pay'
250245
);
251246
}
252247

253248
/**
254-
* Compute a PayZen signature. Parameters must be in UTF-8.
249+
* Return the statuses list of finalized successful payments (authorized or captured).
250+
* @return array
251+
*/
252+
public static function getSuccessStatuses()
253+
{
254+
return array(
255+
'AUTHORISED',
256+
'AUTHORISED_TO_VALIDATE', // TODO is this a pending status?
257+
'CAPTURED',
258+
'ACCEPTED'
259+
);
260+
}
261+
262+
/**
263+
* Return the statuses list of payments that are waiting confirmation (successful but
264+
* the amount has not been transfered and is not yet guaranteed).
265+
* @return array
266+
*/
267+
public static function getPendingStatuses()
268+
{
269+
return array(
270+
'INITIAL',
271+
'WAITING_AUTHORISATION',
272+
'WAITING_AUTHORISATION_TO_VALIDATE',
273+
'UNDER_VERIFICATION',
274+
'PRE_AUTHORISED',
275+
'WAITING_FOR_PAYMENT'
276+
);
277+
}
278+
279+
/**
280+
* Return the statuses list of payments interrupted by the buyer.
281+
* @return array
282+
*/
283+
public static function getCancelledStatuses()
284+
{
285+
return array('ABANDONED');
286+
}
287+
288+
/**
289+
* Return the statuses list of payments waiting manual validation from the gateway Back Office.
290+
* @return array
291+
*/
292+
public static function getToValidateStatuses()
293+
{
294+
return array('WAITING_AUTHORISATION_TO_VALIDATE', 'AUTHORISED_TO_VALIDATE');
295+
}
296+
297+
/**
298+
* Compute the signature. Parameters must be in UTF-8.
255299
*
256-
* @param array[string][string] $parameters payment platform request/response parameters
300+
* @param array[string][string] $parameters payment gateway request/response parameters
257301
* @param string $key shop certificate
258302
* @param string $algo signature algorithm
259303
* @param boolean $hashed set to false to get the unhashed signature
@@ -288,7 +332,7 @@ public static function sign($parameters, $key, $algo, $hashed = true)
288332

289333
/**
290334
* PHP is not yet a sufficiently advanced technology to be indistinguishable from magic...
291-
* so don't use magic_quotes, they mess up with the platform response analysis.
335+
* so don't use magic_quotes, they mess up with the gateway response analysis.
292336
*
293337
* @param array $potentially_quoted_data
294338
* @return mixed

commerce_payzen/includes/PayzenCurrency.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function convertAmountToInteger($float)
3333
$coef = pow(10, $this->decimals);
3434

3535
$amount = $float * $coef;
36-
return (int) (string) $amount; // cast amount to string (to avoid rounding) than return it as int
36+
return (int) (string) $amount; // Cast amount to string (to avoid rounding) than return it as int.
3737
}
3838

3939
public function convertAmountToFloat($integer)

commerce_payzen/includes/PayzenField.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
if (! class_exists('PayzenField', false)) {
1313

1414
/**
15-
* Class representing a form field to send to the payment platform.
15+
* Class representing a form field to send to the payment gateway.
1616
*/
1717
class PayzenField
1818
{
@@ -107,7 +107,7 @@ public function isValid()
107107
public function setValue($value)
108108
{
109109
$value = ($value === null) ? null : (string) $value;
110-
// we save value even if invalid but we return "false" as warning
110+
// We save value even if invalid but we return "false" as warning.
111111
$this->value = $value;
112112

113113
return $this->isValid();

0 commit comments

Comments
 (0)