-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tesco_offline instead of tesco_offsite and other refactoring
- Loading branch information
Showing
11 changed files
with
110 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
view/frontend/templates/checkout/onepage/success/tesco_additional_info.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
<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'))?>: <b><?= $block->getOrderAmount();?></b></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> |
82 changes: 82 additions & 0 deletions
82
view/frontend/web/js/view/payment/method-renderer/omise-offline-tesco-method.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
define( | ||
[ | ||
'ko', | ||
'Magento_Checkout/js/view/payment/default', | ||
'Magento_Checkout/js/model/full-screen-loader', | ||
'Magento_Checkout/js/action/redirect-on-success', | ||
'Magento_Checkout/js/model/quote', | ||
'Magento_Checkout/js/model/error-processor' | ||
], | ||
function ( | ||
ko, | ||
Component, | ||
fullScreenLoader, | ||
redirectOnSuccessAction, | ||
quote, | ||
errorProcessor | ||
) { | ||
'use strict'; | ||
|
||
return Component.extend({ | ||
defaults: { | ||
template: 'Omise_Payment/payment/offline-tesco-form' | ||
}, | ||
|
||
isPlaceOrderActionAllowed: ko.observable(quote.billingAddress() != null), | ||
|
||
/** | ||
* Get payment method code | ||
* | ||
* @return {string} | ||
*/ | ||
getCode: function() { | ||
return 'omise_offline_tesco'; | ||
}, | ||
|
||
/** | ||
* Is method available to display | ||
* | ||
* @return {boolean} | ||
*/ | ||
isActive: function() { | ||
return true; | ||
}, | ||
|
||
/** | ||
* Handle payment error | ||
*/ | ||
handlePaymentError: function(response) { | ||
errorProcessor.process(response, self.messageContainer); | ||
fullScreenLoader.stopLoader(); | ||
self.isPlaceOrderActionAllowed(true); | ||
}, | ||
|
||
/** | ||
* Hook the placeOrder function. | ||
* Original source: placeOrder(data, event); @ module-checkout/view/frontend/web/js/view/payment/default.js | ||
* | ||
* @return {boolean} | ||
*/ | ||
placeOrder: function(data, event) { | ||
var self = this; | ||
|
||
if (event) { | ||
event.preventDefault(); | ||
} | ||
|
||
self.getPlaceOrderDeferredObject() | ||
.fail( | ||
function(response) { | ||
self.handlePaymentError(response); | ||
} | ||
).done( | ||
function() { | ||
redirectOnSuccessAction.execute(); | ||
} | ||
); | ||
|
||
return true; | ||
} | ||
}); | ||
} | ||
); |
140 changes: 0 additions & 140 deletions
140
view/frontend/web/js/view/payment/method-renderer/omise-offsite-tesco-method.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,4 @@ | |
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |