From f6758873e790511aa8fc17cb817d60f432db54d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 21 Dec 2020 12:10:47 +0100 Subject: [PATCH] PayPal: Update amount with fee --- app/PaymentDrivers/PayPalExpressPaymentDriver.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/PaymentDrivers/PayPalExpressPaymentDriver.php b/app/PaymentDrivers/PayPalExpressPaymentDriver.php index 752ebf48c69d..5756abcbff1c 100644 --- a/app/PaymentDrivers/PayPalExpressPaymentDriver.php +++ b/app/PaymentDrivers/PayPalExpressPaymentDriver.php @@ -88,7 +88,7 @@ class PayPalExpressPaymentDriver extends BaseDriver $this->initializeOmnipayGateway(); - $this->payment_hash->data = array_merge((array) $this->payment_hash->data, ['amount' => $data['amount_with_fee']]); + $this->payment_hash->data = array_merge((array) $this->payment_hash->data, ['amount' => $data['total']['amount_with_fee']]); $this->payment_hash->save(); $response = $this->omnipay_gateway @@ -100,7 +100,7 @@ class PayPalExpressPaymentDriver extends BaseDriver return $response->redirect(); } - PaymentFailureMailer::dispatch($this->client, $response->getData(), $this->client->company, $data['amount_with_fee']); + PaymentFailureMailer::dispatch($this->client, $response->getData(), $this->client->company, $data['total']['amount_with_fee']); $message = [ 'server_response' => $response->getMessage(), @@ -183,7 +183,7 @@ class PayPalExpressPaymentDriver extends BaseDriver 'currency' => $this->client->getCurrencyCode(), 'transactionType' => 'Purchase', 'clientIp' => request()->getClientIp(), - 'amount' => $data['amount_with_fee'], + 'amount' => $data['total']['amount_with_fee'], 'returnUrl' => route('client.payments.response', [ 'company_gateway_id' => $this->company_gateway->id, 'payment_hash' => $this->payment_hash->hash, @@ -223,11 +223,11 @@ class PayPalExpressPaymentDriver extends BaseDriver }); }); - if ($total != $data['amount_with_fee']) { + if ($total != $data['total']['amount_with_fee']) { $items[0][] = new Item([ 'name' => trans('texts.taxes_and_fees'), 'description' => '', - 'price' => $data['amount_with_fee'] - $total, + 'price' => $data['total']['amount_with_fee'] - $total, 'quantity' => 1, ]); }