mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 08:04:40 -04:00
Fix Braintree when using the iFrame feature
This commit is contained in:
parent
cd8d1c7db7
commit
7f25147e97
@ -935,17 +935,6 @@ class BasePaymentDriver
|
|||||||
$account = $this->account();
|
$account = $this->account();
|
||||||
$url = URL::to("/payment/{$this->invitation->invitation_key}/{$gatewayTypeAlias}");
|
$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;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Ninja\PaymentDrivers;
|
|||||||
use Braintree\Customer;
|
use Braintree\Customer;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Session;
|
use Session;
|
||||||
|
use App\Models\GatewayType;
|
||||||
|
|
||||||
class BraintreePaymentDriver extends BasePaymentDriver
|
class BraintreePaymentDriver extends BasePaymentDriver
|
||||||
{
|
{
|
||||||
@ -62,6 +63,17 @@ class BraintreePaymentDriver extends BasePaymentDriver
|
|||||||
return $customer instanceof Customer;
|
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)
|
protected function paymentDetails($paymentMethod = false)
|
||||||
{
|
{
|
||||||
$data = parent::paymentDetails($paymentMethod);
|
$data = parent::paymentDetails($paymentMethod);
|
||||||
|
@ -28,4 +28,17 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
|
|||||||
|
|
||||||
return $payment;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user