mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-09-01 10:54:00 +00:00
Merge branch 'vapor/production' into dillon/90-e-invoice-e
This commit is contained in:
@@ -84,7 +84,7 @@ class Helper
|
||||
$ringgitWords = $numberTransformer->toWords((int)$ringgit);
|
||||
$centsWords = $numberTransformer->toWords((int)$cents);
|
||||
|
||||
return strtoupper('ringgit ' . $ringgitWords . ' and ' . $centsWords . ' cents only');
|
||||
return strtoupper('ringgit malaysia ' . $ringgitWords . ' and ' . $centsWords . ' cents only');
|
||||
}
|
||||
|
||||
public static function getLHDNStateCodeByName($name)
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
||||
use App\Classes\Modules\Bookings\Standards\Rules\CanFetchBooking;
|
||||
use App\Classes\Modules\Transactions\Processors\CreateBankingInvoiceTransactionProcessor;
|
||||
use App\Http\Resources\BookingResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateBankingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Create Banking Invoice Transaction',
|
||||
'message' => 'You have successfully create banking invoice transaction'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanFetchBooking */
|
||||
private $canFetchBooking;
|
||||
|
||||
/** @var FetchesBooking */
|
||||
private $fetchesBooking;
|
||||
|
||||
/** @var CreateBankingInvoiceTransactionProcessor */
|
||||
private $createBankingInvoiceTransactionProcessor;
|
||||
|
||||
/**
|
||||
* CreateBankingInvoiceTransactionLogic constructor.
|
||||
* @param CanFetchBooking $canFetchBooking
|
||||
* @param FetchesBooking $fetchesBooking
|
||||
* @param CreateBankingInvoiceTransactionProcessor $createBankingInvoiceTransactionProcessor
|
||||
*/
|
||||
public function __construct(
|
||||
CanFetchBooking $canFetchBooking,
|
||||
FetchesBooking $fetchesBooking,
|
||||
CreateBankingInvoiceTransactionProcessor $createBankingInvoiceTransactionProcessor
|
||||
)
|
||||
{
|
||||
$this->canFetchBooking = $canFetchBooking;
|
||||
$this->fetchesBooking = $fetchesBooking;
|
||||
$this->createBankingInvoiceTransactionProcessor = $createBankingInvoiceTransactionProcessor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
// $this->canFetchBooking->passes();
|
||||
|
||||
$booking = $this->fetchesBooking->execute(['id' => $request->route('id')]);
|
||||
|
||||
$this->createBankingInvoiceTransactionProcessor->execute($booking);
|
||||
|
||||
return $this->resourceResponse(new BookingResource($booking));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Booking;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CalculatesBookingCurrencyAverageRate
|
||||
{
|
||||
@@ -37,13 +38,13 @@ class CalculatesBookingCurrencyAverageRate
|
||||
}
|
||||
|
||||
if ($type == TransactionType::PAYMENT) {
|
||||
if($generateEInvoiceRefund){
|
||||
|
||||
$totalPayment = $booking->fix_currency_id === 1 ? $booking->transactions()->payments()->complete()->sum('original_amount') :
|
||||
$booking->transactions()->payments()->complete()->selectRaw('sum(amount - service_charge - tax) as sub_total')->get()->sum('sub_total');
|
||||
|
||||
if($totalPayment === 0 || $generateEInvoiceRefund){
|
||||
$totalPayment = $booking->fix_currency_id === 1 ? $booking->transactions()->payments()->where('status', ApprovalStatus::REFUNDED)->sum('original_amount') :
|
||||
$booking->transactions()->payments()->where('status', ApprovalStatus::REFUNDED)->selectRaw('sum(amount - service_charge - tax) as sub_total')->get()->sum('sub_total');
|
||||
}
|
||||
else{
|
||||
$totalPayment = $booking->fix_currency_id === 1 ? $booking->transactions()->payments()->complete()->sum('original_amount') :
|
||||
$booking->transactions()->payments()->complete()->selectRaw('sum(amount - service_charge - tax) as sub_total')->get()->sum('sub_total');
|
||||
$booking->transactions()->payments()->where('status', ApprovalStatus::REFUNDED)->selectRaw('sum(amount - service_charge - tax) as sub_total')->get()->sum('sub_total');
|
||||
}
|
||||
|
||||
return $this->calculatesBookingPayableAmount->execute($booking, $booking->fix_currency_id, $generateEInvoiceRefund) / ($totalPayment + $discount);
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Rules\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\CriteriaNotFulfilledException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Rules\DataTransferObjects\CheckEInvoiceAmountLimitRuleDTO;
|
||||
use App\Classes\Modules\Rules\Services\RuleEvaluator;
|
||||
use App\Classes\Modules\Rules\Standards\Rules\CanPassMustEInvoiceAmountLimitRule;
|
||||
use App\Http\Resources\RuleResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CheckEInvoiceAmountLimitLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Rule Check E-Invoice Amount Limit',
|
||||
'message' => 'You have successfully passed all rules evaluated'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var RuleEvaluator */
|
||||
private $ruleEvaluator;
|
||||
|
||||
|
||||
/** @var CanPassMustEInvoiceAmountLimitRule */
|
||||
private $canPassMustEInvoiceAmountLimitRule;
|
||||
|
||||
/**
|
||||
* CheckEInvoiceAmountLimitLogic constructor.
|
||||
* @param RuleEvaluator $ruleEvaluator
|
||||
* @param CanPassMustEInvoiceAmountLimitRule $canPassMustEInvoiceAmountLimitRule
|
||||
*/
|
||||
public function __construct(RuleEvaluator $ruleEvaluator, CanPassMustEInvoiceAmountLimitRule $canPassMustEInvoiceAmountLimitRule)
|
||||
{
|
||||
$this->ruleEvaluator = $ruleEvaluator;
|
||||
$this->canPassMustEInvoiceAmountLimitRule = $canPassMustEInvoiceAmountLimitRule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
* @throws \App\Classes\Exceptions\CriteriaNotFulfilledException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$dto = new CheckEInvoiceAmountLimitRuleDTO($request->all());
|
||||
|
||||
$result = $this->ruleEvaluator->evaluate([
|
||||
$this->canPassMustEInvoiceAmountLimitRule
|
||||
], $dto);
|
||||
|
||||
if ($result->failed()) {
|
||||
throw new CriteriaNotFulfilledException("- " . implode("<br>- ", $result->messages()));
|
||||
}
|
||||
|
||||
return $this->resourceResponse(new RuleResource((object)$result));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Rules\DataTransferObjects;
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
|
||||
class CheckEInvoiceAmountLimitRuleDTO implements DataTransferObject
|
||||
{
|
||||
public int $bookingId;
|
||||
public int $companyId;
|
||||
public ?string $amount;
|
||||
public ?string $paymentMethod;
|
||||
public ?string $voucherCode;
|
||||
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->bookingId = $data['booking_id'];
|
||||
$this->companyId = $data['company_id'];
|
||||
|
||||
$this->amount = $data['amount'] ?? null;
|
||||
$this->paymentMethod = $data['payment_method'] ?? null;
|
||||
$this->voucherCode = $data['voucherCode'] ?? null;
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'booking_id' => $this->bookingId,
|
||||
'company_id' => $this->companyId,
|
||||
'amount' => $this->amount,
|
||||
'payment_method' => $this->paymentMethod,
|
||||
'voucher_code' => $this->voucherCode,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Rules\Standards\Rules;
|
||||
|
||||
use App\Classes\Exceptions\CriteriaNotFulfilledException;
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingOutstanding;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBookingQuotation;
|
||||
use App\Classes\Modules\Currencies\DataTransferObjects\CurrencyConversionObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CanPassMustEInvoiceAmountLimitRule extends AbstractRule
|
||||
{
|
||||
|
||||
/** @var FetchesBooking */
|
||||
private $fetchesBooking;
|
||||
|
||||
/** @var FetchesBookingQuotation */
|
||||
private $fetchesBookingQuotation;
|
||||
|
||||
/** @var CalculatesBookingOutstanding */
|
||||
private $calculatesBookingOutstanding;
|
||||
|
||||
|
||||
/**
|
||||
* CanPassMustEInvoiceAmountLimitRule constructor.
|
||||
* @param FetchesBooking $fetchesBooking
|
||||
* @param FetchesBookingQuotation $fetchesBookingQuotation
|
||||
* @param CalculatesBookingOutstanding $calculatesBookingOutstanding
|
||||
*/
|
||||
public function __construct(FetchesBooking $fetchesBooking, FetchesBookingQuotation $fetchesBookingQuotation, CalculatesBookingOutstanding $calculatesBookingOutstanding)
|
||||
{
|
||||
$this->fetchesBooking = $fetchesBooking;
|
||||
$this->fetchesBookingQuotation = $fetchesBookingQuotation;
|
||||
$this->calculatesBookingOutstanding = $calculatesBookingOutstanding;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
//Check if booking amount is RM10,000 or more, than must opt-in E-Invoice
|
||||
$booking = $this->fetchesBooking->execute(['id' => $object->bookingId]);
|
||||
$company = $booking->company;
|
||||
|
||||
// $totalPayments = 0;
|
||||
|
||||
// if(isset($object->amount)){
|
||||
// $totalPayments = $booking->transactions()->payments()->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
|
||||
|
||||
// $conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', floatval(str_replace(',', '', $object->amount)))), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS[$object->paymentMethod]);
|
||||
// $voucherCode = $object->voucherCode ?? null;
|
||||
// $configurations = $this->fetchesBookingQuotation->execute($booking->company, $conversionObject, $voucherCode, null, $booking);
|
||||
// }
|
||||
// else{
|
||||
// $outstanding = $this->calculatesBookingOutstanding->execute($booking);
|
||||
// $conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $outstanding)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0 : 1, PaymentMethodType::CASH);
|
||||
// $configurations = $this->fetchesBookingQuotation->execute($booking->company, $conversionObject);
|
||||
// }
|
||||
|
||||
// $bookingAmountInMYR = $configurations->getTotal();
|
||||
// $bookingAmountInMYR = $bookingAmountInMYR + $totalPayments;
|
||||
|
||||
// if($bookingAmountInMYR >= 10000 && (!$company->e_invoice || !$company->tin) ){
|
||||
// throw new CriteriaNotFulfilledException("RM10,000 and above must opt-in for E-Invoice.");
|
||||
// }
|
||||
|
||||
//1 MYR, 2 CNY, 3 USD
|
||||
if((($booking->fix_amount >= 9000 && $booking->fix_currency_id === 1) ||
|
||||
($booking->fix_amount >= 12600 && $booking->fix_currency_id === 2) ||
|
||||
($booking->fix_amount >= 1920 && $booking->fix_currency_id === 3))
|
||||
&& (!$company->e_invoice || !$company->tin) ){
|
||||
throw new CriteriaNotFulfilledException("Booking amount above limit, must opt-in for E-Invoice.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesGroup;
|
||||
use App\Classes\Modules\Transactions\Services\DeletesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\Modules\Transactions\Processors\UpdateRefundTransactionStatusProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Http\Resources\GroupResource;
|
||||
@@ -35,17 +36,22 @@ class DeleteGroupLogic extends AbstractControllerLogic
|
||||
/** @var DeletesTransaction */
|
||||
private $deletesTransaction;
|
||||
|
||||
/** @var UpdateRefundTransactionStatusProcessor */
|
||||
private $updateRefundTransactionStatusProcessor;
|
||||
|
||||
/**
|
||||
* DeleteGroupLogic constructor.
|
||||
* @param updatesTransactionStatus $updatesTransactionStatus
|
||||
* @param FetchesGroup $fetchesGroup
|
||||
* @param DeletesTransaction $deletesTransaction
|
||||
* @param UpdateRefundTransactionStatusProcessor $updateRefundTransactionStatusProcessor
|
||||
*/
|
||||
public function __construct(updatesTransactionStatus $updatesTransactionStatus, FetchesGroup $fetchesGroup, DeletesTransaction $deletesTransaction)
|
||||
public function __construct(updatesTransactionStatus $updatesTransactionStatus, FetchesGroup $fetchesGroup, DeletesTransaction $deletesTransaction, UpdateRefundTransactionStatusProcessor $updateRefundTransactionStatusProcessor)
|
||||
{
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->fetchesGroup = $fetchesGroup;
|
||||
$this->deletesTransaction = $deletesTransaction;
|
||||
$this->updateRefundTransactionStatusProcessor = $updateRefundTransactionStatusProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,6 +75,7 @@ class DeleteGroupLogic extends AbstractControllerLogic
|
||||
$this->updatesTransactionStatus->execute($payment, ApprovalStatus::APPROVED);
|
||||
}
|
||||
$this->deletesTransaction->execute($bill);
|
||||
$this->checkForRefund($payment);
|
||||
}
|
||||
|
||||
$group->delete();
|
||||
@@ -76,4 +83,11 @@ class DeleteGroupLogic extends AbstractControllerLogic
|
||||
return $this->resourceResponse(new GroupResource($group));
|
||||
}
|
||||
|
||||
//Check for refund if it is still pending, auto reject immediately
|
||||
private function checkForRefund($payment){
|
||||
$refunds = $payment->transactions()->refunds()->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION])->get();
|
||||
foreach($refunds as $refund) {
|
||||
$this->updateRefundTransactionStatusProcessor->execute($refund->id, ApprovalStatus::REJECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-107
@@ -2,22 +2,11 @@
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Bookings\ControllersLogic\UpdateBookingAmountLogic;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\Modules\Documents\Services\DeletesDocument;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Wallets\Processors\CreditWalletProcessor;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingPayableAmount;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingRefundAmount;
|
||||
use App\Classes\Modules\Transactions\Standards\Rules\CanUpdateRefundTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\RemarkRefundReason;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\Modules\Transactions\Processors\UpdateRefundTransactionStatusProcessor;
|
||||
|
||||
class UpdateRefundTransactionStatusLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -27,61 +16,21 @@ class UpdateRefundTransactionStatusLogic extends AbstractControllerLogic
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Transaction',
|
||||
'message' => 'You have successfully updated a transaction'
|
||||
'title' => 'Updated Refund Transaction',
|
||||
'message' => 'You have successfully updated a refund transaction'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var DeletesDocument */
|
||||
private $deletesDocument;
|
||||
|
||||
/** @var CreditWalletProcessor */
|
||||
private $creditWalletProcessor;
|
||||
|
||||
/** @var CalculatesBookingPayableAmount */
|
||||
private $calculatesBookingPayableAmount;
|
||||
|
||||
/** @var CalculatesBookingRefundAmount */
|
||||
private $calculatesBookingRefundAmount;
|
||||
|
||||
/** @var UpdateBookingAmountLogic */
|
||||
private $updateBookingAmountLogic;
|
||||
|
||||
/** @var CanUpdateRefundTransactionStatus */
|
||||
private $canUpdateRefundTransactionStatus;
|
||||
/** @var UpdateRefundTransactionStatusProcessor */
|
||||
private $updateRefundTransactionStatusProcessor;
|
||||
|
||||
/**
|
||||
* CreatePaymentVerificationDocumentLogic constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param FetchesTransaction $fetchesTransaction
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param DeletesDocument $deletesDocument
|
||||
* @param CreditWalletProcessor $creditWalletProcessor
|
||||
* @param CalculatesBookingPayableAmount $calculatesBookingPayableAmount
|
||||
* @param CalculatesBookingRefundAmount $calculatesBookingRefundAmount
|
||||
* @param UpdateBookingAmountLogic $updateBookingAmountLogic
|
||||
* @param CanUpdateRefundTransactionStatus $canUpdateRefundTransactionStatus
|
||||
* UpdateRefundTransactionStatusLogic constructor.
|
||||
* @param UpdateRefundTransactionStatusProcessor $updateRefundTransactionStatusProcessor
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, DeletesDocument $deletesDocument, CreditWalletProcessor $creditWalletProcessor, CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingRefundAmount $calculatesBookingRefundAmount, UpdateBookingAmountLogic $updateBookingAmountLogic, CanUpdateRefundTransactionStatus $canUpdateRefundTransactionStatus)
|
||||
public function __construct(UpdateRefundTransactionStatusProcessor $updateRefundTransactionStatusProcessor)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->deletesDocument = $deletesDocument;
|
||||
$this->creditWalletProcessor = $creditWalletProcessor;
|
||||
$this->calculatesBookingPayableAmount = $calculatesBookingPayableAmount;
|
||||
$this->calculatesBookingRefundAmount = $calculatesBookingRefundAmount;
|
||||
$this->updateBookingAmountLogic = $updateBookingAmountLogic;
|
||||
$this->canUpdateRefundTransactionStatus = $canUpdateRefundTransactionStatus;
|
||||
$this->updateRefundTransactionStatusProcessor = $updateRefundTransactionStatusProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,52 +42,7 @@ class UpdateRefundTransactionStatusLogic extends AbstractControllerLogic
|
||||
{
|
||||
// $this->canUpdateRefundTransactionStatus->passes();
|
||||
|
||||
$refundTransaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]);
|
||||
|
||||
$refundTransaction = $this->updatesTransactionStatus->execute($refundTransaction, $request->route('status'));
|
||||
|
||||
$paymentTransaction = $refundTransaction->owner;
|
||||
|
||||
$supplierRefundTransaction = $paymentTransaction->transactions()->supplierRefunds()->where('status', [ApprovalStatus::PENDING_VERIFICATION])->first();
|
||||
|
||||
$booking = $paymentTransaction->owner;
|
||||
|
||||
// $reference = $paymentTransaction->amount - $refundTransaction->amount < 0.01 ? 'Fully Refund for Ref. ' . $booking->marking : 'Partially Refund for Ref. ' . $booking->marking;
|
||||
if ($paymentTransaction->amount - $refundTransaction->amount < 0.01) {
|
||||
$reference = 'Return Inward for Ref. ' . $booking->marking;
|
||||
} else {
|
||||
$refundRemark = $refundTransaction->remarks && $refundTransaction->remarks->first() ? $refundTransaction->remarks->first()->content : $request->input('refundRemark') ;
|
||||
$remarkGroup = RemarkRefundReason::REFUND_REASONS[$refundRemark] ?? null;
|
||||
$reference = $remarkGroup ? $remarkGroup . ' for Ref. ' . $booking->marking : $refundRemark . ' for Ref. ' . $booking->marking;
|
||||
}
|
||||
|
||||
$refundAmount = $this->calculatesBookingRefundAmount->calculateRefundAmount($paymentTransaction, $booking->fix_currency_id);
|
||||
|
||||
$paidAmount = $paymentTransaction->original_amount - $refundAmount;
|
||||
|
||||
if ($refundTransaction->status == ApprovalStatus::APPROVED) {
|
||||
$this->creditWalletProcessor->execute($booking->company, $refundTransaction->type, $refundTransaction->amount, $reference, $refundTransaction);
|
||||
|
||||
$po_transaction = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first();
|
||||
|
||||
if ($po_transaction) {
|
||||
$this->updatesTransactionStatus->execute($po_transaction, (float) number_format($po_transaction->amount, 2, '.', '') === (float) number_format((float)$booking->fix_amount - $refundTransaction->original_amount, 2, '.', '') ? ApprovalStatus::PENDING_VERIFICATION : ApprovalStatus::PENDING_SUBMISSION);
|
||||
}
|
||||
|
||||
// cief todo: 90 - REVERTED STARTS (commented before revert)
|
||||
// $request['fix_amount'] = $booking->fix_amount - $refundTransaction->original_amount;
|
||||
// $request->route()->setParameter('id', $booking->id);
|
||||
// $this->updateBookingAmountLogic->execute($request);
|
||||
// cief todo: 90 - REVERTED ENDS (commented before revert)
|
||||
}
|
||||
|
||||
if ($supplierRefundTransaction) {
|
||||
$this->updatesTransactionStatus->execute($supplierRefundTransaction, $request->route('status'));
|
||||
}
|
||||
|
||||
if (!$paidAmount > 0) {
|
||||
$this->updatesTransactionStatus->execute($paymentTransaction, ApprovalStatus::REFUNDED);
|
||||
}
|
||||
$this->updateRefundTransactionStatusProcessor->execute($request->route('id'), $request->route('status'), $request->input('refundRemark') ?? "");
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
+233
@@ -0,0 +1,233 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Processors;
|
||||
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingOutstanding;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBookingQuotation;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyPaymentAttemptLimit;
|
||||
use App\Classes\Modules\Currencies\DataTransferObjects\CurrencyConversionObject;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Document;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
|
||||
|
||||
class CreateBankingInvoiceTransactionProcessor
|
||||
{
|
||||
|
||||
/** @var CreatesTransaction */
|
||||
private $createsTransaction;
|
||||
|
||||
/** @var GeneratesTransactionBillNumber */
|
||||
private $generatesTransactionBillNumber;
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var CreatesDocument */
|
||||
private $createsDocument;
|
||||
|
||||
/** @var CreatesFiles */
|
||||
private $createsFile;
|
||||
|
||||
/** @var CalculatesBookingOutstanding */
|
||||
private $calculatesBookingOutstanding;
|
||||
|
||||
/** @var FetchesBookingQuotation */
|
||||
private $fetchesBookingQuotation;
|
||||
|
||||
/** @var FetchesCompanyPaymentAttemptLimit */
|
||||
private $fetchesCompanyPaymentAttemptLimit;
|
||||
|
||||
|
||||
/**
|
||||
* CreateBankingInvoiceTransactionProcessor constructor.
|
||||
* @param CreatesTransaction $createsTransaction
|
||||
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param CreatesDocument $createsDocument
|
||||
* @param CreatesFiles $createsFile
|
||||
* @param CalculatesBookingOutstanding $calculatesBookingOutstanding
|
||||
* @param FetchesBookingQuotation $fetchesBookingQuotation
|
||||
* @param FetchesCompanyPaymentAttemptLimit $fetchesCompanyPaymentAttemptLimit
|
||||
*/
|
||||
public function __construct(CreatesTransaction $createsTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber, FetchesCompany $fetchesCompany, CreatesDocument $createsDocument, CreatesFiles $createsFile, CalculatesBookingOutstanding $calculatesBookingOutstanding, FetchesBookingQuotation $fetchesBookingQuotation, FetchesCompanyPaymentAttemptLimit $fetchesCompanyPaymentAttemptLimit)
|
||||
{
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->createsDocument = $createsDocument;
|
||||
$this->createsFile = $createsFile;
|
||||
$this->calculatesBookingOutstanding = $calculatesBookingOutstanding;
|
||||
$this->fetchesBookingQuotation = $fetchesBookingQuotation;
|
||||
$this->fetchesCompanyPaymentAttemptLimit = $fetchesCompanyPaymentAttemptLimit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Booking $booking
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Booking $booking)
|
||||
{
|
||||
$po_order_transaction = $booking->transactions()
|
||||
->where('type', TransactionType::PURCHASE_ORDER)
|
||||
->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED])
|
||||
->first();
|
||||
|
||||
$transaction = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->whereNotIn('status', [ApprovalStatus::SUSPENDED])
|
||||
->first();
|
||||
|
||||
if (!$transaction) {
|
||||
$outstanding = $this->calculatesBookingOutstanding->execute($booking);
|
||||
|
||||
$conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $outstanding)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0 : 1, PaymentMethodType::CASH);
|
||||
|
||||
$configurations = $this->fetchesBookingQuotation->execute($booking->company, $conversionObject); //cief todo: 76
|
||||
|
||||
$paymentAttemptLimit = $this->fetchesCompanyPaymentAttemptLimit->execute($booking->company);
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('PYMT-');
|
||||
|
||||
$object = new TransactionObject(
|
||||
$billNumber,
|
||||
TransactionType::PAYMENT,
|
||||
1,
|
||||
$booking->company->id,
|
||||
$configurations->getConfigurations()->getBankId(),
|
||||
$configurations->getConversionObject()->getPaymentMethod(),
|
||||
$configurations->getTotal(),
|
||||
$configurations->getForeignTotal(),
|
||||
1,
|
||||
$configurations->getConversionObject()->getCurrencyId(),
|
||||
$configurations->getConfigurations()->getRate(),
|
||||
$configurations->getTax(),
|
||||
$configurations->getServiceCharge(),
|
||||
Carbon::now()->addMinutes($paymentAttemptLimit),
|
||||
ApprovalStatus::PENDING_SUBMISSION,
|
||||
[],
|
||||
isset($billPlzBill) ? $billPlzBill->id : NULL
|
||||
);
|
||||
|
||||
$this->createsTransaction->execute($booking, $object);
|
||||
}
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('BI-');
|
||||
|
||||
$payable_amount = $booking->transactions()->payments()->where(function ($query) {
|
||||
return $query->where(function ($query) {
|
||||
// return $query->where('status', ApprovalStatus::PENDING_SUBMISSION)->whereDate('expires_on', '>=', Carbon::now())->where('expires_on', '>', Carbon::now()->toTimeString());
|
||||
return $query->where('status', ApprovalStatus::PENDING_SUBMISSION)->where('expires_on', '>=', Carbon::now());
|
||||
})->orWhere(function ($query) {
|
||||
return $query->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
});
|
||||
})->sum('amount');
|
||||
$booking_amount = $booking->fix_amount;
|
||||
|
||||
$transaction = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->first();
|
||||
|
||||
$paymentAmount = $booking->transactions()->payments()->where(function ($query) {
|
||||
return $query->where(function ($query) {
|
||||
return $query->where('status', ApprovalStatus::PENDING_SUBMISSION)->where('expires_on', '>=', Carbon::now());
|
||||
})->orWhere(function ($query) {
|
||||
return $query->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
});
|
||||
})->selectRaw('sum(amount - service_charge - tax) as sub_total')->get()->sum('sub_total');
|
||||
|
||||
$booking_currency_average_rate = $booking_amount / $paymentAmount;
|
||||
|
||||
$total_service_charge = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->whereNotIn('status', [ApprovalStatus::REJECTED, ApprovalStatus::SUSPENDED])
|
||||
->sum('service_charge');
|
||||
|
||||
$total_tax = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->whereIn('status', [ApprovalStatus::REJECTED, ApprovalStatus::SUSPENDED])
|
||||
->sum('tax');
|
||||
|
||||
// delete prev banking transactions
|
||||
$booking->transactions()
|
||||
->where('type', TransactionType::BANKING)
|
||||
->delete();
|
||||
|
||||
$transaction_object = new TransactionObject(
|
||||
$billNumber,
|
||||
TransactionType::BANKING,
|
||||
$transaction->issuer,
|
||||
$transaction->receiver,
|
||||
$transaction->recipient_bank_account_id,
|
||||
$transaction->payment_method,
|
||||
$payable_amount,
|
||||
$booking_amount,
|
||||
$transaction->currency_id,
|
||||
$transaction->original_currency_id,
|
||||
$booking_currency_average_rate,
|
||||
$total_tax,
|
||||
$total_service_charge,
|
||||
null,
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
|
||||
$banking_transaction = $this->createsTransaction->execute($po_order_transaction->booking, $transaction_object);
|
||||
|
||||
$supplier = $this->fetchesCompany->execute(['id' => $transaction->receiver]);
|
||||
$brn = $supplier->documents()->where('document_type', DocumentType::SSM_REGISTRATION)->latest()->first();
|
||||
|
||||
// PDF 1 - Banking Invoice
|
||||
$purchase_order_pdf = LaravelMpdf::loadView('pages.pdfs.banking_invoice',
|
||||
[
|
||||
'transaction' => $banking_transaction,
|
||||
'po_order_transaction' => $po_order_transaction,
|
||||
'supplier' => $supplier,
|
||||
'brn' => $brn,
|
||||
]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::BANKING_INVOICE,
|
||||
[chunk_split('data:application/pdf;base64,' . base64_encode($purchase_order_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'banking_invoices'
|
||||
);
|
||||
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
|
||||
// PDF 2 - Banking Delivery Order
|
||||
$purchase_order_pdf = LaravelMpdf::loadView('pages.pdfs.deliver_order_banking',
|
||||
[
|
||||
'transaction' => $banking_transaction,
|
||||
'po_order_transaction' => $po_order_transaction,
|
||||
'supplier' => $supplier,
|
||||
'brn' => $brn,
|
||||
]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::DELIVER_ORDER_BANKING,
|
||||
[chunk_split('data:application/pdf;base64,' . base64_encode($purchase_order_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'banking_invoices'
|
||||
);
|
||||
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
}
|
||||
}
|
||||
+12
-1
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\Transactions\Processors;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingPayableAmount;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingTransferredAmount;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingRefundAmount;
|
||||
use App\Classes\Modules\ServiceTypes\Services\FetchesServiceConfigurations;
|
||||
use App\Classes\Modules\Transactions\Services\ListsTransactions;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
@@ -55,6 +56,9 @@ class CreateInvoiceTransactionV2Processor
|
||||
/** @var CreateInvoiceDocumentProcessor */
|
||||
private $invoiceDocumentProcessor;
|
||||
|
||||
/** @var CalculatesBookingRefundAmount */
|
||||
private $calculatesBookingRefundAmount;
|
||||
|
||||
|
||||
/**
|
||||
* CreateInvoiceTransactionV2Processor constructor.
|
||||
@@ -69,8 +73,9 @@ class CreateInvoiceTransactionV2Processor
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param UpdatesBookingStatus $updatesBookingStatus
|
||||
* @param CreateInvoiceDocumentProcessor $invoiceDocumentProcessor
|
||||
* @param CalculatesBookingRefundAmount $calculatesBookingRefundAmount
|
||||
*/
|
||||
public function __construct(ListsTransactions $listsTransactions, CreatesTransaction $createsTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CalculatesBookingPaidAmount $calculatesBookingPaidAmount, CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingTransferredAmount $calculatesBookingTransferredAmount, FetchesServiceConfigurations $fetchesServiceConfigurations, CalculatesBookingCurrencyAverageRate $calculatesBookingCurrencyAverageRate, FetchesCompany $fetchesCompany, UpdatesBookingStatus $updatesBookingStatus, CreateInvoiceDocumentProcessor $invoiceDocumentProcessor)
|
||||
public function __construct(ListsTransactions $listsTransactions, CreatesTransaction $createsTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CalculatesBookingPaidAmount $calculatesBookingPaidAmount, CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingTransferredAmount $calculatesBookingTransferredAmount, FetchesServiceConfigurations $fetchesServiceConfigurations, CalculatesBookingCurrencyAverageRate $calculatesBookingCurrencyAverageRate, FetchesCompany $fetchesCompany, UpdatesBookingStatus $updatesBookingStatus, CreateInvoiceDocumentProcessor $invoiceDocumentProcessor, CalculatesBookingRefundAmount $calculatesBookingRefundAmount)
|
||||
{
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
@@ -81,6 +86,7 @@ class CreateInvoiceTransactionV2Processor
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->updatesBookingStatus = $updatesBookingStatus;
|
||||
$this->invoiceDocumentProcessor = $invoiceDocumentProcessor;
|
||||
$this->calculatesBookingRefundAmount = $calculatesBookingRefundAmount;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,8 +121,13 @@ class CreateInvoiceTransactionV2Processor
|
||||
}
|
||||
|
||||
$payable_amount = $this->calculatesBookingPayableAmount->execute($booking, $booking->fix_currency_id, $generateEInvoiceRefund);
|
||||
$refund_amount = $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id);
|
||||
$booking_amount = $booking->fix_amount;
|
||||
|
||||
if ((float) $booking_amount === (float) $refund_amount && !$generateEInvoice) {
|
||||
return;
|
||||
}
|
||||
|
||||
// confirm that booking amount has been fully paid
|
||||
if ((float) $booking_amount > (float) $payable_amount) {
|
||||
return;
|
||||
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Processors;
|
||||
|
||||
|
||||
use App\Classes\Modules\Bookings\ControllersLogic\UpdateBookingAmountLogic;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\Modules\Documents\Services\DeletesDocument;
|
||||
use App\Classes\Modules\Wallets\Processors\CreditWalletProcessor;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingPayableAmount;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingRefundAmount;
|
||||
use App\Classes\Modules\Transactions\Standards\Rules\CanUpdateRefundTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\RemarkRefundReason;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdateRefundTransactionStatusProcessor
|
||||
{
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var DeletesDocument */
|
||||
private $deletesDocument;
|
||||
|
||||
/** @var CreditWalletProcessor */
|
||||
private $creditWalletProcessor;
|
||||
|
||||
/** @var CalculatesBookingPayableAmount */
|
||||
private $calculatesBookingPayableAmount;
|
||||
|
||||
/** @var CalculatesBookingRefundAmount */
|
||||
private $calculatesBookingRefundAmount;
|
||||
|
||||
/** @var UpdateBookingAmountLogic */
|
||||
private $updateBookingAmountLogic;
|
||||
|
||||
/** @var CanUpdateRefundTransactionStatus */
|
||||
private $canUpdateRefundTransactionStatus;
|
||||
|
||||
/**
|
||||
* UpdateRefundTransactionStatusProcessor constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param FetchesTransaction $fetchesTransaction
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param DeletesDocument $deletesDocument
|
||||
* @param CreditWalletProcessor $creditWalletProcessor
|
||||
* @param CalculatesBookingPayableAmount $calculatesBookingPayableAmount
|
||||
* @param CalculatesBookingRefundAmount $calculatesBookingRefundAmount
|
||||
* @param UpdateBookingAmountLogic $updateBookingAmountLogic
|
||||
* @param CanUpdateRefundTransactionStatus $canUpdateRefundTransactionStatus
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, DeletesDocument $deletesDocument, CreditWalletProcessor $creditWalletProcessor, CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingRefundAmount $calculatesBookingRefundAmount, UpdateBookingAmountLogic $updateBookingAmountLogic, CanUpdateRefundTransactionStatus $canUpdateRefundTransactionStatus)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->deletesDocument = $deletesDocument;
|
||||
$this->creditWalletProcessor = $creditWalletProcessor;
|
||||
$this->calculatesBookingPayableAmount = $calculatesBookingPayableAmount;
|
||||
$this->calculatesBookingRefundAmount = $calculatesBookingRefundAmount;
|
||||
$this->updateBookingAmountLogic = $updateBookingAmountLogic;
|
||||
$this->canUpdateRefundTransactionStatus = $canUpdateRefundTransactionStatus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Booking $booking
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(int $transactionId, int $transactionStatus, string $refundRemark = "")
|
||||
{
|
||||
$refundTransaction = $this->fetchesTransaction->execute(['id' => $transactionId]);
|
||||
|
||||
$refundTransaction = $this->updatesTransactionStatus->execute($refundTransaction, $transactionStatus);
|
||||
|
||||
$paymentTransaction = $refundTransaction->owner;
|
||||
|
||||
$supplierRefundTransaction = $paymentTransaction->transactions()->supplierRefunds()->where('status', [ApprovalStatus::PENDING_VERIFICATION])->first();
|
||||
|
||||
$booking = $paymentTransaction->owner;
|
||||
|
||||
// $reference = $paymentTransaction->amount - $refundTransaction->amount < 0.01 ? 'Fully Refund for Ref. ' . $booking->marking : 'Partially Refund for Ref. ' . $booking->marking;
|
||||
if ($paymentTransaction->amount - $refundTransaction->amount < 0.01) {
|
||||
$reference = 'Return Inward for Ref. ' . $booking->marking;
|
||||
} else {
|
||||
$refundRemark = $refundTransaction->remarks && $refundTransaction->remarks->first() ? $refundTransaction->remarks->first()->content : $refundRemark;
|
||||
$remarkGroup = RemarkRefundReason::REFUND_REASONS[$refundRemark] ?? null;
|
||||
$reference = $remarkGroup ? $remarkGroup . ' for Ref. ' . $booking->marking : $refundRemark . ' for Ref. ' . $booking->marking;
|
||||
}
|
||||
|
||||
$refundAmount = $this->calculatesBookingRefundAmount->calculateRefundAmount($paymentTransaction, $booking->fix_currency_id);
|
||||
|
||||
$paidAmount = $paymentTransaction->original_amount - $refundAmount;
|
||||
|
||||
if ($refundTransaction->status == ApprovalStatus::APPROVED) {
|
||||
$this->creditWalletProcessor->execute($booking->company, $refundTransaction->type, $refundTransaction->amount, $reference, $refundTransaction);
|
||||
|
||||
$po_transaction = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first();
|
||||
|
||||
if ($po_transaction) {
|
||||
$this->updatesTransactionStatus->execute($po_transaction, (float) number_format($po_transaction->amount, 2, '.', '') === (float) number_format((float)$booking->fix_amount - $refundTransaction->original_amount, 2, '.', '') ? ApprovalStatus::PENDING_VERIFICATION : ApprovalStatus::PENDING_SUBMISSION);
|
||||
}
|
||||
|
||||
// cief todo: 90 - REVERTED STARTS (commented before revert)
|
||||
// $request['fix_amount'] = $booking->fix_amount - $refundTransaction->original_amount;
|
||||
// $request->route()->setParameter('id', $booking->id);
|
||||
// $this->updateBookingAmountLogic->execute($request);
|
||||
// cief todo: 90 - REVERTED ENDS (commented before revert)
|
||||
}
|
||||
|
||||
if ($supplierRefundTransaction) {
|
||||
$this->updatesTransactionStatus->execute($supplierRefundTransaction, $transactionStatus);
|
||||
}
|
||||
|
||||
if (!$paidAmount > 0) {
|
||||
$this->updatesTransactionStatus->execute($paymentTransaction, ApprovalStatus::REFUNDED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,7 @@ final class DocumentType {
|
||||
|
||||
public const RECEIPT_VOUCHER = 'RECEIPT_VOUCHER';
|
||||
public const EINVOICE = 'E_INVOICE';
|
||||
|
||||
public const BANKING_INVOICE = 'BANKING_INVOICE';
|
||||
public const DELIVER_ORDER_BANKING = 'DELIVER_ORDER_BANKING';
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ final class TransactionType {
|
||||
|
||||
public const RECEIPT_VOUCHER = 17;
|
||||
|
||||
public const BANKING = 18;
|
||||
|
||||
public const ID_TO_NAME = [
|
||||
self::PAYMENT_ATTEMPT => "PAYMENT_ATTEMPT",
|
||||
self::PAYMENT => "PAYMENT",
|
||||
@@ -57,6 +59,7 @@ final class TransactionType {
|
||||
self::CASH_BACK => "CASH_BACK",
|
||||
self::SUPPLIER_PAYMENT => "SUPPLIER_PAYMENT",
|
||||
self::SUPPLIER_REFUND => "SUPPLIER_REFUND",
|
||||
self::BANKING => "BANKING",
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bookings;
|
||||
|
||||
use App\Classes\Modules\Bookings\ControllersLogic\CreateBankingInvoiceTransactionLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateBankingInvoiceTransactionController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateBankingInvoiceTransactionLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateBankingInvoiceTransactionLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Rules;
|
||||
use App\Classes\Modules\Rules\ControllersLogic\CheckEInvoiceRuleLogic;
|
||||
use App\Classes\Modules\Rules\ControllersLogic\CheckPurchaseOrderRuleLogic;
|
||||
use App\Classes\Modules\Rules\ControllersLogic\CheckTransferRuleLogic;
|
||||
use App\Classes\Modules\Rules\ControllersLogic\CheckEInvoiceAmountLimitLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -36,4 +37,13 @@ class CheckRuleController
|
||||
public function checkTransferRule(Request $request, CheckTransferRuleLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CheckEInvoiceAmountLimitLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function checkEInvoiceAmountLimitRule(Request $request, CheckEInvoiceAmountLimitLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,7 +454,11 @@ class DistrictsTableSeeder extends Seeder
|
||||
[439, 1, 15, 'Sungai Pelek', json_encode(['43950']), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'],
|
||||
[440, 1, 15, 'Tanjong Karang', json_encode(['45500']), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'],
|
||||
[441, 1, 15, 'Tanjong Sepat', json_encode(['42800']), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'],
|
||||
[442, 1, 15, 'Telok Panglima Garang', json_encode(['42425','42500','42507','42509']), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07']
|
||||
[442, 1, 15, 'Telok Panglima Garang', json_encode(['42425','42500','42507','42509']), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'],
|
||||
[443, 1, 16, 'Paka', json_encode(['23100']), 1, '2025-11-27 14:09:07', '2025-11-27 14:09:07'],
|
||||
[444, 1, 16, 'Kemaman', json_encode(['24000']), 1, '2025-11-27 14:09:07', '2025-11-27 14:09:07'],
|
||||
[445, 1, 16, 'Cukai', json_encode(['24000']), 1, '2025-11-27 14:09:07', '2025-11-27 14:09:07'],
|
||||
[446, 1, 16, 'Kuala Terengganu', json_encode(['21080']), 1, '2025-11-27 14:09:07', '2025-11-27 14:09:07'],
|
||||
];
|
||||
|
||||
|
||||
|
||||
@@ -169,6 +169,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import registrationFormValidation from '../../../general/mixins/accounts/validation/registrationFormValidation'
|
||||
import { track } from '../../../utils/tracking';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -205,6 +206,17 @@
|
||||
},
|
||||
submitForm(){
|
||||
this.step === 2 ? this.submit(this.route('api.account.registration.register'), 'post', 'registrationSection', false, false) : this.changeStep('next');
|
||||
},
|
||||
successHandler(response){
|
||||
// fire to gtag manager for fb pixel tracking: CompleteRegistration
|
||||
track('exchange_complete_registration', {
|
||||
content_name: this.parameters.type === 1 ? 'Company' : 'Personal',
|
||||
currency: 'MYR'
|
||||
});
|
||||
|
||||
// Call parent success handler logic from authenticationHandler mixin
|
||||
this.formHandler('');
|
||||
this.$store.dispatch('userAuthentication', {access_token: response.payload.access_token, redirect_url: response.payload.redirect_url});
|
||||
}
|
||||
},
|
||||
mixins: [registrationFormValidation]
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
6. 01DRW - Sales Deposit by Wallet [AR PAYMENT ENTRY] → Filters by Created Date<br/>
|
||||
7. 01DRF - Sales Deposit by Wallet [AR REFUND ENTRY] → Filters by Created Date<br/>
|
||||
8. 01DD - Sales Deposit by Wallet [AR DEPOSIT ENTRY] → Filters by Created Date<br/>
|
||||
9. WALLET TOP UP REPORT [Wallet Deposit Received] → Filters by Top Up Date<br/>
|
||||
</div>
|
||||
">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
@@ -52,6 +53,7 @@
|
||||
6. 01DRW - Sales Deposit by Wallet [AR PAYMENT ENTRY] → Filters by Created Date<br/>
|
||||
7. 01DRF - Sales Deposit by Wallet [AR REFUND ENTRY] → Filters by Created Date<br/>
|
||||
8. 01DD - Sales Deposit by Wallet [AR DEPOSIT ENTRY] → Filters by Created Date<br/>
|
||||
9. WALLET TOP UP REPORT [Wallet Deposit Received] → Filters by Top Up Date<br/>
|
||||
</div>
|
||||
">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
@@ -196,10 +198,10 @@ export default {
|
||||
'01D - Sales Deposit Received [AR DEPOSIT ENTRY]',
|
||||
'01R - RECEIVE PAYMENT [AR RECEIVE PAYMENT]',
|
||||
'Credit Note Report',
|
||||
//'WALLET TOP UP REPORT [Wallet Deposit Received]',
|
||||
'01DRW - Sales Deposit by Wallet [AR PAYMENT ENTRY]',
|
||||
'01DRF - Sales Deposit by Wallet [AR REFUND ENTRY]',
|
||||
'01DD - Sales Deposit by Wallet [AR DEPOSIT ENTRY]'
|
||||
'01DD - Sales Deposit by Wallet [AR DEPOSIT ENTRY]',
|
||||
'WALLET TOP UP REPORT [Wallet Deposit Received]'
|
||||
];
|
||||
},
|
||||
handleExportClick(){
|
||||
@@ -215,10 +217,10 @@ export default {
|
||||
'01D - Sales Deposit Received [AR DEPOSIT ENTRY]': route('api.export.transactions.receive_payment_deposit_entry'),
|
||||
'01R - RECEIVE PAYMENT [AR RECEIVE PAYMENT]': route('api.export.transactions.receive_payment_for_booking'),
|
||||
'Credit Note Report': route('api.export.transactions.ar_credit_note'),
|
||||
//'WALLET TOP UP REPORT [Wallet Deposit Received]': route('api.export.transactions.wallet_top_up_deposit_entry'),
|
||||
'01DRW - Sales Deposit by Wallet [AR PAYMENT ENTRY]': route('api.export.transactions.sales_deposit_by_wallet_payment_entry'),
|
||||
'01DRF - Sales Deposit by Wallet [AR REFUND ENTRY]': route('api.export.transactions.sales_deposit_by_wallet_refund_entry'),
|
||||
'01DD - Sales Deposit by Wallet [AR DEPOSIT ENTRY]': route('api.export.transactions.sales_deposit_by_wallet_deposit_entry'),
|
||||
'WALLET TOP UP REPORT [Wallet Deposit Received]': route('api.export.transactions.wallet_top_up_deposit_entry'),
|
||||
};
|
||||
|
||||
let url = `${routesMap[reportType]}?startDate=${this.parameters.startDate}&endDate=${this.parameters.endDate}`;
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<div class="absolute w-100 b-l b-b b-r b-success" :class="[{'hide': !serviceType.status}]" style="top: 100%; right: 0; z-index: 1;">
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" v-for="service in data.services" v-bind:key="service.id" >
|
||||
<div class="row no-margin" v-for="service in data.services.filter(s => ![14,15,16,17,18,19].includes(s.id))" v-bind:key="service.id">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10" :class="[{'bg-success-light': serviceType.id === service.id}, {'text-white': serviceType.id === service.id}, {'hover-success': serviceType.id !== service.id}, {'pointer': serviceType.id !== service.id}]" @click="updateServiceType(service)">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
@@ -81,6 +81,52 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin" v-if="data.services.filter(s => [14, 15, 16, 17, 18, 19].includes(s.id)).length">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10" :class="[{'bg-success-light': [14, 15, 16, 17, 18, 19].includes(serviceType.id)}, {'text-white': [14, 15, 16, 17, 18, 19].includes(serviceType.id)}, {'hover-success': ![14, 15, 16, 17, 18, 19].includes(serviceType.id)}, {'pointer': ![14, 15, 16, 17, 18, 19].includes(serviceType.id)}]">
|
||||
<div class="dropdown w-100" @mouseleave="closeDropdown">
|
||||
<button
|
||||
class="font-heading fs-10 w-100"
|
||||
@click="innerDropdown.main = !innerDropdown.main" style="background: inherit; border: none; text-align: left;"
|
||||
>
|
||||
{{ displaySelection }}
|
||||
<i class="fa" :class="innerDropdown.main ? 'fa-angle-up' : 'fa-angle-down'"></i>
|
||||
</button>
|
||||
|
||||
<div
|
||||
v-if="innerDropdown.main"
|
||||
class="dropdown-menu show p-0 border border-success w-100"
|
||||
style="max-height: 400px; overflow-y: auto;"
|
||||
>
|
||||
<ul class="menu-level w-100">
|
||||
<li
|
||||
v-for="svc in hardcodeBankingInvoiceServices.services"
|
||||
:key="svc.id"
|
||||
class="menu-item w-100 p-l-0"
|
||||
>
|
||||
<div
|
||||
class="level-title w-100 font-heading fs-10"
|
||||
@click="selectService(svc)"
|
||||
:class="{ 'bg-success-light text-white': innerDropdownSelected.service && innerDropdownSelected.service.id === svc.id }"
|
||||
>
|
||||
{{ svc.name }}
|
||||
</div>
|
||||
<ul v-if="innerDropdownHovered.service && innerDropdownHovered.service.id === svc.id" class="menu-level submenu w-100">
|
||||
<li v-for="sub in svc.subservices" :key="'sub-'+sub.id" class="menu-item w-100">
|
||||
<div
|
||||
class="level-title w-100 sub-level font-heading fs-10"
|
||||
@click="selectSubservice(svc, sub)"
|
||||
:class="{ 'bg-success-light text-white': innerDropdownSelected.subservice && innerDropdownSelected.subservice.id === sub.id }"
|
||||
>
|
||||
{{ sub.name }}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -96,6 +142,14 @@
|
||||
<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" v-if="serviceType.id === 12">You can request Pay-on-Behalf via Alipay for platforms like Taobao, 1688, Pinduoduo, or any Alipay-supported platform. <br><span class="text-danger">Please use Alipay account "2766384544@QQ.com" to apply for Daifu. This account may change, so always confirm the latest Alipay account before placing an order.</span></p>
|
||||
<p class="no-margin" v-if="serviceType.id === 14 || serviceType.id === 17 || serviceType.id === 18">The customer may request an <span class="bold">official invoice first</span> for Bank submission (e.g. BA Trade Line). <br> <br>
|
||||
The <span class="bold">2% service fee is already included</span> in each product unit price, so it will not appear separately.<br>
|
||||
🕓 Transfer will be processed once bank payment is received.<br>
|
||||
</p>
|
||||
<p class="no-margin" v-if="serviceType.id === 15 || serviceType.id === 16 || serviceType.id === 19">The customer may request an <span class="bold">official invoice first</span> for Bank submission (e.g. BA Trade Line). <br> <br>
|
||||
Invoice will show a <span class="bold">2% service fee</span> as a separate item.<br>
|
||||
🕓 Transfer will be processed once bank payment is received. <br>
|
||||
</p>
|
||||
<p class="no-margin text-danger" v-if="[1, 3].includes(serviceType.id) && serviceType.selectedCurrency.id !== 3">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>
|
||||
@@ -188,7 +242,65 @@
|
||||
recipientBanks: [],
|
||||
company: {}
|
||||
},
|
||||
parameters: {}
|
||||
parameters: {},
|
||||
|
||||
innerDropdown: { main: false },
|
||||
innerDropdownHovered: {
|
||||
service: null,
|
||||
subservice: null
|
||||
},
|
||||
|
||||
innerDropdownSelected: {
|
||||
service: null,
|
||||
subservice: null,
|
||||
option: null
|
||||
},
|
||||
hardcodeBankingInvoiceServices: {
|
||||
services: [
|
||||
{
|
||||
id: 1,
|
||||
name: "BANK TRANSFER",
|
||||
subservices: [
|
||||
{
|
||||
id: 14,
|
||||
name: "(IN) BANK TRANSFER (CNY/USD) - BA",
|
||||
},
|
||||
{
|
||||
id: 15,
|
||||
name: "(EX) BANK TRANSFER (CNY/USD) - BA",
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "ALIPAY TRANSFER",
|
||||
subservices: [
|
||||
{
|
||||
id: 17,
|
||||
name: "(IN) ALIPAY - BA",
|
||||
},
|
||||
{
|
||||
id: 16,
|
||||
name: "(EX) ALIPAY - BA",
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "ENTERPRISE TO ENTERPRISE 公打公",
|
||||
subservices: [
|
||||
{
|
||||
id: 18,
|
||||
name: "(IN) ENTERPRISE TO ENTERPRISE - BA",
|
||||
},
|
||||
{
|
||||
id: 19,
|
||||
name: "(EX) ENTERPRISE TO ENTERPRISE - BA",
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created(){
|
||||
@@ -204,6 +316,28 @@
|
||||
this.summary.recipientBanks = this.data.recipient_banks.accounts;
|
||||
|
||||
},
|
||||
mounted() {
|
||||
this.hardcodeBankingInvoiceServices.services.forEach(service => {
|
||||
service.subservices = service.subservices.map(sub => {
|
||||
const match = this.data.services.find(s => s.id === sub.id);
|
||||
return match
|
||||
? { ...sub, name: match.name, currencies: match.currencies }
|
||||
: sub;
|
||||
});
|
||||
});
|
||||
},
|
||||
computed: {
|
||||
displaySelection() {
|
||||
var defaultName = "BANKING INVOICE";
|
||||
var service = this.innerDropdownSelected.service;
|
||||
var sub = this.innerDropdownSelected.subservice;
|
||||
var opt = this.innerDropdownSelected.option;
|
||||
if (service && sub && opt) return defaultName + " → " + service.name + " → " + sub.name + " → " + opt.name;
|
||||
if (service && sub) return defaultName + " → " + service.name + " → " + sub.name;
|
||||
if (service) return defaultName + " → " + service.name;
|
||||
return defaultName;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateServiceType(service){
|
||||
this.serviceType.id = service.id;
|
||||
@@ -222,9 +356,67 @@
|
||||
recipientBanks: this.data.recipient_banks.accounts,
|
||||
company: this.data,
|
||||
}
|
||||
this.innerDropdownSelected = { service: null, subservice: null };
|
||||
},
|
||||
selectService(service) {
|
||||
this.innerDropdownSelected.service = service;
|
||||
this.innerDropdownSelected.subservice = null;
|
||||
this.innerDropdownSelected.option = null;
|
||||
this.innerDropdownHovered.service = service;
|
||||
this.innerDropdownHovered.subservice = null;
|
||||
},
|
||||
selectSubservice(svc, sub) {
|
||||
this.updateServiceType(sub);
|
||||
this.innerDropdownSelected = { service: svc, subservice: sub };
|
||||
|
||||
this.innerDropdownSelected.subservice = sub;
|
||||
this.innerDropdownSelected.option = null;
|
||||
this.innerDropdownHovered.subservice = sub;
|
||||
|
||||
this.innerDropdown.main = false;
|
||||
this.innerDropdownHovered.service = null;
|
||||
},
|
||||
closeDropdown() {
|
||||
this.innerDropdownHovered.service = null;
|
||||
this.innerDropdownHovered.subservice = null;
|
||||
this.innerDropdown.main = false;
|
||||
}
|
||||
},
|
||||
mixins: [formHandler]
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.menu-level {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.level-title {
|
||||
padding: 4px 8px;
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.level-title.sub-level {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.level-title.option-level {
|
||||
padding-left: 35px;
|
||||
}
|
||||
|
||||
.menu-item:hover > .level-title {
|
||||
background-color: #8fd19e;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.bg-success-light {
|
||||
background-color: #8fd19e !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
+48
-24
@@ -162,29 +162,6 @@
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component
|
||||
id="modal-einvoice-request"
|
||||
class="animate__animated animate__fast animate__fadeIn"
|
||||
styleType="fill-in" type="requestEInvoiceA" size="large">
|
||||
<e-invoice-request-form-component
|
||||
class="text-center"
|
||||
:section="section"
|
||||
:company-id="data.company.id"
|
||||
@choice-made="handleEInvoiceRequestRespond"
|
||||
/>
|
||||
</modal-component>
|
||||
<modal-component
|
||||
id="modal-einvoice-info"
|
||||
class="animate__animated animate__fast animate__fadeIn"
|
||||
styleType="fill-in" type="requestEInvoiceB" size="large">
|
||||
<e-invoice-info-form-component
|
||||
:section="section"
|
||||
:company-id="data.company.id"
|
||||
:company-type="data.company.type"
|
||||
v-on:eInvoiceInfoUpdated="updatedEInvoiceInfo($event)"
|
||||
v-on:eInvoiceChangeOfMindRequest="changeOfMindEInvoiceRequest()">
|
||||
</e-invoice-info-form-component>
|
||||
</modal-component>
|
||||
<!-- E-Invoice - end -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -622,7 +599,7 @@
|
||||
<!-- E-Invoice -->
|
||||
<button id="lock-booking" class="btn btn-sm all-caps b-rad-none btn-success btn-block"
|
||||
v-if="paymentMethod.id !== 'wallet' || walletOutstanding >= 0"
|
||||
@click.prevent="checkPurchaseOrderRule">Lock Booking</button>
|
||||
@click.prevent="checkEInvoiceAmountLimitRule">Lock Booking</button>
|
||||
</div>
|
||||
<modal-component id="confirm-booking-modal" v-if="calculation.total > 0" class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="paymentSummary">
|
||||
<confirm-quotation-form-component v-on:cancelQuotation="cancelQuotation()" :calculation="calculation" :section="section" :id="item.id" :payment_method="paymentMethod.id" :bank_code="onlinePayment.id" :amount="amount" :company-id="item.company.id"></confirm-quotation-form-component>
|
||||
@@ -630,6 +607,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- E-Invoice - start -->
|
||||
<modal-component
|
||||
id="modal-einvoice-request"
|
||||
class="animate__animated animate__fast animate__fadeIn"
|
||||
styleType="fill-in" type="requestEInvoiceA" size="large">
|
||||
<e-invoice-request-form-component
|
||||
class="text-center"
|
||||
:section="section"
|
||||
:company-id="data.company.id"
|
||||
@choice-made="handleEInvoiceRequestRespond"
|
||||
/>
|
||||
</modal-component>
|
||||
<modal-component
|
||||
id="modal-einvoice-info"
|
||||
class="animate__animated animate__fast animate__fadeIn"
|
||||
styleType="fill-in" type="requestEInvoiceB" size="large">
|
||||
<e-invoice-info-form-component
|
||||
:section="section"
|
||||
:company-id="data.company.id"
|
||||
:company-type="data.company.type"
|
||||
v-on:eInvoiceInfoUpdated="updatedEInvoiceInfo($event)"
|
||||
v-on:eInvoiceChangeOfMindRequest="changeOfMindEInvoiceRequest()">
|
||||
</e-invoice-info-form-component>
|
||||
</modal-component>
|
||||
<!-- E-Invoice - end -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -740,6 +742,9 @@
|
||||
$('#confirm-booking-modal').modal('show');
|
||||
}
|
||||
}
|
||||
else if(section === this.section + 'CheckEInvoiceAmountLimitRule'){
|
||||
this.checkPurchaseOrderRule();
|
||||
}
|
||||
else if(section === this.section + 'ChangeOfMind'){
|
||||
this.$store.dispatch('reloadList', {'name': "bookingDetailSection"});
|
||||
}
|
||||
@@ -767,6 +772,14 @@
|
||||
if(section === this.section + 'CheckEInvoiceRule' && statusCode === 422){
|
||||
$('#modal-einvoice-info').modal('show');
|
||||
}
|
||||
else if(section === this.section + 'CheckEInvoiceAmountLimitRule' && statusCode === 422){
|
||||
if(!this.data.company.e_invoice){
|
||||
$('#modal-einvoice-request').modal('show');
|
||||
}
|
||||
else if(!this.data.company.tin){
|
||||
$('#modal-einvoice-info').modal('show');
|
||||
}
|
||||
}
|
||||
this.error = error.message;
|
||||
},
|
||||
makePayment(){ //E-Invoice
|
||||
@@ -837,6 +850,17 @@
|
||||
};
|
||||
this.submit(route('api.rule.check.einvoice'), 'post', this.section + 'CheckEInvoiceRule', false, true);
|
||||
},
|
||||
checkEInvoiceAmountLimitRule(){
|
||||
this.error = '';
|
||||
this.parameters = {
|
||||
booking_id: this.data.id,
|
||||
company_id: this.data.company.id,
|
||||
payment_method: this.paymentMethod.id,
|
||||
voucherCode: this.voucherCode,
|
||||
amount: this.amount
|
||||
};
|
||||
this.submit(route('api.rule.check.einvoice.amount-limit'), 'post', this.section + 'CheckEInvoiceAmountLimitRule', false, true);
|
||||
},
|
||||
checkPurchaseOrderRule(){
|
||||
this.error = '';
|
||||
this.parameters = {
|
||||
|
||||
@@ -222,6 +222,10 @@
|
||||
})
|
||||
},
|
||||
disabledMyr(){
|
||||
if (this.data.id === 14 || this.data.id === 15 || this.data.id === 16 || this.data.id === 17 || this.data.id === 18 || this.data.id === 19) { //default for service type manual / banking invoice
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.currentSegmentNames.includes('enable enter MYR rate')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -11,6 +11,7 @@
|
||||
|
||||
<script>
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { track } from '../../../utils/tracking';
|
||||
export default {
|
||||
props:{
|
||||
order_reference_no: {
|
||||
@@ -26,6 +27,12 @@
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
// fire to gtag manager for fb pixel tracking: AddToCart — fired when the user clicks Confirm Order (user intent, OK even if API fails)
|
||||
track('exchange_add_to_cart', {
|
||||
value: Number(String(this.data.amount).replace(/,/g, '')),
|
||||
currency: 'MYR'
|
||||
});
|
||||
|
||||
this.parameters = {
|
||||
company_id: this.data.company.id,
|
||||
type: this.data.type,
|
||||
@@ -42,6 +49,13 @@
|
||||
this.submit(route('api.booking.create'), 'post', this.section, true, true)
|
||||
},
|
||||
successHandler(response){
|
||||
// fire to gtag manager for fb pixel tracking: InitiateCheckout — booking created
|
||||
track('exchange_checkout', {
|
||||
value: Number(String(this.data.amount).replace(/,/g, '')),
|
||||
currency: 'MYR',
|
||||
booking_id: response.payload.data.marking
|
||||
});
|
||||
|
||||
window.location.href = this.route('booking.details', response.payload.data.marking)
|
||||
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// resources/assets/vue/utils/tracking.js
|
||||
export function track(event, payload = {}) {
|
||||
if (typeof window === 'undefined') return;
|
||||
|
||||
// console.log('tracking', event, payload);
|
||||
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
window.dataLayer.push({
|
||||
event,
|
||||
...payload,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
<div class="col">
|
||||
<input class="form-control" type="text" name="booking_reference" placeholder="Booking Reference" value="{{$bookingReference}}">
|
||||
</div>
|
||||
<div class="col">
|
||||
<input class="form-control" type="text" name="bill_no" placeholder="Bill No" value="">
|
||||
</div>
|
||||
<div class="col">
|
||||
<input class="form-control" type="text" name="autocount_docno_invoice" placeholder="Autocount Invoice Number" value="">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button class="btn btn-complete" type="submit">Search</button>
|
||||
</div>
|
||||
@@ -63,10 +69,12 @@
|
||||
$purchaseOrder = $booking->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PURCHASE_ORDER)->first();
|
||||
@endphp
|
||||
<section class="m-b-50">
|
||||
<h5 class="bold">Booking Reference: {{$booking->marking}}</h5>
|
||||
<h5 class="bold">Booking Reference: <span><a href="{{route('booking.details', $booking->marking)}}" target="_blank">{{$booking->marking}}</a></span></h5>
|
||||
<p>Amount: <span>{{$booking->fix_amount.' '.$booking->fixedCurrency->short_code}}</span></p>
|
||||
<p>Status: <span>{{$booking->status === 3 ? 'Complete' : 'In Progress'}}</span></p>
|
||||
<p>Purchase Order Status: <span>{{$purchaseOrder ? ($purchaseOrder->status === 3 ? 'Approved' : ($purchaseOrder->status === 1 ? 'Pending Approval' : 'Incomplete Submission')) : 'Pending Submission'}}</span></p>
|
||||
<p>Marking: <span><a href="{{route('customer.profile', $booking->company->reference)}}" target="_blank">{{$booking->company->reference}}</a></span></p>
|
||||
|
||||
@if($payments)<p class="m-t-35 bold">Payment History:</p>@endif
|
||||
@php $i = 1; @endphp
|
||||
@foreach($payments as $payment)
|
||||
@@ -123,10 +131,12 @@
|
||||
$purchaseOrder = $booking->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PURCHASE_ORDER)->first();
|
||||
@endphp
|
||||
<section>
|
||||
<h5 class="bold">Booking Reference: {{$booking->marking}}</h5>
|
||||
<h5 class="bold">Booking Reference: <span><a href="{{route('booking.details', $booking->marking)}}" target="_blank">{{$booking->marking}}</a></span></h5>
|
||||
<p>Amount: <span>{{$booking->fix_amount.' '.$booking->fixedCurrency->short_code}}</span></p>
|
||||
<p>Status: <span>{{$booking->status === 3 ? 'Complete' : 'In Progress'}}</span></p>
|
||||
<p>Purchase Order Status: <span>{{$purchaseOrder ? ($purchaseOrder->status === 3 ? 'Approved' : ($purchaseOrder->status === 1 ? 'Pending Approval' : 'Incomplete Submission')) : 'Pending Submission'}}</span></p>
|
||||
<p>Marking: <span><a href="{{route('customer.profile', $booking->company->reference)}}" target="_blank">{{$booking->company->reference}}</a></span></p>
|
||||
|
||||
@if($payments)<p class="m-t-35 bold">Payment History:</p>@endif
|
||||
@php $i = 1; @endphp
|
||||
@foreach($payments as $payment)
|
||||
|
||||
@@ -103,4 +103,21 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@if($status === 2 && isset($transaction) && $transaction)
|
||||
<script>
|
||||
(function() {
|
||||
// fire to gtag manager for fb pixel tracking: exchange_purchase
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
window.dataLayer.push({
|
||||
event: 'exchange_purchase',
|
||||
transaction_id: @json($transaction->payment_reference ?? ''),
|
||||
value: {{ number_format((float)($transaction->amount ?? 0), 2, '.', '') }},
|
||||
currency: 'MYR'
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
@endif
|
||||
@endpush
|
||||
@@ -0,0 +1,97 @@
|
||||
@extends('layouts.base_pdf')
|
||||
|
||||
@section('inner_content')
|
||||
|
||||
<br>
|
||||
<htmlpageheader name="page-header">
|
||||
<br><br>
|
||||
<div class="separator"><strong><i>{{ $transaction->bill_no }}</i></strong></div>
|
||||
</htmlpageheader>
|
||||
|
||||
<table>
|
||||
<!-- Header Section -->
|
||||
<tr>
|
||||
<td class="header-logo">
|
||||
<img src="{{ asset('images/ri_1.png') }}" alt="logo" id="logo" class="logo">
|
||||
</td>
|
||||
<td class="header-cief-address">
|
||||
<span class="company-name"><strong>CIEF WORLDWIDE SDN BHD</strong></span>
|
||||
<span class="company-reg">(1134596-M)</span><br>
|
||||
No. 72-3, Jalan Jalil 1,<br>
|
||||
The Earth Bukit Jalil,<br>
|
||||
57000 Kuala Lumpur<br>
|
||||
Tel: 03-8082 1252<br>
|
||||
TIN: C23880226040, MSIC: 46909<br>
|
||||
SST: W10-2403-32000643
|
||||
</td>
|
||||
<td class="header-details">
|
||||
<div class="title"><strong>Invoice</strong></div>
|
||||
<div class="number">EBI#: {{ $transaction->bill_no }}</div>
|
||||
<div class="ref">Ref# {{ $transaction->booking->marking }}</div>
|
||||
<div class="date">Date: {{ $po_order_transaction->booking->created_at }}</div>
|
||||
<div class="ref">Terms: C.O.D</div>
|
||||
<div> </div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="bill-to">
|
||||
<span class="sub-title">Bill To</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="address">
|
||||
<div class="label">
|
||||
{{ $supplier->name }}
|
||||
@if ($brn)
|
||||
(ROC: {{ $brn->reference }})
|
||||
@endif
|
||||
</div>
|
||||
<div class="address">
|
||||
@php
|
||||
$billingAddress = $supplier->addresses()->where('billing', '=', true)->first();
|
||||
@endphp
|
||||
{{ $billingAddress->street_one }}
|
||||
{{ $billingAddress->street_two }},
|
||||
{{ $billingAddress->district()->first()->name }},
|
||||
{{ $billingAddress->postcode }}
|
||||
{{ $billingAddress->state()->first()->name }},
|
||||
{{ $billingAddress->country()->first()->name }}
|
||||
</div>
|
||||
<div>Phone: {{ $supplier->contacts()->first()->phone }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
$voucher_redemption = $voucher_redemption ?? null;
|
||||
?>
|
||||
|
||||
<!-- Invoice Table -->
|
||||
@include('pages.pdfs.purchase_order_table_v2')
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<div class="note">
|
||||
<p><strong><span>{{ \App\Classes\General\Helper::convert(round($transaction->amount, 2)) }}</span></strong></p>
|
||||
<strong>Notes:</strong><br>
|
||||
1. All cheques should be crossed and made payable to CIEF WORLDWIDE SDN. BHD. (MAYBANK) MBB-568603010762<br>
|
||||
2. Goods sold are neither returnable nor refundable. Otherwise a cancellation fee of 20% on purchase price will be imposed.<br>
|
||||
3. Interest rate 2% per month will be charged on all overdue bills.<br>
|
||||
4. Price offered on invoice is based on present as at the current invoice date.<br><br>
|
||||
No any price amendment will be allowed after invoice being chop & sign.<br>
|
||||
CIEF WORLDWIDE SDN. BHD.<br>
|
||||
</div>
|
||||
<br><br>
|
||||
<htmlpagefooter name="page-footer">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td style="text-align: right; ">This is generated by computer. No signature required.</td>
|
||||
<td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</htmlpagefooter>
|
||||
@endsection
|
||||
@@ -0,0 +1,113 @@
|
||||
@extends('layouts.base_pdf')
|
||||
@section('inner_content')
|
||||
<br>
|
||||
<htmlpageheader name="page-header">
|
||||
<br><br>
|
||||
<div class="separator"><strong><i>{{ str_replace(['BI-'], 'BDO-', $transaction->bill_no) }}</i></strong></div>
|
||||
</htmlpageheader>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td class="header-logo">
|
||||
<img src="{{ asset('images/ri_1.png') }}" alt="logo" id="logo" class="logo">
|
||||
</td>
|
||||
<td class="header-cief-address">
|
||||
<span class="company-name"><strong>CIEF WORLDWIDE SDN BHD</strong></span>
|
||||
<span class="company-reg">(1134596-M)</span><br>
|
||||
No. 72-3, Jalan Jalil 1,<br>
|
||||
The Earth Bukit Jalil,<br>
|
||||
57000 Kuala Lumpur<br>
|
||||
Tel: 03-8082 1252<br>
|
||||
TIN: C23880226040, MSIC: 46909<br>
|
||||
SST: W10-2403-32000643
|
||||
</td>
|
||||
<td class="header-details">
|
||||
<div class="title">
|
||||
<strong>
|
||||
Delivery Order
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
<div class="number">EBDO#: {{ str_replace(['BI-'], 'BDO-', $transaction->bill_no) }}</div>
|
||||
<div class="ref">Ref#: {{ $transaction->booking->marking }}</div>
|
||||
<div class="date">Date: {{
|
||||
$supplier->segments->whereIn('id', [23])->first() ? \Carbon\Carbon::now() : $po_order_transaction->created_at }}</div>
|
||||
<div> </div>
|
||||
</td>
|
||||
<tr>
|
||||
<td colspan="3" class="bill-to">
|
||||
<span class="sub-title">
|
||||
Bill To
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="address">
|
||||
<div class="label">
|
||||
{{ $supplier->name }}
|
||||
@if ($brn)
|
||||
(ROC: {{ $brn->reference }})
|
||||
@endif
|
||||
</div>
|
||||
<div class="address">
|
||||
@php
|
||||
$billingAddress = $supplier->addresses()->where('billing', '=', true)->first();
|
||||
@endphp
|
||||
{{ $billingAddress->street_one }}
|
||||
{{ $billingAddress->street_two }} ,
|
||||
{{ $billingAddress->district()->first()->name }},
|
||||
{{ $billingAddress->postcode }}
|
||||
{{ $billingAddress->state()->first()->name }},
|
||||
{{ $billingAddress->country()->first()->name }}
|
||||
</div>
|
||||
<div>
|
||||
Phone: {{ $supplier->contacts()->first()->phone }}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
$voucher_redemption = $voucher_redemption ?? null;
|
||||
?>
|
||||
|
||||
@include('pages.pdfs.purchase_order_table_v2')
|
||||
|
||||
<table style="width: 100%; border-spacing: 0;">
|
||||
<tbody>
|
||||
<tr style="border-spacing: 2em;">
|
||||
<td width="60%">
|
||||
|
||||
</td>
|
||||
<td width="40%" valign="top">
|
||||
E & O.E<br>
|
||||
Receive In Good Order & Condition<br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="width: 100%; border-spacing: 0;">
|
||||
<tbody>
|
||||
<tr style="border-spacing: 2em;">
|
||||
<td width="60%">
|
||||
CIEF WORLDWIDE SDN BHD<br>
|
||||
</td>
|
||||
<td width="40%" valign="top">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<htmlpagefooter name="page-footer">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td style="text-align: right; ">This is generated by computer. No signature required.</td>
|
||||
<td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</htmlpagefooter>
|
||||
@endsection
|
||||
@@ -3,6 +3,7 @@
|
||||
use App\Http\Controllers\Bookings\RegenerateBookingPaymentRVController;
|
||||
use App\Http\Controllers\Bookings\RegenerateBookingEInvoiceController;
|
||||
use App\Http\Controllers\Bookings\UpdateBookingAmountController;
|
||||
use App\Http\Controllers\Bookings\CreateBankingInvoiceTransactionController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Bookings'], function () {
|
||||
@@ -43,6 +44,8 @@ Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Booking
|
||||
Route::post('/merge', 'MergeBookingController@merge')->name('merge');
|
||||
|
||||
Route::post('{id}/proforma/create', 'CreateProformaInvoiceTransaction@create')->name('proforma.create');
|
||||
Route::post('{id}/banking/create', [CreateBankingInvoiceTransactionController::class, 'create'])->name('banking.create');
|
||||
|
||||
|
||||
Route::group(['prefix' => '{id}/receipt', 'as' => 'receipt.'], function () {
|
||||
Route::post('/', [RegenerateBookingPaymentRVController::class, 'regenerate'])->name('regenerate');
|
||||
|
||||
@@ -28,4 +28,5 @@ Route::group(['prefix' => 'import', 'as' => 'import.', 'namespace' => 'Imports']
|
||||
Route::post('/import/sales-invoice', [ImportController::class, 'salesInvoices'])->name('sales_invoices');
|
||||
Route::post('/import/offical-receipt', [ImportController::class, 'officialReceipt'])->name('official_receipt');
|
||||
Route::post('/import/sales-deposit', [ImportController::class, 'salesDeposit'])->name('sales_deposit');
|
||||
Route::post('/import/credit-note', [ImportController::class, 'creditNote'])->name('credit_note');
|
||||
});
|
||||
|
||||
@@ -9,4 +9,5 @@ Route::prefix('rule')
|
||||
Route::post('/check/eInvoice', [CheckRuleController::class, 'checkEInvoiceRule'])->name('check.einvoice');
|
||||
Route::post('/check/purchase-order', [CheckRuleController::class, 'checkPurchaseOrderRule'])->name('check.purchase.order');
|
||||
Route::post('/check/tranfer', [CheckRuleController::class, 'checkTransferRule'])->name('check.transfer');
|
||||
Route::post('/check/e-invoice/amount-limit', [CheckRuleController::class, 'checkEInvoiceAmountLimitRule'])->name('check.einvoice.amount-limit');
|
||||
});
|
||||
|
||||
@@ -36,7 +36,9 @@ use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionV2Proces
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\General\AWSS3Helper;
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use App\Http\Controllers\Reports\UnfinishedPaymentOrders;
|
||||
use App\Models\KeyValuePair;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
|
||||
@@ -215,6 +217,8 @@ Route::post('/support', function (Request $request) {
|
||||
$marking = $request->input('marking');
|
||||
$email = $request->input('customer_email');
|
||||
$bookingReference = $request->input('booking_reference');
|
||||
$billNo = $request->input('bill_no');
|
||||
$autocountDocNoInvoice = $request->input('autocount_docno_invoice');
|
||||
|
||||
$company = null;
|
||||
$booking = null;
|
||||
@@ -234,6 +238,21 @@ Route::post('/support', function (Request $request) {
|
||||
$company = $booking->company;
|
||||
}
|
||||
|
||||
if($billNo) {
|
||||
$transaction = Transaction::where('bill_no', $billNo)->first();
|
||||
if($transaction){
|
||||
$booking = $transaction->booking;
|
||||
}
|
||||
}
|
||||
|
||||
if($autocountDocNoInvoice) {
|
||||
$kvp = KeyValuePair::where('key', KVPKey::AUTOCOUNT_DOCNO_INVOICE)->where('value', $autocountDocNoInvoice)->first();
|
||||
if($kvp){
|
||||
$transaction = $kvp->owner()->withTrashed()->first();
|
||||
$booking = $transaction ? $transaction->booking : null;
|
||||
}
|
||||
}
|
||||
|
||||
return view('pages.customer_support', [
|
||||
'marking' => $marking,
|
||||
'email' => $email,
|
||||
|
||||
Reference in New Issue
Block a user