当前位置: 首页>>代码示例>>PHP>>正文


PHP Braintree_CreditCard::factory方法代码示例

本文整理汇总了PHP中Braintree_CreditCard::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_CreditCard::factory方法的具体用法?PHP Braintree_CreditCard::factory怎么用?PHP Braintree_CreditCard::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Braintree_CreditCard的用法示例。


在下文中一共展示了Braintree_CreditCard::factory方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _verifyGatewayResponse

 /**
  * generic method for validating incoming gateway responses
  *
  * creates a new Braintree_CreditCard or Braintree_PayPalAccount object
  * and encapsulates it inside a Braintree_Result_Successful object, or
  * encapsulates a Braintree_Errors object inside a Result_Error
  * alternatively, throws an Unexpected exception if the response is invalid.
  *
  * @ignore
  * @param array $response gateway response values
  * @return object Result_Successful or Result_Error
  * @throws Braintree_Exception_Unexpected
  */
 private function _verifyGatewayResponse($response)
 {
     if (isset($response['creditCard'])) {
         // return a populated instance of Braintree_CreditCard
         return new Braintree_Result_Successful(Braintree_CreditCard::factory($response['creditCard']), "paymentMethod");
     } else {
         if (isset($response['paypalAccount'])) {
             // return a populated instance of Braintree_PayPalAccount
             return new Braintree_Result_Successful(Braintree_PayPalAccount::factory($response['paypalAccount']), "paymentMethod");
         } else {
             if (isset($response['coinbaseAccount'])) {
                 // return a populated instance of Braintree_CoinbaseAccount
                 return new Braintree_Result_Successful(Braintree_CoinbaseAccount::factory($response['coinbaseAccount']), "paymentMethod");
             } else {
                 if (isset($response['applePayCard'])) {
                     // return a populated instance of Braintree_ApplePayCard
                     return new Braintree_Result_Successful(Braintree_ApplePayCard::factory($response['applePayCard']), "paymentMethod");
                 } else {
                     if (isset($response['androidPayCard'])) {
                         // return a populated instance of Braintree_AndroidPayCard
                         return new Braintree_Result_Successful(Braintree_AndroidPayCard::factory($response['androidPayCard']), "paymentMethod");
                     } else {
                         if (isset($response['europeBankAccount'])) {
                             // return a populated instance of Braintree_EuropeBankAccount
                             return new Braintree_Result_Successful(Braintree_EuropeBankAccount::factory($response['europeBankAccount']), "paymentMethod");
                         } else {
                             if (isset($response['apiErrorResponse'])) {
                                 return new Braintree_Result_Error($response['apiErrorResponse']);
                             } else {
                                 if (is_array($response)) {
                                     return new Braintree_Result_Successful(Braintree_UnknownPaymentMethod::factory($response), "paymentMethod");
                                 } else {
                                     throw new Braintree_Exception_Unexpected('Expected payment method or apiErrorResponse');
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:oscarsmartwave,项目名称:l45fbl45t,代码行数:55,代码来源:PaymentMethodGateway.php

示例2: _initialize

 /**
  * sets instance properties from an array of values
  *
  * @ignore
  * @access protected
  * @param array $customerAttribs array of customer data
  * @return none
  */
 protected function _initialize($customerAttribs)
 {
     // set the attributes
     $this->_attributes = $customerAttribs;
     // map each address into its own object
     $addressArray = array();
     if (isset($customerAttribs['addresses'])) {
         foreach ($customerAttribs['addresses'] as $address) {
             $addressArray[] = Braintree_Address::factory($address);
         }
     }
     $this->_set('addresses', $addressArray);
     // map each creditCard into its own object
     $creditCardArray = array();
     if (isset($customerAttribs['creditCards'])) {
         foreach ($customerAttribs['creditCards'] as $creditCard) {
             $creditCardArray[] = Braintree_CreditCard::factory($creditCard);
         }
     }
     $this->_set('creditCards', $creditCardArray);
     // map each coinbaseAccount into its own object
     $coinbaseAccountArray = array();
     if (isset($customerAttribs['coinbaseAccounts'])) {
         foreach ($customerAttribs['coinbaseAccounts'] as $coinbaseAccount) {
             $coinbaseAccountArray[] = Braintree_CoinbaseAccount::factory($coinbaseAccount);
         }
     }
     $this->_set('coinbaseAccounts', $coinbaseAccountArray);
     // map each paypalAccount into its own object
     $paypalAccountArray = array();
     if (isset($customerAttribs['paypalAccounts'])) {
         foreach ($customerAttribs['paypalAccounts'] as $paypalAccount) {
             $paypalAccountArray[] = Braintree_PayPalAccount::factory($paypalAccount);
         }
     }
     $this->_set('paypalAccounts', $paypalAccountArray);
     // map each applePayCard into its own object
     $applePayCardArray = array();
     if (isset($customerAttribs['applePayCards'])) {
         foreach ($customerAttribs['applePayCards'] as $applePayCard) {
             $applePayCardArray[] = Braintree_applePayCard::factory($applePayCard);
         }
     }
     $this->_set('applePayCards', $applePayCardArray);
     // map each androidPayCard into its own object
     $androidPayCardArray = array();
     if (isset($customerAttribs['androidPayCards'])) {
         foreach ($customerAttribs['androidPayCards'] as $androidPayCard) {
             $androidPayCardArray[] = Braintree_AndroidPayCard::factory($androidPayCard);
         }
     }
     $this->_set('androidPayCards', $androidPayCardArray);
 }
开发者ID:nstungxd,项目名称:F2CA5,代码行数:61,代码来源:Customer.php

示例3: testVerificationIsLatestVerification

 function testVerificationIsLatestVerification()
 {
     $creditCard = Braintree_CreditCard::factory(array('verifications' => array(array('id' => '123', 'createdAt' => DateTime::createFromFormat('Ymd', '20121212')), array('id' => '932', 'createdAt' => DateTime::createFromFormat('Ymd', '20121215')), array('id' => '456', 'createdAt' => DateTime::createFromFormat('Ymd', '20121213')))));
     $this->assertEquals('932', $creditCard->verification->id);
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:5,代码来源:CreditCardTest.php

示例4: _initialize

 /**
  * sets instance properties from an array of values
  *
  * @ignore
  * @access protected
  * @param array $customerAttribs array of customer data
  * @return none
  */
 protected function _initialize($customerAttribs)
 {
     // set the attributes
     $this->_attributes = $customerAttribs;
     // map each address into its own object
     $addressArray = array();
     if (isset($customerAttribs['addresses'])) {
         foreach ($customerAttribs['addresses'] as $address) {
             $addressArray[] = Braintree_Address::factory($address);
         }
     }
     $this->_set('addresses', $addressArray);
     // map each creditcard into its own object
     $ccArray = array();
     if (isset($customerAttribs['creditCards'])) {
         foreach ($customerAttribs['creditCards'] as $creditCard) {
             $ccArray[] = Braintree_CreditCard::factory($creditCard);
         }
     }
     $this->_set('creditCards', $ccArray);
 }
开发者ID:othreed,项目名称:osCommerce-234-bootstrap-wADDONS,代码行数:29,代码来源:Customer.php

示例5: testMaskedNumber

 function testMaskedNumber()
 {
     $creditCard = Braintree_CreditCard::factory(array('bin' => '123456', 'last4' => '7890'));
     $this->assertEquals('123456******7890', $creditCard->maskedNumber);
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:5,代码来源:CreditCardTest.php

示例6: _verifyGatewayResponse

 /**
  * generic method for validating incoming gateway responses
  *
  * creates a new Braintree_CreditCard or Braintree_PayPalAccount object
  * and encapsulates it inside a Braintree_Result_Successful object, or
  * encapsulates a Braintree_Errors object inside a Result_Error
  * alternatively, throws an Unexpected exception if the response is invalid.
  *
  * @ignore
  * @param array $response gateway response values
  * @return object Result_Successful or Result_Error
  * @throws Braintree_Exception_Unexpected
  */
 private static function _verifyGatewayResponse($response)
 {
     if (isset($response['creditCard'])) {
         // return a populated instance of Braintree_CreditCard
         return new Braintree_Result_Successful(Braintree_CreditCard::factory($response['creditCard']), "paymentMethod");
     } else {
         if (isset($response['paypalAccount'])) {
             // return a populated instance of Braintree_PayPalAccount
             return new Braintree_Result_Successful(Braintree_PayPalAccount::factory($response['paypalAccount']), "paymentMethod");
         } else {
             if (isset($response['apiErrorResponse'])) {
                 return new Braintree_Result_Error($response['apiErrorResponse']);
             } else {
                 if (is_array($response)) {
                     return Braintree_UnknownPaymentMethod::factory($response);
                 } else {
                     throw new Braintree_Exception_Unexpected('Expected credit card, paypal account or apiErrorResponse');
                 }
             }
         }
     }
 }
开发者ID:bala223344,项目名称:wordpress-bear,代码行数:35,代码来源:PaymentMethod.php

示例7: getConfigDataProvider

 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function getConfigDataProvider()
 {
     return ['no_vault' => ['config_data' => ['isActive' => true, 'getClientToken' => self::CLIENT_TOKEN, 'is3dSecureEnabled' => true, 'useVault' => false, 'getCountrySpecificCardTypeConfig' => ['US' => ['VI', 'AE', 'MA']], 'isFraudDetectionEnabled' => true, 'isCcDetectionEnabled' => true, 'getBraintreeDataJs' => 'https://js.braintreegateway.com/v1/braintree-data.js'], 'vault_data' => [], 'token_nonce_map' => [], 'expected_result' => ['payment' => ['braintree' => ['clientToken' => self::CLIENT_TOKEN, 'useVault' => false, 'canSaveCard' => false, 'show3dSecure' => true, 'storedCards' => [], 'selectedCardToken' => null, 'creditCardExpMonth' => self::TODAY_MONTH, 'creditCardExpYear' => self::TODAY_YEAR, 'countrySpecificCardTypes' => ['US' => ['VI', 'AE', 'MA']], 'isFraudDetectionEnabled' => true, 'isCcDetectionEnabled' => true, 'availableCardTypes' => $this->availableCardTypes, 'braintreeDataJs' => 'https://js.braintreegateway.com/v1/braintree-data.js', 'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL]]]], 'vault_with_stored_cards' => ['config_data' => ['isActive' => true, 'getClientToken' => self::CLIENT_TOKEN, 'is3dSecureEnabled' => false, 'useVault' => true, 'getCountrySpecificCardTypeConfig' => ['US' => ['VI', 'AE', 'MA']], 'isFraudDetectionEnabled' => true, 'isCcDetectionEnabled' => true, 'getBraintreeDataJs' => 'https://js.braintreegateway.com/v1/braintree-data.js'], 'vault_data' => ['currentCustomerStoredCards' => [\Braintree_CreditCard::factory(['token' => 'token1', 'bin' => '4218', 'last4' => '1001', 'cardType' => 'Visa', 'default' => false]), \Braintree_CreditCard::factory(['token' => 'token2', 'bin' => '5555', 'last4' => '1054', 'cardType' => 'Master Card', 'default' => 1])]], 'token_nonce_map' => [['token1', 'nonce1'], ['token2', 'nonce2']], 'expected_result' => ['payment' => ['braintree' => ['clientToken' => self::CLIENT_TOKEN, 'useVault' => true, 'canSaveCard' => true, 'show3dSecure' => false, 'storedCards' => [['token' => 'token1', 'maskedNumber' => '4218******1001 - Visa', 'selected' => false, 'type' => 'VI'], ['token' => 'token2', 'maskedNumber' => '5555******1054 - Master Card', 'selected' => 1, 'type' => 'MA']], 'selectedCardToken' => 'token2', 'creditCardExpMonth' => self::TODAY_MONTH, 'creditCardExpYear' => self::TODAY_YEAR, 'countrySpecificCardTypes' => ['US' => ['VI', 'AE', 'MA']], 'isFraudDetectionEnabled' => true, 'isCcDetectionEnabled' => true, 'availableCardTypes' => $this->availableCardTypes, 'braintreeDataJs' => 'https://js.braintreegateway.com/v1/braintree-data.js', 'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL]]]], 'vault_with_stored_cards_3dsecure' => ['config_data' => ['isActive' => true, 'getClientToken' => self::CLIENT_TOKEN, 'is3dSecureEnabled' => true, 'useVault' => true, 'getCountrySpecificCardTypeConfig' => ['US' => ['VI', 'AE', 'MA']], 'isFraudDetectionEnabled' => true, 'isCcDetectionEnabled' => true, 'getBraintreeDataJs' => 'https://js.braintreegateway.com/v1/braintree-data.js'], 'vault_data' => ['currentCustomerStoredCards' => [\Braintree_CreditCard::factory(['token' => 'token1', 'bin' => '4218', 'last4' => '1001', 'cardType' => 'Visa', 'default' => false]), \Braintree_CreditCard::factory(['token' => 'token2', 'bin' => '5555', 'last4' => '1054', 'cardType' => 'Master Card', 'default' => 1])]], 'token_nonce_map' => [['token1', 'nonce1'], ['token2', 'nonce2']], 'expected_result' => ['payment' => ['braintree' => ['clientToken' => self::CLIENT_TOKEN, 'useVault' => true, 'canSaveCard' => true, 'show3dSecure' => true, 'storedCards' => [['token' => 'token1', 'maskedNumber' => '4218******1001 - Visa', 'selected' => false, 'type' => 'VI'], ['token' => 'token2', 'maskedNumber' => '5555******1054 - Master Card', 'selected' => 1, 'type' => 'MA']], 'selectedCardToken' => 'token2', 'creditCardExpMonth' => self::TODAY_MONTH, 'creditCardExpYear' => self::TODAY_YEAR, 'countrySpecificCardTypes' => ['US' => ['VI', 'AE', 'MA']], 'isFraudDetectionEnabled' => true, 'isCcDetectionEnabled' => true, 'availableCardTypes' => $this->availableCardTypes, 'braintreeDataJs' => 'https://js.braintreegateway.com/v1/braintree-data.js', 'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL]]]], 'vault_with_no_stored_cards' => ['config_data' => ['isActive' => true, 'getClientToken' => self::CLIENT_TOKEN, 'is3dSecureEnabled' => true, 'useVault' => true, 'getCountrySpecificCardTypeConfig' => ['US' => ['VI', 'AE', 'MA']], 'isFraudDetectionEnabled' => true, 'isCcDetectionEnabled' => true, 'getBraintreeDataJs' => 'https://js.braintreegateway.com/v1/braintree-data.js'], 'vault_data' => ['currentCustomerStoredCards' => []], 'token_nonce_map' => [['token1', 'nonce1'], ['token2', 'nonce2']], 'expected_result' => ['payment' => ['braintree' => ['clientToken' => self::CLIENT_TOKEN, 'useVault' => false, 'canSaveCard' => true, 'show3dSecure' => true, 'storedCards' => [], 'selectedCardToken' => null, 'creditCardExpMonth' => self::TODAY_MONTH, 'creditCardExpYear' => self::TODAY_YEAR, 'countrySpecificCardTypes' => ['US' => ['VI', 'AE', 'MA']], 'isFraudDetectionEnabled' => true, 'isCcDetectionEnabled' => true, 'availableCardTypes' => $this->availableCardTypes, 'braintreeDataJs' => 'https://js.braintreegateway.com/v1/braintree-data.js', 'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL]]]]];
 }
开发者ID:nja78,项目名称:magento2,代码行数:7,代码来源:ConfigProviderTest.php

示例8: _verifyGatewayResponse

 /**
  * generic method for validating incoming gateway responses
  *
  * creates a new Braintree_CreditCard object and encapsulates
  * it inside a Braintree_Result_Successful object, or
  * encapsulates a Braintree_Errors object inside a Result_Error
  * alternatively, throws an Unexpected exception if the response is invalid.
  *
  * @ignore
  * @param array $response gateway response values
  * @return object Result_Successful or Result_Error
  * @throws Braintree_Exception_Unexpected
  */
 private function _verifyGatewayResponse($response)
 {
     if (isset($response['creditCard'])) {
         // return a populated instance of Braintree_Address
         return new Braintree_Result_Successful(Braintree_CreditCard::factory($response['creditCard']));
     } else {
         if (isset($response['apiErrorResponse'])) {
             return new Braintree_Result_Error($response['apiErrorResponse']);
         } else {
             throw new Braintree_Exception_Unexpected("Expected address or apiErrorResponse");
         }
     }
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:26,代码来源:CreditCardGateway.php


注:本文中的Braintree_CreditCard::factory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。