diff --git a/config/bazar.php b/config/bazar.php index 953bd15c..1104e546 100644 --- a/config/bazar.php +++ b/config/bazar.php @@ -56,14 +56,12 @@ 'gateway' => [ 'default' => env('BAZAR_GATEWAY_DRIVER', 'transfer'), 'drivers' => [ - 'cash' => [ - 'success_url' => '/?order={order}&status=success', - 'failure_url' => '/?order={order}&status=failed', - ], - 'transfer' => [ - 'success_url' => '/?order={order}&status=success', - 'failure_url' => '/?order={order}&status=failed', - ], + 'cash' => [], + 'transfer' => [], + ], + 'urls' => [ + 'success' => '/?order={order}', + 'failure' => '/?order={order}', ], ], diff --git a/src/Gateway/Driver.php b/src/Gateway/Driver.php index 83646f47..d4091d56 100644 --- a/src/Gateway/Driver.php +++ b/src/Gateway/Driver.php @@ -12,6 +12,7 @@ use Cone\Bazar\Support\Facades\Cart; use Illuminate\Http\Request; use Illuminate\Http\Response as HttpResponse; +use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\URL; use Throwable; @@ -62,7 +63,9 @@ public function getCaptureUrl(Order $order): string */ public function getSuccessUrl(Order $order): string { - return URL::to(str_replace(['{order}'], [$order->uuid], $this->config['success_url'] ?? '/')); + $url = $this->config['success_url'] ?? Config::get('bazar.gateway.urls.success'); + + return URL::to(str_replace(['{order}'], [$order->uuid], $url ?? '/')); } /** @@ -70,7 +73,9 @@ public function getSuccessUrl(Order $order): string */ public function getFailureUrl(Order $order): string { - return URL::to(str_replace(['{order}'], [$order->uuid], $this->config['failure_url'] ?? '/')); + $url = $this->config['failure_url'] ?? Config::get('bazar.gateway.urls.failure'); + + return URL::to(str_replace(['{order}'], [$order->uuid], $url ?? '/')); } /**