We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit b82f2b05 authored by cyattilakiss's avatar cyattilakiss Committed by GitHub

Merge pull request #390 from Adyen/PW-966

PW-966 Address verification iDeal
parents 1e54e4c8 2eeec278
...@@ -1011,10 +1011,11 @@ ...@@ -1011,10 +1011,11 @@
max-width: 290px; max-width: 290px;
} }
#iDealContainer .adyen-checkout__dropdown--large{
margin-left: 21px;
}
#iDealContainer .adyen-checkout__dropdown__element{ #iDealContainer .adyen-checkout__dropdown__element{
margin-bottom: 0; margin-bottom: 0;
}
.message.error.hpp-message{
margin-top: 10px;
display: none;
} }
\ No newline at end of file
...@@ -164,6 +164,12 @@ define( ...@@ -164,6 +164,12 @@ define(
result.value = value.brandCode; result.value = value.brandCode;
result.name = value; result.name = value;
result.method = self.item.method; result.method = self.item.method;
/**
* Observable to enable and disable place order buttons for payment methods
* Default value is true to be able to send the real hpp requiests that doesn't require any input
* @type {observable}
*/
result.placeOrderAllowed = ko.observable(true);
result.getCode = function () { result.getCode = function () {
return self.item.method; return self.item.method;
}; };
...@@ -176,6 +182,17 @@ define( ...@@ -176,6 +182,17 @@ define(
result.isPlaceOrderActionAllowed = function(bool) { result.isPlaceOrderActionAllowed = function(bool) {
return self.isPlaceOrderActionAllowed(bool); return self.isPlaceOrderActionAllowed(bool);
}; };
/**
* Set and get if the place order action is allowed
* Sets the placeOrderAllowed observable and the original isPlaceOrderActionAllowed as well
* @param bool
* @returns {*}
*/
result.isPlaceOrderAllowed = function(bool) {
self.isPlaceOrderActionAllowed(bool);
return result.placeOrderAllowed(bool);
};
result.afterPlaceOrder = function() { result.afterPlaceOrder = function() {
return self.afterPlaceOrder(); return self.afterPlaceOrder();
}; };
...@@ -227,7 +244,7 @@ define( ...@@ -227,7 +244,7 @@ define(
* sets up the callbacks for ideal components and * sets up the callbacks for ideal components and
*/ */
result.renderIdealComponent = function () { result.renderIdealComponent = function () {
self.isPlaceOrderActionAllowed(false); result.isPlaceOrderAllowed(false);
var secureFieldsNode = document.getElementById('iDealContainer'); var secureFieldsNode = document.getElementById('iDealContainer');
...@@ -240,15 +257,15 @@ define( ...@@ -240,15 +257,15 @@ define(
onChange: function (state) { onChange: function (state) {
// isValid is not present on start // isValid is not present on start
if (typeof state.isValid !== 'undefined' && state.isValid === false) { if (typeof state.isValid !== 'undefined' && state.isValid === false) {
self.isPlaceOrderActionAllowed(false); result.isPlaceOrderAllowed(false);
} }
}, },
onValid: function (state) { onValid: function (state) {
result.issuerId(state.data.issuer); result.issuerId(state.data.issuer);
self.isPlaceOrderActionAllowed(true); result.isPlaceOrderAllowed(true);
}, },
onError: function (state) { onError: function (state) {
self.isPlaceOrderActionAllowed(false); result.isPlaceOrderAllowed(false);
} }
}); });
...@@ -373,18 +390,30 @@ define( ...@@ -373,18 +390,30 @@ define(
placeRedirectOrder: function(data) { placeRedirectOrder: function(data) {
// Place Order but use our own redirect url after // Place Order but use our own redirect url after
var self = this; var self = this;
fullScreenLoader.startLoader();
var messageContainer = this.messageContainer; var messageContainer = this.messageContainer;
if(brandCode()) { if(brandCode()) {
messageContainer = self.messageComponents['messages-' + brandCode()]; messageContainer = self.messageComponents['messages-' + brandCode()];
} }
$('.hpp-message').slideUp();
this.isPlaceOrderActionAllowed(false); this.isPlaceOrderActionAllowed(false);
fullScreenLoader.startLoader();
$.when( $.when(
placeOrderAction(data, messageContainer) placeOrderAction(data, messageContainer)
).fail( ).fail(
function () { function (response) {
fullScreenLoader.stopLoader();
if (!!response['responseJSON'].parameters) {
$("#messages-" + brandCode()).text((response['responseJSON'].message).replace('%1', response['responseJSON'].parameters[0])).slideDown();
} else {
$("#messages-" + brandCode()).text(response['responseJSON'].message).slideDown();
}
setTimeout(function(){
$("#messages-" + brandCode()).slideUp();
}, 10000);
self.isPlaceOrderActionAllowed(true); self.isPlaceOrderActionAllowed(true);
} }
).done( ).done(
......
...@@ -173,11 +173,15 @@ ...@@ -173,11 +173,15 @@
<!-- ko template: getTemplate() --><!-- /ko --> <!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko--> <!--/ko-->
</div> </div>
<div>
<span class="message message-error error hpp-message" data-bind="attr: {id: 'messages-' + value}"></span>
</div>
<div class="actions-toolbar"> <div class="actions-toolbar">
<div class="primary"> <div class="primary">
<button class="action primary checkout" <button class="action primary checkout"
type="submit" type="submit"
data-bind="click: $parent.continueToAdyenBrandCode, enable: (value == $parent.isBrandCodeChecked())" data-bind="click: $parent.continueToAdyenBrandCode, enable: placeOrderAllowed() && (value == $parent.isBrandCodeChecked())"
disabled> disabled>
<span data-bind="text: $t('Place Order')"></span> <span data-bind="text: $t('Place Order')"></span>
</button> </button>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment