mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Fix create order button not working at dashboard
This commit is contained in:
@@ -25,15 +25,18 @@ class CalculatesTransactionServiceCharge
|
||||
* @param SegmentConstant|null $service_charge
|
||||
* @return float
|
||||
*/
|
||||
public function execute(float $amount, float $rate, ?SegmentConstant $service_charge) {
|
||||
public function execute(float $amount, float $rate, ?SegmentConstant $service_charge)
|
||||
{
|
||||
|
||||
if(!$service_charge) {
|
||||
if (!$service_charge) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$transfer_fee = $this->calculatesTransactionTransferFee->execute(($amount * (1 / $rate)), $service_charge);
|
||||
return $service_charge->detail->amount->type === 'percentage' ? (($amount + $transfer_fee) * ( (float) $service_charge->detail->amount->value /100) * (1/$rate)) : (float) $service_charge->detail->amount->value;
|
||||
|
||||
if (isset($service_charge->detail->amount)) {
|
||||
return $service_charge->detail->amount->type === 'percentage' ? (($amount + $transfer_fee) * ((float) $service_charge->detail->amount->value / 100) * (1 / $rate)) : (float) $service_charge->detail->amount->value;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,17 @@ class CalculatesTransactionTransferFee
|
||||
* @param SegmentConstant|null $service_charge
|
||||
* @return float
|
||||
*/
|
||||
public function execute(float $amount, ?SegmentConstant $service_charge) {
|
||||
public function execute(float $amount, ?SegmentConstant $service_charge)
|
||||
{
|
||||
|
||||
if(!$service_charge) {
|
||||
if (!$service_charge) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $service_charge->detail->transferFee->type === 'percentage' ? $amount * ((float) $service_charge->detail->transferFee->value /100) : (float) $service_charge->detail->transferFee->value;
|
||||
if (isset($service_charge->detail->transferFee)) {
|
||||
return $service_charge->detail->transferFee->type === 'percentage' ? $amount * ((float) $service_charge->detail->transferFee->value / 100) : (float) $service_charge->detail->transferFee->value;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user