コード例 #1
0
 public function testGatewayFind()
 {
     $paymentMethodToken = 'PAYPALToken-' . strval(rand());
     $customer = Braintree\Customer::createNoValidate();
     $http = new HttpClientApi(Braintree\Configuration::$global);
     $nonce = $http->nonceForPayPalAccount(['paypal_account' => ['consent_code' => 'PAYPAL_CONSENT_CODE', 'token' => $paymentMethodToken]]);
     Braintree\PaymentMethod::create(['customerId' => $customer->id, 'paymentMethodNonce' => $nonce]);
     $gateway = new Braintree\Gateway(['environment' => 'development', 'merchantId' => 'integration_merchant_id', 'publicKey' => 'integration_public_key', 'privateKey' => 'integration_private_key']);
     $foundPayPalAccount = $gateway->paypalAccount()->find($paymentMethodToken);
     $this->assertSame('*****@*****.**', $foundPayPalAccount->email);
     $this->assertSame($paymentMethodToken, $foundPayPalAccount->token);
     $this->assertNotNull($foundPayPalAccount->imageUrl);
 }