Add subdomain check for applepay

This commit is contained in:
Hillel Coren 2018-01-14 09:45:55 +02:00
parent d0bd49e0a6
commit 7c5633b224

View File

@ -425,20 +425,23 @@ class OnlinePaymentController extends BaseController
{ {
if (Utils::isNinja()) { if (Utils::isNinja()) {
$subdomain = Utils::getSubdomain(\Request::server('HTTP_HOST')); $subdomain = Utils::getSubdomain(\Request::server('HTTP_HOST'));
if (! $subdomain || $subdomain == 'app') {
exit('Invalid subdomain');
}
$account = Account::whereSubdomain($subdomain)->first(); $account = Account::whereSubdomain($subdomain)->first();
} else { } else {
$account = Account::first(); $account = Account::first();
} }
if (! $account) { if (! $account) {
exit("Account not found"); exit('Account not found');
} }
$accountGateway = $account->account_gateways() $accountGateway = $account->account_gateways()
->whereGatewayId(GATEWAY_STRIPE)->first(); ->whereGatewayId(GATEWAY_STRIPE)->first();
if (! $account) { if (! $account) {
exit("Apple merchant id not set"); exit('Apple merchant id not set');
} }
echo $accountGateway->getConfigField('appleMerchantId'); echo $accountGateway->getConfigField('appleMerchantId');