File tree 2 files changed +47
-0
lines changed
2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ public function getData()
48
48
return ! is_null ($ value );
49
49
});
50
50
51
+ if ($ this ->getCardholderName ()) {
52
+ $ data ['creditCard ' ] = array (
53
+ 'cardholderName ' => $ this ->getCardholderName (),
54
+ );
55
+ }
56
+
51
57
$ data += $ this ->getOptionData ();
52
58
$ data += $ this ->getCardData ();
53
59
$ data ['options ' ]['submitForSettlement ' ] = false ;
@@ -67,4 +73,24 @@ public function sendData($data)
67
73
68
74
return $ this ->createResponse ($ response );
69
75
}
76
+
77
+ /**
78
+ * [optional] The cardholder name associated with the credit card. 175 character maximum.
79
+ * Required for iOS integration because its missing in "tokenizeCard" function there.
80
+ * See: https://developers.braintreepayments.com/reference/request/transaction/sale/php#credit_card.cardholder_name
81
+ *
82
+ * @param $value
83
+ * @return mixed
84
+ */
85
+ public function setCardholderName ($ value )
86
+ {
87
+ $ cardholderName = trim ($ value );
88
+ $ cardholderName = strlen ($ cardholderName )>0 ? $ cardholderName : null ;
89
+ return $ this ->setParameter ('cardholderName ' , $ cardholderName );
90
+ }
91
+
92
+ public function getCardholderName ()
93
+ {
94
+ return $ this ->getParameter ('cardholderName ' );
95
+ }
70
96
}
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class CreatePaymentMethodRequest extends AbstractRequest
14
14
public function getData ()
15
15
{
16
16
$ data = array (
17
+ 'cardholderName ' => $ this ->getCardholderName (),
17
18
'customerId ' => $ this ->getCustomerId (),
18
19
'paymentMethodNonce ' => $ this ->getToken (),
19
20
);
@@ -34,4 +35,24 @@ public function sendData($data)
34
35
35
36
return $ this ->createResponse ($ response );
36
37
}
38
+
39
+ /**
40
+ * [optional] The cardholder name associated with the credit card. 175 character maximum.
41
+ * Required for iOS integration because its missing in "tokenizeCard" function there.
42
+ * See: https://developers.braintreepayments.com/reference/request/payment-method/create/php#cardholder_name
43
+ *
44
+ * @param $value
45
+ * @return mixed
46
+ */
47
+ public function setCardholderName ($ value )
48
+ {
49
+ $ cardholderName = trim ($ value );
50
+ $ cardholderName = strlen ($ cardholderName )>0 ? $ cardholderName : null ;
51
+ return $ this ->setParameter ('cardholderName ' , $ cardholderName );
52
+ }
53
+
54
+ public function getCardholderName ()
55
+ {
56
+ return $ this ->getParameter ('cardholderName ' );
57
+ }
37
58
}
You can’t perform that action at this time.
0 commit comments