diff --git a/Block/Checkout/Onepage/Success/PromptpayAdditionalInformation.php b/Block/Checkout/Onepage/Success/PromptpayAdditionalInformation.php index 125b96d8..d78d910b 100644 --- a/Block/Checkout/Onepage/Success/PromptpayAdditionalInformation.php +++ b/Block/Checkout/Onepage/Success/PromptpayAdditionalInformation.php @@ -14,20 +14,8 @@ protected function _toHtml() } $data['order_amount'] = $this->getOrderAmount(); $data['image_code'] = $this->getPaymentAdditionalInformation('image_code'); - $data['charge_expires_at'] = $this->getChargeExpiryDate(); + $data['charge_expires_at'] = $this->getPaymentAdditionalInformation('charge_expires_at'); $this->addData($data); return parent::_toHtml(); } - - /** - * get expiry date - * @return string - */ - public function getChargeExpiryDate() - { - // Making sure that timezone is Thailand - date_default_timezone_set("Asia/Bangkok"); - $timestamp = strtotime($this->getPaymentAdditionalInformation('charge_expires_at')); - return date("M d, Y h:i A", $timestamp); - } } diff --git a/Controller/Callback/Threedsecure.php b/Controller/Callback/Threedsecure.php index e334fdbd..2f98fe3e 100644 --- a/Controller/Callback/Threedsecure.php +++ b/Controller/Callback/Threedsecure.php @@ -146,7 +146,7 @@ public function execute() if ($result instanceof Invalid) { // restoring the cart $this->checkoutSession->restoreQuote(); - return $this->processFailedCharge($result->getMessage()); + return $this->processFailedCharge($result->getMessage(), false); } // Do not proceed if webhook is enabled diff --git a/Test/Unit/PromptpayAdditionalInformationTest.php b/Test/Unit/PromptpayAdditionalInformationTest.php index 6c4c1e79..9715d67b 100644 --- a/Test/Unit/PromptpayAdditionalInformationTest.php +++ b/Test/Unit/PromptpayAdditionalInformationTest.php @@ -57,9 +57,9 @@ public function testPromptpayAdditionalInformation() $this->checkoutSessionMock->shouldReceive('getLastRealOrder')->andReturn($this->orderMock); $model = new PromptpayAdditionalInformation($this->contextMock, $this->checkoutSessionMock, []); - $this->assertEquals("Sep 29, 2023 01:49 PM", $model->getChargeExpiryDate()); - $html = $model->toHtml(); $this->assertNotNull($html); + + $this->assertEquals("2023-09-29T06:49:35Z", $model->getChargeExpiresAt()); } } diff --git a/view/frontend/templates/checkout/onepage/success/promptpay_additional_info.phtml b/view/frontend/templates/checkout/onepage/success/promptpay_additional_info.phtml index 8c4571ab..828d040c 100644 --- a/view/frontend/templates/checkout/onepage/success/promptpay_additional_info.phtml +++ b/view/frontend/templates/checkout/onepage/success/promptpay_additional_info.phtml @@ -1,25 +1,76 @@ -

- escapeHtml(__('Amount to pay')) ?>: - - escapeHtml($block->getOrderAmount()) ?> - - -

escapeHtml(__('PromptPay QR Code.')); ?>

-
-

- Payment expires at: escapeHtml($block->getChargeExpiresAt()); ?> -

-

- -

- -
-

To make payment:

- +
+

+ escapeHtml(__('Amount to pay')) ?>: + + escapeHtml($block->getOrderAmount()) ?> + + +

escapeHtml(__('PromptPay QR Code.')); ?>

+
+

+ Payment expires in: +

+

+ +

+ +
+

To make payment:

+
    +
  • Download the QR code or open your preferred bank app to scan it
  • +
  • Check that the payment details are correct
  • +
  • Import the QR code image into your bank app or scan the QR code with your bank app to pay
  • +
  • Share the payment slip from your bank app to the seller
  • +
+
+ + \ No newline at end of file