mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 11:14:06 +00:00
(remove Stripe mocking examples)
This commit is contained in:
@@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Billing\Alternate;
|
|
||||||
|
|
||||||
use App\Billing\PaymentGateway;
|
|
||||||
|
|
||||||
class StripePaymentGateway implements PaymentGateway
|
|
||||||
{
|
|
||||||
private $stripeClient;
|
|
||||||
|
|
||||||
public function __construct(\Stripe\ApiClient $stripeClient)
|
|
||||||
{
|
|
||||||
$this->stripeClient = $stripeClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function charge($amount, $token)
|
|
||||||
{
|
|
||||||
$this->stripeClient->createCharge([
|
|
||||||
'amount' => $amount,
|
|
||||||
'source' => $token,
|
|
||||||
'currency' => 'usd',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,27 +22,3 @@ class StripePaymentGateway implements PaymentGateway
|
|||||||
], ['api_key' => $this->apiKey]);
|
], ['api_key' => $this->apiKey]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// class StripePaymentGateway implements PaymentGateway
|
|
||||||
// {
|
|
||||||
// private $apiKey;
|
|
||||||
|
|
||||||
// public function __construct($apiKey)
|
|
||||||
// {
|
|
||||||
// $this->apiKey = $apiKey;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function charge($amount, $token)
|
|
||||||
// {
|
|
||||||
// (new \GuzzleHttp\Client)->post('https://api.stripe.com/v1/charges', [
|
|
||||||
// 'headers' => [
|
|
||||||
// 'Authorization' => "Bearer {$this->apiKey}",
|
|
||||||
// ],
|
|
||||||
// 'form_params' => [
|
|
||||||
// 'amount' => $amount,
|
|
||||||
// 'token' => $token,
|
|
||||||
// 'currency' => 'usd',
|
|
||||||
// ]
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use App\Billing\Alternate\StripePaymentGateway;
|
|
||||||
|
|
||||||
class MockStripePaymentGatewayTest extends TestCase
|
|
||||||
{
|
|
||||||
/** @test */
|
|
||||||
function charges_with_a_valid_payment_token_are_successful()
|
|
||||||
{
|
|
||||||
$stripeClient = Mockery::spy(\Stripe\ApiClient::class);
|
|
||||||
$paymentGateway = new StripePaymentGateway($stripeClient);
|
|
||||||
|
|
||||||
$paymentGateway->charge(2500, 'valid-token');
|
|
||||||
|
|
||||||
$stripeClient->shouldHaveReceived('createCharge')->with([
|
|
||||||
'amount' => 2500,
|
|
||||||
'source' => 'valid-token',
|
|
||||||
'currency' => 'usd',
|
|
||||||
])->once();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user