From aa24fd05036e42626e05726c5e7ffc9a7c432a2e Mon Sep 17 00:00:00 2001 From: mgroensmit Date: Thu, 25 Mar 2021 08:23:18 +0100 Subject: [PATCH] PayReminder for Paypal --- Model/Method/Paypal.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Model/Method/Paypal.php b/Model/Method/Paypal.php index ebef92a4b..a5687ba32 100644 --- a/Model/Method/Paypal.php +++ b/Model/Method/Paypal.php @@ -97,9 +97,19 @@ public function getOrderTransactionBuilder($payment) { $transactionBuilder = $this->transactionBuilderFactory->get('order'); + $serviceAction = 'Pay'; + if($originalTransactionKey = $this->helper->getOriginalTransactionKey($payment->getOrder()->getIncrementId())){ + $serviceAction = 'PayRemainder'; + $transactionBuilder->setOriginalTransactionKey($originalTransactionKey); + + if($alreadyPaid = $this->helper->getBuckarooAlreadyPaid($payment->getOrder()->getIncrementId())){ + $transactionBuilder->setAmount($transactionBuilder->getAmount() - $alreadyPaid); + } + } + $services = [ 'Name' => 'paypal', - 'Action' => 'Pay', + 'Action' => $serviceAction, 'Version' => 1, 'RequestParameter' => [], ];