mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-19 03:54:41 +00:00
164 - Paying Promoters Directly
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user