fix code merging

This commit is contained in:
edmondlang
2024-08-12 23:39:17 +08:00
parent 204ebf04ca
commit ca1d36bac6
@@ -113,32 +113,32 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
$service_charges_to_refund = $transaction->service_charge; $service_charges_to_refund = $transaction->service_charge;
} else { } else {
$refundAmount = bcdiv($request->input('amount'), $transaction->currency_rate, 7); $refundAmount = bcdiv($request->input('amount'), $transaction->currency_rate, 7);
$bookingAmountBeforeCurrentRefund = $booking->fix_amount - $refundInPending;
$bookingAmountAfterRefunded = $booking->fix_amount - $refundInPending - $request->input('amount');
$isFullyRefund = ($refund + $request->input('amount')) == $transaction->original_amount;
$voucherCode = null;
$redemptionId = null;
if ($transaction->voucherRedemption) {
// $voucherCode = $transaction->voucherRedemption->voucher->code;
$redemptionId = $transaction->voucherRedemption->redemption_id;
}
$conversionObjectBeforeCurrentRefund = new CurrencyConversionObject($bookingAmountBeforeCurrentRefund, $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, $transaction->payment_method);
$conversionObjectAfterRefund = new CurrencyConversionObject($isFullyRefund ? $request->input('amount') : $bookingAmountAfterRefunded, $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, $transaction->payment_method);
$quotationBeforeCurrentRefund = $this->fetchBookingQuotation->execute($booking->company, $conversionObjectBeforeCurrentRefund, $voucherCode, $redemptionId);
$quotationAfterRefund = $this->fetchBookingQuotation->execute($booking->company, $conversionObjectAfterRefund, $voucherCode, $redemptionId);
$service_charges_to_refund = $isFullyRefund ? $quotationBeforeCurrentRefund->getServiceCharge() : $quotationBeforeCurrentRefund->getServiceCharge() - $quotationAfterRefund->getServiceCharge();
} }
$bookingAmountBeforeCurrentRefund = $booking->fix_amount - $refundInPending;
$bookingAmountAfterRefunded = $booking->fix_amount - $refundInPending - $request->input('amount');
$isFullyRefund = ($refund + $request->input('amount')) == $transaction->original_amount;
$voucherCode = null;
$redemptionId = null;
if ($transaction->voucherRedemption) {
// $voucherCode = $transaction->voucherRedemption->voucher->code;
$redemptionId = $transaction->voucherRedemption->redemption_id;
}
$conversionObjectBeforeCurrentRefund = new CurrencyConversionObject($bookingAmountBeforeCurrentRefund, $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, $transaction->payment_method);
$conversionObjectAfterRefund = new CurrencyConversionObject($isFullyRefund ? $request->input('amount') : $bookingAmountAfterRefunded, $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, $transaction->payment_method);
$quotationBeforeCurrentRefund = $this->fetchBookingQuotation->execute($booking->company, $conversionObjectBeforeCurrentRefund, $voucherCode, $redemptionId);
$quotationAfterRefund = $this->fetchBookingQuotation->execute($booking->company, $conversionObjectAfterRefund, $voucherCode, $redemptionId);
$service_charges_to_refund = $isFullyRefund ? $quotationBeforeCurrentRefund->getServiceCharge() : $quotationBeforeCurrentRefund->getServiceCharge() - $quotationAfterRefund->getServiceCharge();
// refund service charges if booking is not E2E // refund service charges if booking is not E2E
$refundTotal = $refundAmount; $refundTotal = $refundAmount;