mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'debtor' into 'development'
refund bug See merge request CIEFWorldwideSdnBhd/exchange-2.0!103
This commit is contained in:
@@ -84,12 +84,14 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('RFD-');
|
||||
|
||||
|
||||
$refund = $transaction->transactions()->refunds()->sum('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'));
|
||||
$amount = $transaction->booking->fix_currency_id == 1 ? $request->input('amount') : $request->input('amount') / $transaction->currency_rate;
|
||||
|
||||
|
||||
$transactionRefundCalculationObject = new TransactionRefundCalculationObject($booking, $transaction, $amount);
|
||||
$transactionRefundCalculationObject->init();
|
||||
|
||||
$object = new TransactionObject($billNumber, TransactionType::REFUND, 1, $booking->company->id,
|
||||
|
||||
@@ -31,6 +31,7 @@ class BookingResource extends JsonResource
|
||||
'service' => new ServiceTypeResource($this->service),
|
||||
'marking' => $this->marking,
|
||||
'amount' => $this->fix_amount,
|
||||
'amount' => $this->fix_amount,
|
||||
'floating_amount' => floatval((App()->make(CalculatesBookingFloatingAmount::class))->execute($this->resource, $this->fix_currency_id)),
|
||||
'paid_amount' => floatval((App()->make(CalculatesBookingPayableAmount::class))->execute($this->resource, $this->fix_currency_id)) - floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)),
|
||||
'outstanding_amount' => floatval((App()->make(CalculatesBookingOutstanding::class))->execute($this->resource)) - floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)),
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-10" v-show="[2, 3].includes(item.status) && totalRequestedRefund < data.booking.amount">
|
||||
<div class="row m-t-10" v-show="[2, 3].includes(item.status) && totalRequestedConvertRefund < data.booking.amount">
|
||||
<div class="col hide">
|
||||
<button class="btn btn-xs all-caps b-rad-none bg-master-lighter btn-block no-border requestModal" data-type="transferSummary">Request Refund</button>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="transferSummary" size="large">
|
||||
@@ -249,12 +249,25 @@
|
||||
},
|
||||
computed: {
|
||||
totalRequestedRefund() {
|
||||
let vm = this;
|
||||
var TotalRequestedRefund = 0;
|
||||
this.data.transaction_refunds.forEach(function(refunds) {
|
||||
TotalRequestedRefund += refunds.status === 1 ? refunds.original_amount : 0;
|
||||
});
|
||||
|
||||
return TotalRequestedRefund;
|
||||
},
|
||||
totalRequestedConvertRefund() {
|
||||
let vm = this;
|
||||
var TotalRequestedRefund = 0;
|
||||
this.data.transaction_refunds.forEach(function(refunds) {
|
||||
TotalRequestedRefund += refunds.status === 1 ? refunds.original_amount : 0;
|
||||
});
|
||||
if (vm.data.booking.fixed_currency.id != 1 && this.data.transaction_refunds[0]) {
|
||||
TotalRequestedRefund = (TotalRequestedRefund * this.data.transaction_refunds[0].currency_rate);
|
||||
}
|
||||
return ((Math.round((TotalRequestedRefund + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
|
||||
},
|
||||
totalRefunds() {
|
||||
var TotalRequestedRefund = 0;
|
||||
this.data.transaction_refunds.forEach(function(refunds) {
|
||||
|
||||
Reference in New Issue
Block a user