Changeset View
Changeset View
Standalone View
Standalone View
src/app/Providers/PaymentProvider.php
Show First 20 Lines • Show All 381 Lines • ▼ Show 20 Lines | public static function paymentMethods(Wallet $wallet, $type): array | ||||
$provider = PaymentProvider::factory($providerName); | $provider = PaymentProvider::factory($providerName); | ||||
$methods = self::applyMethodWhitelist($type, $provider->providerPaymentMethods($type)); | $methods = self::applyMethodWhitelist($type, $provider->providerPaymentMethods($type)); | ||||
Cache::put($cacheKey, $methods, now()->addHours(1)); | Cache::put($cacheKey, $methods, now()->addHours(1)); | ||||
return $methods; | return $methods; | ||||
} | } | ||||
/** | |||||
* Returns the full URL for the wallet page, used when returning from an external payment page. | |||||
* Depending on the request origin it will return a URL for the User or Reseller UI. | |||||
* | |||||
* @return string The redirect URL | |||||
*/ | |||||
public static function redirectUrl(): string | |||||
{ | |||||
$url = \App\Utils::serviceUrl('/wallet'); | |||||
$domain = preg_replace('/:[0-9]+$/', '', request()->getHttpHost()); | |||||
if (strpos($domain, 'reseller') === 0) { | |||||
$url = preg_replace('|^(https?://)([^/]+)|', '\\1' . $domain, $url); | |||||
} | |||||
return $url; | |||||
} | |||||
} | } |