function Braintree_TransactionTest::testCreateFromTransparentRedirect in Commerce Braintree 7
File
- braintree_php/
tests/ integration/ TransactionTest.php, line 993
Class
Code
function testCreateFromTransparentRedirect() {
Braintree_TestHelper::suppressDeprecationWarnings();
$queryString = $this
->createTransactionViaTr(array(
'transaction' => array(
'customer' => array(
'first_name' => 'First',
),
'credit_card' => array(
'number' => '5105105105105100',
'expiration_date' => '05/12',
),
),
), array(
'transaction' => array(
'type' => Braintree_Transaction::SALE,
'amount' => '100.00',
),
));
$result = Braintree_Transaction::createFromTransparentRedirect($queryString);
Braintree_TestHelper::assertPrintable($result);
$this
->assertTrue($result->success);
$this
->assertEquals('100.00', $result->transaction->amount);
$this
->assertEquals(Braintree_Transaction::SALE, $result->transaction->type);
$this
->assertEquals(Braintree_Transaction::AUTHORIZED, $result->transaction->status);
$creditCard = $result->transaction->creditCardDetails;
$this
->assertEquals('510510', $creditCard->bin);
$this
->assertEquals('5100', $creditCard->last4);
$this
->assertEquals('US', $creditCard->customerLocation);
$this
->assertEquals('MasterCard', $creditCard->cardType);
$this
->assertEquals('05/2012', $creditCard->expirationDate);
$this
->assertEquals('510510******5100', $creditCard->maskedNumber);
$customer = $result->transaction->customerDetails;
$this
->assertequals('First', $customer->firstName);
}