Skip to content

Commit

Permalink
merge master, resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jacstn committed Nov 19, 2018
2 parents b6959eb + b28d7b0 commit 07a6a5f
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 7 deletions.
Expand Up @@ -30,7 +30,7 @@ public function __construct(
protected function _toHtml()
{
$paymentData = $this->_checkoutSession->getLastRealOrder()->getPayment()->getData();
if ($paymentData['additional_information']['payment_type'] !== 'bill_payment_tesco_lotus' || !isset($paymentData['additional_information']['barcode'])) {
if (!isset($paymentData['additional_information']['payment_type']) || $paymentData['additional_information']['payment_type'] !== 'bill_payment_tesco_lotus') {
return;
}
$orderCurrency = $this->_checkoutSession->getLastRealOrder()->getOrderCurrency()->getCurrencyCode();
Expand Down
1 change: 1 addition & 0 deletions i18n/th_TH.csv
Expand Up @@ -4,3 +4,4 @@
"Krungthai Bank", "ธนาคารกรุงไทย"
"Krungsri Bank","ธนาคารกรุงศรี"
"Option available only for orders in THB","สามารถเลือกชำระผ่านอาลีเพย์ได้ในรายการที่เป็นสกุลเงินบาทเท่านั้น"
"Print", "พิมพ์"
@@ -1,4 +1,5 @@

<p> <?= __('To finish payment, print the code below and bring it to make payment in any Tesco Lotus Store. Code is valid for the next <b>24 hours only</b>. After that time your order will be canceled.'); ?></p>
<p style="margin:.5rem 0"><?= $block->escapeHtml(__('Amount to pay'))?>: <strong><?= $block->getOrderAmount();?></strong></p>
<p><?= $block->getTescoCodeImage(); ?></p>
<p><?= __('To finish payment, print the code below and bring it to make payment in any Tesco Lotus Store. Code is valid for the next <b>24 hours only</b>. After that time your order will be canceled.'); ?></p>
<p style="margin:.5rem 0"><?= $block->escapeHtml(__('Amount to pay'))?>: <strong><?= $block->getOrderAmount();?></b></strong>
<p><img src="<?= $block->escapeUrl($block->getTescoCodeUrl()) ?>" /></p>
<p><button class="action secondary" onclick="window.print ? window.print() : alert('Print not available')"><?= __('Print')?></button></p>
Expand Up @@ -39,7 +39,25 @@ define(
* @return {boolean}
*/
isActive: function() {
return true;
return this.getOrderCurrency().toLowerCase() === 'thb' && this.getStoreCurrency().toLowerCase() === 'thb';
},

/**
* Get order currency
*
* @return {string}
*/
getOrderCurrency: function () {
return window.checkoutConfig.quoteData.quote_currency_code;
},

/**
* Get store currency
*
* @return {string}
*/
getStoreCurrency: function () {
return window.checkoutConfig.quoteData.store_currency_code;
},

/**
Expand Down
15 changes: 14 additions & 1 deletion view/frontend/web/template/payment/offline-tesco-form.html
Expand Up @@ -8,10 +8,18 @@
value: getCode(),
checked: isChecked,
click: selectPaymentMethod,
visible: isRadioButtonVisible()" />
visible: isRadioButtonVisible(),
enable: isActive()"/>
<label data-bind="attr: {'for': getCode()}" class="label">
<span data-bind="text: getTitle()"></span>
</label>
<div data-bind="visible: !isActive()" class="page messages">
<div role="alert" class="messages">
<div class="message-warning warning message">
<div data-bind="i18n: 'Option available only for orders in THB'"></div>
</div>
</div>
</div>
</div>
<div class="payment-method-content">
<!-- ko foreach: getRegion('messages') -->
Expand All @@ -24,6 +32,11 @@
<!-- /ko -->
<!--/ko-->
</div>
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="actions-toolbar">
<div class="primary">
<button class="action primary checkout" type="submit"
Expand Down
5 changes: 5 additions & 0 deletions view/frontend/web/template/payment/offsite-alipay-form.html
Expand Up @@ -32,6 +32,11 @@
<!-- /ko -->
<!--/ko-->
</div>
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="actions-toolbar">
<div class="primary">
<button class="action primary checkout" type="submit"
Expand Down
Expand Up @@ -143,7 +143,7 @@
click: placeOrder,
attr: {title: $t('Place Order')},
css: {disabled: !isPlaceOrderActionAllowed()},
enable: (getCode() == isChecked())">
enable: (getCode() == isChecked() && omiseOffsite())">
<span data-bind="i18n: 'Place Order'"></span>
</button>
</div>
Expand Down

0 comments on commit 07a6a5f

Please sign in to comment.