@@ -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
0 commit comments