From c30616fc4622add99d4f2956494cf8e5db15b929 Mon Sep 17 00:00:00 2001 From: Kishan Patel Date: Thu, 23 Jun 2022 12:03:57 +0530 Subject: [PATCH] calculation updated for credit card. --- app/PaymentDrivers/Forte/CreditCard.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/PaymentDrivers/Forte/CreditCard.php b/app/PaymentDrivers/Forte/CreditCard.php index 8e632357e993..b9882b3a4349 100644 --- a/app/PaymentDrivers/Forte/CreditCard.php +++ b/app/PaymentDrivers/Forte/CreditCard.php @@ -88,8 +88,18 @@ class CreditCard { $payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$request->input('payment_hash')])->firstOrFail(); $amount_with_fee = $payment_hash->data->total->amount_with_fee; - $fee_total = ( 3 * $amount_with_fee) / 100; - $amount_with_fee = $amount_with_fee + $fee_total; + $invoice_totals = $payment_hash->data->total->invoice_totals; + $fee_total = 0; + print_r($payment_hash->data->total); + for ($i = ($invoice_totals * 100) ; $i < ($amount_with_fee * 100); $i++) { + $calculated_fee = ( 3 * $i) / 100; + $calculated_amount_with_fee = round(($i + $calculated_fee) / 100,2); + if ($calculated_amount_with_fee == $amount_with_fee) { + $fee_total = round($calculated_fee / 100,2); + $amount_with_fee = $calculated_amount_with_fee; + break; + } + } try { $curl = curl_init();