• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Braintree_Subscription类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

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


示例2: afterFind

 public function afterFind($results, $primary = false)
 {
     if ($primary) {
         $results = Hash::insert($results, "{n}.BraintreeSubscription", array());
         $results = Hash::insert($results, "{n}.BraintreePlan", array());
         $braintreeSubscriptions = Braintree_Subscription::search([Braintree_SubscriptionSearch::ids()->in(Hash::extract($results, "{n}.BillingSubscription.remote_subscription_id"))]);
         $braintreePlans = Braintree_Plan::all();
         foreach ($results as $key => $result) {
             foreach ($braintreeSubscriptions as $braintreeSubscription) {
                 if ($braintreeSubscription->id == $result['BillingSubscription']['remote_subscription_id']) {
                     $result['BraintreeSubscription'] = $braintreeSubscription;
                     break;
                 }
                 //$results = Hash::insert($results, "{n}.BillingSubscription[remote_subscription_id=".$braintreeSubscription->id."]", array('BraintreeSubscription' => $braintreeSubscription));
             }
             foreach ($braintreePlans as $braintreePlan) {
                 if ($braintreePlan->id == $result['BillingSubscription']['remote_plan_id']) {
                     $result['BraintreePlan'] = $braintreePlan;
                     break;
                 }
             }
             $results[$key] = $result;
         }
     }
     return $results;
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:26,代码来源:BillingSubscription.php


示例3: _initialize

 protected function _initialize($attributes)
 {
     $this->_attributes = $attributes;
     if (isset($attributes['subject']) && isset($attributes['subject']['subscription'])) {
         $this->_set('subscription', Braintree_Subscription::factory($attributes['subject']['subscription']));
     }
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:7,代码来源:WebhookNotification.php


示例4: updateSubscriptions

 /**
  * updateSubscriptions
  * --------------------------------------------------
  * Updating the BraintreeSubscriptions.
  * @return The stripe plans.
  * @throws BraintreeNotConnected
  * --------------------------------------------------
  */
 public function updateSubscriptions()
 {
     // Updating plans to be up to date.
     $this->updatePlans();
     $subscriptions = array();
     // Clollecting subscriptions.
     try {
         $braintreeSubscriptions = Braintree_Subscription::search(array(Braintree_SubscriptionSearch::status()->in(array(Braintree_Subscription::ACTIVE))));
     } catch (Exception $e) {
         // Something went wrong.
         return;
     }
     foreach ($braintreeSubscriptions as $subscription) {
         $new_subscription = new BraintreeSubscription(array('start' => $subscription->firstBillingDate, 'status' => $subscription->status));
         $plan = BraintreePlan::where('plan_id', $subscription->planId)->first();
         if ($plan === null) {
             // Braintree integrity error, link to a non-existing plan.
             return array();
         }
         $new_subscription->plan()->associate($plan);
         array_push($subscriptions, $new_subscription);
     }
     // Save new.
     foreach ($subscriptions as $subscription) {
         $subscription->save();
     }
     return $subscriptions;
 }
开发者ID:neraunzaran,项目名称:fruit-dashboard,代码行数:36,代码来源:BraintreeDataCollector.php


示例5: __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


示例6: testContains

 function testContains()
 {
     $creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
     $triallessPlan = Braintree_SubscriptionTestHelper::triallessPlan();
     $trialPlan = Braintree_SubscriptionTestHelper::trialPlan();
     $trialSubscription = Braintree_Subscription::create(array('paymentMethodToken' => $creditCard->token, 'planId' => $trialPlan['id'], 'price' => '9'))->subscription;
     $triallessSubscription = Braintree_Subscription::create(array('paymentMethodToken' => $creditCard->token, 'planId' => $triallessPlan['id'], 'price' => '9'))->subscription;
     $collection = Braintree_Subscription::search(array(Braintree_SubscriptionSearch::planId()->contains("ration_trial_pl"), Braintree_SubscriptionSearch::price()->is("9")));
     $this->assertTrue(Braintree_TestHelper::includes($collection, $trialSubscription));
     $this->assertFalse(Braintree_TestHelper::includes($collection, $triallessSubscription));
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:11,代码来源:TextNodeTest.php


示例7: testIn_multipleValues

 function testIn_multipleValues()
 {
     $creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
     $triallessPlan = Braintree_SubscriptionTestHelper::triallessPlan();
     $activeSubscription = Braintree_Subscription::create(array('paymentMethodToken' => $creditCard->token, 'planId' => $triallessPlan['id'], 'price' => '4'))->subscription;
     $canceledSubscription = Braintree_Subscription::create(array('paymentMethodToken' => $creditCard->token, 'planId' => $triallessPlan['id'], 'price' => '4'))->subscription;
     Braintree_Subscription::cancel($canceledSubscription->id);
     $collection = Braintree_Subscription::search(array(Braintree_SubscriptionSearch::status()->in(array(Braintree_Subscription::ACTIVE, Braintree_Subscription::CANCELED)), Braintree_SubscriptionSearch::price()->is('4')));
     $this->assertTrue(Braintree_TestHelper::includes($collection, $activeSubscription));
     $this->assertTrue(Braintree_TestHelper::includes($collection, $canceledSubscription));
 }
开发者ID:kingsolmn,项目名称:CakePHP-Braintree-Plugin,代码行数:11,代码来源:MultipleValueNodeTest.php


示例8: _initialize

 /**
  * sets instance properties from an array of values
  *
  * @access protected
  * @param array $paypalAccountAttribs array of paypalAccount data
  * @return none
  */
 protected function _initialize($paypalAccountAttribs)
 {
     // set the attributes
     $this->_attributes = $paypalAccountAttribs;
     $subscriptionArray = array();
     if (isset($paypalAccountAttribs['subscriptions'])) {
         foreach ($paypalAccountAttribs['subscriptions'] as $subscription) {
             $subscriptionArray[] = Braintree_Subscription::factory($subscription);
         }
     }
     $this->_set('subscriptions', $subscriptionArray);
 }
开发者ID:Flesh192,项目名称:magento,代码行数:19,代码来源:PayPalAccount.php


示例9: _initialize

 /**
  * sets instance properties from an array of values
  *
  * @access protected
  * @param array $applePayCardAttribs array of Apple Pay card properties
  * @return none
  */
 protected function _initialize($applePayCardAttribs)
 {
     // set the attributes
     $this->_attributes = $applePayCardAttribs;
     $subscriptionArray = array();
     if (isset($applePayCardAttribs['subscriptions'])) {
         foreach ($applePayCardAttribs['subscriptions'] as $subscription) {
             $subscriptionArray[] = Braintree_Subscription::factory($subscription);
         }
     }
     $this->_set('subscriptions', $subscriptionArray);
     $this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
 }
开发者ID:nstungxd,项目名称:F2CA5,代码行数:20,代码来源:ApplePayCard.php


示例10: createSubscription

 public function createSubscription($customer_id, $package_code, $monthly_price)
 {
     try {
         $customer = Braintree_Customer::find($customer_id);
         $payment_method_token = $customer->creditCards[0]->token;
         $result = Braintree_Subscription::create(array('paymentMethodToken' => $payment_method_token, 'planId' => $package_code, 'price' => $monthly_price));
         return $result;
     } catch (Braintree_Exception_NotFound $e) {
         $bexcption = print_r($e, true);
         log_message('error', date('Y-m-d H:i:s') . ' ' . $bexcption, true);
         $result = new stdClass();
         $result->success = false;
         return $result;
     }
 }
开发者ID:agency2016,项目名称:rothy_cloudynote,代码行数:15,代码来源:braintree_ci.php


示例11: sendSubscription

 /**
  * Braintree sale function
  * @param bool|true $submitForSettlement
  * @param bool|true $storeInVaultOnSuccess
  * @return array
  */
 public function sendSubscription()
 {
     //$customer = \Braintree_Customer::find($this->options['customerId']);
     $subscriptionData = array('paymentMethodToken' => $this->options['paymentMethodToken'], 'planId' => $this->options['planId']);
     $result = \Braintree_Subscription::create($subscriptionData);
     if ($result->success) {
         return ['status' => true, 'result' => $result];
     } else {
         if ($result->transaction) {
             return ['status' => false, 'result' => $result];
         } else {
             return ['status' => false, 'result' => $result];
         }
     }
 }
开发者ID:skamnev,项目名称:members,代码行数:21,代码来源:Braintree.php


示例12: testFind_returnsSubscriptionsAssociatedWithAPaypalAccount

 function testFind_returnsSubscriptionsAssociatedWithAPaypalAccount()
 {
     $customer = Braintree_Customer::createNoValidate();
     $paymentMethodToken = 'paypal-account-' . strval(rand());
     $nonce = Braintree_HttpClientApi::nonceForPayPalAccount(array('paypal_account' => array('consent_code' => 'consent-code', 'token' => $paymentMethodToken)));
     $result = Braintree_PaymentMethod::create(array('paymentMethodNonce' => $nonce, 'customerId' => $customer->id));
     $this->assertTrue($result->success);
     $token = $result->paymentMethod->token;
     $triallessPlan = Braintree_SubscriptionTestHelper::triallessPlan();
     $subscription1 = Braintree_Subscription::create(array('paymentMethodToken' => $token, 'planId' => $triallessPlan['id']))->subscription;
     $subscription2 = Braintree_Subscription::create(array('paymentMethodToken' => $token, 'planId' => $triallessPlan['id']))->subscription;
     $paypalAccount = Braintree_PayPalAccount::find($token);
     $getIds = function ($sub) {
         return $sub->id;
     };
     $subIds = array_map($getIds, $paypalAccount->subscriptions);
     $this->assertTrue(in_array($subscription1->id, $subIds));
     $this->assertTrue(in_array($subscription2->id, $subIds));
 }
开发者ID:kingsj,项目名称:shopping-cart-lite,代码行数:19,代码来源:PayPalAccountTest.php


示例13: subscribe

 function subscribe($nonce, $info)
 {
     $customerResult;
     $subscriptionResult;
     $customerResult = Braintree_Customer::create(['firstName' => $info['fname'], 'lastName' => $info['lname'], 'email' => $info['email'], 'paymentMethodNonce' => $nonce]);
     if (!$customerResult->success) {
         return $this->processErrors('subscription', $customerResult->errors->deepAll());
     }
     $r = $customerResult->customer;
     $a = $r->addresses[0];
     $sql = 'INSERT INTO users (first_name, last_name, address, city, state, zip, braintree_customer_id, created_date, email) ';
     $sql .= "VALUES ('" . $r->firstName . "','" . $r->lastName . "','" . $a->streetAddress . "','" . $a->locality . "','" . $a->region . "','" . $a->postalCode . "','" . $r->id . "', now(),'" . $r->email . "');";
     $info['userId'] = MysqlAccess::insert($sql);
     $subscriptionResult = Braintree_Subscription::create(['paymentMethodToken' => $customerResult->customer->paymentMethods[0]->token, 'planId' => 'donation', 'price' => $info['amount']]);
     if (!isset($subscriptionResult->subscription) || !$subscriptionResult->subscription) {
         return $this->processErrors('subscription', $subscriptionResult->errors->deepAll());
     }
     return $this->retrieveSubscriptionResults($subscriptionResult->success, $subscriptionResult->subscription, $info);
 }
开发者ID:Slimshavy,项目名称:tiferesrachamim-temp,代码行数:19,代码来源:BraintreeHelper.php


示例14: testRetryCharge_WithAmount

 function testRetryCharge_WithAmount()
 {
     $subscription = Braintree_SubscriptionTestHelper::createSubscription();
     Braintree_Http::put('/subscriptions/' . $subscription->id . '/make_past_due');
     $result = Braintree_Subscription::retryCharge($subscription->id, 1000);
     $this->assertTrue($result->success);
     $transaction = $result->transaction;
     $this->assertEquals(1000, $transaction->amount);
     $this->assertNotNull($transaction->processorAuthorizationCode);
     $this->assertEquals(Braintree_Transaction::SALE, $transaction->type);
     $this->assertEquals(Braintree_Transaction::AUTHORIZED, $transaction->status);
 }
开发者ID:robelkin,项目名称:braintree_php,代码行数:12,代码来源:SubscriptionTest.php


示例15: testFindReturnsAssociatedSubscriptions

 function testFindReturnsAssociatedSubscriptions()
 {
     $customer = Braintree_Customer::createNoValidate();
     $result = Braintree_CreditCard::create(array('customerId' => $customer->id, 'cardholderName' => 'Cardholder', 'number' => '5105105105105100', 'expirationDate' => '05/12', 'billingAddress' => array('firstName' => 'Drew', 'lastName' => 'Smith', 'company' => 'Smith Co.', 'streetAddress' => '1 E Main St', 'extendedAddress' => 'Suite 101', 'locality' => 'Chicago', 'region' => 'IL', 'postalCode' => '60622', 'countryName' => 'United States of America')));
     $id = strval(rand());
     Braintree_Subscription::create(array('id' => $id, 'paymentMethodToken' => $result->creditCard->token, 'planId' => 'integration_trialless_plan', 'price' => '1.00'));
     $creditCard = Braintree_CreditCard::find($result->creditCard->token);
     $this->assertEquals($id, $creditCard->subscriptions[0]->id);
     $this->assertEquals('integration_trialless_plan', $creditCard->subscriptions[0]->planId);
     $this->assertEquals('1.00', $creditCard->subscriptions[0]->price);
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:11,代码来源:CreditCardTest.php


示例16: cancel_subscription

 function cancel_subscription($sub_id)
 {
     $result = Braintree_Subscription::cancel($sub_id);
     if ($result->success === true) {
         return true;
     }
     $this->_parse_errors($result);
     return false;
 }
开发者ID:sahartak,项目名称:storage,代码行数:9,代码来源:Braintree_lib.php


示例17:

<?php

require_once "../library/lib/Braintree.php";
$result = Braintree_Subscription::cancel('8bpb4b');
echo "<pre>";
print_r($result);
开发者ID:ajlangsdonpp,项目名称:paypal_api_testing,代码行数:6,代码来源:cancel.php


示例18: checkout

 public function checkout()
 {
     $this->layout = 'profile_new';
     if (!$this->request->is('post')) {
         throw new NotFoundException(__d('billing', 'Incorrect request type'));
     }
     $customer = Braintree_Customer::find('konstruktor-' . $this->currUser['User']['id']);
     if (isset($this->request->data['payment_method_nonce'])) {
         $nonceFromTheClient = $this->request->data['payment_method_nonce'];
         $payment = Braintree_PaymentMethod::create(['customerId' => 'konstruktor-' . $this->currUser['User']['id'], 'paymentMethodNonce' => $nonceFromTheClient]);
         if (!$payment->success) {
             $this->Session->setFlash($payment->message);
             $this->redirect(array('action' => 'payment'));
         }
         $payment = $payment->paymentMethod;
     } elseif (isset($this->request->data['payment_method']) && !empty($this->request->data['payment_method'])) {
         $payment = null;
         foreach ($customer->paymentMethods as $payment) {
             if ($payment->token == $this->request->data['payment_method']) {
                 break;
             }
         }
         if (empty($payment)) {
             throw new NotFoundException(__d('billing', 'Payment method not found'));
         }
     } else {
         throw new NotFoundException(__d('billing', 'Unable to create subscription'));
     }
     $braintreePlanId = $this->Session->read('Billing.plan');
     $plan = $this->BillingPlan->findByRemotePlan($braintreePlanId);
     $braintreePlans = Braintree_Plan::all();
     $braintreePlan = null;
     foreach ($braintreePlans as $_braintreePlan) {
         if ($_braintreePlan->id == $braintreePlanId) {
             $braintreePlan = $_braintreePlan;
             break;
         }
     }
     if (empty($braintreePlan)) {
         throw new NotFoundException(__d('billing', 'Unable to create subscription'));
     }
     //Important! unit setup for model must be here. Before creating Braintree subscription
     $unit = Configure::read('Billing.units.' . $plan['BillingGroup']['limit_units']);
     if (empty($unit['model']) || empty($unit['field'])) {
         throw new NotFoundException(__d('billing', 'Invalid billing plan'));
     }
     $this->BillingSubscription->Behaviors->load('Billing.Limitable', array('remoteModel' => $unit['model'], 'remoteField' => $unit['field'], 'scope' => isset($unit['scope']) ? $unit['scope'] : 'user_id'));
     //Precreate subscription
     $braintreeData = array('paymentMethodToken' => $payment->token, 'planId' => $braintreePlanId);
     $qty = $this->Session->read('Billing.qty');
     if (!empty($qty)) {
         if (empty($braintreePlan->addOns)) {
             throw new NotFoundException(__d('billing', 'Unable to create subscription'));
         }
         foreach ($braintreePlan->addOns as $addOn) {
             $braintreeData['addOns']['update'][] = array('existingId' => $addOn->id, 'quantity' => $qty);
         }
     }
     $billingSubscription = $this->BillingSubscription->find('first', array('conditions' => array('BillingSubscription.group_id' => $plan['BillingGroup']['id'], 'BillingSubscription.user_id' => $this->currUser['User']['id'], 'BillingSubscription.active' => true)));
     //braintree unable to update subscription to a plan with a different billing frequency So we need to cancel current
     if (!empty($billingSubscription)) {
         if ($braintreePlan->billingFrequency != $billingSubscription['BraintreePlan']->billingFrequency || $billingSubscription['BraintreeSubscription']->status == 'Canceled' || $billingSubscription['BraintreeSubscription']->status == 'Expired') {
             if ($braintreePlan->billingFrequency != $billingSubscription['BraintreePlan']->billingFrequency || $billingSubscription['BraintreeSubscription']->status != 'Canceled') {
                 try {
                     $result = Braintree_Subscription::cancel($billingSubscription['BraintreeSubscription']->id);
                     if ($result->success) {
                         $billingSubscription['BraintreeSubscription'] = $result->subscription;
                     }
                 } catch (Exception $e) {
                 }
             }
             $status = isset($billingSubscription['BraintreeSubscription']->status) ? $billingSubscription['BraintreeSubscription']->status : 'Canceled';
             $this->BillingSubscription->cancel($billingSubscription['BillingSubscription']['id'], $status);
             $billingSubscription = null;
         }
     }
     if (!isset($billingSubscription['BillingSubscription'])) {
         $data = array('group_id' => $plan['BillingGroup']['id'], 'plan_id' => $plan['BillingPlan']['id'], 'user_id' => $this->currUser['User']['id'], 'limit_value' => !empty($qty) ? $qty : $plan['BillingPlan']['limit_value'], 'active' => false);
     } else {
         $data = $billingSubscription['BillingSubscription'];
         $data['limit_value'] = !empty($qty) ? $qty : $plan['BillingPlan']['limit_value'];
     }
     //No Exceptions anymore!
     if (!isset($data['remote_subscription_id']) || empty($data['remote_subscription_id'])) {
         //Subscribe user by create
         $result = Braintree_Subscription::create($braintreeData);
     } else {
         $data['plan_id'] = $plan['BillingPlan']['id'];
         //Subscribe user by update
         $result = Braintree_Subscription::update($data['remote_subscription_id'], $braintreeData);
     }
     if (!$result->success) {
         $this->Session->setFlash(__d('billing', 'Unable to subscribe on chosen plan. Please contact with resorce administration'));
         $this->redirect(array('action' => 'plans', $plan['BillingGroup']['slug']));
     }
     $data = Hash::merge($data, array('remote_subscription_id' => $result->subscription->id, 'remote_plan_id' => $result->subscription->planId, 'active' => $result->subscription->status === 'Active' ? true : false, 'status' => $result->subscription->status, 'expires' => $result->subscription->billingPeriodEndDate->format('Y-m-d H:i:s'), 'created' => $result->subscription->createdAt->format('Y-m-d H:i:s'), 'modified' => $result->subscription->updatedAt->format('Y-m-d H:i:s')));
     if (!isset($data['id'])) {
         $this->BillingSubscription->create();
     }
     if ($this->BillingSubscription->save($data)) {
//.........这里部分代码省略.........
开发者ID:nilBora,项目名称:konstruktor,代码行数:101,代码来源:BillingSubscriptionsController.php


示例19: _initialize

 /**
  * sets instance properties from an array of values
  *
  * @access protected
  * @param array $creditCardAttribs array of creditcard data
  * @return none
  */
 protected function _initialize($creditCardAttribs)
 {
     // set the attributes
     $this->_attributes = $creditCardAttribs;
     // map each address into its own object
     $billingAddress = isset($creditCardAttribs['billingAddress']) ? Braintree_Address::factory($creditCardAttribs['billingAddress']) : null;
     $subscriptionArray = array();
     if (isset($creditCardAttribs['subscriptions'])) {
         foreach ($creditCardAttribs['subscriptions'] as $subscription) {
             $subscriptionArray[] = Braintree_Subscription::factory($subscription);
         }
     }
     $this->_set('subscriptions', $subscriptionArray);
     $this->_set('billingAddress', $billingAddress);
     $this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
     $this->_set('maskedNumber', $this->bin . '******' . $this->last4);
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:24,代码来源:CreditCard.php


示例20: _verifyGatewayResponse

 /**
  * @ignore
  */
 private function _verifyGatewayResponse($response)
 {
     if (isset($response['subscription'])) {
         return new Braintree_Result_Successful(Braintree_Subscription::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']);
             } else {
                 throw new Braintree_Exception_Unexpected("Expected subscription, transaction, or apiErrorResponse");
             }
         }
     }
 }
开发者ID:portchris,项目名称:NaturalRemedyCompany,代码行数:20,代码来源:SubscriptionGateway.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Braintree_Transaction类代码示例发布时间:2022-05-23
下一篇:
PHP Braintree_Http类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap