mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 04:24:16 +00:00
clean up development
This commit is contained in:
@@ -78,22 +78,18 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$booking = Booking::find($request->route('id'));
|
||||
|
||||
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('payment_id')]);
|
||||
|
||||
$booking = $transaction->owner;
|
||||
|
||||
$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();
|
||||
}
|
||||
|
||||
$refund = $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id, $transaction->bill_no);
|
||||
// dd($refund);
|
||||
$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, (int) $transaction->type === TransactionType::BILL ? $customerBooking : $transaction, $request->input('amount'));
|
||||
$transactionRefundCalculationObject = new TransactionRefundCalculationObject($booking, $transaction, $request->input('amount'));
|
||||
$transactionRefundCalculationObject->init();
|
||||
|
||||
$object = new TransactionObject($billNumber, TransactionType::REFUND, 1, $booking->company->id,
|
||||
@@ -102,7 +98,7 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
|
||||
$transactionRefundCalculationObject->getConversionObject()->getCurrencyId(), $transactionRefundCalculationObject->getTransaction()->currency_rate,
|
||||
$transactionRefundCalculationObject->getRefundTax(), $transactionRefundCalculationObject->getRefundServiceCharge(), null, ApprovalStatus::PENDING_VERIFICATION, [], $transaction->bill_no);
|
||||
|
||||
$transaction = $this->createsTransaction->execute($booking, $object);
|
||||
$transaction = $this->createsTransaction->execute($transaction, $object);
|
||||
|
||||
return $this->resourceResponse(new TransactionResource($transaction));
|
||||
}
|
||||
|
||||
+6
-5
@@ -71,14 +71,15 @@ class UpdateRefundTransactionStatusLogic extends AbstractControllerLogic
|
||||
|
||||
$transaction = $this->updatesTransactionStatus->execute($transaction, $request->input('status'));
|
||||
|
||||
$company = $this->fetchesCompany->execute(['id' => $transaction->booking->company_id]);
|
||||
$booking = $transaction->owner->owner;
|
||||
|
||||
$reference = 'Refund for booking reference '.$transaction->booking->marking;
|
||||
$reference = 'Credit Voucher for Overpaid for Ref. '.$booking->marking;
|
||||
|
||||
if ($transaction->status == ApprovalStatus::APPROVED) {
|
||||
// add to credit wallet
|
||||
$this->creditWalletProcessor->execute($company, $transaction->type, $transaction->amount, $reference);
|
||||
}
|
||||
$this->creditWalletProcessor->execute($booking->company, $transaction->type, $transaction->amount, $reference);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
@@ -68,9 +68,10 @@ class CreditWalletProcessor
|
||||
{
|
||||
if (!$company->wallets()->first()) {
|
||||
$object = new WalletObject($company->id, 1, $this->generatesWalletCode->execute());
|
||||
$wallet = $this->createsWallet->execute($object, $company);
|
||||
$this->createsWallet->execute($object, $company);
|
||||
}
|
||||
|
||||
/** @var Wallet $wallet */
|
||||
$wallet = $company->wallets()->first();
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute($transactionType === 2 ? 'DEBIT-NOTE-' : 'CREDIT-NOTE-');
|
||||
|
||||
@@ -17,7 +17,7 @@ class TransactionResource extends JsonResource
|
||||
public function toArray($request)
|
||||
{
|
||||
|
||||
$booking = (int)$this->type === TransactionType::BILL ? $this->owner->owner : $this->owner;
|
||||
$booking = in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])? $this->owner->owner : $this->owner;
|
||||
$days = $this->updated_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1);
|
||||
|
||||
return [
|
||||
@@ -39,7 +39,8 @@ class TransactionResource extends JsonResource
|
||||
'status' => (int) $this->status,
|
||||
'details' => TransactionDetailResource::collection($this->transactionDetails),
|
||||
'documents' => new DocumentResource($this->documents()->first()),
|
||||
'transaction_bill' => new TransactionResource($this->when((int) $this->type === TransactionType::PAYMENT, $this->transactions()->first())),
|
||||
'transaction_bill' => new TransactionResource($this->when((int) $this->type === TransactionType::PAYMENT, $this->transactions()->bills()->first())),
|
||||
'transaction_refunds' => TransactionResource::collection($this->when((int) $this->type === TransactionType::PAYMENT, $this->transactions()->refunds()->get())),
|
||||
'expires_on' => Carbon::parse($this->expires_on)->format('d-m-Y h:i:s A'),
|
||||
'updated_at' => Carbon::parse($this->updated_at)->format('d-m-Y h:i:s A'),
|
||||
'interval' => [
|
||||
|
||||
@@ -24,16 +24,16 @@
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10 m-b-5">Refund Type: </div>
|
||||
<div class="row p-l-15">
|
||||
<div class="col p-t-20 p-b-20 bg-master-lightest text-center b-grey" :class="[{'bg-complete': refundMethod.name === 'Partially Refund'}, {'text-white': refundMethod.name === 'Partially Refund'}]" @click="updateRefundType({name: 'Partially Refund'})">
|
||||
Partially Refund
|
||||
<div class="col p-t-20 p-b-20 bg-master-lightest text-center b-grey pointer" :class="[{'bg-complete': refundMethod.name === 'Fully Refund'}, {'text-white': refundMethod.name === 'Fully Refund'}]" @click="updateRefundType({name: 'Fully Refund'})">
|
||||
Full Refund
|
||||
</div>
|
||||
<div class="col p-t-20 p-b-20 bg-master-lightest text-center b-grey" :class="[{'bg-complete': refundMethod.name === 'Fully Refund'}, {'text-white': refundMethod.name === 'Fully Refund'}]" @click="updateRefundType({name: 'Fully Refund'})">
|
||||
Fully Refund
|
||||
<div class="col p-t-20 p-b-20 bg-master-lightest text-center b-grey pointer" :class="[{'bg-complete': refundMethod.name === 'Partially Refund'}, {'text-white': refundMethod.name === 'Partially Refund'}]" @click="updateRefundType({name: 'Partially Refund'})">
|
||||
Partial Refund
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-r-0 m-b-10">
|
||||
<div class="row m-r-0 m-b-10" v-if="refundMethod.name === 'Partially Refund'">
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.refundAmount">
|
||||
<label>Amount</label>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<div class="col text-right">
|
||||
<div class="font-heading fs-10 muted all-caps">Amount</div>
|
||||
<div class="font-heading fs-14 text-success bold">
|
||||
{{(Math.round((data.booking.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
{{(Math.round((data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -92,175 +92,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row tabsContainer tabContent hide" tab-name="transactions">
|
||||
<div class="col no-padding">
|
||||
<div class="widget-11-2 card no-border card-condensed no-margin widget-loader-circle d-flex flex-column align-self-stretch">
|
||||
<div class="card-header top-right">
|
||||
<div class="card-controls">
|
||||
<ul>
|
||||
<li><a data-toggle="refresh" class="portlet-refresh text-black" href="#"><i
|
||||
class="portlet-icon portlet-icon-refresh"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="padding-25">
|
||||
<div class="pull-left">
|
||||
<h2 class="text-success no-margin">webarch</h2>
|
||||
<p class="no-margin">Today's sales</p>
|
||||
</div>
|
||||
<h3 class="pull-right semi-bold"><sup>
|
||||
<small class="semi-bold">MYR</small>
|
||||
</sup> 102,967
|
||||
</h3>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="overflow-hidden scrollable widget-11-2-table">
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="font-montserrat all-caps fs-12 w-50">Purchase CODE #2345</td>
|
||||
<td class="text-right hidden-lg">
|
||||
<span class="hint-text small">dewdrops</span>
|
||||
</td>
|
||||
<td class="text-right b-r b-dashed b-grey w-25">
|
||||
<span class="hint-text small">Qty 1</span>
|
||||
</td>
|
||||
<td class="w-25">
|
||||
<span class="font-montserrat fs-18">27 RM</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-montserrat all-caps fs-12 w-50">Purchase CODE #2345</td>
|
||||
<td class="text-right hidden-lg">
|
||||
<span class="hint-text small">dewdrops</span>
|
||||
</td>
|
||||
<td class="text-right b-r b-dashed b-grey w-25">
|
||||
<span class="hint-text small">Qty 1</span>
|
||||
</td>
|
||||
<td class="w-25">
|
||||
<span class="font-montserrat fs-18">27 RM</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-montserrat all-caps fs-12 w-50">Purchase CODE #2345</td>
|
||||
<td class="text-right hidden-lg">
|
||||
<span class="hint-text small">dewdrops</span>
|
||||
</td>
|
||||
<td class="text-right b-r b-dashed b-grey w-25">
|
||||
<span class="hint-text small">Qty 1</span>
|
||||
</td>
|
||||
<td class="w-25">
|
||||
<span class="font-montserrat fs-18">27 RM</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-montserrat all-caps fs-12 w-50">Purchase CODE #2345</td>
|
||||
<td class="text-right hidden-lg">
|
||||
<span class="hint-text small">dewdrops</span>
|
||||
</td>
|
||||
<td class="text-right b-r b-dashed b-grey w-25">
|
||||
<span class="hint-text small">Qty 1</span>
|
||||
</td>
|
||||
<td class="w-25">
|
||||
<span class="font-montserrat fs-18">27 RM</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-montserrat all-caps fs-12 w-50">Purchase CODE #2345</td>
|
||||
<td class="text-right hidden-lg">
|
||||
<span class="hint-text small">dewdrops</span>
|
||||
</td>
|
||||
<td class="text-right b-r b-dashed b-grey w-25">
|
||||
<span class="hint-text small">Qty 1</span>
|
||||
</td>
|
||||
<td class="w-25">
|
||||
<span class="font-montserrat fs-18">27 RM</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-montserrat all-caps fs-12 w-50">Purchase CODE #2345</td>
|
||||
<td class="text-right hidden-lg">
|
||||
<span class="hint-text small">dewdrops</span>
|
||||
</td>
|
||||
<td class="text-right b-r b-dashed b-grey w-25">
|
||||
<span class="hint-text small">Qty 1</span>
|
||||
</td>
|
||||
<td class="w-25">
|
||||
<span class="font-montserrat fs-18">27 RM</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-montserrat all-caps fs-12 w-50">Purchase CODE #2345</td>
|
||||
<td class="text-right hidden-lg">
|
||||
<span class="hint-text small">dewdrops</span>
|
||||
</td>
|
||||
<td class="text-right b-r b-dashed b-grey w-25">
|
||||
<span class="hint-text small">Qty 1</span>
|
||||
</td>
|
||||
<td class="w-25">
|
||||
<span class="font-montserrat fs-18">27 RM</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-montserrat all-caps fs-12 w-50">Purchase CODE #2345</td>
|
||||
<td class="text-right hidden-lg">
|
||||
<span class="hint-text small">dewdrops</span>
|
||||
</td>
|
||||
<td class="text-right b-r b-dashed b-grey w-25">
|
||||
<span class="hint-text small">Qty 1</span>
|
||||
</td>
|
||||
<td class="w-25">
|
||||
<span class="font-montserrat fs-18">27 RM</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-montserrat all-caps fs-12 w-50">Purchase CODE #2345</td>
|
||||
<td class="text-right hidden-lg">
|
||||
<span class="hint-text small">dewdrops</span>
|
||||
</td>
|
||||
<td class="text-right b-r b-dashed b-grey w-25">
|
||||
<span class="hint-text small">Qty 1</span>
|
||||
</td>
|
||||
<td class="w-25">
|
||||
<span class="font-montserrat fs-18">27 RM</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-montserrat all-caps fs-12 w-50">Purchase CODE #2345</td>
|
||||
<td class="text-right hidden-lg">
|
||||
<span class="hint-text small">dewdrops</span>
|
||||
</td>
|
||||
<td class="text-right b-r b-dashed b-grey w-25">
|
||||
<span class="hint-text small">Qty 1</span>
|
||||
</td>
|
||||
<td class="w-25">
|
||||
<span class="font-montserrat fs-18">27 RM</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row tabsContainer hide tabContent" tab-name="PO">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
{{--<list-component key="2" section="purchaseOrderSection" :endpoint="route('api.address.list')">--}}
|
||||
{{--<template slot="list" slot-scope="{data}">--}}
|
||||
{{--<address-component :data="data"></address-component>--}}
|
||||
{{--</template>--}}
|
||||
{{--</list-component>--}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user