mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-30 01:43:59 +00:00
add partial refund credit note flow
This commit is contained in:
@@ -102,13 +102,17 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('RFD-');
|
||||
|
||||
if((int) $transaction->type === TransactionType::BILL){
|
||||
$customerBooking = $booking->transactions()->payments()->complete()->where('original_amount', '=', $transaction->original_amount)->where('id', '<', $transaction->id)->orderByDesc('id')->first();
|
||||
}
|
||||
|
||||
$unrequestedAmount = $this->calculateTransactionRefundOriginalAmount->execute($transaction, $request->input('amount'));
|
||||
|
||||
$conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $unrequestedAmount)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1);
|
||||
|
||||
$configurations = $this->fetchBookingQuotation->execute($booking->company, $conversionObject);
|
||||
|
||||
$totalRefundAmount = $this->calculateTransactionRefundAmount->execute($transaction, $configurations->getTotal());
|
||||
$totalRefundAmount = $this->calculateTransactionRefundAmount->execute(((int) $transaction->type === TransactionType::BILL) ? $customerBooking : $transaction, $configurations->getTotal());
|
||||
|
||||
$object = new TransactionObject($billNumber, TransactionType::REFUND, 1, $booking->company->id,
|
||||
$configurations->getConfigurations()->getBankId(), $configurations->getConversionObject()->getPaymentMethod(),
|
||||
|
||||
Reference in New Issue
Block a user