mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange-2.0 into 1688-changes
This commit is contained in:
@@ -132,8 +132,14 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
|
||||
|
||||
$service_charges_to_refund = $isFullyRefund ? $quotationBeforeCurrentRefund->getServiceCharge() : $quotationBeforeCurrentRefund->getServiceCharge() - $quotationAfterRefund->getServiceCharge();
|
||||
|
||||
// refund service charges if is fully refund
|
||||
$refundTotal = $refundAmount + $service_charges_to_refund + $transaction->tax;
|
||||
// refund service charges if booking is not E2E
|
||||
$refundTotal = $refundAmount;
|
||||
|
||||
if ($booking->service_id !== 5) {
|
||||
$refundTotal = $refundTotal + $service_charges_to_refund + $transaction->tax;
|
||||
} else {
|
||||
$service_charges_to_refund = 0;
|
||||
}
|
||||
|
||||
$object = new TransactionObject($billNumber, TransactionType::REFUND, 1, $booking->company->id,
|
||||
1, PaymentMethodType::CASH,
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Voucher;
|
||||
use App\Classes\ValueObjects\Constants\Vouchers;
|
||||
use App\Classes\Jobs\SendWelcomeVoucherEmail;
|
||||
use App\Classes\Modules\Vouchers\Services\FetchesVoucher;
|
||||
use App\Classes\Jobs\SendUserVerificationEmail;
|
||||
use App\Classes\Modules\Accounts\Services\GeneratesEmailVerificationAttempt;
|
||||
use App\Classes\Jobs\SendResetPasswordEmail;
|
||||
use App\Classes\Modules\Accounts\Services\GeneratesPasswordReset;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class OneTimeTestVoucherifyEmailCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
protected $signature = 'one-time-test-voucherify-email';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'One time test sending voucherify email to see out of alignment issue';
|
||||
|
||||
/** @var FetchesVoucher */
|
||||
private $fetchesVoucher;
|
||||
|
||||
/** @var GeneratesEmailVerificationAttempt */
|
||||
private $generatesEmailVerificationAttempt;
|
||||
|
||||
/** @var SendUserVerificationEmail */
|
||||
private $sendUserVerificationEmail;
|
||||
|
||||
/** @var GeneratesPasswordReset */
|
||||
private $generatesPasswordReset;
|
||||
|
||||
/** @var SendResetPasswordEmail */
|
||||
private $sendResetPasswordEmail;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(FetchesVoucher $fetchesVoucher, GeneratesEmailVerificationAttempt $generatesEmailVerificationAttempt, SendUserVerificationEmail $sendUserVerificationEmail, GeneratesPasswordReset $generatesPasswordReset, SendResetPasswordEmail $sendResetPasswordEmail)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->fetchesVoucher = $fetchesVoucher;
|
||||
$this->generatesEmailVerificationAttempt = $generatesEmailVerificationAttempt;
|
||||
$this->sendUserVerificationEmail = $sendUserVerificationEmail;
|
||||
$this->generatesPasswordReset = $generatesPasswordReset;
|
||||
$this->sendResetPasswordEmail = $sendResetPasswordEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
try{ //In case voucher got deleted unintentionally
|
||||
$user = User::where('id', 3974)->first(); //5436, 3974
|
||||
|
||||
Log::info(json_encode($user));
|
||||
$voucher = $this->fetchesVoucher->execute(['code' => Vouchers::WELCOME_50_PERCENT_OFF]);
|
||||
Log::info(json_encode($voucher));
|
||||
if($voucher) SendWelcomeVoucherEmail::dispatch($user, $voucher, 1);
|
||||
|
||||
// $attempt = $this->generatesEmailVerificationAttempt->execute($user);
|
||||
// $this->sendUserVerificationEmail::dispatch($user, $attempt);
|
||||
|
||||
// $attempt = $this->generatesPasswordReset->execute($user);
|
||||
// $this->sendResetPasswordEmail::dispatch($user, $attempt);
|
||||
}
|
||||
catch(\Exception $e){}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -95,6 +95,8 @@
|
||||
<div class="col">
|
||||
<p class="no-margin" v-if="serviceType.id === 1">The recipient can expect to receive the transfer within <span class="text-success bold">3-5 working days</span>. Explore our BANK TRANSFER (SAVER) option for a better rate!</p>
|
||||
<p class="no-margin" v-if="serviceType.id === 3">Enjoy a <span class="bold text-underline">better rate</span> with this option! The recipient will receive the transfer after <span class="text-success bold">5-7 working days.</span>.</p>
|
||||
<p class="no-margin text-danger" v-if="[1, 3].includes(serviceType.id)">Please ensure is a PERSONAL bank account details. Company bank account details only allow to use as E2E service.</p>
|
||||
<p class="no-margin text-danger" v-if="serviceType.id === 5">Cancellation of E2E service are strictly NO refund on the 2% transfer fee charge.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
@@ -448,6 +448,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" v-if="booking.payment_history.length">
|
||||
<div class="alert alert-danger padding-15" role="alert">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">Please contact CIEF if the supplier hasn’t received the funds within 14 working days; otherwise, the dispute request may no longer be traceable.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-5" v-if="$store.getters.isAdmin">
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
<br>
|
||||
<htmlpageheader name="page-header">
|
||||
<br><br>
|
||||
<div class="separator"><strong><i>{{ $transaction->bill_no }}</i></strong></div>
|
||||
@php
|
||||
$credit_title = \Carbon\Carbon::parse($transaction->created_at)->greaterThanOrEqualTo('2024-04-02') ? 'Refund' : 'Credit';
|
||||
$bill_no = $credit_title === 'Refund' ? str_replace('CREDIT', 'REFUND', $transaction->bill_no) : $transaction->bill_no;
|
||||
@endphp
|
||||
<div class="separator"><strong><i>{{ $bill_no }}</i></strong></div>
|
||||
</htmlpageheader>
|
||||
<table>
|
||||
<tr>
|
||||
@@ -25,7 +29,7 @@
|
||||
<td class="header-details">
|
||||
<div class="title">
|
||||
<strong>
|
||||
{{ $transaction->type == 9 ? 'Credit' : 'Debit' }} Note
|
||||
{{ $transaction->type == 9 ? $credit_title : 'Debit' }} Note
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
|
||||
+51
-31
@@ -440,26 +440,54 @@ Route::get('/pending_orders', function(){
|
||||
|
||||
Route::get('/approve_refunds', function(Request $request){
|
||||
$type = $request->query('type');
|
||||
$payments = Transaction::where('type', TransactionType::PAYMENT)->where('owner_type', Booking::class)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED, ApprovalStatus::REFUNDED])
|
||||
->whereHas('transactions', function ($query) use ($type) {
|
||||
$query->where('type', TransactionType::REFUND)->where('status', ApprovalStatus::APPROVED);
|
||||
if (str_contains($type, 'partial')) {
|
||||
$query->whereColumn('original_amount', '!=','transactions.original_amount');
|
||||
} else {
|
||||
$query->whereColumn('original_amount', 'transactions.original_amount');
|
||||
}
|
||||
});
|
||||
|
||||
if (str_contains($type, 'post')) {
|
||||
$payments->whereHas('transactions', function($query) {
|
||||
$query->where('type', TransactionType::SUPPLIER_REFUND);
|
||||
$approve_refunds = Transaction::where('type', TransactionType::REFUND)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
|
||||
if (str_contains($type, 'partial')) {
|
||||
$approve_refunds->whereHas('owner', function ($q) {
|
||||
$q->whereColumn('original_amount', '!=', 'transactions.original_amount');
|
||||
});
|
||||
} else {
|
||||
$payments->whereDoesntHave('transactions', function($query) {
|
||||
$query->where('type', TransactionType::SUPPLIER_REFUND);
|
||||
$approve_refunds->whereHas('owner', function ($q) {
|
||||
$q->whereColumn('original_amount', 'transactions.original_amount');
|
||||
});
|
||||
}
|
||||
|
||||
if (str_contains($type, 'post')) {
|
||||
$approve_refunds->whereHas('owner', function ($q) {
|
||||
$q->whereHas('transactions', function($query) {
|
||||
$query->where('type', TransactionType::SUPPLIER_REFUND);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$approve_refunds->whereHas('owner', function ($q) {
|
||||
$q->whereDoesntHave('transactions', function($query) {
|
||||
$query->where('type', TransactionType::SUPPLIER_REFUND);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// $payments = Transaction::where('type', TransactionType::PAYMENT)->where('owner_type', Booking::class)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED, ApprovalStatus::REFUNDED])
|
||||
// ->whereHas('transactions', function ($query) use ($type) {
|
||||
// $query->where('type', TransactionType::REFUND)->where('status', ApprovalStatus::APPROVED);
|
||||
// if (str_contains($type, 'partial')) {
|
||||
// $query->whereColumn('original_amount', '!=','transactions.original_amount');
|
||||
// } else {
|
||||
// $query->whereColumn('original_amount', 'transactions.original_amount');
|
||||
// }
|
||||
// });
|
||||
|
||||
// if (str_contains($type, 'post')) {
|
||||
// $payments->whereHas('transactions', function($query) {
|
||||
// $query->where('type', TransactionType::SUPPLIER_REFUND);
|
||||
// });
|
||||
// } else {
|
||||
// $payments->whereDoesntHave('transactions', function($query) {
|
||||
// $query->where('type', TransactionType::SUPPLIER_REFUND);
|
||||
// });
|
||||
// }
|
||||
|
||||
echo '<table>';
|
||||
echo '<tr>';
|
||||
echo '<td>No.</td>';
|
||||
@@ -478,12 +506,11 @@ Route::get('/approve_refunds', function(Request $request){
|
||||
echo '<td>Bank Holder Name</td>';
|
||||
echo '<td>Note Remark</td>';
|
||||
echo '</tr>';
|
||||
foreach ($payments->orderBy('created_at', 'DESC')->get() as $index => $payment){
|
||||
$booking = $payment->owner;
|
||||
$original_refunds = floatval((App()->make(CalculatesBookingRefundAmount::class))->calculateRefundAmount($payment, $booking->fix_currency_id));
|
||||
$refunds = $original_refunds / $payment->currency_rate;
|
||||
foreach ($approve_refunds->orderBy('created_at', 'DESC')->get() as $index => $refund){
|
||||
$payment = $refund->owner;
|
||||
$booking = $refund->owner->owner;
|
||||
if(!$booking instanceof Booking){
|
||||
dd($payment);
|
||||
dd($refund);
|
||||
}
|
||||
$bankType = str::length($booking->bank->holder_name) > 4 ? 'Company' : 'Personal';
|
||||
|
||||
@@ -492,8 +519,7 @@ Route::get('/approve_refunds', function(Request $request){
|
||||
$bankType = str_word_count($booking->bank->holder_name) > 4 ? 'Company' : 'Personal';
|
||||
}
|
||||
|
||||
$refundTransaction = $payment->transactions()->refunds()->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->first();
|
||||
$remark = $refundTransaction->original_amount === $payment->original_amount ? 'Fully Refund' : 'Partial Refund';
|
||||
$remark = $refund->original_amount === $refund->owner->original_amount ? 'Fully Refund' : 'Partial Refund';
|
||||
|
||||
if (str_contains($type, 'post')) {
|
||||
$remark = 'Post ' . $remark;
|
||||
@@ -501,25 +527,19 @@ Route::get('/approve_refunds', function(Request $request){
|
||||
$remark = 'Pre ' . $remark;
|
||||
}
|
||||
|
||||
$refundTransactions = $payment->transactions()->refunds()->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
|
||||
|
||||
$noteRemark = '';
|
||||
|
||||
foreach ($refundTransactions as $refund) {
|
||||
$noteRemark .= implode(', ', $refund->remarks->pluck('content')->toArray()) . ' ';
|
||||
}
|
||||
$noteRemark = implode(', ', $refund->remarks->pluck('content')->toArray());
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>'.($index + 1).'.</td>';
|
||||
echo '<td>'.$payment->created_at->format('d-M-y').'</td>';
|
||||
echo '<td>'.$refund->created_at->format('d-M-y').'</td>';
|
||||
echo '<td>'.$booking->marking.'</td>';
|
||||
echo '<td>'.\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_METHODS_ID[$payment->payment_method].'</td>';
|
||||
echo '<td>'.$payment->currency->short_code.'</td>';
|
||||
echo '<td>'.number_format($refunds, 5, '.', '').'</td>';
|
||||
echo '<td>'.number_format($refund->amount, 5, '.', '').'</td>';
|
||||
echo '<td>'.$booking->company->reference.'</td>';
|
||||
echo '<td></td>';
|
||||
echo '<td>'.$payment->original_currency->short_code.'</td>';
|
||||
echo '<td>'.number_format($original_refunds, 5, '.', '').'</td>';
|
||||
echo '<td>'.number_format($refund->original_amount, 5, '.', '').'</td>';
|
||||
echo '<td></td>';
|
||||
echo '<td>'.$remark.'</td>';
|
||||
echo '<td>'.$booking->service->name.'</td>';
|
||||
|
||||
Reference in New Issue
Block a user