mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'dillon/137-project-upgrade-update-1A' into vapor/production
This commit is contained in:
@@ -107,18 +107,23 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
|
||||
$refund = $transaction->transactions()->refunds()->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED])->sum('original_amount');
|
||||
$isFullyRefund = round($refund + $request->input('amount'), 2) == round((float) $transaction->original_amount, 2);
|
||||
if ($isFullyRefund) {
|
||||
$request->merge(['amount' => $transaction->original_amount]);
|
||||
Log::info('isFullyRefund: ' . ($refund + $request->input('amount')));
|
||||
// $request->merge(['amount' => $transaction->original_amount]);
|
||||
}
|
||||
|
||||
$refundInPending = $transaction->transactions()->refunds()->where('status', ApprovalStatus::PENDING_VERIFICATION)->sum('original_amount');
|
||||
|
||||
if(($refund + $request->input('amount') > $transaction->original_amount) && !$isFullyRefund) throw new MalformedRequestException('Your refund must not be greater than '. $transaction->original_amount .'.');
|
||||
Log::info('refund 1: ' . $refund);
|
||||
Log::info('refund 2: ' . $request->input('amount'));
|
||||
Log::info('refund 3: ' . ($refund + $request->input('amount')));
|
||||
if(($refund + $request->input('amount') > $transaction->original_amount)) throw new MalformedRequestException('Your refund must not be greater than '. $transaction->original_amount .'.');
|
||||
|
||||
// $transactionRefundCalculationObject = new TransactionRefundCalculationObject($booking, $transaction, $request->input('amount'));
|
||||
// $transactionRefundCalculationObject->init();
|
||||
|
||||
// full refund
|
||||
if ((float)$request->input('amount') === (float)$transaction->original_amount) {
|
||||
// if ((float)$request->input('amount') === (float)$transaction->original_amount) {
|
||||
if($isFullyRefund) {
|
||||
$refundAmount = $transaction->original_amount / $transaction->currency_rate;
|
||||
$service_charges_to_refund = $transaction->service_charge;
|
||||
} else {
|
||||
@@ -138,7 +143,7 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
|
||||
|
||||
$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);
|
||||
$conversionObjectAfterRefund = new CurrencyConversionObject($isFullyRefund ? $transaction->original_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, $booking);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user