Skip to content

Commit

Permalink
make debug mode laravel compliant and make Startbutton USD default ay…
Browse files Browse the repository at this point in the history
…ment channel null
  • Loading branch information
stephenjude committed Jun 7, 2024
1 parent ac6aa69 commit 2a4c66c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/payment-gateways.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/*
* Debug mode set to true logs all the HTTP response to your application log file
*/
'debug_mode' => true,
'debug_mode' => env('APP_DEBUG'),

/*
* All payment transactions are verified on the callback route.
Expand Down
2 changes: 2 additions & 0 deletions src/Providers/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function request($method, $path, array $payload = [], array $options = []
$this->logResponse($this->provider, $response);

if ($response->failed()) {
dd($response->json(), $payload);

throw new Exception($response->reason().': '.$this->parseProviderError($response));
}

Expand Down
6 changes: 3 additions & 3 deletions src/Providers/StartbuttonProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function initializeCheckout(array $parameters = []): SessionData
'partner' => Arr::get($parameters, 'partner'),
'email' => Arr::get($parameters, 'email'),
'amount' => $amount,
'currency' => Arr::get($parameters, 'currency'),
'currency' => $currency = Arr::get($parameters, 'currency'),
'reference' => Arr::get($parameters, 'reference'),
'paymentMethods' => $this->getChannels(),
'paymentMethods' => strtoupper($currency) === 'USD' ? null : $this->getChannels(),
'metadata' => Arr::get($parameters, 'meta'),
'redirectUrl' => $parameters['callback_url']
?? route(config('payment-gateways.routes.callback.name'), [
Expand All @@ -48,7 +48,7 @@ public function initializeCheckout(array $parameters = []): SessionData
])
);

return Cache::remember($parameters['session_cache_key'], $parameters['expires'], fn () => new SessionData(
return Cache::remember($parameters['session_cache_key'], $parameters['expires'], fn() => new SessionData(
provider: $this->provider,
sessionReference: $parameters['reference'],
paymentReference: null,
Expand Down

0 comments on commit 2a4c66c

Please sign in to comment.