-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25babb8
commit eba0d45
Showing
4 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
use Saloon\Http\Faking\MockClient; | ||
use Saloon\Http\Faking\MockResponse; | ||
use Shimmer\LaravelTebexCheckout\Requests\Checkout\CreateCheckoutRequest; | ||
use Shimmer\LaravelTebexCheckout\TebexCheckout; | ||
|
||
it('successfully creates a checkout request', function () { | ||
$mockClient = new MockClient([ | ||
CreateCheckoutRequest::class => MockResponse::fixture('create.checkout.request') | ||
]); | ||
|
||
$checkout = new TebexCheckout('foo', 'bar'); | ||
$checkout->withMockClient($mockClient); | ||
|
||
$request = new CreateCheckoutRequest( | ||
basket: [ | ||
'return_url' => 'http://foo.com', | ||
'complete_url' => 'http://bar.com', | ||
'custom' => [ | ||
'baz' => 'buzz' | ||
] | ||
], | ||
items: [ | ||
[ | ||
'package' => [ | ||
'name' => 'foobar', | ||
'price' => 12.34 | ||
] | ||
] | ||
] | ||
); | ||
|
||
$response = $checkout->send($request); | ||
|
||
expect($response->successful())->toBeTrue(); | ||
expect($response->json())->toHaveKey('price', 12.34); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"statusCode":200,"headers":{"Date":"Fri, 31 Mar 2023 00:09:25 GMT","Content-Type":"application\/json","Transfer-Encoding":"chunked","Connection":"keep-alive","CF-Ray":"fake-EWR","Cache-Control":"no-cache, private","Strict-Transport-Security":"max-age=31536000;","CF-Cache-Status":"DYNAMIC","TB-Node":"fake","X-Frame-Options":"SAMEORIGIN","X-VAT-Mode":"exclusive","Set-Cookie":"fake; path=\/; expires=Fri, 31-Mar-23 00:39:25 GMT; domain=.tebex.io; HttpOnly; Secure; SameSite=None","Server":"cloudflare"},"data":"{\"ident\":\"bgew6k-e5479e0f75f302b23947defa7219256a00055e75\",\"expire\":\"2023-04-05 00:09:25\",\"price\":12.34,\"priceDetails\":{\"fullPrice\":12.34,\"subTotal\":12.34,\"discounts\":[],\"total\":12.34,\"surcharges\":[],\"tax\":0,\"balance\":12.34,\"sales\":[],\"giftcards\":[],\"recurring\":null,\"roundUp\":null},\"type\":\"single\",\"recurring\":false,\"recurringPeriod\":null,\"complete\":false,\"tax\":null,\"username\":null,\"discounts\":null,\"coupons\":[],\"giftcards\":[],\"address\":{\"name\":null,\"first_name\":null,\"last_name\":null,\"address\":null,\"email\":null,\"state_id\":null,\"country\":\"XX\",\"postal_code\":null},\"actions\":null,\"game_currency\":null,\"tebex_account_id\":null,\"verified\":null,\"rows\":[{\"id\":151356931,\"basket\":692696684,\"package\":null,\"override\":0,\"quantity\":1,\"server\":null,\"price\":12.34,\"gift_username_id\":null,\"options\":null,\"meta\":{\"name\":\"foobar\",\"rowprice\":12.34,\"initialprice\":12.34,\"isCumulative\":false,\"requiredPackages\":[],\"requiresAny\":false,\"category\":false,\"producesGiftCard\":false,\"allowsGiftCards\":true,\"servers\":[],\"limits\":{\"user\":{\"enabled\":false,\"timestamp\":0,\"limit\":false},\"global\":{\"enabled\":false,\"timestamp\":0,\"limit\":false},\"packageExpiryTime\":0},\"hasDeliverables\":false,\"hasSellerProtection\":true,\"itemType\":null,\"revenue_share\":[],\"realprice\":12.34},\"custom\":null}],\"fingerprint\":null,\"creator_code\":\"\",\"roundup\":null,\"custom\":{\"baz\":\"buzz\"},\"links\":{\"checkout\":\"https:\\\/\\\/checkout.tebex.io\\\/checkout\\\/fake\"}}"} |