mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-17 20:54:14 +00:00
165 - Splitting Payments with Stripe
This commit is contained in:
@@ -16,4 +16,22 @@ class StripePaymentGatewayTest extends TestCase
|
||||
{
|
||||
return new StripePaymentGateway(config('services.stripe.secret'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function ninety_percent_of_the_payment_is_transferred_to_the_destination_account()
|
||||
{
|
||||
$paymentGateway = new StripePaymentGateway(config('services.stripe.secret'));
|
||||
|
||||
$paymentGateway->charge(5000, $paymentGateway->getValidTestToken(), env('STRIPE_TEST_PROMOTER_ID'));
|
||||
|
||||
$lastStripeCharge = array_first(\Stripe\Charge::all([
|
||||
'limit' => 1
|
||||
], ['api_key' => config('services.stripe.secret')])['data']);
|
||||
|
||||
$this->assertEquals(5000, $lastStripeCharge['amount']);
|
||||
$this->assertEquals(env('STRIPE_TEST_PROMOTER_ID'), $lastStripeCharge['destination']);
|
||||
|
||||
$transfer = \Stripe\Transfer::retrieve($lastStripeCharge['transfer'], ['api_key' => config('services.stripe.secret')]);
|
||||
$this->assertEquals(4500, $transfer['amount']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user