From 88b622df269bce464733e9b408ae238e5e08ca55 Mon Sep 17 00:00:00 2001 From: peterojo Date: Tue, 8 Jun 2021 14:47:22 +0200 Subject: [PATCH] Display selected PM in payment component --- .../storefront/js/adyen-payment-shopware6.js | 2 +- .../src/checkout/confirm-order.plugin.js | 6 +---- .../app/storefront/src/scss/modal.scss | 2 +- .../payment/payment-component-modal.html.twig | 26 +++++++++++++++++-- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js b/src/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js index e36d3bd8..34f5b7ee 100644 --- a/src/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js +++ b/src/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([["adyen-payment-shopware6"],{YcTq:function(e,t,n){"use strict";t.a={updatablePaymentMethods:["scheme","ideal","sepadirectdebit","oneclick","dotpay","bcmc","blik","eps","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","afterpay_default","ratepay","ratepay_directdebit"],componentsWithPayButton:{applepay:{extra:{},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)}},paywithgoogle:{extra:{buttonSizeMode:"fill"},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)},onError:function(e,t,n){"CANCELED"!==e.statusCode&&("statusMessage"in e?console.log(e.statusMessage):console.log(e.statusCode))}},paypal:{extra:{},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()},onError:function(e,t,n){t.setStatus("ready"),window.location.href=n.errorUrl.toString()},onCancel:function(e,t,n){t.setStatus("ready"),window.location.href=n.errorUrl.toString()},responseHandler:function(e,t){try{(t=JSON.parse(t)).isFinal&&(location.href=e.returnUrl),this.handleAction(t.action)}catch(e){console.error(e)}}},amazonpay:{extra:{productType:"PayOnly",checkoutMode:"ProcessOrder",returnUrl:location.href},prePayRedirect:!0,sessionKey:"amazonCheckoutSessionId",onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)},onError:function(e,t){console.log(e),t.setStatus("ready")}}},paymentMethodTypeHandlers:{scheme:"handler_adyen_cardspaymentmethodhandler",ideal:"handler_adyen_idealpaymentmethodhandler",klarna:"handler_adyen_klarnapaylaterpaymentmethodhandler",klarna_account:"handler_adyen_klarnaaccountpaymentmethodhandler",klarna_paynow:"handler_adyen_klarnapaynowpaymentmethodhandler",ratepay:"handler_adyen_ratepaypaymentmethodhandler",ratepay_directdebit:"handler_adyen_ratepaydirectdebitpaymentmethodhandler",sepadirectdebit:"handler_adyen_sepapaymentmethodhandler",sofort:"handler_adyen_sofortpaymentmethodhandler",paypal:"handler_adyen_paypalpaymentmethodhandler",oneclick:"handler_adyen_oneclickpaymentmethodhandler",giropay:"handler_adyen_giropaypaymentmethodhandler",applepay:"handler_adyen_applepaypaymentmethodhandler",paywithgoogle:"handler_adyen_googlepaypaymentmethodhandler",dotpay:"handler_adyen_dotpaypaymentmethodhandler",bcmc:"handler_adyen_bancontactcardpaymentmethodhandler",amazonpay:"handler_adyen_amazonpaypaymentmethodhandler",twint:"handler_adyen_twintpaymentmethodhandler",eps:"handler_adyen_epspaymentmethodhandler",swish:"handler_adyen_swishpaymentmethodhandler",alipay:"handler_adyen_alipaypaymentmethodhandler",alipay_hk:"handler_adyen_alipayhkpaymentmethodhandler",blik:"handler_adyen_blikpaymentmethodhandler",clearpay:"handler_adyen_clearpaypaymentmethodhandler",facilypay_3x:"handler_adyen_facilypay3xpaymentmethodhandler",facilypay_4x:"handler_adyen_facilypay4xpaymentmethodhandler",facilypay_6x:"handler_adyen_facilypay6xpaymentmethodhandler",facilypay_10x:"handler_adyen_facilypay10xpaymentmethodhandler",facilypay_12x:"handler_adyen_facilypay12xpaymentmethodhandler",afterpay_default:"handler_adyen_afterpaydefaultpaymentmethodhandler",trustly:"handler_adyen_trustlypaymentmethodhandler",paysafecard:"handler_adyen_paysafecardpaymentmethodhandler"}}},j5lx:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return v}));var a=n("FGIj"),o=n("gHbT"),r=n("p4AR"),i=n("2Y4b"),d=n("u0Tz"),l=n("YcTq");function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(){return(c=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=adyenCheckoutOptions.orderId,a=null,o=null;n?(e.set("orderId",n),a=adyenCheckoutOptions.updatePaymentUrl,o=this.afterSetPayment.bind(this,t)):(a=adyenCheckoutOptions.checkoutOrderUrl,o=this.afterCreateOrder.bind(this,t)),this._client.post(a,e,o)}},{key:"afterCreateOrder",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;try{e=JSON.parse(n)}catch(e){return d.a.remove(document.body),void console.log("Error: invalid response from Shopware API",n)}this.orderId=e.id,this.finishUrl=new URL(location.origin+adyenCheckoutOptions.paymentFinishUrl),this.finishUrl.searchParams.set("orderId",e.id),this.errorUrl=new URL(location.origin+adyenCheckoutOptions.paymentErrorUrl),this.errorUrl.searchParams.set("orderId",e.id);var a={orderId:this.orderId,finishUrl:this.finishUrl.toString(),errorUrl:this.errorUrl.toString()};for(var o in t)a[o]=t[o];this._client.post(adyenCheckoutOptions.paymentHandleUrl,JSON.stringify(a),this.afterPayOrder.bind(this,this.orderId))}},{key:"afterSetPayment",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;try{var n=JSON.parse(t);n.success&&this.afterCreateOrder(e,JSON.stringify({id:adyenCheckoutOptions.orderId}))}catch(e){return d.a.remove(document.body),void console.log("Error: invalid response from Shopware API",t)}}},{key:"afterPayOrder",value:function(e,t){try{t=JSON.parse(t),this.returnUrl=t.redirectUrl}catch(e){return d.a.remove(document.body),void console.log("Error: invalid response from Shopware API",t)}this.returnUrl===this.errorUrl.toString()&&(location.href=this.returnUrl);try{this._client.post("".concat(adyenCheckoutOptions.paymentStatusUrl),JSON.stringify({orderId:e}),this.responseHandler.bind(this))}catch(e){console.log(e)}}},{key:"handlePaymentAction",value:function(t){e("[data-adyen-payment-component-modal]").modal().hide();try{var n=JSON.parse(t);n.isFinal&&(location.href=this.returnUrl),n.action&&(this.adyenCheckout.createFromAction(n.action).mount("[data-adyen-payment-action-container]"),["threeDS2","qrCode"].includes(n.action.type)&&e("[data-adyen-payment-action-modal]").modal({show:!0}))}catch(e){console.log(e)}}},{key:"initializeCustomPayButton",value:function(){var e=this,t=this.getSelectedPaymentMethodKey();if(t in l.a.componentsWithPayButton){var n=l.a.componentsWithPayButton[t];this.completePendingPayment(t,n);var a=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter((function(e){return e.type===t}));if(!(a.length<1)){var o=a[0];if(adyenCheckoutOptions.amount)if(n.prePayRedirect)this.renderPrePaymentButton(n,o);else{var r=c(n.extra,o,{amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},onClick:function(t,a){if(!n.onClick(t,a,e))return!1;d.a.create(document.body)},onSubmit:function(e,t){if(e.isValid){var a={stateData:JSON.stringify(e.data)},o=i.a.serialize(this.confirmOrderForm);"responseHandler"in n&&(this.responseHandler=n.responseHandler.bind(t,this)),this.confirmOrder(o,a)}else t.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",e)}.bind(this),onCancel:function(t,a){d.a.remove(document.body),n.onCancel(t,a,e)},onError:function(t,a){d.a.remove(document.body),n.onError(t,a,e),console.log(t)}}),s=this.adyenCheckout.create(o.type,r);try{"isAvailable"in s?s.isAvailable().then(function(){this.mountCustomPayButton(s)}.bind(this)).catch((function(e){console.log(o.type+" is not available",e)})):this.mountCustomPayButton(s)}catch(e){console.log(e)}}else console.error("Failed to fetch Cart/Order total amount.")}}}},{key:"renderPrePaymentButton",value:function(e,t){var n=this,a=c(e.extra,t,{configuration:t.configuration,amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},onClick:function(t,a){if(!e.onClick(t,a,n))return!1;d.a.create(document.body)},onError:function(t,a){d.a.remove(document.body),e.onError(t,a,n),console.log(t)}}),o=this.adyenCheckout.create(t.type,a);this.mountCustomPayButton(o)}},{key:"completePendingPayment",value:function(e,t){var n=new URL(location.href);if(n.searchParams.has(t.sessionKey)){var a;d.a.create(document.body);var o=this.adyenCheckout.create(e,(y(a={},t.sessionKey,n.searchParams.get(t.sessionKey)),y(a,"showOrderButton",!1),y(a,"onSubmit",function(e,t){if(e.isValid){var n={stateData:JSON.stringify(e.data)},a=i.a.serialize(this.confirmOrderForm);this.confirmOrder(a,n)}}.bind(this)),a));this.mountCustomPayButton(o),o.submit()}}},{key:"getSelectedPaymentMethodKey",value:function(){return Object.keys(l.a.paymentMethodTypeHandlers).find((function(e){return l.a.paymentMethodTypeHandlers[e]===adyenCheckoutOptions.selectedPaymentMethodHandler}))}},{key:"mountCustomPayButton",value:function(t){var n=e('
');e("#confirmOrderForm").append(n),t.mount(n.get(0)),e("#confirmOrderForm button[type=submit]").remove()}},{key:"mountPaymentComponent",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=c(e,{onSubmit:function(e,t){if(this.paymentComponent.find(".loader").show(),this.paymentComponent.find("[data-adyen-payment-container]").hide(),e.isValid){var n={stateData:JSON.stringify(e.data)},a=i.a.serialize(this.confirmOrderForm);this.confirmOrder(a,n)}else t.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",e)}.bind(this)});n||"scheme"!==e.type||(a.enableStoreDetails=!0);try{var o=this.adyenCheckout.create(e.type,a);o.mount(this.paymentComponent.find(t).get(0)),this.paymentComponent.find(".loader").hide()}catch(t){return console.error(e.type,t),!1}}}])&&u(a.prototype,s),v&&u(a,v),n}(a.a)}).call(this,n("UoTJ"))},jC4o:function(e,t,n){"use strict";n.r(t);var a=n("j5lx");window.PluginManager.register("ConfirmOrderPlugin",a.a,"[data-adyen-payment]")}},[["jC4o","runtime","vendor-node","vendor-shared"]]]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([["adyen-payment-shopware6"],{YcTq:function(e,t,n){"use strict";t.a={updatablePaymentMethods:["scheme","ideal","sepadirectdebit","oneclick","dotpay","bcmc","blik","eps","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","afterpay_default","ratepay","ratepay_directdebit"],componentsWithPayButton:{applepay:{extra:{},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)}},paywithgoogle:{extra:{buttonSizeMode:"fill"},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)},onError:function(e,t,n){"CANCELED"!==e.statusCode&&("statusMessage"in e?console.log(e.statusMessage):console.log(e.statusCode))}},paypal:{extra:{},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()},onError:function(e,t,n){t.setStatus("ready"),window.location.href=n.errorUrl.toString()},onCancel:function(e,t,n){t.setStatus("ready"),window.location.href=n.errorUrl.toString()},responseHandler:function(e,t){try{(t=JSON.parse(t)).isFinal&&(location.href=e.returnUrl),this.handleAction(t.action)}catch(e){console.error(e)}}},amazonpay:{extra:{productType:"PayOnly",checkoutMode:"ProcessOrder",returnUrl:location.href},prePayRedirect:!0,sessionKey:"amazonCheckoutSessionId",onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)},onError:function(e,t){console.log(e),t.setStatus("ready")}}},paymentMethodTypeHandlers:{scheme:"handler_adyen_cardspaymentmethodhandler",ideal:"handler_adyen_idealpaymentmethodhandler",klarna:"handler_adyen_klarnapaylaterpaymentmethodhandler",klarna_account:"handler_adyen_klarnaaccountpaymentmethodhandler",klarna_paynow:"handler_adyen_klarnapaynowpaymentmethodhandler",ratepay:"handler_adyen_ratepaypaymentmethodhandler",ratepay_directdebit:"handler_adyen_ratepaydirectdebitpaymentmethodhandler",sepadirectdebit:"handler_adyen_sepapaymentmethodhandler",sofort:"handler_adyen_sofortpaymentmethodhandler",paypal:"handler_adyen_paypalpaymentmethodhandler",oneclick:"handler_adyen_oneclickpaymentmethodhandler",giropay:"handler_adyen_giropaypaymentmethodhandler",applepay:"handler_adyen_applepaypaymentmethodhandler",paywithgoogle:"handler_adyen_googlepaypaymentmethodhandler",dotpay:"handler_adyen_dotpaypaymentmethodhandler",bcmc:"handler_adyen_bancontactcardpaymentmethodhandler",amazonpay:"handler_adyen_amazonpaypaymentmethodhandler",twint:"handler_adyen_twintpaymentmethodhandler",eps:"handler_adyen_epspaymentmethodhandler",swish:"handler_adyen_swishpaymentmethodhandler",alipay:"handler_adyen_alipaypaymentmethodhandler",alipay_hk:"handler_adyen_alipayhkpaymentmethodhandler",blik:"handler_adyen_blikpaymentmethodhandler",clearpay:"handler_adyen_clearpaypaymentmethodhandler",facilypay_3x:"handler_adyen_facilypay3xpaymentmethodhandler",facilypay_4x:"handler_adyen_facilypay4xpaymentmethodhandler",facilypay_6x:"handler_adyen_facilypay6xpaymentmethodhandler",facilypay_10x:"handler_adyen_facilypay10xpaymentmethodhandler",facilypay_12x:"handler_adyen_facilypay12xpaymentmethodhandler",afterpay_default:"handler_adyen_afterpaydefaultpaymentmethodhandler",trustly:"handler_adyen_trustlypaymentmethodhandler",paysafecard:"handler_adyen_paysafecardpaymentmethodhandler"}}},j5lx:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return v}));var a=n("FGIj"),o=n("gHbT"),r=n("p4AR"),i=n("2Y4b"),d=n("u0Tz"),l=n("YcTq");function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(){return(c=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=adyenCheckoutOptions.orderId,a=null,o=null;n?(e.set("orderId",n),a=adyenCheckoutOptions.updatePaymentUrl,o=this.afterSetPayment.bind(this,t)):(a=adyenCheckoutOptions.checkoutOrderUrl,o=this.afterCreateOrder.bind(this,t)),this._client.post(a,e,o)}},{key:"afterCreateOrder",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;try{e=JSON.parse(n)}catch(e){return d.a.remove(document.body),void console.log("Error: invalid response from Shopware API",n)}this.orderId=e.id,this.finishUrl=new URL(location.origin+adyenCheckoutOptions.paymentFinishUrl),this.finishUrl.searchParams.set("orderId",e.id),this.errorUrl=new URL(location.origin+adyenCheckoutOptions.paymentErrorUrl),this.errorUrl.searchParams.set("orderId",e.id);var a={orderId:this.orderId,finishUrl:this.finishUrl.toString(),errorUrl:this.errorUrl.toString()};for(var o in t)a[o]=t[o];this._client.post(adyenCheckoutOptions.paymentHandleUrl,JSON.stringify(a),this.afterPayOrder.bind(this,this.orderId))}},{key:"afterSetPayment",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;try{var n=JSON.parse(t);n.success&&this.afterCreateOrder(e,JSON.stringify({id:adyenCheckoutOptions.orderId}))}catch(e){return d.a.remove(document.body),void console.log("Error: invalid response from Shopware API",t)}}},{key:"afterPayOrder",value:function(e,t){try{t=JSON.parse(t),this.returnUrl=t.redirectUrl}catch(e){return d.a.remove(document.body),void console.log("Error: invalid response from Shopware API",t)}this.returnUrl===this.errorUrl.toString()&&(location.href=this.returnUrl);try{this._client.post("".concat(adyenCheckoutOptions.paymentStatusUrl),JSON.stringify({orderId:e}),this.responseHandler.bind(this))}catch(e){console.log(e)}}},{key:"handlePaymentAction",value:function(t){e("[data-adyen-payment-component-modal]").modal().hide();try{var n=JSON.parse(t);n.isFinal&&(location.href=this.returnUrl),n.action&&(this.adyenCheckout.createFromAction(n.action).mount("[data-adyen-payment-action-container]"),["threeDS2","qrCode"].includes(n.action.type)&&e("[data-adyen-payment-action-modal]").modal({show:!0}))}catch(e){console.log(e)}}},{key:"initializeCustomPayButton",value:function(){var e=this,t=this.getSelectedPaymentMethodKey();if(t in l.a.componentsWithPayButton){var n=l.a.componentsWithPayButton[t];this.completePendingPayment(t,n);var a=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter((function(e){return e.type===t}));if(!(a.length<1)){var o=a[0];if(adyenCheckoutOptions.amount)if(n.prePayRedirect)this.renderPrePaymentButton(n,o);else{var r=c(n.extra,o,{amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},onClick:function(t,a){if(!n.onClick(t,a,e))return!1;d.a.create(document.body)},onSubmit:function(e,t){if(e.isValid){var a={stateData:JSON.stringify(e.data)},o=i.a.serialize(this.confirmOrderForm);"responseHandler"in n&&(this.responseHandler=n.responseHandler.bind(t,this)),this.confirmOrder(o,a)}else t.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",e)}.bind(this),onCancel:function(t,a){d.a.remove(document.body),n.onCancel(t,a,e)},onError:function(t,a){d.a.remove(document.body),n.onError(t,a,e),console.log(t)}}),y=this.adyenCheckout.create(o.type,r);try{"isAvailable"in y?y.isAvailable().then(function(){this.mountCustomPayButton(y)}.bind(this)).catch((function(e){console.log(o.type+" is not available",e)})):this.mountCustomPayButton(y)}catch(e){console.log(e)}}else console.error("Failed to fetch Cart/Order total amount.")}}}},{key:"renderPrePaymentButton",value:function(e,t){var n=this,a=c(e.extra,t,{configuration:t.configuration,amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},onClick:function(t,a){if(!e.onClick(t,a,n))return!1;d.a.create(document.body)},onError:function(t,a){d.a.remove(document.body),e.onError(t,a,n),console.log(t)}}),o=this.adyenCheckout.create(t.type,a);this.mountCustomPayButton(o)}},{key:"completePendingPayment",value:function(e,t){var n=new URL(location.href);if(n.searchParams.has(t.sessionKey)){var a;d.a.create(document.body);var o=this.adyenCheckout.create(e,(s(a={},t.sessionKey,n.searchParams.get(t.sessionKey)),s(a,"showOrderButton",!1),s(a,"onSubmit",function(e,t){if(e.isValid){var n={stateData:JSON.stringify(e.data)},a=i.a.serialize(this.confirmOrderForm);this.confirmOrder(a,n)}}.bind(this)),a));this.mountCustomPayButton(o),o.submit()}}},{key:"getSelectedPaymentMethodKey",value:function(){return Object.keys(l.a.paymentMethodTypeHandlers).find((function(e){return l.a.paymentMethodTypeHandlers[e]===adyenCheckoutOptions.selectedPaymentMethodHandler}))}},{key:"mountCustomPayButton",value:function(t){var n=e('
');e("#confirmOrderForm").append(n),t.mount(n.get(0)),e("#confirmOrderForm button[type=submit]").remove()}},{key:"mountPaymentComponent",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=c(e,{onSubmit:function(e,t){if(this.paymentComponent.find(".loader").show(),this.paymentComponent.find("[data-adyen-payment-container]").hide(),e.isValid){var n={stateData:JSON.stringify(e.data)},a=i.a.serialize(this.confirmOrderForm);this.confirmOrder(a,n)}else t.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",e)}.bind(this)});n||"scheme"!==e.type||(a.enableStoreDetails=!0);try{var o=this.adyenCheckout.create(e.type,a);o.mount(this.paymentComponent.find(t).get(0)),this.paymentComponent.find(".loader").hide()}catch(t){return console.error(e.type,t),!1}}}])&&u(a.prototype,y),v&&u(a,v),n}(a.a)}).call(this,n("UoTJ"))},jC4o:function(e,t,n){"use strict";n.r(t);var a=n("j5lx");window.PluginManager.register("ConfirmOrderPlugin",a.a,"[data-adyen-payment]")}},[["jC4o","runtime","vendor-node","vendor-shared"]]]); \ No newline at end of file diff --git a/src/Resources/app/storefront/src/checkout/confirm-order.plugin.js b/src/Resources/app/storefront/src/checkout/confirm-order.plugin.js index 0d74b9da..50f9914e 100644 --- a/src/Resources/app/storefront/src/checkout/confirm-order.plugin.js +++ b/src/Resources/app/storefront/src/checkout/confirm-order.plugin.js @@ -33,7 +33,6 @@ export default class ConfirmOrderPlugin extends Plugin { init() { this._client = new StoreApiClient(); - this.stateData = null; const { locale, clientKey, environment, paymentMethodsResponse } = adyenCheckoutConfiguration; const ADYEN_CHECKOUT_CONFIG = { locale, @@ -97,6 +96,7 @@ export default class ConfirmOrderPlugin extends Plugin { if (adyenConfiguration.updatablePaymentMethods.includes(selectedAdyenPaymentMethod) && !this.stateData) { // render component to collect payment data this.renderPaymentComponent(selectedAdyenPaymentMethod); + $('[data-adyen-payment-component-modal]').modal({show: true}); return; } @@ -121,8 +121,6 @@ export default class ConfirmOrderPlugin extends Plugin { // Mount payment method instance this.mountPaymentComponent(paymentMethod, '[data-adyen-payment-container]', false); - - $('[data-adyen-payment-component-modal]').modal({show: true}); } renderStoredPaymentMethodComponents() { @@ -136,8 +134,6 @@ export default class ConfirmOrderPlugin extends Plugin { this.showSelectedStoredPaymentMethod(); $('[name=adyenStoredPaymentMethodId]').change(this.showSelectedStoredPaymentMethod); - - $('[data-adyen-payment-component-modal]').modal({show: true}); } showSelectedStoredPaymentMethod() { diff --git a/src/Resources/app/storefront/src/scss/modal.scss b/src/Resources/app/storefront/src/scss/modal.scss index 9eece9da..20e7ecfc 100644 --- a/src/Resources/app/storefront/src/scss/modal.scss +++ b/src/Resources/app/storefront/src/scss/modal.scss @@ -24,7 +24,7 @@ height: calc(100% - 3.5rem); .modal-content { - min-height: 5em; + height: 80%; } } diff --git a/src/Resources/views/storefront/component/payment/payment-component-modal.html.twig b/src/Resources/views/storefront/component/payment/payment-component-modal.html.twig index 4608333e..25a18aaa 100644 --- a/src/Resources/views/storefront/component/payment/payment-component-modal.html.twig +++ b/src/Resources/views/storefront/component/payment/payment-component-modal.html.twig @@ -6,14 +6,36 @@ >