diff --git a/app/Ninja/PaymentDrivers/BasePaymentDriver.php b/app/Ninja/PaymentDrivers/BasePaymentDriver.php index b6c5b9eda9..b7eb8007f6 100644 --- a/app/Ninja/PaymentDrivers/BasePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BasePaymentDriver.php @@ -935,17 +935,6 @@ class BasePaymentDriver $account = $this->account(); $url = URL::to("/payment/{$this->invitation->invitation_key}/{$gatewayTypeAlias}"); - $gatewayTypeId = GatewayType::getIdFromAlias($gatewayTypeAlias); - - // PayPal doesn't allow being run in an iframe so we need to open in new tab - if ($gatewayTypeId === GATEWAY_TYPE_PAYPAL) { - $url .= '#braintree_paypal'; - - if ($account->iframe_url) { - return 'javascript:window.open("' . $url . '", "_blank")'; - } - } - return $url; } diff --git a/app/Ninja/PaymentDrivers/BraintreePaymentDriver.php b/app/Ninja/PaymentDrivers/BraintreePaymentDriver.php index 7acb3cb794..6a53c8d292 100644 --- a/app/Ninja/PaymentDrivers/BraintreePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BraintreePaymentDriver.php @@ -5,6 +5,7 @@ namespace App\Ninja\PaymentDrivers; use Braintree\Customer; use Exception; use Session; +use App\Models\GatewayType; class BraintreePaymentDriver extends BasePaymentDriver { @@ -62,6 +63,17 @@ class BraintreePaymentDriver extends BasePaymentDriver return $customer instanceof Customer; } + protected function paymentUrl($gatewayTypeAlias) + { + $url = parent::paymentUrl($gatewayTypeAlias); + + if (GatewayType::getIdFromAlias($gatewayTypeAlias) === GATEWAY_TYPE_PAYPAL) { + $url .= '#braintree_paypal'; + } + + return $url; + } + protected function paymentDetails($paymentMethod = false) { $data = parent::paymentDetails($paymentMethod); diff --git a/app/Ninja/PaymentDrivers/PayPalExpressPaymentDriver.php b/app/Ninja/PaymentDrivers/PayPalExpressPaymentDriver.php index f183ef4d81..ffec414c59 100644 --- a/app/Ninja/PaymentDrivers/PayPalExpressPaymentDriver.php +++ b/app/Ninja/PaymentDrivers/PayPalExpressPaymentDriver.php @@ -28,4 +28,17 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver return $payment; } + + protected function paymentUrl($gatewayTypeAlias) + { + $url = parent::paymentUrl($gatewayTypeAlias); + + // PayPal doesn't allow being run in an iframe so we need to open in new tab + if ($this->account()->iframe_url) { + return 'javascript:window.open("' . $url . '", "_blank")'; + } else { + return $url; + } + } + }