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


PHP Braintree_CreditCard类代码示例

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


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

示例1: init

 /**
  * create signatures for different call types
  * @ignore
  */
 public static function init()
 {
     self::$_createCustomerSignature = array(self::$_transparentRedirectKeys, array('customer' => Braintree_Customer::createSignature()));
     self::$_updateCustomerSignature = array(self::$_transparentRedirectKeys, 'customerId', array('customer' => Braintree_Customer::updateSignature()));
     self::$_transactionSignature = array(self::$_transparentRedirectKeys, array('transaction' => Braintree_Transaction::createSignature()));
     self::$_createCreditCardSignature = array(self::$_transparentRedirectKeys, array('creditCard' => Braintree_CreditCard::createSignature()));
     self::$_updateCreditCardSignature = array(self::$_transparentRedirectKeys, 'paymentMethodToken', array('creditCard' => Braintree_CreditCard::updateSignature()));
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:12,代码来源:TransparentRedirect.php

示例2: testCreate_fromPaymentMethodToken

 function testCreate_fromPaymentMethodToken()
 {
     $customer = Braintree_Customer::createNoValidate();
     $card = Braintree_CreditCard::create(array('customerId' => $customer->id, 'cardholderName' => 'Cardholder', 'number' => '5105105105105100', 'expirationDate' => '05/12'))->creditCard;
     $result = Braintree_PaymentMethodNonce::create($card->token);
     $this->assertTrue($result->success);
     $this->assertNotNull($result->paymentMethodNonce);
     $this->assertNotNull($result->paymentMethodNonce->nonce);
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:9,代码来源:PaymentMethodNonceTest.php

示例3: testUpdateSignature_doesNotAlterOptionsInCreditCardUpdateSignature

 function testUpdateSignature_doesNotAlterOptionsInCreditCardUpdateSignature()
 {
     Braintree_Customer::updateSignature();
     foreach (Braintree_CreditCard::updateSignature() as $key => $value) {
         if (is_array($value) and array_key_exists('options', $value)) {
             $this->assertEquals(array('makeDefault', 'verificationMerchantAccountId', 'verifyCard'), $value['options']);
         }
     }
 }
开发者ID:robelkin,项目名称:braintree_php,代码行数:9,代码来源:CustomerTest.php

示例4: create_card

 function create_card($card_info)
 {
     $result = Braintree_CreditCard::create($card_info);
     if ($result->success === true) {
         # Generated credit card token
         return $result->creditCard->token;
     }
     $this->_parse_errors($result);
     return false;
 }
开发者ID:sahartak,项目名称:storage,代码行数:10,代码来源:Braintree_lib.php

示例5: _createPaymentToken

 private function _createPaymentToken($postFormData, $customerId)
 {
     $ccNumber = $postFormData['Order']['cc_number'];
     $ccHolderName = $postFormData['Order']['cc_holder_name'];
     $expiration = str_split($postFormData['Order']['cc_expiration'], 2);
     $expirationMonth = $expiration[0];
     $expirationYear = $expiration[2];
     $cvv = $postFormData['Order']['cc_cvv'];
     $payment = Braintree_CreditCard::create(['number' => $ccNumber, 'cardholderName' => $ccHolderName, 'expirationMonth' => $expirationMonth, 'expirationYear' => $expirationYear, 'cvv' => $cvv, 'customerId' => $customerId]);
     return $payment->creditCard->token;
 }
开发者ID:coder-d,项目名称:payment_library,代码行数:11,代码来源:Braintree.php

示例6: saveCreditCard

 public function saveCreditCard()
 {
     $send_array = $this->options['creditCard'];
     if (isset($this->options['billing'])) {
         $send_array['billingAddress'] = $this->options['billing'];
     }
     if (isset($this->options['customerId'])) {
         $send_array['customerId'] = $this->options['customerId'];
     }
     $result = Braintree_CreditCard::create($send_array);
     if ($result->success) {
         return array('status' => true, 'result' => $result);
     } else {
         return array('status' => false, 'result' => $result);
     }
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:16,代码来源:BraintreeApi.php

示例7: test_GatewayRespectsMakeDefault

 function test_GatewayRespectsMakeDefault()
 {
     $result = Braintree_Customer::create();
     $this->assertTrue($result->success);
     $customerId = $result->customer->id;
     $result = Braintree_CreditCard::create(array('customerId' => $customerId, 'number' => '4111111111111111', 'expirationDate' => '11/2099'));
     $this->assertTrue($result->success);
     $clientToken = Braintree_ClientToken::generate(array("customerId" => $customerId, "options" => array("makeDefault" => true)));
     $authorizationFingerprint = json_decode($clientToken)->authorizationFingerprint;
     $response = Braintree_HttpClientApi::post('/client_api/nonces.json', json_encode(array("credit_card" => array("number" => "4242424242424242", "expirationDate" => "11/2099"), "authorization_fingerprint" => $authorizationFingerprint, "shared_customer_identifier" => "fake_identifier", "shared_customer_identifier_type" => "testing")));
     $this->assertEquals(201, $response["status"]);
     $customer = Braintree_Customer::find($customerId);
     $this->assertEquals(2, count($customer->creditCards));
     foreach ($customer->creditCards as $creditCard) {
         if ($creditCard->last4 == "4242") {
             $this->assertTrue($creditCard->default);
         }
     }
 }
开发者ID:riteshkmr33,项目名称:ovessnce,代码行数:19,代码来源:ClientTokenTest.php

示例8: delete

 /**
  * Deletes a record via the API
  *
  * @param   object  $model
  * @param   mixed   $conditions
  * @return  bool
  */
 public function delete(Model $model, $conditions = null)
 {
     $ids = $this->_getIdsToBeDeleted($model, $conditions);
     if ($ids === false) {
         return false;
     }
     $entity = $this->_getModelEntity($model);
     if (!empty($ids)) {
         foreach ($ids as $id) {
             try {
                 switch ($entity) {
                     case 'Customer':
                         Braintree_Customer::delete($id);
                         break;
                     case 'Transaction':
                         $this->showError(__('Transactions cannot be deleted', true));
                         return false;
                         break;
                     case 'CreditCard':
                         Braintree_CreditCard::delete($id);
                         break;
                     case 'Address':
                         $exploded = explode('|', $id);
                         if (count($exploded) != 2) {
                             return false;
                         }
                         list($customer_id, $address_id) = $exploded;
                         Braintree_Address::delete($customer_id, $address_id);
                         break;
                     default:
                         return false;
                         break;
                 }
             } catch (Exception $e) {
                 $this->showError(print_r($e, true));
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:sime,项目名称:cakephp-braintree-plugin,代码行数:48,代码来源:BraintreeSource.php

示例9: _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

示例10: testErrorsOnFindWithWhitespaceCharacterArgument

 function testErrorsOnFindWithWhitespaceCharacterArgument()
 {
     $this->setExpectedException('InvalidArgumentException');
     Braintree_CreditCard::find('\\t');
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:5,代码来源:CreditCardTest.php

示例11: _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

示例12: testDelete_worksWithCreditCards

 function testDelete_worksWithCreditCards()
 {
     $paymentMethodToken = 'CREDIT_CARD_TOKEN-' . strval(rand());
     $customer = Braintree_Customer::createNoValidate();
     $creditCardResult = Braintree_CreditCard::create(array('customerId' => $customer->id, 'number' => '5105105105105100', 'expirationDate' => '05/2011', 'token' => $paymentMethodToken));
     $this->assertTrue($creditCardResult->success);
     Braintree_PaymentMethod::delete($paymentMethodToken);
     $this->setExpectedException('Braintree_Exception_NotFound');
     Braintree_PaymentMethod::find($paymentMethodToken);
     integrationMerchantConfig();
 }
开发者ID:dhaupin,项目名称:braintree-payments,代码行数:11,代码来源:PaymentMethodTest.php

示例13: testUpdateCreditCardFromTransparentRedirect

 function testUpdateCreditCardFromTransparentRedirect()
 {
     $customer = Braintree_Customer::create(array('firstName' => 'Mike', 'lastName' => 'Jonez'))->customer;
     $creditCard = Braintree_CreditCard::create(array('customerId' => $customer->id, 'number' => Braintree_Test_CreditCardNumbers::$masterCard, 'expirationMonth' => '10', 'expirationYear' => '10'))->creditCard;
     $params = array('credit_card' => array('number' => Braintree_Test_CreditCardNumbers::$visa));
     $trParams = array('paymentMethodToken' => $creditCard->token, 'creditCard' => array('expirationMonth' => '11', 'expirationYear' => '11'));
     $trData = Braintree_TransparentRedirect::updateCreditCardData(array_merge($trParams, array("redirectUrl" => "http://www.example.com")));
     $queryString = Braintree_TestHelper::submitTrRequest(Braintree_TransparentRedirect::url(), $params, $trData);
     Braintree_TransparentRedirect::confirm($queryString);
     $creditCard = Braintree_CreditCard::find($creditCard->token);
     $this->assertequals('401288', $creditCard->bin);
     $this->assertequals('1881', $creditCard->last4);
     $this->assertequals('11/2011', $creditCard->expirationDate);
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:14,代码来源:TransparentRedirectTest.php

示例14: deleteCard

 function deleteCard($token, $token_id)
 {
     $OSCOM_Db = Registry::get('Db');
     Braintree_Configuration::environment(MODULE_PAYMENT_BRAINTREE_CC_TRANSACTION_SERVER == 'Live' ? 'production' : 'sandbox');
     Braintree_Configuration::merchantId(MODULE_PAYMENT_BRAINTREE_CC_MERCHANT_ID);
     Braintree_Configuration::publicKey(MODULE_PAYMENT_BRAINTREE_CC_PUBLIC_KEY);
     Braintree_Configuration::privateKey(MODULE_PAYMENT_BRAINTREE_CC_PRIVATE_KEY);
     try {
         Braintree_CreditCard::delete($token);
     } catch (Exception $e) {
     }
     return $OSCOM_Db->delete('customers_braintree_tokens', ['id' => $token_id, 'customers_id' => $_SESSION['customer_id'], 'braintree_token' => $token]) === 1;
 }
开发者ID:Akofelaz,项目名称:oscommerce2,代码行数:13,代码来源:braintree_cc.php

示例15: vaultCreditCard

 public function vaultCreditCard()
 {
     $token = $this->creditCardDetails->token;
     if (empty($token)) {
         return null;
     } else {
         return Braintree_CreditCard::find($token);
     }
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:9,代码来源:Transaction.php


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