From 039544e753e3d1ab78995239b1e5cda5bccaa816 Mon Sep 17 00:00:00 2001 From: David Roizenman Date: Thu, 12 Nov 2020 02:53:25 -0800 Subject: [PATCH] Use correct formula when adjust_fee_percent=true --- app/Models/CompanyGateway.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Models/CompanyGateway.php b/app/Models/CompanyGateway.php index eae78caf17..73451f4495 100644 --- a/app/Models/CompanyGateway.php +++ b/app/Models/CompanyGateway.php @@ -287,7 +287,11 @@ class CompanyGateway extends BaseModel } if ($fees_and_limits->fee_percent) { - $fee += round(($amount * $fees_and_limits->fee_percent / 100),2); + if ($fees_and_limits->adjust_fee_percent) { + $fee += round(($amount / (1 - $fees_and_limits->fee_percent / 100) - $amount),2); + } else { + $fee += round(($amount * $fees_and_limits->fee_percent / 100),2); + } info("fee after adding fee percent = {$fee}"); }