1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Ninja/PaymentDrivers/PayPalExpressPaymentDriver.php

45 lines
1.1 KiB
PHP
Raw Normal View History

2017-01-30 20:40:43 +01:00
<?php
namespace App\Ninja\PaymentDrivers;
2016-06-20 16:14:43 +02:00
class PayPalExpressPaymentDriver extends BasePaymentDriver
{
2016-06-22 20:42:09 +02:00
public function gatewayTypes()
2016-06-20 16:14:43 +02:00
{
return [
2017-01-30 20:40:43 +01:00
GATEWAY_TYPE_PAYPAL,
2016-06-20 16:14:43 +02:00
];
}
2016-07-21 14:35:23 +02:00
protected function paymentDetails($paymentMethod = false)
2016-06-20 16:14:43 +02:00
{
$data = parent::paymentDetails();
$data['ButtonSource'] = 'InvoiceNinja_SP';
$data['solutionType'] = 'Sole'; // show 'Pay with credit card' option
2017-03-28 11:47:11 +02:00
$data['transactionId'] = $data['transactionId'] . '-' . time();
2016-06-20 16:14:43 +02:00
return $data;
}
2016-07-21 14:35:23 +02:00
protected function creatingPayment($payment, $paymentMethod)
2016-06-20 16:14:43 +02:00
{
$payment->payer_id = $this->input['PayerID'];
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;
}
}
2016-06-20 16:14:43 +02:00
}