From c1ff7e1fb9dbdd966e2ccd4bf51744d9f3d8954f Mon Sep 17 00:00:00 2001 From: margud Date: Tue, 25 Jan 2022 10:12:06 +0200 Subject: [PATCH] fixed issue with payment fee and single click credit card method --- .../CreditCardPaymentOptionProvider.php | 31 +++++++++---------- ...itCardSingleClickPaymentOptionProvider.php | 26 +++++++++------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/Provider/PaymentOption/CreditCardPaymentOptionProvider.php b/src/Provider/PaymentOption/CreditCardPaymentOptionProvider.php index fc23bf799..170b81260 100644 --- a/src/Provider/PaymentOption/CreditCardPaymentOptionProvider.php +++ b/src/Provider/PaymentOption/CreditCardPaymentOptionProvider.php @@ -175,23 +175,20 @@ public function getPaymentOption(MolPaymentMethod $paymentMethod) $paymentFee = $this->paymentFeeProvider->getPaymentFee($paymentMethod); if ($paymentFee) { - $paymentOption->setInputs([ - [ - 'type' => 'hidden', - 'name' => 'mollieCardToken', - 'value' => '', - ], - [ - 'type' => 'hidden', - 'name' => 'payment-fee-price', - 'value' => $paymentFee, - ], - [ - 'type' => 'hidden', - 'name' => 'payment-fee-price-display', - 'value' => sprintf($this->module->l('Payment Fee: %1s'), Tools::displayPrice($paymentFee)), - ], - ]); + $paymentOption->setInputs( + array_merge($paymentOption->getInputs(), [ + [ + 'type' => 'hidden', + 'name' => 'payment-fee-price', + 'value' => $paymentFee, + ], + [ + 'type' => 'hidden', + 'name' => 'payment-fee-price-display', + 'value' => sprintf($this->module->l('Payment Fee: %1s'), Tools::displayPrice($paymentFee)), + ], + ]) + ); } return $paymentOption; diff --git a/src/Provider/PaymentOption/CreditCardSingleClickPaymentOptionProvider.php b/src/Provider/PaymentOption/CreditCardSingleClickPaymentOptionProvider.php index 25d3c70a9..abba402b1 100644 --- a/src/Provider/PaymentOption/CreditCardSingleClickPaymentOptionProvider.php +++ b/src/Provider/PaymentOption/CreditCardSingleClickPaymentOptionProvider.php @@ -179,18 +179,20 @@ public function getPaymentOption(MolPaymentMethod $paymentMethod) $paymentFee = $this->paymentFeeProvider->getPaymentFee($paymentMethod); if ($paymentFee) { - $paymentOption->setInputs([ - [ - 'type' => 'hidden', - 'name' => 'payment-fee-price', - 'value' => $paymentFee, - ], - [ - 'type' => 'hidden', - 'name' => 'payment-fee-price-display', - 'value' => sprintf($this->module->l('Payment Fee: %1s'), Tools::displayPrice($paymentFee)), - ], - ]); + $paymentOption->setInputs( + array_merge($paymentOption->getInputs(), [ + [ + 'type' => 'hidden', + 'name' => 'payment-fee-price', + 'value' => $paymentFee, + ], + [ + 'type' => 'hidden', + 'name' => 'payment-fee-price-display', + 'value' => sprintf($this->module->l('Payment Fee: %1s'), Tools::displayPrice($paymentFee)), + ], + ]) + ); } return $paymentOption;