164 - Paying Promoters Directly

This commit is contained in:
Adam Wathan
2018-01-26 11:58:50 -05:00
parent 0db962d04c
commit 7442baa5c5
6 changed files with 14 additions and 14 deletions

View File

@@ -34,11 +34,11 @@ class FakePaymentGatewayTest extends TestCase
$paymentGateway->beforeFirstCharge(function ($paymentGateway) use (&$timesCallbackRan) {
$timesCallbackRan++;
$paymentGateway->charge(2500, $paymentGateway->getValidTestToken());
$paymentGateway->charge(2500, $paymentGateway->getValidTestToken(), 'test_acct_1234');
$this->assertEquals(2500, $paymentGateway->totalCharges());
});
$paymentGateway->charge(2500, $paymentGateway->getValidTestToken());
$paymentGateway->charge(2500, $paymentGateway->getValidTestToken(), 'test_acct_1234');
$this->assertEquals(1, $timesCallbackRan);
$this->assertEquals(5000, $paymentGateway->totalCharges());
}

View File

@@ -14,7 +14,7 @@ trait PaymentGatewayContractTests
$paymentGateway = $this->getPaymentGateway();
$newCharges = $paymentGateway->newChargesDuring(function ($paymentGateway) {
$paymentGateway->charge(2500, $paymentGateway->getValidTestToken());
$paymentGateway->charge(2500, $paymentGateway->getValidTestToken(), 'test_acct_1234');
});
$this->assertCount(1, $newCharges);
@@ -40,7 +40,7 @@ trait PaymentGatewayContractTests
$newCharges = $paymentGateway->newChargesDuring(function ($paymentGateway) {
try {
$paymentGateway->charge(2500, 'invalid-payment-token');
$paymentGateway->charge(2500, 'invalid-payment-token', 'test_acct_1234');
} catch (PaymentFailedException $e) {
return;
}
@@ -55,12 +55,12 @@ trait PaymentGatewayContractTests
function can_fetch_charges_created_during_a_callback()
{
$paymentGateway = $this->getPaymentGateway();
$paymentGateway->charge(2000, $paymentGateway->getValidTestToken());
$paymentGateway->charge(3000, $paymentGateway->getValidTestToken());
$paymentGateway->charge(2000, $paymentGateway->getValidTestToken(), 'test_acct_1234');
$paymentGateway->charge(3000, $paymentGateway->getValidTestToken(), 'test_acct_1234');
$newCharges = $paymentGateway->newChargesDuring(function ($paymentGateway) {
$paymentGateway->charge(4000, $paymentGateway->getValidTestToken());
$paymentGateway->charge(5000, $paymentGateway->getValidTestToken());
$paymentGateway->charge(4000, $paymentGateway->getValidTestToken(), 'test_acct_1234');
$paymentGateway->charge(5000, $paymentGateway->getValidTestToken(), 'test_acct_1234');
});
$this->assertCount(2, $newCharges);

View File

@@ -76,11 +76,11 @@ class ReservationTest extends TestCase
$reservation = new Reservation($tickets, 'john@example.com');
$paymentGateway = new FakePaymentGateway;
$order = $reservation->complete($paymentGateway, $paymentGateway->getValidTestToken());
$order = $reservation->complete($paymentGateway, $paymentGateway->getValidTestToken(), 'test_acct_1234');
$this->assertEquals('john@example.com', $order->email);
$this->assertEquals(3, $order->ticketQuantity());
$this->assertEquals(3600, $order->amount);
$this->assertEquals(3600, $paymentGateway->totalCharges());
$this->assertEquals(3600, $paymentGateway->totalChargesFor('test_acct_1234'));
}
}