public function testDelete_worksWithPayPalAccounts()
 {
     $paymentMethodToken = 'PAYPAL_TOKEN-' . strval(rand());
     $customer = Braintree\Customer::createNoValidate();
     $http = new HttpClientApi(Braintree\Configuration::$global);
     $nonce = $http->nonceForPayPalAccount(['paypal_account' => ['consent_code' => 'PAYPAL_CONSENT_CODE', 'token' => $paymentMethodToken]]);
     $paypalAccountResult = Braintree\PaymentMethod::create(['customerId' => $customer->id, 'paymentMethodNonce' => $nonce]);
     $this->assertTrue($paypalAccountResult->success);
     Braintree\PaymentMethod::delete($paymentMethodToken);
     $this->setExpectedException('Braintree\\Exception\\NotFound');
     Braintree\PaymentMethod::find($paymentMethodToken);
 }
Exemplo n.º 2
0
 public function deletePaymentMethod()
 {
     $result = PaymentMethod::delete($this->options['paymentMethodToken']);
     if ($result->success) {
         return ['status' => true, 'result' => $result];
     } else {
         return ['status' => false, 'result' => $result];
     }
 }