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/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..116c933f 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,80 @@ -
- = $block->escapeHtml(__('Amount to pay')) ?>: - - = $block->escapeHtml($block->getOrderAmount()) ?> - - -
= $block->escapeHtml(__('PromptPay QR Code.')); ?>
- -- Payment expires at: = $block->escapeHtml($block->getChargeExpiresAt()); ?> -
-- -
- -To make payment:
-+ = $block->escapeHtml(__('Amount to pay')) ?>: + + = $block->escapeHtml($block->getOrderAmount()) ?> + + +
= $block->escapeHtml(__('PromptPay QR Code.')); ?>
+ ++ Payment expires in: +
++ +
+ +To make payment:
+