File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ public function getData()
4848 return ! is_null ($ value );
4949 });
5050
51+ if ($ this ->getCardholderName ()) {
52+ $ data ['creditCard ' ] = array (
53+ 'cardholderName ' => $ this ->getCardholderName (),
54+ );
55+ }
56+
5157 $ data += $ this ->getOptionData ();
5258 $ data += $ this ->getCardData ();
5359 $ data ['options ' ]['submitForSettlement ' ] = false ;
@@ -67,4 +73,24 @@ public function sendData($data)
6773
6874 return $ this ->createResponse ($ response );
6975 }
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+ }
7096}
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class CreatePaymentMethodRequest extends AbstractRequest
1414 public function getData ()
1515 {
1616 $ data = array (
17+ 'cardholderName ' => $ this ->getCardholderName (),
1718 'customerId ' => $ this ->getCustomerId (),
1819 'paymentMethodNonce ' => $ this ->getToken (),
1920 );
@@ -34,4 +35,24 @@ public function sendData($data)
3435
3536 return $ this ->createResponse ($ response );
3637 }
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+ }
3758}
You can’t perform that action at this time.
0 commit comments