public function testCreateWithAccessToken() { $credentials = Test\Braintree\OAuthTestHelper::createCredentials(['clientId' => 'client_id$development$integration_client_id', 'clientSecret' => 'client_secret$development$integration_client_secret', 'merchantId' => 'integration_merchant_id']); $gateway = new Braintree\Gateway(['accessToken' => $credentials->accessToken]); $result = $gateway->customer()->create(['firstName' => 'Mike', 'lastName' => 'Jones']); $this->assertEquals(true, $result->success); $customer = $result->customer; $this->assertEquals('Mike', $customer->firstName); $this->assertEquals('Jones', $customer->lastName); $this->assertNotNull($customer->merchantId); }
public function testSaleWithAccessToken() { $credentials = Test\Braintree\OAuthTestHelper::createCredentials(['clientId' => 'client_id$development$integration_client_id', 'clientSecret' => 'client_secret$development$integration_client_secret', 'merchantId' => 'integration_merchant_id']); $gateway = new Braintree\Gateway(['accessToken' => $credentials->accessToken]); $result = $gateway->transaction()->sale(['amount' => '100.00', 'creditCard' => ['cardholderName' => 'The Cardholder', 'number' => '5105105105105100', 'expirationDate' => '05/12']]); $this->assertTrue($result->success); $transaction = $result->transaction; $this->assertEquals(Braintree\Transaction::AUTHORIZED, $transaction->status); $this->assertEquals(Braintree\Transaction::SALE, $transaction->type); $this->assertEquals('100.00', $transaction->amount); $this->assertNotNull($transaction->processorAuthorizationCode); $this->assertEquals('510510', $transaction->creditCardDetails->bin); $this->assertEquals('5100', $transaction->creditCardDetails->last4); $this->assertEquals('The Cardholder', $transaction->creditCardDetails->cardholderName); }