diff --git a/src/Requests/Baskets/CreateBasketRequest.php b/src/Requests/Baskets/CreateBasketRequest.php index 97512e1..ed2079b 100644 --- a/src/Requests/Baskets/CreateBasketRequest.php +++ b/src/Requests/Baskets/CreateBasketRequest.php @@ -13,19 +13,16 @@ class CreateBasketRequest extends Request implements HasBody public function __construct( protected string $returnUrl, protected string $completeUrl - ){} + ) { + } /** * Define the HTTP method - * - * @var Method */ protected Method $method = Method::POST; /** * Define the endpoint for the request - * - * @return string */ public function resolveEndpoint(): string { @@ -36,7 +33,7 @@ protected function defaultBody(): array { return [ 'return_url' => $this->returnUrl, - 'complete_url' => $this->completeUrl + 'complete_url' => $this->completeUrl, ]; } } diff --git a/src/Requests/Baskets/GetBasketRequest.php b/src/Requests/Baskets/GetBasketRequest.php index c8c79f4..b3dc2c5 100644 --- a/src/Requests/Baskets/GetBasketRequest.php +++ b/src/Requests/Baskets/GetBasketRequest.php @@ -2,8 +2,6 @@ namespace Shimmer\LaravelTebexCheckout\Requests\Baskets; -use App\Data\TebexCheckout\Responses\Baskets\BasketResponse; -use Saloon\Contracts\Response; use Saloon\Enums\Method; use Saloon\Http\Request; @@ -11,22 +9,19 @@ class GetBasketRequest extends Request { public function __construct( protected string $ident - ){} + ) { + } /** * Define the HTTP method - * - * @var Method */ protected Method $method = Method::GET; /** * Define the endpoint for the request - * - * @return string */ public function resolveEndpoint(): string { - return '/baskets/' . $this->ident; + return '/baskets/'.$this->ident; } } diff --git a/src/Requests/Baskets/Packages/AddPackageRequest.php b/src/Requests/Baskets/Packages/AddPackageRequest.php index db057bb..59f27f3 100644 --- a/src/Requests/Baskets/Packages/AddPackageRequest.php +++ b/src/Requests/Baskets/Packages/AddPackageRequest.php @@ -3,7 +3,6 @@ namespace Shimmer\LaravelTebexCheckout\Requests\Baskets\Packages; use Saloon\Contracts\Body\HasBody; -use Saloon\Contracts\Response; use Saloon\Enums\Method; use Saloon\Http\Request; use Saloon\Traits\Body\HasJsonBody; @@ -16,30 +15,27 @@ public function __construct( protected string $ident, protected object $package, protected string $type, - ){} + ) { + } /** * Define the HTTP method - * - * @var Method */ protected Method $method = Method::POST; /** * Define the endpoint for the request - * - * @return string */ public function resolveEndpoint(): string { - return '/baskets/'. $this->ident . '/packages'; + return '/baskets/'.$this->ident.'/packages'; } protected function defaultBody(): array { return [ 'package' => $this->package, - 'type' => $this->type + 'type' => $this->type, ]; } } diff --git a/src/Requests/Baskets/Packages/DeletePackageRequest.php b/src/Requests/Baskets/Packages/DeletePackageRequest.php index 051dbfa..a804348 100644 --- a/src/Requests/Baskets/Packages/DeletePackageRequest.php +++ b/src/Requests/Baskets/Packages/DeletePackageRequest.php @@ -10,22 +10,19 @@ class DeletePackageRequest extends Request public function __construct( protected string $ident, protected int $rowId - ){} + ) { + } /** * Define the HTTP method - * - * @var Method */ protected Method $method = Method::DELETE; /** * Define the endpoint for the request - * - * @return string */ public function resolveEndpoint(): string { - return '/baskets/' . $this->ident . '/packages/' . $this->rowId; + return '/baskets/'.$this->ident.'/packages/'.$this->rowId; } } diff --git a/src/Requests/Baskets/Sales/CreateSaleRequest.php b/src/Requests/Baskets/Sales/CreateSaleRequest.php index 59951ed..401104b 100644 --- a/src/Requests/Baskets/Sales/CreateSaleRequest.php +++ b/src/Requests/Baskets/Sales/CreateSaleRequest.php @@ -15,23 +15,20 @@ public function __construct( protected string $name, protected string $discountType, protected float $amount - ){} + ) { + } /** * Define the HTTP method - * - * @var Method */ protected Method $method = Method::POST; /** * Define the endpoint for the request - * - * @return string */ public function resolveEndpoint(): string { - return '/baskets/' . $this->ident . '/sales'; + return '/baskets/'.$this->ident.'/sales'; } protected function defaultBody(): array @@ -39,7 +36,7 @@ protected function defaultBody(): array return [ 'name' => $this->name, 'discount_type' => $this->discountType, - 'amount' => $this->amount + 'amount' => $this->amount, ]; } } diff --git a/src/Requests/Checkout/CreateCheckoutRequest.php b/src/Requests/Checkout/CreateCheckoutRequest.php index 892d1fc..8ba8e12 100644 --- a/src/Requests/Checkout/CreateCheckoutRequest.php +++ b/src/Requests/Checkout/CreateCheckoutRequest.php @@ -14,19 +14,16 @@ class CreateCheckoutRequest extends Request implements HasBody public function __construct( protected array $basket, protected array $items, - ){} + ) { + } /** * Define the HTTP method - * - * @var Method */ protected Method $method = Method::POST; /** * Define the endpoint for the request - * - * @return string */ public function resolveEndpoint(): string { @@ -37,7 +34,7 @@ protected function defaultBody(): array { return [ 'basket' => $this->basket, - 'items' => $this->items + 'items' => $this->items, ]; } } diff --git a/src/Requests/Payments/GetPaymentRequest.php b/src/Requests/Payments/GetPaymentRequest.php index 6aff4b4..aeaf446 100644 --- a/src/Requests/Payments/GetPaymentRequest.php +++ b/src/Requests/Payments/GetPaymentRequest.php @@ -9,22 +9,19 @@ class GetPaymentRequest extends Request { public function __construct( protected string $txnID - ){} + ) { + } /** * Define the HTTP method - * - * @var Method */ protected Method $method = Method::GET; /** * Define the endpoint for the request - * - * @return string */ public function resolveEndpoint(): string { - return '/payments/' . $this->txnID . '?type=txn_id'; + return '/payments/'.$this->txnID.'?type=txn_id'; } } diff --git a/src/Requests/Payments/RefundPaymentRequest.php b/src/Requests/Payments/RefundPaymentRequest.php index 29dbf30..fa43891 100644 --- a/src/Requests/Payments/RefundPaymentRequest.php +++ b/src/Requests/Payments/RefundPaymentRequest.php @@ -9,22 +9,19 @@ class RefundPaymentRequest extends Request { public function __construct( protected string $txnID - ){} + ) { + } /** * Define the HTTP method - * - * @var Method */ protected Method $method = Method::POST; /** * Define the endpoint for the request - * - * @return string */ public function resolveEndpoint(): string { - return '/payments/' . $this->txnID . '/refund?type=txn_id'; + return '/payments/'.$this->txnID.'/refund?type=txn_id'; } } diff --git a/src/Requests/RecurringPayments/CancelRecurringPaymentRequest.php b/src/Requests/RecurringPayments/CancelRecurringPaymentRequest.php index 01fa15b..3900e8b 100644 --- a/src/Requests/RecurringPayments/CancelRecurringPaymentRequest.php +++ b/src/Requests/RecurringPayments/CancelRecurringPaymentRequest.php @@ -9,22 +9,19 @@ class CancelRecurringPaymentRequest extends Request { public function __construct( protected string $reference - ){} + ) { + } /** * Define the HTTP method - * - * @var Method */ protected Method $method = Method::DELETE; /** * Define the endpoint for the request - * - * @return string */ public function resolveEndpoint(): string { - return '/recurring-payments/' . $this->reference; + return '/recurring-payments/'.$this->reference; } } diff --git a/src/Requests/RecurringPayments/GetRecurringPaymentRequest.php b/src/Requests/RecurringPayments/GetRecurringPaymentRequest.php index 0be5a95..3e1910f 100644 --- a/src/Requests/RecurringPayments/GetRecurringPaymentRequest.php +++ b/src/Requests/RecurringPayments/GetRecurringPaymentRequest.php @@ -9,22 +9,19 @@ class GetRecurringPaymentRequest extends Request { public function __construct( protected string $reference - ){} + ) { + } /** * Define the HTTP method - * - * @var Method */ protected Method $method = Method::GET; /** * Define the endpoint for the request - * - * @return string */ public function resolveEndpoint(): string { - return '/recurring-payments/' . $this->reference; + return '/recurring-payments/'.$this->reference; } } diff --git a/src/Requests/RecurringPayments/UpdateRecurringPaymentRequest.php b/src/Requests/RecurringPayments/UpdateRecurringPaymentRequest.php index 4acce08..31fa620 100644 --- a/src/Requests/RecurringPayments/UpdateRecurringPaymentRequest.php +++ b/src/Requests/RecurringPayments/UpdateRecurringPaymentRequest.php @@ -14,29 +14,26 @@ class UpdateRecurringPaymentRequest extends Request implements HasBody public function __construct( protected string $reference, protected array $items, - ){} + ) { + } /** * Define the HTTP method - * - * @var Method */ protected Method $method = Method::PUT; /** * Define the endpoint for the request - * - * @return string */ public function resolveEndpoint(): string { - return '/recurring-payments/' . $this->reference; + return '/recurring-payments/'.$this->reference; } protected function defaultBody(): array { return [ - 'items' => $this->items + 'items' => $this->items, ]; } } diff --git a/src/TebexCheckout.php b/src/TebexCheckout.php index f83bc2d..9b1fa79 100644 --- a/src/TebexCheckout.php +++ b/src/TebexCheckout.php @@ -14,12 +14,11 @@ class TebexCheckout extends Connector public function __construct( public string $username, public string $password - ){} + ) { + } /** * The Base URL of the API - * - * @return string */ public function resolveBaseUrl(): string { diff --git a/tests/CheckoutTest.php b/tests/CheckoutTest.php index 5893a9d..a8ad66e 100644 --- a/tests/CheckoutTest.php +++ b/tests/CheckoutTest.php @@ -7,7 +7,7 @@ it('successfully creates a checkout request', function () { $mockClient = new MockClient([ - CreateCheckoutRequest::class => MockResponse::fixture('create.checkout.request') + CreateCheckoutRequest::class => MockResponse::fixture('create.checkout.request'), ]); $checkout = new TebexCheckout('foo', 'bar'); @@ -18,16 +18,16 @@ 'return_url' => 'http://foo.com', 'complete_url' => 'http://bar.com', 'custom' => [ - 'baz' => 'buzz' - ] + 'baz' => 'buzz', + ], ], items: [ [ 'package' => [ 'name' => 'foobar', - 'price' => 12.34 - ] - ] + 'price' => 12.34, + ], + ], ] ); diff --git a/tests/TestCase.php b/tests/TestCase.php index d22a90b..73dd32b 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,7 +2,6 @@ namespace Shimmer\LaravelTebexCheckout\Tests; -use Illuminate\Database\Eloquent\Factories\Factory; use Orchestra\Testbench\TestCase as Orchestra; use Shimmer\LaravelTebexCheckout\LaravelTebexCheckoutServiceProvider;