mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 22:13:59 +00:00
Admin Workflow - Fix new unclear workflow requirement
This commit is contained in:
@@ -1,31 +1,20 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
||||
|
||||
use App\Classes\Modules\Bookings\Services\UpdatesBookingFixedAmount;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Http\Resources\BookingResource;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
||||
|
||||
use App\Classes\Modules\Bookings\Standards\Rules\CanUpdateBooking;
|
||||
use App\Classes\Modules\Bookings\DataTransferObjects\BookingObject;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingOutstanding;
|
||||
|
||||
use ErrorException;
|
||||
use App\Classes\Modules\Bookings\Processors\UpdateBookingAmountProcessor;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
|
||||
class UpdateBookingAmountLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -39,33 +28,23 @@ class UpdateBookingAmountLogic extends AbstractControllerLogic
|
||||
/** @var CanUpdateBooking */
|
||||
private $canUpdateBooking;
|
||||
|
||||
/** @var UpdatesBookingFixedAmount */
|
||||
private $updatesBookingFixedAmount;
|
||||
|
||||
/** @var FetchesBooking */
|
||||
private $fetchesBooking;
|
||||
|
||||
/** @var CalculatesBookingOutstanding */
|
||||
private $calculatesBookingOutstanding;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
/** @var UpdateBookingAmountProcessor */
|
||||
private $updateBookingAmountProcessor;
|
||||
|
||||
/**
|
||||
* UpdateBookingAmountLogic constructor.
|
||||
* @param CanUpdateBooking $canUpdateBooking
|
||||
* @param UpdatesBookingFixedAmount $updatesBookingFixedAmount
|
||||
* @param FetchesBooking $fetchesBooking
|
||||
* @param CalculatesBookingOutstanding $calculatesBookingOutstanding
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param UpdateBookingAmountProcessor $updateBookingAmountProcessor
|
||||
*/
|
||||
public function __construct(CanUpdateBooking $canUpdateBooking, UpdatesBookingFixedAmount $updatesBookingFixedAmount, FetchesBooking $fetchesBooking, CalculatesBookingOutstanding $calculatesBookingOutstanding, UpdatesTransactionStatus $updatesTransactionStatus)
|
||||
public function __construct(CanUpdateBooking $canUpdateBooking, FetchesBooking $fetchesBooking, UpdateBookingAmountProcessor $updateBookingAmountProcessor)
|
||||
{
|
||||
$this->canUpdateBooking = $canUpdateBooking;
|
||||
$this->updatesBookingFixedAmount = $updatesBookingFixedAmount;
|
||||
$this->fetchesBooking = $fetchesBooking;
|
||||
$this->calculatesBookingOutstanding = $calculatesBookingOutstanding;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->updateBookingAmountProcessor = $updateBookingAmountProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,25 +55,11 @@ class UpdateBookingAmountLogic extends AbstractControllerLogic
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$booking = $this->fetchesBooking->execute(['id' => $request->route('id')]);
|
||||
$fixAmount = floatval(str_replace(',', '', $request->input('fix_amount', $booking->fix_amount)));
|
||||
|
||||
$input_amount = number_format( floatval(str_replace(',', '', $request->input('fix_amount', $booking->fix_amount))), 5, '.', '');
|
||||
|
||||
$minimum_amount = $booking->fix_amount - $this->calculatesBookingOutstanding->execute($booking);
|
||||
|
||||
if (((float)$input_amount + 0.01) < (float)$minimum_amount) {
|
||||
throw new MalformedRequestException('Booking Amount cannot be less than '. $minimum_amount .'.');
|
||||
}
|
||||
|
||||
$poTransaction = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first();
|
||||
$booking->transactions()->where('type', TransactionType::PROFORMA)->delete();
|
||||
|
||||
if($poTransaction) {
|
||||
$this->updatesTransactionStatus->execute($poTransaction, ApprovalStatus::PENDING_SUBMISSION);
|
||||
}
|
||||
|
||||
$booking = $this->updatesBookingFixedAmount->execute($booking, $input_amount);
|
||||
$this->updateBookingAmountProcessor->execute($booking, $fixAmount);
|
||||
|
||||
return $this->resourceResponse(new BookingResource($booking));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class CreateBookingPaymentProcessor
|
||||
private $calculatesBookingRefundAmount;
|
||||
|
||||
/**
|
||||
* CreateBookingPaymentLogic constructor.
|
||||
* CreateBookingPaymentProcessor constructor.
|
||||
* @param FetchesBookingQuotation $fetchBookingQuotation
|
||||
* @param FetchesCompanyPaymentAttemptLimit $fetchesCompanyPaymentAttemptLimit
|
||||
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
|
||||
@@ -109,13 +109,15 @@ class CreateBookingPaymentProcessor
|
||||
* @return Transaction
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(Booking $booking, string $amount, string $paymentMethod, ?string $voucherCode, ?string $bankCode, string $email)
|
||||
public function execute(Booking $booking, string $amount, string $paymentMethod, ?string $voucherCode, ?string $bankCode, string $email, bool $checkSysRecordedOutstanding = true)
|
||||
{
|
||||
$conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $amount)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS[$paymentMethod]);
|
||||
|
||||
$outstanding = $this->calculatesBookingOutstanding->execute($booking) + $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id);
|
||||
|
||||
if($conversionObject->getAmount() > round($outstanding, 2)) throw new MalformedRequestException('Your payment must not be greater than '. $outstanding .'.');
|
||||
if($checkSysRecordedOutstanding){
|
||||
if($conversionObject->getAmount() > round($outstanding, 2)) throw new MalformedRequestException('Your payment must not be greater than '. $outstanding .'.');
|
||||
}
|
||||
|
||||
$configurations = $this->fetchBookingQuotation->execute($booking->company, $conversionObject, $voucherCode);
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Bookings\Processors;
|
||||
|
||||
use App\Classes\Modules\Bookings\Services\UpdatesBookingFixedAmount;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingOutstanding;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Models\Booking;
|
||||
|
||||
class UpdateBookingAmountProcessor
|
||||
{
|
||||
/** @var UpdatesBookingFixedAmount */
|
||||
private $updatesBookingFixedAmount;
|
||||
|
||||
/** @var CalculatesBookingOutstanding */
|
||||
private $calculatesBookingOutstanding;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/**
|
||||
* UpdateBookingAmountProcessor constructor.
|
||||
* @param UpdatesBookingFixedAmount $updatesBookingFixedAmount
|
||||
* @param CalculatesBookingOutstanding $calculatesBookingOutstanding
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
*/
|
||||
public function __construct(UpdatesBookingFixedAmount $updatesBookingFixedAmount, FetchesBooking $fetchesBooking, CalculatesBookingOutstanding $calculatesBookingOutstanding, UpdatesTransactionStatus $updatesTransactionStatus)
|
||||
{
|
||||
$this->updatesBookingFixedAmount = $updatesBookingFixedAmount;
|
||||
$this->calculatesBookingOutstanding = $calculatesBookingOutstanding;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Booking $booking
|
||||
* @return Booking $booking
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Booking $booking, float $fixAmount)
|
||||
{
|
||||
$input_amount = number_format($fixAmount, 5, '.', '');
|
||||
|
||||
$minimum_amount = $booking->fix_amount - $this->calculatesBookingOutstanding->execute($booking);
|
||||
|
||||
if (((float)$input_amount + 0.01) < (float)$minimum_amount) {
|
||||
throw new MalformedRequestException('Booking Amount cannot be less than '. $minimum_amount .'.');
|
||||
}
|
||||
|
||||
$poTransaction = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first();
|
||||
$booking->transactions()->where('type', TransactionType::PROFORMA)->delete();
|
||||
|
||||
if($poTransaction) {
|
||||
$this->updatesTransactionStatus->execute($poTransaction, ApprovalStatus::PENDING_SUBMISSION);
|
||||
}
|
||||
|
||||
$booking = $this->updatesBookingFixedAmount->execute($booking, $input_amount);
|
||||
|
||||
return $booking;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -9,9 +9,9 @@ class FetchNextQuestionMetadataV1AdminWFProcessor
|
||||
public function execute(QAQuestions $returnQuestion, ?array $questionMetadata) {
|
||||
|
||||
if($returnQuestion && $returnQuestion->question_number === '1688_underpaid_order_1'){
|
||||
$processed = $questionMetadata['amount_processed'];
|
||||
$amount = $questionMetadata['amount'];
|
||||
$questionMetadata['amount_to_be_deducted'] = $amount - $processed;
|
||||
$amountProcessed = $questionMetadata['amount_processed'];
|
||||
$amountPaid = $questionMetadata['paid_amount'];
|
||||
$questionMetadata['amount_to_be_deducted'] = $amountProcessed - $amountPaid;
|
||||
}
|
||||
|
||||
return $questionMetadata;
|
||||
|
||||
+14
-13
@@ -106,33 +106,34 @@ class FetchNextQuestionV1AdminWFProcessor
|
||||
$questions = $this->listsQuestions->execute(['questionnaire_set_id' => $questionnaireSetId, 'question_number' => $question_number]);
|
||||
if($previousAnswer['answer'] === '1688_order_verified' && count($questions) == 0){
|
||||
$questionMetadata = $questionContext['questionMetadata'] ?? null;
|
||||
$processed = $questionMetadata['amount_processed'];
|
||||
$amount = $questionMetadata['amount'];
|
||||
$amountProcessed = $questionMetadata['amount_processed'];
|
||||
$amountPaid = $questionMetadata['paid_amount'];
|
||||
$wallet = $booking->company->wallets()->first();
|
||||
$walletAmount = $wallet->amount;
|
||||
|
||||
if ($processed === $amount) {
|
||||
if ($amountProcessed === $amountPaid) {
|
||||
$question_number = '1688_proceed_order';
|
||||
}
|
||||
else if ($processed < $amount) {
|
||||
else if ($amountProcessed > $amountPaid) {
|
||||
$outstanding = $this->calculatesBookingOutstanding->execute($booking) + $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id);
|
||||
|
||||
$differenceUnder = $amount - $processed;
|
||||
|
||||
$conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $differenceUnder)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS['wallet']);
|
||||
$differenceUnderPayinCNY = $amountProcessed - $amountPaid;
|
||||
$conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $differenceUnderPayinCNY)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS['wallet']);
|
||||
$configurations = $this->fetchBookingQuotation->execute($booking->company, $conversionObject);
|
||||
$underpay = $configurations->getTotal();
|
||||
$amountUnderpay = $configurations->getTotal();
|
||||
|
||||
if($underpay > round($outstanding, 2)) {
|
||||
$question_number = '1688_underpaid_order_3';
|
||||
}
|
||||
else if($walletAmount > $underpay) {
|
||||
// if($amountUnderpay > round($outstanding, 2)) {
|
||||
// $question_number = '1688_underpaid_order_3';
|
||||
// }
|
||||
|
||||
if($walletAmount > $amountUnderpay) {
|
||||
$question_number = '1688_underpaid_order_1';
|
||||
}
|
||||
else {
|
||||
$question_number = '1688_underpaid_order_2';
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$question_number = '1688_overpaid_order';
|
||||
}
|
||||
}
|
||||
|
||||
+21
-10
@@ -6,12 +6,14 @@ namespace App\Classes\Modules\Questionnaires\Processors;
|
||||
use App\Classes\Modules\Bookings\Processors\ApprovePurchaseOrderProcessor;
|
||||
use App\Classes\Modules\Bookings\Processors\UploadPurchaseOrderProcessor;
|
||||
use App\Classes\Modules\Bookings\Processors\CreateBookingPaymentProcessor;
|
||||
use App\Classes\Modules\Bookings\Processors\UpdateBookingAmountProcessor;
|
||||
use App\Classes\Modules\Transactions\Processors\CreatePaymentProofDocumentProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBookingQuotation;
|
||||
use App\Classes\Modules\Currencies\DataTransferObjects\CurrencyConversionObject;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Models\QAAnswerOptions;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SaveAnswerActionV1AdminWFProcessor
|
||||
{
|
||||
@@ -33,6 +35,9 @@ class SaveAnswerActionV1AdminWFProcessor
|
||||
/** @var CreateBookingPaymentProcessor */
|
||||
private $createBookingPaymentProcessor;
|
||||
|
||||
/** @var UpdateBookingAmountProcessor */
|
||||
private $updateBookingAmountProcessor;
|
||||
|
||||
/**
|
||||
* SaveAnswerActionV1AdminWFProcessor constructor.
|
||||
* @param ApprovePurchaseOrderProcessor $approvePurchaseOrderProcessor
|
||||
@@ -41,8 +46,9 @@ class SaveAnswerActionV1AdminWFProcessor
|
||||
* @param FetchesTransaction $fetchesTransaction
|
||||
* @param FetchesBookingQuotation $fetchBookingQuotation
|
||||
* @param CreateBookingPaymentProcessor $createBookingPaymentProcessor
|
||||
* @param UpdateBookingAmountProcessor $updateBookingAmountProcessor
|
||||
*/
|
||||
public function __construct(ApprovePurchaseOrderProcessor $approvePurchaseOrderProcessor, UploadPurchaseOrderProcessor $uploadPurchaseOrderProcessor, CreatePaymentProofDocumentProcessor $createPaymentProofDocumentProcessor, FetchesTransaction $fetchesTransaction, FetchesBookingQuotation $fetchBookingQuotation, CreateBookingPaymentProcessor $createBookingPaymentProcessor)
|
||||
public function __construct(ApprovePurchaseOrderProcessor $approvePurchaseOrderProcessor, UploadPurchaseOrderProcessor $uploadPurchaseOrderProcessor, CreatePaymentProofDocumentProcessor $createPaymentProofDocumentProcessor, FetchesTransaction $fetchesTransaction, FetchesBookingQuotation $fetchBookingQuotation, CreateBookingPaymentProcessor $createBookingPaymentProcessor, UpdateBookingAmountProcessor $updateBookingAmountProcessor)
|
||||
{
|
||||
$this->approvePurchaseOrderProcessor = $approvePurchaseOrderProcessor;
|
||||
$this->uploadPurchaseOrderProcessor = $uploadPurchaseOrderProcessor;
|
||||
@@ -50,6 +56,7 @@ class SaveAnswerActionV1AdminWFProcessor
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->fetchBookingQuotation = $fetchBookingQuotation;
|
||||
$this->createBookingPaymentProcessor = $createBookingPaymentProcessor;
|
||||
$this->updateBookingAmountProcessor = $updateBookingAmountProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +67,7 @@ class SaveAnswerActionV1AdminWFProcessor
|
||||
if($currentQuestion['question_number'] === 'approve_po' && $answerOption && $answerOption->value === "approve_po_approved"){
|
||||
$this->approvePurchaseOrderProcessor->execute($booking);
|
||||
}
|
||||
else if($currentQuestion['question_number'] === '1688_submit')
|
||||
else if($currentQuestion['question_number'] === '1688_submit' || $currentQuestion['question_number'] === '1688_underpaid_documents_submission' || $currentQuestion['question_number'] === '1688_overpaid_documents_submission')
|
||||
{
|
||||
if($filesUpload){
|
||||
if ($booking && isset($filesUpload['filesA']) && isset($filesUpload['filesB']))
|
||||
@@ -82,18 +89,22 @@ class SaveAnswerActionV1AdminWFProcessor
|
||||
else if($currentQuestion['question_number'] === '1688_underpaid_order_1')
|
||||
{
|
||||
$wallet = $booking->company->wallets()->first();
|
||||
$processed = $questionMetadata['amount_processed'];
|
||||
$amount = $questionMetadata['amount'];
|
||||
if ($processed < $amount) {
|
||||
$differenceUnder = $amount - $processed;
|
||||
$conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $differenceUnder)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS['wallet']);
|
||||
$amountProcessed = $questionMetadata['amount_processed'];
|
||||
$amountPaid = $questionMetadata['paid_amount'];
|
||||
if ($amountProcessed > $amountPaid) {
|
||||
$differenceUnderInCNY = $amountProcessed - $amountPaid;
|
||||
$conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $differenceUnderInCNY)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS['wallet']);
|
||||
$configurations = $this->fetchBookingQuotation->execute($booking->company, $conversionObject);
|
||||
$underpay = $configurations->getTotal();
|
||||
$amountUnderpay = $configurations->getTotal();
|
||||
|
||||
if($wallet->amount > $underpay){
|
||||
if($amountUnderpay != $differenceUnderInCNY){
|
||||
$this->updateBookingAmountProcessor->execute($booking, $amountProcessed);
|
||||
}
|
||||
|
||||
if($wallet->amount > $amountUnderpay){
|
||||
$company = $booking->company()->first();
|
||||
$employee = $company->employees()->first();
|
||||
$transaction = $this->createBookingPaymentProcessor->execute($booking, (string) $differenceUnder, 'wallet', "", "", $employee->email);
|
||||
$transaction = $this->createBookingPaymentProcessor->execute($booking, (string) $differenceUnderInCNY, 'wallet', "", "", $employee->email, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingFloatingAmount;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingOutstanding;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingPayableAmount;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingRefundAmount;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\BookingAttributeNames;
|
||||
@@ -25,7 +30,10 @@ class BookingBaseResource extends JsonResource
|
||||
'bank' => new BankResource($this->bank),
|
||||
'service' => new ServiceTypeResource($this->service),
|
||||
'marking' => $this->marking,
|
||||
'amount' => $this->fix_amount,
|
||||
// 'amount' => $this->fix_amount,
|
||||
// 'floating_amount' => floatval((App()->make(CalculatesBookingFloatingAmount::class))->execute($this->resource, $this->fix_currency_id)),
|
||||
'paid_amount' => floatval((App()->make(CalculatesBookingPayableAmount::class))->execute($this->resource, $this->fix_currency_id)) - floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)),
|
||||
// 'outstanding_amount' => floatval((App()->make(CalculatesBookingOutstanding::class))->execute($this->resource)),
|
||||
'fixed_currency' => new CurrencyResource($this->fixedCurrency),
|
||||
'order_reference_no' => $this->modelAttributes()->where('name', BookingAttributeNames::ORDER_REFERENCE_NO)->get()->map(function ($attr) {
|
||||
return [
|
||||
|
||||
@@ -204,11 +204,23 @@ class QAWorkFlowSeeder extends Seeder
|
||||
'question_number' => '1688_submit',
|
||||
'question_title' => '1688_submit',
|
||||
'question_type' => QAType::SUBMIT_1688_3_TYPES_DOCUMENTS,
|
||||
'next_nested_question' => '1688_issue_submit',
|
||||
'next_nested_question' => '1688_documents_submitted',
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'group' => '1688',
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_documents_submitted',
|
||||
'question_title' => 'Thank you for the hard work',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => true,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
||||
['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'],
|
||||
],
|
||||
'group' => '1688',
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_issue_submit',
|
||||
'question_title' => 'Issue has been submitted',
|
||||
@@ -275,7 +287,7 @@ class QAWorkFlowSeeder extends Seeder
|
||||
'question_type' => QAType::DEFAULT,
|
||||
'is_start' => false,
|
||||
'is_end' => true,
|
||||
'next_nested_question' => '1688_issue_submit',
|
||||
'next_nested_question' => '1688_underpaid_proceed_order',
|
||||
// 'answer_options' => [
|
||||
// ['display_text' => 'Done', 'value' => '1688_issue_submit', 'next_question_number' => '1688_issue_submit'],
|
||||
// ],
|
||||
@@ -289,22 +301,22 @@ class QAWorkFlowSeeder extends Seeder
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Done', 'value' => '1688_issue_submit', 'next_question_number' => '1688_issue_submit'],
|
||||
],
|
||||
'group' => '1688',
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_underpaid_order_3',
|
||||
'question_title' => 'Underpaid Order?',
|
||||
'question_description' => 'There is no outstanding on record, please go back and check if the amount processed is entered correctly.',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Done', 'value' => '1688_issue_submit', 'next_question_number' => '1688_issue_submit'],
|
||||
['display_text' => 'Done', 'value' => '1688_underpaid_order_2_submitted', 'next_question_number' => '1688_underpaid_order_2_submitted'],
|
||||
],
|
||||
'group' => '1688',
|
||||
],
|
||||
// [
|
||||
// 'question_number' => '1688_underpaid_order_3',
|
||||
// 'question_title' => 'Underpaid Order?',
|
||||
// 'question_description' => 'There is no outstanding on record, please go back and check if the amount processed is entered correctly.',
|
||||
// 'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
// 'is_start' => false,
|
||||
// 'is_end' => false,
|
||||
// 'answer_options' => [
|
||||
// ['display_text' => 'Done', 'value' => '1688_issue_submit', 'next_question_number' => '1688_issue_submit'],
|
||||
// ],
|
||||
// 'group' => '1688',
|
||||
// ],
|
||||
[
|
||||
'question_number' => '1688_overpaid_order',
|
||||
'question_title' => 'Overpaid Order',
|
||||
@@ -313,10 +325,170 @@ class QAWorkFlowSeeder extends Seeder
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Done', 'value' => '1688_order_overpaid', 'next_question_number' => '1688_issue_submit'],
|
||||
['display_text' => 'Next', 'value' => '1688_overpaid_proceed_order', 'next_question_number' => '1688_overpaid_proceed_order'],
|
||||
],
|
||||
'group' => '1688',
|
||||
],
|
||||
|
||||
// 1688 underpaid - starts
|
||||
[
|
||||
'question_number' => '1688_underpaid_proceed_order',
|
||||
'question_title' => 'Please process the order on 1688',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Yes', 'value' => '1688_underpaid_documents_submission', 'next_question_number' => '1688_underpaid_documents_submission'],
|
||||
['display_text' => 'Got Issue', 'value' => '1688_underpaid_proceed_order_issue', 'next_question_number' => '1688_underpaid_proceed_order_issue'],
|
||||
],
|
||||
'group' => '1688',
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_underpaid_proceed_order_issue',
|
||||
'question_title' => '1688_underpaid_proceed_order_issue',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Wrong Pin Number', 'value' => '1688_underpaid_proceed_order_issue_wrong_pin_number', 'next_question_number' => '1688_underpaid_issue_submit'],
|
||||
['display_text' => 'Not Enough Stock', 'value' => '1688_underpaid_proceed_order_issue_not_enough_stock', 'next_question_number' => '1688_underpaid_issue_submit'],
|
||||
['display_text' => 'Others', 'value' => '1688_underpaid_proceed_order_issue_others', 'next_question_number' => '1688_underpaid_proceed_order_issue_others'],
|
||||
['display_text' => 'No CrossBoarder', 'value' => '1688_underpaid_proceed_order_issue_no_crossborder', 'next_question_number' => '1688_underpaid_issue_submit'],
|
||||
['display_text' => 'AngPau', 'value' => '1688_underpaid_proceed_order_issue_angpau', 'next_question_number' => '1688_underpaid_issue_submit'],
|
||||
],
|
||||
'group' => '1688',
|
||||
'is_admin_filter' => true
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_underpaid_proceed_order_issue_others',
|
||||
'question_title' => 'What other issues did you encounter? Upload documents if needed',
|
||||
'question_type' => QAType::REMARKS_WITH_DOCUMENT_UPLOAD,
|
||||
'next_nested_question' => '1688_underpaid_issue_submit',
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'group' => '1688',
|
||||
'is_admin_filter' => true
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_underpaid_documents_submission',
|
||||
'question_title' => '1688_underpaid_documents_submission',
|
||||
'question_type' => QAType::SUBMIT_1688_3_TYPES_DOCUMENTS,
|
||||
'next_nested_question' => '1688_underpaid_documents_submitted',
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'group' => '1688',
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_underpaid_documents_submitted',
|
||||
'question_title' => 'Thank you for your hard work',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => true,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
||||
['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'],
|
||||
],
|
||||
'group' => '1688',
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_underpaid_issue_submit',
|
||||
'question_title' => 'Issue has been submitted',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => true,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
||||
['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'],
|
||||
],
|
||||
'group' => '1688',
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_underpaid_order_2_submitted',
|
||||
'question_title' => 'Issue has been submitted',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => true,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
||||
['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'],
|
||||
],
|
||||
'group' => '1688',
|
||||
],
|
||||
// 1688 underpaid - ends
|
||||
// 1688 overpaid - starts
|
||||
[
|
||||
'question_number' => '1688_overpaid_proceed_order',
|
||||
'question_title' => 'Please process the order on 1688',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Yes', 'value' => '1688_overpaid_documents_submission', 'next_question_number' => '1688_overpaid_documents_submission'],
|
||||
['display_text' => 'Got Issue', 'value' => '1688_overpaid_proceed_order_issue', 'next_question_number' => '1688_overpaid_proceed_order_issue'],
|
||||
],
|
||||
'group' => '1688',
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_overpaid_proceed_order_issue',
|
||||
'question_title' => '1688_overpaid_proceed_order_issue',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Wrong Pin Number', 'value' => '1688_overpaid_proceed_order_issue_wrong_pin_number', 'next_question_number' => '1688_overpaid_issue_submit'],
|
||||
['display_text' => 'Not Enough Stock', 'value' => '1688_overpaid_proceed_order_issue_not_enough_stock', 'next_question_number' => '1688_overpaid_issue_submit'],
|
||||
['display_text' => 'Others', 'value' => '1688_overpaid_proceed_order_issue_others', 'next_question_number' => '1688_overpaid_proceed_order_issue_others'],
|
||||
['display_text' => 'No CrossBoarder', 'value' => '1688_overpaid_proceed_order_issue_no_crossborder', 'next_question_number' => '1688_overpaid_issue_submit'],
|
||||
['display_text' => 'AngPau', 'value' => '1688_overpaid_proceed_order_issue_angpau', 'next_question_number' => '1688_overpaid_issue_submit'],
|
||||
],
|
||||
'group' => '1688',
|
||||
'is_admin_filter' => true
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_overpaid_proceed_order_issue_others',
|
||||
'question_title' => 'What other issues did you encounter? Upload documents if needed',
|
||||
'question_type' => QAType::REMARKS_WITH_DOCUMENT_UPLOAD,
|
||||
'next_nested_question' => '1688_overpaid_issue_submit',
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'group' => '1688',
|
||||
'is_admin_filter' => true
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_overpaid_documents_submission',
|
||||
'question_title' => '1688_overpaid_documents_submission',
|
||||
'question_type' => QAType::SUBMIT_1688_3_TYPES_DOCUMENTS,
|
||||
'next_nested_question' => '1688_overpaid_documents_submitted',
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
'group' => '1688',
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_overpaid_documents_submitted',
|
||||
'question_title' => 'Thank you for your hard work',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => true,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
||||
['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'],
|
||||
],
|
||||
'group' => '1688',
|
||||
],
|
||||
[
|
||||
'question_number' => '1688_overpaid_issue_submit',
|
||||
'question_title' => 'Issue has been submitted',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => true,
|
||||
'answer_options' => [
|
||||
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
||||
['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'],
|
||||
],
|
||||
'group' => '1688',
|
||||
],
|
||||
// 1688 overpaid - ends
|
||||
|
||||
[
|
||||
'question_number' => 'approve_po',
|
||||
'question_title' => 'approve_po',
|
||||
|
||||
@@ -125,23 +125,10 @@
|
||||
<h6 class="font-heading all-caps bold">Total: </h6>
|
||||
<h6>
|
||||
<span v-if="question.answer && question.question_number === '1688_order_verification'" class="bold m-r-5"
|
||||
:class="[{'text-danger' : (Math.round((parseFloat(externalApiResponse.data.amount_processed) + Number.EPSILON) * 1000) / 1000).toFixed(3) !== (Math.round((externalApiResponse.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)},
|
||||
{'text-success' : (Math.round((parseFloat(externalApiResponse.data.amount_processed) + Number.EPSILON) * 1000) / 1000).toFixed(3) === (Math.round((externalApiResponse.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}]">{{(Math.round(( parseFloat(externalApiResponse.data.amount_processed) + Number.EPSILON) * 1000) / 1000).toFixed(3)}}/</span>
|
||||
<span class="text-primary bold m-l-5">{{(Math.round((externalApiResponse.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}} {{externalApiResponse.data.fixed_currency.short_code}}</span>
|
||||
:class="[{'text-danger' : (Math.round((parseFloat(externalApiResponse.data.amount_processed) + Number.EPSILON) * 1000) / 1000).toFixed(3) !== (Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)},
|
||||
{'text-success' : (Math.round((parseFloat(externalApiResponse.data.amount_processed) + Number.EPSILON) * 1000) / 1000).toFixed(3) === (Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}]">{{(Math.round(( parseFloat(externalApiResponse.data.amount_processed) + Number.EPSILON) * 1000) / 1000).toFixed(3)}}/</span>
|
||||
<span class="text-primary bold m-l-5">{{(Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}} {{externalApiResponse.data.fixed_currency.short_code}}</span>
|
||||
</h6>
|
||||
<!-- <h6 v-else>
|
||||
<span v-if="question.answer && question.question_number === '1688_order_verification'" class="bold m-r-5"
|
||||
:class="[{'text-danger' : (Math.round((parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3) !== (Math.round((externalApiResponse.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)},
|
||||
{'text-success' : (Math.round((parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3) === (Math.round((externalApiResponse.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}]">{{(Math.round(( parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3)}}/</span>
|
||||
<span class="text-primary bold m-l-5">{{(Math.round((externalApiResponse.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}} {{externalApiResponse.data.fixed_currency.short_code}}</span>
|
||||
</h6> -->
|
||||
<!-- <h3 v-if="externalApiResponse">
|
||||
<span class="bold d-inline-block m-r-15">ORDER Marking: </span>
|
||||
<a :href="route('booking.details', externalApiResponse.data.marking)"
|
||||
target="_blank">
|
||||
{{ externalApiResponse.data.marking }}
|
||||
</a>
|
||||
</h3> -->
|
||||
</div>
|
||||
|
||||
<div v-if="question.question_number === '1688_underpaid_order_1'">
|
||||
@@ -211,7 +198,7 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-auto text-left">
|
||||
<div class="form-group form-group-default m-b-0">
|
||||
<label>Order Amount <span v-if="externalApiResponse">{{externalApiResponse.data.fixed_currency.short_code}}</span></label>
|
||||
<label>Amount Processed <span v-if="externalApiResponse">{{externalApiResponse.data.fixed_currency.short_code}}</span></label>
|
||||
<input id="cc_get" name="cc_get" type="text" placeholder="0.00" value="0" class="form-control" v-model="answer" v-money="{decimal: '.',thousands: ',', precision: 2}">
|
||||
</div>
|
||||
</div>
|
||||
@@ -344,12 +331,12 @@
|
||||
</div>
|
||||
<div class="col-12" v-if="externalApiResponse.data.company.address">
|
||||
<div class="row justify-content-center align-items-center text-center">
|
||||
<h6 class="font-heading all-caps bold">Total: </h6>
|
||||
<h6 class="font-heading all-caps bold">Total Paid: </h6>
|
||||
<h6>
|
||||
<!-- <span v-if="question.answer && question.question_number === '1688_order_verification'" class="bold m-r-5"
|
||||
:class="[{'text-danger' : (Math.round((parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3) !== (Math.round((externalApiResponse.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)},
|
||||
{'text-success' : (Math.round((parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3) === (Math.round((externalApiResponse.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}]">{{(Math.round(( parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3)}}/</span> -->
|
||||
<span class="text-primary bold m-l-5">{{(Math.round((externalApiResponse.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}} {{externalApiResponse.data.fixed_currency.short_code}}</span>
|
||||
:class="[{'text-danger' : (Math.round((parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3) !== (Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)},
|
||||
{'text-success' : (Math.round((parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3) === (Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}]">{{(Math.round(( parseFloat(question.answer.answer) + Number.EPSILON) * 1000) / 1000).toFixed(3)}}/</span> -->
|
||||
<span class="text-primary bold m-l-5">{{(Math.round((externalApiResponse.data.paid_amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}} {{externalApiResponse.data.fixed_currency.short_code}}</span>
|
||||
</h6>
|
||||
</div>
|
||||
</div>
|
||||
@@ -641,6 +628,7 @@
|
||||
marking: this.externalApiResponse?.data?.marking,
|
||||
payment_history: this.externalApiResponse?.data?.payment_history,
|
||||
amount: this.externalApiResponse?.data?.amount,
|
||||
paid_amount: this.externalApiResponse?.data?.paid_amount,
|
||||
amount_processed: this.externalApiResponse?.data?.amount_processed,
|
||||
amount_to_be_deducted: this.externalApiResponse?.data?.amount_to_be_deducted,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user