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


PHP Braintree_Transaction::factory方法代码示例

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


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

示例1: _initialize

 /**
  * @ignore
  */
 protected function _initialize($attributes)
 {
     $this->_attributes = $attributes;
     $addOnArray = array();
     if (isset($attributes['addOns'])) {
         foreach ($attributes['addOns'] as $addOn) {
             $addOnArray[] = Braintree_AddOn::factory($addOn);
         }
     }
     $this->_attributes['addOns'] = $addOnArray;
     $discountArray = array();
     if (isset($attributes['discounts'])) {
         foreach ($attributes['discounts'] as $discount) {
             $discountArray[] = Braintree_Discount::factory($discount);
         }
     }
     $this->_attributes['discounts'] = $discountArray;
     if (isset($attributes['descriptor'])) {
         $this->_set('descriptor', new Braintree_Descriptor($attributes['descriptor']));
     }
     $statusHistory = array();
     if (isset($attributes['statusHistory'])) {
         foreach ($attributes['statusHistory'] as $history) {
             $statusHistory[] = new Braintree_Subscription_StatusDetails($history);
         }
     }
     $this->_attributes['statusHistory'] = $statusHistory;
     $transactionArray = array();
     if (isset($attributes['transactions'])) {
         foreach ($attributes['transactions'] as $transaction) {
             $transactionArray[] = Braintree_Transaction::factory($transaction);
         }
     }
     $this->_attributes['transactions'] = $transactionArray;
 }
开发者ID:nstungxd,项目名称:F2CA5,代码行数:38,代码来源:Subscription.php

示例2: _initialize

 protected function _initialize($attributes)
 {
     $this->_attributes = $attributes;
     if (isset($attributes['subject']['apiErrorResponse'])) {
         $wrapperNode = $attributes['subject']['apiErrorResponse'];
     } else {
         $wrapperNode = $attributes['subject'];
     }
     if (isset($wrapperNode['subscription'])) {
         $this->_set('subscription', Braintree_Subscription::factory($attributes['subject']['subscription']));
     }
     if (isset($wrapperNode['merchantAccount'])) {
         $this->_set('merchantAccount', Braintree_MerchantAccount::factory($wrapperNode['merchantAccount']));
     }
     if (isset($wrapperNode['transaction'])) {
         $this->_set('transaction', Braintree_Transaction::factory($wrapperNode['transaction']));
     }
     if (isset($wrapperNode['disbursement'])) {
         $this->_set('disbursement', Braintree_Disbursement::factory($wrapperNode['disbursement']));
     }
     if (isset($wrapperNode['partnerMerchant'])) {
         $this->_set('partnerMerchant', Braintree_PartnerMerchant::factory($wrapperNode['partnerMerchant']));
     }
     if (isset($wrapperNode['errors'])) {
         $this->_set('errors', new Braintree_Error_ValidationErrorCollection($wrapperNode['errors']));
         $this->_set('message', $wrapperNode['message']);
     }
 }
开发者ID:bobstermyang,项目名称:communityfoodshare,代码行数:28,代码来源:WebhookNotification.php

示例3: __construct

 /**
  * overrides default constructor
  * @ignore
  * @param array $response gateway response array
  */
 public function __construct($response)
 {
     $this->_attributes = $response;
     $this->_set('errors', new Braintree_Error_ErrorCollection($response['errors']));
     if (isset($response['verification'])) {
         $this->_set('creditCardVerification', new Braintree_Result_CreditCardVerification($response['verification']));
     } else {
         $this->_set('creditCardVerification', null);
     }
     if (isset($response['transaction'])) {
         $this->_set('transaction', Braintree_Transaction::factory($response['transaction']));
     } else {
         $this->_set('transaction', null);
     }
     if (isset($response['subscription'])) {
         $this->_set('subscription', Braintree_Subscription::factory($response['subscription']));
     } else {
         $this->_set('subscription', null);
     }
     if (isset($response['merchantAccount'])) {
         $this->_set('merchantAccount', Braintree_MerchantAccount::factory($response['merchantAccount']));
     } else {
         $this->_set('merchantAccount', null);
     }
 }
开发者ID:Flesh192,项目名称:magento,代码行数:30,代码来源:Error.php

示例4: _doTestRequest

 private function _doTestRequest($testPath, $transactionId)
 {
     self::_checkEnvironment();
     $path = $this->_config->merchantPath() . '/transactions/' . $transactionId . $testPath;
     $response = $this->_http->put($path);
     return Braintree_Transaction::factory($response['transaction']);
 }
开发者ID:oscarsmartwave,项目名称:l45fbl45t,代码行数:7,代码来源:TestingGateway.php

示例5: test__isset

 function test__isset()
 {
     $transaction = Braintree_Transaction::factory(array('creditCard' => array('expirationMonth' => '05', 'expirationYear' => '2010', 'bin' => '510510', 'last4' => '5100', 'cardType' => 'MasterCard')));
     $this->assertEquals('MasterCard', $transaction->creditCardDetails->cardType);
     $this->assertFalse(empty($transaction->creditCardDetails->cardType));
     $this->assertTrue(isset($transaction->creditCardDetails->cardType));
     $transaction = Braintree_Transaction::factory(array('creditCard' => array('expirationMonth' => '05', 'expirationYear' => '2010', 'bin' => '510510', 'last4' => '5100')));
     $this->assertTrue(empty($transaction->creditCardDetails->cardType));
     $this->assertFalse(isset($transaction->creditCardDetails->cardType));
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:10,代码来源:InstanceTest.php

示例6: testIsset

 function testIsset()
 {
     $t = Braintree_Transaction::factory(array('creditCard' => array('expirationMonth' => '05', 'expirationYear' => '2010', 'bin' => '510510', 'last4' => '5100'), 'customer' => array(), 'billing' => array(), 'descriptor' => array(), 'shipping' => array(), 'subscription' => array('billingPeriodStartDate' => '1983-07-12'), 'statusHistory' => array()));
     $this->assertTrue(isset($t->creditCard));
     $this->assertFalse(empty($t->creditCard));
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:6,代码来源:BraintreeTest.php

示例7: _verifyGatewayResponse

 /**
  * generic method for validating incoming gateway responses
  *
  * creates a new Braintree_Transaction 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['transaction'])) {
         // return a populated instance of Braintree_Transaction
         return new Braintree_Result_Successful(Braintree_Transaction::factory($response['transaction']));
     } else {
         if (isset($response['apiErrorResponse'])) {
             return new Braintree_Result_Error($response['apiErrorResponse']);
         } else {
             throw new Braintree_Exception_Unexpected("Expected transaction or apiErrorResponse");
         }
     }
 }
开发者ID:superflyz,项目名称:WallFly,代码行数:26,代码来源:TransactionGateway.php

示例8: testInitializationWithoutArguments

 function testInitializationWithoutArguments()
 {
     $transaction = Braintree_Transaction::factory(array());
     $this->assertTrue($transaction instanceof Braintree_Transaction);
 }
开发者ID:beevo,项目名称:disruptivestrong,代码行数:5,代码来源:TransactionTest.php

示例9: testVoidInvalidState

 /**
  * @expectedException \Magento\Framework\Exception\LocalizedException
  * @expectedExceptionMessage Some transactions are already settled or voided and cannot be voided.
  */
 public function testVoidInvalidState()
 {
     $orderId = 1005;
     $paymentObject = $this->setupPaymentObjectForVoid($orderId);
     $transactions = ['1' => \Braintree_Transaction::factory(['id' => '1', 'status' => \Braintree_Transaction::SETTLED])];
     $this->setupTransactionIds($orderId, array_keys($transactions));
     $index = 0;
     foreach ($transactions as $id => $transaction) {
         $this->braintreeTransactionMock->expects($this->at($index))->method('find')->with($id)->willReturn($transaction);
         $index++;
     }
     $this->model->void($paymentObject);
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:17,代码来源:PaymentMethodTest.php

示例10: authorizeDataProvider

 /**
  * @return array
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function authorizeDataProvider()
 {
     return ['paypal_payment_nonce' => ['config' => ['is3dSecureEnabled' => false, 'isFraudProtectionEnabled' => false, 'isDebugEnabled' => false, 'useVault' => false, 'getMerchantAccountId' => self::MERCHANT_ACCOUNT_ID], 'infoInstanceValueMap' => [['store_in_vault', null], ['payment_method_nonce', self::PAYMENT_METHOD_NONCE], ['device_data', 'fraud_detection_data']], 'expectedParams' => ['options' => ['addBillingAddressToPaymentMethod' => true], 'merchantAccountId' => self::MERCHANT_ACCOUNT_ID, 'paymentMethodNonce' => self::PAYMENT_METHOD_NONCE], 'braintree_response' => ['transaction' => \Braintree_Transaction::factory(['id' => self::AUTH_TRAN_ID, 'gatewayRejectionReason' => null, 'processorAuthorizationCode' => 'S02T5Q', 'processorResponseCode' => '1000', 'processorResponseText' => 'Approved', 'paypal' => ['payerEmail' => self::PAYER_EMAIL, 'paymentId' => self::PAYMENT_ID, 'authorizationId' => self::AUTHORIZATION_ID, 'payerId' => self::PAYER_ID, 'payerFirstName' => self::FNAME, 'payerLastName' => self::LNAME]])], 'expected_payment_fields' => ['status' => 'APPROVED', 'cc_trans_id' => self::AUTH_TRAN_ID, 'last_trans_id' => self::AUTH_TRAN_ID, 'transaction_id' => self::AUTH_TRAN_ID, 'is_transactioN_cloned' => 0, 'amount' => self::AUTH_AMOUNT, 'should_close_parent_transaction' => false, 'additional_information' => ['processorAuthorizationCode' => 'S02T5Q', 'processorResponseCode' => '1000', 'processorResponseText' => 'Approved', 'payerEmail' => self::PAYER_EMAIL, 'paymentId' => self::PAYMENT_ID, 'authorizationId' => self::AUTHORIZATION_ID, 'payerId' => self::PAYER_ID, 'payerFirstName' => self::FNAME, 'payerLastName' => self::LNAME]]], 'paypal_payment_nonce_fraud_protection' => ['config' => ['is3dSecureEnabled' => false, 'isFraudProtectionEnabled' => true, 'isDebugEnabled' => false, 'useVault' => false, 'getMerchantAccountId' => self::MERCHANT_ACCOUNT_ID], 'infoInstanceValueMap' => [['store_in_vault', null], ['payment_method_nonce', self::PAYMENT_METHOD_NONCE], ['device_data', 'fraud_detection_data']], 'expectedParams' => ['options' => ['addBillingAddressToPaymentMethod' => true], 'merchantAccountId' => self::MERCHANT_ACCOUNT_ID, 'paymentMethodNonce' => self::PAYMENT_METHOD_NONCE, 'deviceData' => 'fraud_detection_data'], 'braintree_response' => ['transaction' => \Braintree_Transaction::factory(['id' => self::AUTH_TRAN_ID, 'gatewayRejectionReason' => null, 'processorAuthorizationCode' => 'S02T5Q', 'processorResponseCode' => '1000', 'processorResponseText' => 'Approved', 'paypal' => ['payerEmail' => self::PAYER_EMAIL, 'paymentId' => self::PAYMENT_ID, 'authorizationId' => self::AUTHORIZATION_ID, 'payerId' => self::PAYER_ID, 'payerFirstName' => self::FNAME, 'payerLastName' => self::LNAME]])], 'expected_payment_fields' => ['status' => 'APPROVED', 'cc_trans_id' => self::AUTH_TRAN_ID, 'last_trans_id' => self::AUTH_TRAN_ID, 'transaction_id' => self::AUTH_TRAN_ID, 'is_transactioN_cloned' => 0, 'amount' => self::AUTH_AMOUNT, 'should_close_parent_transaction' => false, 'additional_information' => ['processorAuthorizationCode' => 'S02T5Q', 'processorResponseCode' => '1000', 'processorResponseText' => 'Approved', 'payerEmail' => self::PAYER_EMAIL, 'paymentId' => self::PAYMENT_ID, 'authorizationId' => self::AUTHORIZATION_ID, 'payerId' => self::PAYER_ID, 'payerFirstName' => self::FNAME, 'payerLastName' => self::LNAME]]]];
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:8,代码来源:PayPalTest.php

示例11: testGet_givesErrorIfInvalidProperty

 function testGet_givesErrorIfInvalidProperty()
 {
     $t = Braintree_Transaction::factory(array('creditCard' => array('expirationMonth' => '05', 'expirationYear' => '2010', 'bin' => '510510', 'last4' => '5100'), 'customer' => array(), 'billing' => array(), 'descriptor' => array(), 'shipping' => array(), 'subscription' => array('billingPeriodStartDate' => '1983-07-12'), 'statusHistory' => array()));
     $this->setExpectedException('PHPUnit_Framework_Error', 'Undefined property on Braintree_Transaction: foo');
     $t->foo;
 }
开发者ID:robelkin,项目名称:braintree_php,代码行数:6,代码来源:TransactionTest.php

示例12: _verifyGatewayResponse

 /**
  * @ignore
  */
 private static function _verifyGatewayResponse($response)
 {
     if (isset($response['subscription'])) {
         return new Braintree_Result_Successful(self::factory($response['subscription']));
     } else {
         if (isset($response['transaction'])) {
             // return a populated instance of Braintree_Transaction, for subscription retryCharge
             return new Braintree_Result_Successful(Braintree_Transaction::factory($response['transaction']));
         } else {
             if (isset($response['apiErrorResponse'])) {
                 return new Braintree_Result_Error($response['apiErrorResponse']);
             }
         }
     }
 }
开发者ID:kingsolmn,项目名称:CakePHP-Braintree-Plugin,代码行数:18,代码来源:Subscription.php


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