update() public static method

public static update ( integer $customerId, array $attributes ) : Braintree\Result\Successful | Error
$customerId integer
$attributes array
return Braintree\Result\Successful | Braintree\Result\Error
 /**
  * Handle the event.
  *
  * @param  \Laravel\Spark\Events\Profile\ContactInformationUpdated  $event
  */
 public function handle($event)
 {
     if (!$event->user->hasBillingProvider()) {
         return;
     }
     BraintreeCustomer::update($event->user->braintree_id, ['email' => $event->user->email]);
 }
示例#2
0
 public function testUpdate_doesNotWorkWithOnetimePayPalNonce()
 {
     $customerResult = Braintree\Customer::create(['creditCard' => ['number' => '5105105105105100', 'expirationDate' => '05/12', 'options' => ['makeDefault' => true]]]);
     $paypalAccountToken = 'PAYPALToken-' . strval(rand());
     $http = new HttpClientApi(Braintree\Configuration::$global);
     $nonce = $http->nonceForPayPalAccount(['paypal_account' => ['access_token' => 'PAYPAL_ACCESS_TOKEN', 'token' => $paypalAccountToken, 'options' => ['makeDefault' => true]]]);
     $result = Braintree\Customer::update($customerResult->customer->id, ['paymentMethodNonce' => $nonce]);
     $this->assertFalse($result->success);
     $errors = $result->errors->forKey('customer')->forKey('paypalAccount')->errors;
     $this->assertEquals(Braintree\Error\Codes::PAYPAL_ACCOUNT_CANNOT_VAULT_ONE_TIME_USE_PAYPAL_ACCOUNT, $errors[0]->code);
 }