add partial refund credit note flow

This commit is contained in:
ahmedsophyudden
2021-09-06 09:21:56 +08:00
parent 2b167b1950
commit 1c4669a857
@@ -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(),