mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-29 22:46:12 +00:00
38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Billing;
|
|
|
|
use Tests\TestCase;
|
|
use App\Billing\StripePaymentGateway;
|
|
|
|
/**
|
|
* @group integration
|
|
*/
|
|
class StripePaymentGatewayTest extends TestCase
|
|
{
|
|
use PaymentGatewayContractTests;
|
|
|
|
protected function getPaymentGateway()
|
|
{
|
|
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']);
|
|
}
|
|
}
|