(remove Stripe mocking examples)

This commit is contained in:
Adam Wathan
2016-12-30 15:18:39 -05:00
parent 7eb064a9ec
commit 2d4ce1dc9e
3 changed files with 0 additions and 69 deletions

View File

@@ -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',
]);
}
}

View File

@@ -22,27 +22,3 @@ class StripePaymentGateway implements PaymentGateway
], ['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',
// ]
// ]);
// }
// }

View File

@@ -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();
}
}