From 279384498d1381a0b5e34f4e88c080b83ecd3cbb Mon Sep 17 00:00:00 2001 From: Willian Keller Date: Fri, 27 Jul 2018 08:53:11 -0300 Subject: [PATCH 1/5] Add Brazilian Credit Cards Support Add Brazilian Credit Cards Support #1 --- app/code/Magento/Payment/etc/payment.xml | 9 +++++++++ .../Payment/view/base/web/images/cc/au.png | Bin 0 -> 1791 bytes .../Payment/view/base/web/images/cc/elo.png | Bin 0 -> 1397 bytes .../Payment/view/base/web/images/cc/hc.png | Bin 0 -> 1427 bytes 4 files changed, 9 insertions(+) create mode 100644 app/code/Magento/Payment/view/base/web/images/cc/au.png create mode 100644 app/code/Magento/Payment/view/base/web/images/cc/elo.png create mode 100644 app/code/Magento/Payment/view/base/web/images/cc/hc.png diff --git a/app/code/Magento/Payment/etc/payment.xml b/app/code/Magento/Payment/etc/payment.xml index 19b5eb709c649..4afb6b01b366c 100644 --- a/app/code/Magento/Payment/etc/payment.xml +++ b/app/code/Magento/Payment/etc/payment.xml @@ -41,5 +41,14 @@ + + + + + + + + + diff --git a/app/code/Magento/Payment/view/base/web/images/cc/au.png b/app/code/Magento/Payment/view/base/web/images/cc/au.png new file mode 100644 index 0000000000000000000000000000000000000000..04cb2df8fa332127111138efe7499c74dea562bb GIT binary patch literal 1791 zcmVBW zK~z}7)tG&3U1c4|KfmWW=iGbS+ioq)Fxr*j*3FGD%%%Bk!1o$8i(;n8WJ&G5^2oS}VR}VF_ZTn3e{O2O(HFn{gnPDUd zvV7%sooP7rbl32+UAtJf?hr(vg;Fx0m~12k1h9Yq3hvx+H<_w%hTa!uWV#V041HdF zZY%4qKZNE=N|zKK;jRVHKDchpVO~DC1uKd%Zbt5!k>c&A>-qW4M_Jg|jt-Zlaw-Il z0S%!pljDiUx6yX$;+es7y3jNz28Th3#V{xVy(UAaWcl2eTlmDaZ$L)CGiYRS10G4Q zPtp~TbO*RW52prF2C@QKSaIbEHr)3d@48xgO@={}A`}aNEy+iD^#qDnwQpfMh|9bUEXG61|OE46nP{MB{5GfiJtKwKWQ^YGZTz0HS(gef_nkXbP zx-UkNK*2A?f&pZDT^xcpPH8FYTyqAOGsS?&I81}XG#9YVA$DPiy)44aaY$W^nWadT zLyQ}{iHV-oBHv=>5wy?Zx-G8VBRS!d91lqT9pFy-&{eeBq!sFtqG4qLZ*X|T0tIjd zgJd0ML4;jaz*|wkE()=ihnNo~n5-M?B^{7VP)N(3wXAZM!^47j4zC)RTb6ZfnT-X( zbyF|3RHw) zo2I2>2?q|Z;=qwrw6ray-)7GmM$R(8m*zp&Fv!+HsFwecNwUwRlDyy5s5f`r$9`QO%1UKRI7hYhKay_y170KDtSF{^nNI z1YP)ry}I?WyYTh>C;74}N(& z5Bzi^N1nQcS+)IKQrE@rUbvopEmt8jRqLaZ&zxf5-JUu8@xZ6~!y_AMs_CGqs$=W} zAO7_4M(+6TL#+SIGi?6qle~4hfz@|BNpoWx)#+gtH@4Cr{Ee#q%ND zzV6Sw^yYHzdE^0Bf8;d^QHsmvcCfgijkfknnY*lWY%rPNadA1(No^BBtzeu(U1j5( zH4v5BFCQZHP$zgM!HC1DLE=(H^##K5m0CO@avrK+CBcfri6HS*e-BKj`2R5(E=ZCK hRdK~!h%iBg{{f~>4i{y7PpAL@002ovPDHLkV1ifUU4sAs literal 0 HcmV?d00001 diff --git a/app/code/Magento/Payment/view/base/web/images/cc/elo.png b/app/code/Magento/Payment/view/base/web/images/cc/elo.png new file mode 100644 index 0000000000000000000000000000000000000000..eba0296a09104b059809ff2beea5ce501dab24e4 GIT binary patch literal 1397 zcmV-*1&aEKP)(lr0Rd#KBdHf=K;tl)tQ zmwSG{%jceZ&iDL|*r+r*l!motnn4Hz5(|(JYXVpb;1g3J1OTqJXxC_ZNUT88XFtoa=Abf*RNm4$jHdQ{5T17fd)^r30vNh2u}$N{~X01_fh~8 zt5)b`e~Z~{=KlTr8488?vfa6Jhiz?b)HE%#e%G#D8NbKldFg$El^YHG=6DeoW-Me% zk_kbk1erAO%J)TVe6N5~>IjHsQ)O9jo6W`x7cOumJ9FmDs=$R%?Cr6W3mQ46kui`I zWD?|@Aft+NkBsd2w2*+J5F&qYr4&z{I+X=DG&IDnt}Y%rbclgKAj@~`*s)ba9JJbu zd~mmr$r(M*e`n)?&q{dw>-7xXw=q2nre_5iGt*UFKtNkE^2>r(S66d>ex4*5iA31Z z(ecWf?(Xgk7D7Ze!Sf8I*Q6d477 z{l!W^c%$6Idu7e^m29PgTr!dd zgON8z%wz;)OwZbFmi)m72M03%m6eqQz=nnf`u%<;lgTXL(a}-v*|R5Ss#NGqd{XA+ zQ-_!S4ewGXauuFp*8wA$068o9`GLZm;5p^cYPDwWw{PE$zP>(qJf6(6hYufOcz75- zpAUY&e_7cwD+QSbq!gG)E+Cyl?SzmRf1m@91Vjo}o629uCnqN}P2}9Ua}duP!}$0( zPM$o8OP4O;=FOWqo6L*$G?heJ0%;IilnD@viNaU(J&kv20f;034U^$y{%4ho7cV}K zf&fX3jg6tby&ao3Z^nreClCk(GX9n9Q6h#vnFK-9>k83mvVm%;<0>&UtZ+A22q=lc zpO}9Gs;a7DFc{>(zyMoYTUlIOOq0o!@t2mCva_?3PNy?#--|ik+1Z)d^O3cJ@roUs zc6d2a?&XexV(R5Ts#0UH@MFuyMJbj#wzm~!sm{weo^t|HN};^G9HCGMi9`aYPoG9p zQxk6Az73@m+-^5&YHD!p+BLMav>+S~FHR>lHJQH=jYbg&1aRcY5&UrZGWynUL#y77 z2vUfX_$~Deo7e%jiX18A|8(; znoeP0;R&QBQ6w~&r4BkJkrG6Raa>8x;)}U4j4sSBs(cPBk!tnBvejxuMMVW{HXBG{ zYHA7-6BCF;B02Zi?RMDhb_9dLY(-ZlbIP+K!E?_dQ}jp(;M*@P>u9Pg{X|F00000NkvXXu0mjf DE(3;T literal 0 HcmV?d00001 diff --git a/app/code/Magento/Payment/view/base/web/images/cc/hc.png b/app/code/Magento/Payment/view/base/web/images/cc/hc.png new file mode 100644 index 0000000000000000000000000000000000000000..203e0b7e305c16191909dc552f26e7e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#85#zuut`h+zUfavvW7 h9|0f6qKQis{7;G9J|AYPA143+002ovPDHLkV1hClmmvTE literal 0 HcmV?d00001 From 6c1b1442e16e32e7af5cd0951000732e5564afb5 Mon Sep 17 00:00:00 2001 From: Willian Keller Date: Tue, 7 Aug 2018 15:52:47 -0300 Subject: [PATCH 2/5] Add Brazilian Credit Cards regex #1 --- .../credit-card-type.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js index 3ac67f6f31002..b438371cc24a5 100644 --- a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js +++ b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js @@ -110,6 +110,39 @@ define([ name: 'CVC', size: 3 } + }, + { + title: 'Hipercard', + type: 'HC', + pattern: '^((606282)|(637095)|(637568)|(637599)|(637609)|(637612))\\d*$', + gaps: [4, 8, 12], + lengths: [13, 16], + code: { + name: 'CVC', + size: 3 + } + }, + { + title: 'Elo', + type: 'ELO', + pattern: '^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\\d*$', + gaps: [4, 8, 12], + lengths: [16], + code: { + name: 'CVC', + size: 3 + } + }, + { + title: 'Aura', + type: 'AU', + pattern: '^5078\\d*$', + gaps: [4, 8, 12], + lengths: [19], + code: { + name: 'CVC', + size: 3 + } } ]; From 8832267ac724434fc661ab71f59429cbc62d0e7b Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi Date: Thu, 13 Sep 2018 18:03:30 +0300 Subject: [PATCH 3/5] magento/payment-improvements#1: Add Brazilian Credit Cards Support - formatting of pattern to match code style requirements --- .../credit-card-number-validator/credit-card-type.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js index b438371cc24a5..1b387b384104f 100644 --- a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js +++ b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js @@ -125,7 +125,16 @@ define([ { title: 'Elo', type: 'ELO', - pattern: '^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\\d*$', + pattern: '^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|' + + '(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|' + + '(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|' + + '(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|' + + '(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|' + + '(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|' + + '(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|' + + '(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|' + + '(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|' + + '(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\\d*$', gaps: [4, 8, 12], lengths: [16], code: { From 6ffb464c3e8a11791aea875a2e8cb6629c7ac51e Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi Date: Thu, 13 Sep 2018 18:14:27 +0300 Subject: [PATCH 4/5] magento/payment-improvements#1: Add Brazilian Credit Cards Support - added patterns for Brazilian cards to validator --- app/code/Magento/Payment/Model/Method/Cc.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index c23ad5b535dd8..06661469014a5 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -148,6 +148,22 @@ public function validate() 'JCB' => '/^35(2[8-9][0-9]{12,15}|[3-8][0-9]{13,16})/', 'MI' => '/^(5(0|[6-9])|63|67(?!59|6770|6774))\d*$/', 'MD' => '/^(6759(?!24|38|40|6[3-9]|70|76)|676770|676774)\d*$/', + + //Hipercard + 'HC' => '/^((606282)|(637095)|(637568)|(637599)|(637609)|(637612))\d*$/', + //Elo + 'ELO' => '/^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|' . + '(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|' . + '(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|' . + '(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|' . + '(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|' . + '(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|' . + '(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|' . + '(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|' . + '(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|' . + '(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\d*$/', + //Aura + 'AU' => '/^5078\d*$/' ]; $ccNumAndTypeMatches = isset( From 4222ec243e43837f09581dea7a06d8bdb4d5577c Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi Date: Thu, 7 Feb 2019 12:19:27 -0600 Subject: [PATCH 5/5] Fixed code style. --- app/code/Magento/Payment/Model/Method/Cc.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index 06661469014a5..11629308cd46b 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -10,6 +10,8 @@ use Magento\Quote\Model\Quote\Payment; /** + * Credit Card payment method legacy implementation. + * * @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @deprecated 100.0.8 @@ -93,6 +95,7 @@ public function __construct( * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function validate() { @@ -205,6 +208,8 @@ public function validate() } /** + * Check if verification should be used. + * * @return bool * @api */ @@ -218,6 +223,8 @@ public function hasVerification() } /** + * Get list of credit cards verification reg exp. + * * @return array * @api */ @@ -242,6 +249,8 @@ public function getVerificationRegEx() } /** + * Validate expiration date + * * @param string $expYear * @param string $expMonth * @return bool @@ -292,6 +301,8 @@ public function assignData(\Magento\Framework\DataObject $data) } /** + * Get code for "other" credit cards. + * * @param string $type * @return bool * @api