From 49b97038f7d459557542822e83237ffdc23fe28d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 26 Sep 2019 15:47:37 +1000 Subject: [PATCH] Working on Paypal --- .../PayPalExpressPaymentDriver.php | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/app/PaymentDrivers/PayPalExpressPaymentDriver.php b/app/PaymentDrivers/PayPalExpressPaymentDriver.php index 7903e9f0cc..626d758209 100644 --- a/app/PaymentDrivers/PayPalExpressPaymentDriver.php +++ b/app/PaymentDrivers/PayPalExpressPaymentDriver.php @@ -37,6 +37,20 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver ]; } + /** + * Processes the payment with this gateway + * + * @var $data['invoices'] + * @var $data['amount'] + * @var $data['fee'] + * @var $data['amount_with_fee'] + * @var $data['token'] + * @var $data['payment_method_id'] + * @var $data['hashed_ids'] + * + * @param array $data variables required to build payment page + * @return view Gateway and payment method specific view + */ public function processPaymentView(array $data) { @@ -47,14 +61,24 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver } - protected function paymentDetails($paymentMethod = false) + protected function paymentDetails() { $data = parent::paymentDetails(); + $data['amount'] = $invoice->getRequestedAmount(); + $data['returnUrl'] = $completeUrl; + $data['cancelUrl'] = $this->invitation->getLink(); + $data['description'] = trans('texts.' . $invoice->getEntityType()) . " {$invoice->invoice_number}"; + $data['transactionId'] = $invoice->invoice_number; + $data['ButtonSource'] = 'InvoiceNinja_SP'; $data['solutionType'] = 'Sole'; // show 'Pay with credit card' option $data['transactionId'] = $data['transactionId'] . '-' . time(); return $data; } -} \ No newline at end of file +} + + 'currency' => $this->client->getCurrencyCode(), + 'transactionType' => 'Purchase', + 'clientIp' => request()->getClientIp(), \ No newline at end of file