/** * create signatures for different call types * @ignore */ public static function init() { self::$_createCustomerSignature = array(self::$_transparentRedirectKeys, array('customer' => Braintree_CustomerGateway::createSignature())); self::$_updateCustomerSignature = array(self::$_transparentRedirectKeys, 'customerId', array('customer' => Braintree_CustomerGateway::updateSignature())); self::$_transactionSignature = array(self::$_transparentRedirectKeys, array('transaction' => Braintree_TransactionGateway::createSignature())); self::$_createCreditCardSignature = array(self::$_transparentRedirectKeys, array('creditCard' => Braintree_CreditCardGateway::createSignature())); self::$_updateCreditCardSignature = array(self::$_transparentRedirectKeys, 'paymentMethodToken', array('creditCard' => Braintree_CreditCardGateway::updateSignature())); }
function testCreateSignature() { $expected = array('billingAddressId', 'cardholderName', 'cvv', 'number', 'deviceSessionId', 'expirationDate', 'expirationMonth', 'expirationYear', 'token', 'venmoSdkPaymentMethodCode', 'deviceData', 'fraudMerchantId', 'paymentMethodNonce', array('options' => array('makeDefault', 'verificationMerchantAccountId', 'verifyCard', 'verificationAmount', 'venmoSdkSession', 'failOnDuplicatePaymentMethod')), array('billingAddress' => array('firstName', 'lastName', 'company', 'countryCodeAlpha2', 'countryCodeAlpha3', 'countryCodeNumeric', 'countryName', 'extendedAddress', 'locality', 'region', 'postalCode', 'streetAddress')), 'customerId'); $this->assertEquals($expected, Braintree_CreditCardGateway::createSignature()); }
/** * creates a full array signature of a valid create request * @return array gateway create request format */ public static function createSignature() { $creditCardSignature = Braintree_CreditCardGateway::createSignature(); unset($creditCardSignature['customerId']); $signature = array('id', 'company', 'email', 'fax', 'firstName', 'lastName', 'phone', 'website', 'deviceData', 'deviceSessionId', 'fraudMerchantId', 'paymentMethodNonce', array('creditCard' => $creditCardSignature), array('customFields' => array('_anyKey_'))); return $signature; }