Created
January 19, 2024 11:06
-
-
Save akalongman/9884aa5ac4fe36921fa727ffc7330383 to your computer and use it in GitHub Desktop.
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
private function generateRedirectUrl(Order $order): ?string | |
{ | |
if (! $order->isPaymentTypeBank()) { | |
return null; | |
} | |
$requestUri = [ | |
'lang_code' => config('project.payments.merchant.lang_code'), | |
'merch_id' => config('project.payments.merchant.merch_id'), | |
'o.order_id' => $order->getId(), | |
]; | |
$locale = app()->getLocale(); | |
if ($order->isClientPlatformMobile()) { | |
$requestUri['back_url_s'] = $this->replaceLocaleMarker( | |
(string) config('project.payments.redirect.mobile.success'), | |
$locale, | |
); | |
$requestUri['back_url_f'] = $this->replaceLocaleMarker( | |
(string) config('project.payments.redirect.mobile.fail'), | |
$locale, | |
); | |
} else { | |
$requestUri['back_url_s'] = $this->replaceLocaleMarker( | |
(string) config('project.payments.redirect.web.success'), | |
$locale, | |
); | |
$requestUri['back_url_f'] = $this->replaceLocaleMarker( | |
(string) config('project.payments.redirect.web.fail'), | |
$locale, | |
); | |
} | |
$redirectUrl = config('project.payments.merchant.url') . '?' . http_build_query($requestUri); | |
return $redirectUrl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment