163 - Total Charges for a Specific Account

This commit is contained in:
Adam Wathan
2018-01-29 13:13:29 -05:00
parent 54a8159a1d
commit 0db962d04c
6 changed files with 37 additions and 5 deletions

View File

@@ -14,6 +14,18 @@ class FakePaymentGatewayTest extends TestCase
return new FakePaymentGateway;
}
/** @test */
function can_get_total_charges_for_a_specific_account()
{
$paymentGateway = new FakePaymentGateway;
$paymentGateway->charge(1000, $paymentGateway->getValidTestToken(), 'test_acct_0000');
$paymentGateway->charge(2500, $paymentGateway->getValidTestToken(), 'test_acct_1234');
$paymentGateway->charge(4000, $paymentGateway->getValidTestToken(), 'test_acct_1234');
$this->assertEquals(6500, $paymentGateway->totalChargesFor('test_acct_1234'));
}
/** @test */
function running_a_hook_before_the_first_charge()
{

View File

@@ -26,10 +26,11 @@ trait PaymentGatewayContractTests
{
$paymentGateway = $this->getPaymentGateway();
$charge = $paymentGateway->charge(2500, $paymentGateway->getValidTestToken($paymentGateway::TEST_CARD_NUMBER));
$charge = $paymentGateway->charge(2500, $paymentGateway->getValidTestToken($paymentGateway::TEST_CARD_NUMBER), 'test_acct_1234');
$this->assertEquals(substr($paymentGateway::TEST_CARD_NUMBER, -4), $charge->cardLastFour());
$this->assertEquals(2500, $charge->amount());
$this->assertEquals('test_acct_1234', $charge->destination());
}
/** @test */