public function testGatewayCreate_whenSuccessful() { $creditCard = SubscriptionHelper::createCreditCard(); $plan = SubscriptionHelper::triallessPlan(); $gateway = new Braintree\Gateway(['environment' => 'development', 'merchantId' => 'integration_merchant_id', 'publicKey' => 'integration_public_key', 'privateKey' => 'integration_private_key']); $result = $gateway->subscription()->create(['paymentMethodToken' => $creditCard->token, 'planId' => $plan['id']]); Test\Helper::assertPrintable($result); $this->assertTrue($result->success); $subscription = $result->subscription; $this->assertEquals($creditCard->token, $subscription->paymentMethodToken); $this->assertEquals(0, $subscription->failureCount); $this->assertEquals($plan['id'], $subscription->planId); $this->assertEquals(Test\Helper::defaultMerchantAccountId(), $subscription->merchantAccountId); $this->assertEquals(Braintree\Subscription::ACTIVE, $subscription->status); }
public function testUpdate_withCardVerification() { $customer = Braintree\Customer::createNoValidate(); $initialCreditCard = Braintree\CreditCard::create(array('customerId' => $customer->id, 'number' => '5105105105105100', 'expirationDate' => '05/12'))->creditCard; $result = Braintree\CreditCard::update($initialCreditCard->token, array('billingAddress' => array('region' => 'IL'), 'options' => array('verifyCard' => true))); $this->assertFalse($result->success); $this->assertEquals(Braintree\Result\CreditCardVerification::PROCESSOR_DECLINED, $result->creditCardVerification->status); $this->assertEquals('2000', $result->creditCardVerification->processorResponseCode); $this->assertEquals('Do Not Honor', $result->creditCardVerification->processorResponseText); $this->assertEquals('I', $result->creditCardVerification->cvvResponseCode); $this->assertEquals(null, $result->creditCardVerification->avsErrorResponseCode); $this->assertEquals('I', $result->creditCardVerification->avsPostalCodeResponseCode); $this->assertEquals('I', $result->creditCardVerification->avsStreetAddressResponseCode); $this->assertEquals(Test\Helper::defaultMerchantAccountId(), $result->creditCardVerification->merchantAccountId); }
public function testCredit_withoutMerchantAccountIdFallsBackToDefault() { $result = Braintree\Transaction::credit(['amount' => '100.00', 'creditCard' => ['number' => '5105105105105100', 'expirationDate' => '05/12']]); $this->assertTrue($result->success); $transaction = $result->transaction; $this->assertEquals(Test\Helper::defaultMerchantAccountId(), $transaction->merchantAccountId); }