File tree Expand file tree Collapse file tree
Model/Payment/Stripe/Payments Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,20 @@ class CvvEmsCodeMapper extends Base_CvvEmsCodeMapper
1313 */
1414 public $ allowedMethods = ['stripe_payments ' ];
1515
16+ /**
17+ * List of mapping CVV codes
18+ *
19+ * Keys are concatenation cvc_check field from Stripe charge object
20+ *
21+ * @var array
22+ */
23+ public $ cvvMap = [
24+ 'pass ' => 'M ' ,
25+ 'fail ' => 'N ' ,
26+ 'unchecked ' => 'P ' ,
27+ 'unavailable ' => 'U '
28+ ];
29+
1630 /**
1731 * Gets payment CVV verification code.
1832 *
@@ -29,13 +43,18 @@ public function getPaymentData(\Magento\Sales\Model\Order $order)
2943 isset ($ charge ->payment_method_details ->card ->checks ) &&
3044 isset ($ charge ->payment_method_details ->card ->checks ->cvc_check )
3145 ) {
32- $ cvvStatus = $ charge ->payment_method_details ->card ->checks ->cvc_check ;
33- $ message = 'CVV found on payment mapper: ' . (empty ($ cvvStatus ) ? 'EMPTY ' : $ cvvStatus );
46+ $ cvvCheck = $ charge ->payment_method_details ->card ->checks ->cvc_check ;
47+
48+ if (isset ($ this ->cvvMap [$ cvvCheck ])) {
49+ $ cvvStatus = $ this ->cvvMap [$ cvvCheck ];
50+ } else {
51+ $ cvvStatus = null ;
52+ }
3453 } else {
3554 $ cvvStatus = null ;
36- $ message = 'CVV found on payment mapper: false ' ;
3755 }
3856
57+ $ message = 'CVV found on payment mapper: ' . (empty ($ cvvStatus ) ? 'false ' : $ cvvStatus );
3958 $ this ->logger ->debug ($ message , ['entity ' => $ order ]);
4059
4160 if (empty ($ cvvStatus )) {
@@ -44,4 +63,4 @@ public function getPaymentData(\Magento\Sales\Model\Order $order)
4463
4564 return $ cvvStatus ;
4665 }
47- }
66+ }
You can’t perform that action at this time.
0 commit comments