Admin Workflow - Fix new unclear workflow requirement

This commit is contained in:
Dillon Ngo
2025-02-25 10:44:38 +08:00
parent cc558b0af9
commit 3b0f81c842
2 changed files with 16 additions and 19 deletions
@@ -104,17 +104,15 @@ class FetchNextQuestionV1AdminWFProcessor
if($question_number !== ""){
//Check if question exists
$questions = $this->listsQuestions->execute(['questionnaire_set_id' => $questionnaireSetId, 'question_number' => $question_number]);
if($previousAnswer['answer'] === '1688_underpaid_overpaid' && count($questions) == 0){
if($previousAnswer['answer'] === '1688_order_verified' && count($questions) == 0){
$questionMetadata = $questionContext['questionMetadata'] ?? null;
// $processed = round((floatval($questionMetadata['amount_processed']) + PHP_FLOAT_EPSILON) * 1000) / 1000;
// $amount = round((floatval($questionMetadata['amount']) + PHP_FLOAT_EPSILON) * 1000) / 1000;
$processed = $questionMetadata['amount_processed'];
$amount = $questionMetadata['amount'];
$wallet = $booking->company->wallets()->first();
$walletAmount = $wallet->amount;
if ($processed === $amount) {
$question_number = '1688_order_paid_precisely';
$question_number = '1688_proceed_order';
}
else if ($processed < $amount) {
$outstanding = $this->calculatesBookingOutstanding->execute($booking) + $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id);
@@ -126,7 +124,6 @@ class FetchNextQuestionV1AdminWFProcessor
$underpay = $configurations->getTotal();
if($underpay > round($outstanding, 2)) {
// throw new MalformedRequestException('Your payment must not be greater than '. $outstanding .'.');
$question_number = '1688_underpaid_order_3';
}
else if($walletAmount > $underpay) {
+14 -14
View File
@@ -147,8 +147,8 @@ class QAWorkFlowSeeder extends Seeder
'is_start' => false,
'is_end' => false,
'answer_options' => [
['display_text' => 'Yes', 'value' => '1688_proceed_order', 'next_question_number' => '1688_proceed_order'],
['display_text' => 'No', 'value' => '1688_underpaid_overpaid', 'next_question_number' => '1688_underpaid_overpaid'],
['display_text' => 'Yes', 'value' => '1688_order_verified', 'next_question_number' => '1688_order_verified'],
['display_text' => 'No', 'value' => '1688_order_verified', 'next_question_number' => '1688_order_verified'],
],
'group' => '1688',
],
@@ -246,17 +246,17 @@ class QAWorkFlowSeeder extends Seeder
// ],
// 'group' => '1688',
// ],
[
'question_number' => '1688_order_paid_precisely',
'question_title' => 'Amount paid is same as recorded in system',
'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_order_paid_precisely',
// 'question_title' => 'Amount paid is same as recorded in system',
// '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_underpaid_order_1',
'question_title' => "This order is underpaid. Clicking 'Next' will deduct the amount short from wallet automatically. ",
@@ -313,7 +313,7 @@ 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'],
['display_text' => 'Done', 'value' => '1688_order_overpaid', 'next_question_number' => '1688_issue_submit'],
],
'group' => '1688',
],