Skip to content

Commit

Permalink
fix: add correct payment endpoint (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio authored Sep 19, 2023
1 parent d198a46 commit 72910fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/Payments/Mobilpay/GatewayParametersTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

namespace App\Payments\Mobilpay;

use App\Payments\PaymentGateway;

trait GatewayParametersTrait
{
public function getEndpointUrl(?bool $testMode = null): string
public function getEndpointUrl(): string
{
return $testMode === false
? 'https://secure.mobilpay.ro'
: 'https://sandboxsecure.mobilpay.ro';
return PaymentGateway::isTestMode()
? 'https://sandboxsecure.mobilpay.ro'
: 'https://secure.mobilpay.ro';
}

public function setSignature($value): self
Expand Down
5 changes: 5 additions & 0 deletions app/Payments/PaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public static function isActive(?string $alias = null): bool
return ! \is_null(static::getDriver($alias));
}

public static function isTestMode(): bool
{
return (bool) settings('payments.defaults.testMode');
}

public static function getDriver(string $gateway): ?string
{
$class = settings("payments.gateways.{$gateway}.driver");
Expand Down

0 comments on commit 72910fd

Please sign in to comment.