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 refund-update
This commit is contained in:
@@ -38,4 +38,23 @@ final class TransactionType {
|
||||
|
||||
public const BILL_REFUND = 16;
|
||||
|
||||
}
|
||||
public const ID_TO_NAME = [
|
||||
self::PAYMENT_ATTEMPT => "PAYMENT_ATTEMPT",
|
||||
self::PAYMENT => "PAYMENT",
|
||||
self::INVOICE => "INVOICE",
|
||||
self::BILL => "BILL",
|
||||
self::PROFORMA => "PROFORMA",
|
||||
self::TOP_UP => "TOP_UP",
|
||||
self::REFUND => "REFUND",
|
||||
self::PURCHASE_ORDER => "PURCHASE_ORDER",
|
||||
self::SUPPLIER_DELIVER => "SUPPLIER_DELIVER",
|
||||
self::CREDIT_NOTE => "CREDIT_NOTE",
|
||||
self::DEBIT_NOTE => "DEBIT_NOTE",
|
||||
self::WITHDRAW => "WITHDRAW",
|
||||
self::TRANSFER_FEE => "TRANSFER_FEE",
|
||||
self::CASH_BACK => "CASH_BACK",
|
||||
self::SUPPLIER_PAYMENT => "SUPPLIER_PAYMENT",
|
||||
self::SUPPLIER_REFUND => "SUPPLIER_REFUND",
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -56,7 +56,8 @@ class BookingResource extends JsonResource
|
||||
->whereDate('expires_on', '>=', Carbon::now())
|
||||
->get()
|
||||
),
|
||||
'expired_payment_attempts' => TransactionResource::collection($this->transactions()->payments()->where('status', ApprovalStatus::PENDING_SUBMISSION)->whereDate('expires_on', '>=', Carbon::now())->where('expires_on', '>', Carbon::now()->toTimeString())->get()),
|
||||
// 'expired_payment_attempts' => TransactionResource::collection($this->transactions()->payments()->where('status', ApprovalStatus::PENDING_SUBMISSION)->whereDate('expires_on', '>=', Carbon::now())->where('expires_on', '>', Carbon::now()->toTimeString())->get()),
|
||||
'expired_payment_attempts' => TransactionResource::collection($this->transactions()->payments()->where('status', ApprovalStatus::EXPIRED)->get()),
|
||||
'payment_history' => TransactionResource::collection($this->transactions()->where(function($query){
|
||||
$query->where(function($query){
|
||||
$query->payments()->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::COMPLETED, ApprovalStatus::REJECTED, ApprovalStatus::REFUNDED]);
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<script>
|
||||
import FormHandler from '../../../general/mixins/formHandler';
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { maxValue } from "vuelidate/lib/validators";
|
||||
import { maxValue, required } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -92,7 +92,9 @@ export default {
|
||||
refundAmount: {
|
||||
maxValue: maxValue(this.refundMaxValue)
|
||||
},
|
||||
refundRemark: {}
|
||||
refundRemark: {
|
||||
required
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -33,6 +33,7 @@ use App\Classes\Modules\Bookings\Services\CalculatesBookingRefundAmount;
|
||||
use App\Classes\Modules\Documents\Services\DeletesDocument;
|
||||
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionWithInvoiceNoProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\DeletesTransaction;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
@@ -1109,3 +1110,83 @@ Route::get('/show-white-form-transactions-in-date-range/{from_date}/{to_date}',
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
});
|
||||
|
||||
Route::get('check-duplicate-refunds', function () {
|
||||
$results = Transaction::select('payment_reference', 'owner_id', 'owner_type', 'type', 'status', 'amount', DB::raw('COUNT(*) as count'))
|
||||
->whereNotNull('payment_reference')
|
||||
->where('payment_reference', '<>', '')
|
||||
->where('payment_reference', '<>', 'Withdraw')
|
||||
->where('payment_reference', '<>', 'Refund for Ref. 77315')
|
||||
->whereNull('deleted_at')
|
||||
->groupBy('payment_reference', 'owner_id', 'owner_type', 'type', 'status', 'amount')
|
||||
->having(DB::raw('COUNT(*)'), '>', 1)
|
||||
->get();
|
||||
|
||||
$transactionType = TransactionType::ID_TO_NAME;
|
||||
$approvalStatus = ApprovalStatus::APPROVAL_STATUS_ID;
|
||||
|
||||
echo '<table style="border-collapse: collapse; width: 100%;">';
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th style="border: 1px solid black;">Owner Type</th>';
|
||||
echo '<th style="border: 1px solid black;">Owner ID</th>';
|
||||
echo '<th style="border: 1px solid black;">Payment Reference</th>';
|
||||
echo '<th style="border: 1px solid black;">Type</th>';
|
||||
echo '<th style="border: 1px solid black;">Status</th>';
|
||||
echo '<th style="border: 1px solid black;">Count</th>';
|
||||
echo '<th style="border: 1px solid black;">Amount</th>';
|
||||
echo '<th style="border: 1px solid black;">Wallet Details</th>';
|
||||
echo '<th style="border: 1px solid black;">Booking Ref</th>';
|
||||
echo '<th style="border: 1px solid black;">Payment ID</th>';
|
||||
echo '<th style="border: 1px solid black;">Payment Status</th>';
|
||||
echo '<th style="border: 1px solid black;">Refund ID</th>';
|
||||
echo '</tr>';
|
||||
echo '</thead>';
|
||||
echo '<tbody>';
|
||||
|
||||
foreach ($results as $result) {
|
||||
$booking_ref_arr = explode(' ', $result->payment_reference);
|
||||
$booking_ref = end($booking_ref_arr);
|
||||
|
||||
echo '<tr>';
|
||||
echo "<td style='border: 1px solid black;'>$result->owner_type</td>";
|
||||
echo "<td style='border: 1px solid black;'>$result->owner_id</td>";
|
||||
echo "<td style='border: 1px solid black;'>$result->payment_reference</td>";
|
||||
$status = $transactionType[$result->type];
|
||||
echo "<td style='border: 1px solid black;'>$status</td>";
|
||||
$approvalsName = $approvalStatus[$result->status];
|
||||
echo "<td style='border: 1px solid black;'>$approvalsName</td>";
|
||||
echo "<td style='border: 1px solid black;'>$result->count</td>";
|
||||
echo "<td style='border: 1px solid black;'>$result->amount</td>";
|
||||
|
||||
$click = null;
|
||||
if ($result->owner_type == 'App\Models\Wallet') {
|
||||
$click = '<a href="'.route('wallet.details', $result->owner->owner->reference).'" target="_blank">'.$result->owner->owner->reference.'</a>';
|
||||
}
|
||||
echo "<td style='border: 1px solid black;'>". $click ."</td>";
|
||||
|
||||
$booking_ref_click = null;
|
||||
$payment = null;
|
||||
$refund = null;
|
||||
if ($booking_ref) {
|
||||
$booking_ref_click = '<a href="'.route('booking.details', $booking_ref).'" target="_blank">'.$booking_ref.'</a>';
|
||||
|
||||
$booking = Booking::where('marking', $booking_ref)->first();
|
||||
if ($booking) {
|
||||
$payment = $booking->transactions()->where('type', TransactionType::PAYMENT)->first();
|
||||
$refund = $payment->transactions()->where('type', TransactionType::REFUND)->get()->pluck('id')->toArray();
|
||||
$refund = implode(',', $refund);
|
||||
}
|
||||
}
|
||||
echo "<td style='border: 1px solid black;'>$booking_ref_click</td>";
|
||||
echo "<td style='border: 1px solid black;'>" . ($payment ? $payment->id : '') . "</td>";
|
||||
echo "<td style='border: 1px solid black;'>" . ($payment ? $approvalStatus[$payment->status] : '') . "</td>";
|
||||
echo "<td style='border: 1px solid black;'>" . ($refund ? $refund : '') . "</td>";
|
||||
echo '</tr>';
|
||||
|
||||
|
||||
}
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user