diff --git a/composer.json b/composer.json index 1dea0e61..b4460e50 100644 --- a/composer.json +++ b/composer.json @@ -6,13 +6,13 @@ } ], "description": "Official Shopware 6 Plugin to connect to Payment Service Provider Adyen", - "version": "3.14.2", + "version": "3.14.3", "type": "shopware-platform-plugin", "license": "MIT", "require": { - "shopware/core": "^6.4.0.0 || ^6.5.0.0", - "shopware/storefront": "^6.4.0.0 || ^6.5.0.0", - "adyen/php-api-library": "15.0.0", + "shopware/core": "~6.4.0 || ~6.5.0", + "shopware/storefront": "~6.4.0 || ~6.5.0", + "adyen/php-api-library": "^15.0.0", "adyen/php-webhook-module": "0.8.0", "ext-json": "*" }, diff --git a/src/AdyenPaymentShopware6.php b/src/AdyenPaymentShopware6.php index bb636972..0d0a2cdf 100644 --- a/src/AdyenPaymentShopware6.php +++ b/src/AdyenPaymentShopware6.php @@ -50,31 +50,25 @@ class AdyenPaymentShopware6 extends Plugin { - public function build(ContainerBuilder $container): void - { - parent::build($container); - $this->installJsAssets($container->getParameter('kernel.shopware_version')); - } - public function installJsAssets($shopwareVersion) { $storefrontAssetPath = __DIR__ . '/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js'; $adminAssetPath = __DIR__ . '/Resources/public/administration/js/adyen-payment-shopware6.js'; if (\version_compare($shopwareVersion, '6.5.0.0', '<')) { - $resultStorefront = copy( + $resultStorefront = $this->safeCopyAsset( __DIR__ . '/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware64.js.dist', $storefrontAssetPath ); - $resultAdmin = copy( + $resultAdmin = $this->safeCopyAsset( __DIR__ . '/Resources/public/administration/js/adyen-payment-shopware64.js.dist', $adminAssetPath ); } else { - $resultStorefront = copy( + $resultStorefront = $this->safeCopyAsset( __DIR__ . '/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware65.js.dist', $storefrontAssetPath ); - $resultAdmin = copy( + $resultAdmin = $this->safeCopyAsset( __DIR__ . '/Resources/public/administration/js/adyen-payment-shopware64.js.dist', $adminAssetPath ); @@ -103,6 +97,7 @@ public function install(InstallContext $installContext): void public function activate(ActivateContext $activateContext): void { + $this->installJsAssets($activateContext->getCurrentShopwareVersion()); foreach (PaymentMethods\PaymentMethods::PAYMENT_METHODS as $paymentMethod) { $this->setPaymentMethodIsActive(true, $activateContext->getContext(), new $paymentMethod()); } @@ -568,6 +563,15 @@ private function updateTo3100(UpdateContext $updateContext): void ); } } + + private function safeCopyAsset($source, $destination): bool + { + try { + return copy($source, $destination); + } catch (\Exception $e) { + return false; + } + } } if (file_exists(__DIR__ . '/../vendor/autoload.php')) { 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 8b43d145..13220282 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"],{HNRU:function(e,t,n){"use strict";t.a={updatablePaymentMethods:["scheme","ideal","sepadirectdebit","oneclick","dotpay","bcmc","bcmc_mobile","blik","eps","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","afterpay_default","ratepay","ratepay_directdebit","giftcard","paybright","affirm","multibanco","mbway","vipps","mobilepay","wechatpayQR","wechatpayWeb","paybybank"],componentsWithPayButton:{applepay:{extra:{},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)}},googlepay:{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:"PayAndShip",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",googlepay:"handler_adyen_googlepaypaymentmethodhandler",dotpay:"handler_adyen_dotpaypaymentmethodhandler",bcmc:"handler_adyen_bancontactcardpaymentmethodhandler",bcmc_mobile:"handler_adyen_bancontactmobilepaymentmethodhandler",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",givex:"handler_adyen_givexgiftcardpaymentmethodhandler",webshopgiftcard:"handler_adyen_webshopgiftcardpaymentmethodhandler",kadowereld:"handler_adyen_kadowereldgiftcardpaymentmethodhandler",tcstestgiftcard:"handler_adyen_tcstestgiftcardpaymentmethodhandler",albelligiftcard:"handler_adyen_albelligiftcardpaymentmethodhandler",bijcadeaucard:"handler_adyen_bijenkorfgiftcardpaymentmethodhandler",vvvgiftcard:"handler_adyen_vvvgiftcardpaymentmethodhandler",genericgiftcard:"handler_adyen_genericgiftcardpaymentmethodhandler",gallgall:"handler_adyen_gallgallgiftcardpaymentmethodhandler",hmlingerie:"handler_adyen_hunkemollerlingeriegiftcardpaymentmethodhandler",beautycadeaukaart:"handler_adyen_beautygiftcardpaymentmethodhandler",svs:"handler_adyen_svsgiftcardpaymentmethodhandler",fashioncheque:"handler_adyen_fashionchequegiftcardpaymentmethodhandler",decadeaukaart:"handler_adyen_decadeaukaartgiftcardpaymentmethodhandler",mbway:"handler_adyen_mbwaypaymentmethodhandler",multibanco:"handler_adyen_multibancopaymentmethodhandler",wechatpayQR:"handler_adyen_wechatpayqrpaymentmethodhandler",wechatpayWeb:"handler_adyen_wechatpaywebpaymentmethodhandler",mobilepay:"handler_adyen_mobilepaypaymentmethodhandler",vipps:"handler_adyen_vippspaymentmethodhandler",affirm:"handler_adyen_affirmpaymentmethodhandler",paybright:"handler_adyen_paybrightpaymentmethodhandler",paybybank:"handler_adyen_openbankingpaymentmethodhandler"}}},TVZM:function(e,t,n){"use strict";n.r(t);var a=n("FGIj"),r=n("gHbT"),o=n("k8s9"),i=n("u0Tz");function c(e){return(c="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 d(){return(d=Object.assign||function(e){for(var t=1;t0)){this.paymentMethodInstance&&this.paymentMethodInstance.unmount(),i.a.create(r.a.querySelector(document,"#adyen-giftcard-component")),this.giftcardHeader.innerHTML=e.name,this.giftcardComponentClose.style.display="block";var t=d({},e,{showPayButton:!0,onBalanceCheck:this.handleBalanceCheck.bind(this)});try{this.paymentMethodInstance=this.adyenCheckout.create("giftcard",t),this.paymentMethodInstance.mount("#adyen-giftcard-component")}catch(e){console.log("giftcard not available")}i.a.remove(r.a.querySelector(document,"#adyen-giftcard-component"))}}},{key:"handleBalanceCheck",value:function(e,t,n){var a={};a.paymentMethod=JSON.stringify(n.paymentMethod),a.amount=JSON.stringify({currency:adyenGiftcardsConfiguration.currency,value:adyenGiftcardsConfiguration.totalInMinorUnits}),this._client.post("".concat(adyenGiftcardsConfiguration.checkBalanceUrl),JSON.stringify(a),function(e){if((e=JSON.parse(e)).hasOwnProperty("pspReference")){var a=e.transactionLimit?parseFloat(e.transactionLimit.value):parseFloat(e.balance.value),r=a-adyenGiftcardsConfiguration.totalInMinorUnits;a>=adyenGiftcardsConfiguration.totalInMinorUnits?(this.remainingGiftcardBalance=(r/this.minorUnitsQuotient).toFixed(2),this.setGiftcardAsPaymentMethod(n,r)):(this.remainingAmount=((adyenGiftcardsConfiguration.totalInMinorUnits-a)/this.minorUnitsQuotient).toFixed(2),this.saveGiftcardStateData(n,a.toString(),0,this.selectedGiftcard.id)),this.remainingBalanceField.style.display="block";var o=adyenGiftcardsConfiguration.translationAdyenGiftcardRemainingBalance+": "+adyenGiftcardsConfiguration.currencySymbol+this.remainingGiftcardBalance;this.remainingBalanceField.innerHTML=o}else console.error(e.resultCode),t(e.resultCode)}.bind(this))}},{key:"saveGiftcardStateData",value:function(e,t,n,a){e=JSON.stringify(e),this._client.post(adyenGiftcardsConfiguration.setGiftcardUrl,JSON.stringify({stateData:e,amount:t,balance:n,paymentMethodId:a}),function(e){"paymentMethodId"in(e=JSON.parse(e))&&(this.giftcardDiscount=(t/this.minorUnitsQuotient).toFixed(2),this.remainingAmount=(adyenGiftcardsConfiguration.totalPrice-this.giftcardDiscount).toFixed(2),this.onGiftcardSelected(),i.a.remove(document.body))}.bind(this))}},{key:"setGiftcardAsPaymentMethod",value:function(e,t){this._client.patch(adyenGiftcardsConfiguration.switchContextUrl,JSON.stringify({paymentMethodId:this.selectedGiftcard.id}),function(n){this.saveGiftcardStateData(e,adyenGiftcardsConfiguration.totalInMinorUnits,t,this.selectedGiftcard.id)}.bind(this))}},{key:"removeGiftcard",value:function(){i.a.create(document.body),this._client.post(adyenGiftcardsConfiguration.removeGiftcardUrl,new FormData,function(e){if("token"in(e=JSON.parse(e))){if(this.giftcardDiscount=0,this.remainingAmount=(adyenGiftcardsConfiguration.totalPrice-this.giftcardDiscount).toFixed(2),this.shoppingCartSummaryBlock.length)for(var t=this.shoppingCartSummaryBlock[0].querySelectorAll(".adyen-giftcard-summary"),n=0;n
'+adyenGiftcardsConfiguration.currencySymbol+this.giftcardDiscount+'
'+adyenGiftcardsConfiguration.translationAdyenGiftcardRemainingAmount+'
'+adyenGiftcardsConfiguration.currencySymbol+this.remainingAmount+"
";this.shoppingCartSummaryBlock[0].innerHTML+=e}}},{key:"onGiftcardSelected",value:function(){this.paymentMethodInstance&&this.paymentMethodInstance.unmount(),this.giftcardComponentClose.style.display="none";for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:null;this.hideStorePaymentMethodComponents(),t=e?e.target.value:t;var n='[data-adyen-stored-payment-method-id="'.concat(t,'"]'),a=o.a.querySelector(document,n);a.style.display="block"}},{key:"hideStorePaymentMethodComponents",value:function(){o.a.querySelectorAll(document,".stored-payment-component").forEach((function(e){e.style.display="none"}))}},{key:"confirmOrder",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=adyenCheckoutOptions.orderId;e.set("affiliateCode",adyenCheckoutOptions.affiliateCode),e.set("campaignCode",adyenCheckoutOptions.campaignCode),n?this.updatePayment(e,n,t):this.createOrder(e,t)}},{key:"updatePayment",value:function(e,t,n){e.set("orderId",t),this._client.post(adyenCheckoutOptions.updatePaymentUrl,e,this.afterSetPayment.bind(this,n))}},{key:"createOrder",value:function(e,t){parseInt(adyenCheckoutOptions.giftcardDiscount,10)&&!parseInt(adyenCheckoutOptions.payInFullWithGiftcard,10)?this._client.post(adyenCheckoutOptions.createOrderUrl,JSON.stringify({orderAmount:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency}),function(n){var a=JSON.parse(n);"Success"===a.resultCode&&(t=y(t,{order:a})),this._client.post(adyenCheckoutOptions.checkoutOrderUrl,e,this.afterCreateOrder.bind(this,t))}.bind(this)):this._client.post(adyenCheckoutOptions.checkoutOrderUrl,e,this.afterCreateOrder.bind(this,t))}},{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 r in t)a[r]=t[r];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){try{var n=JSON.parse(t);if((n.isFinal||"voucher"===n.action.type)&&(location.href=this.returnUrl),n.action){var r={};"threeDS2"===n.action.type&&(r.challengeWindowSize="05"),this.adyenCheckout.createFromAction(n.action,r).mount("[data-adyen-payment-action-container]"),["threeDS2","qrCode"].includes(n.action.type)&&(e?a("[data-adyen-payment-action-modal]").modal({show:!0}):new bootstrap.Modal(document.getElementById("adyen-payment-action-modal"),{keyboard:!1}).show())}}catch(e){console.log(e)}}},{key:"initializeCustomPayButton",value:function(){var e=this,t=s.a.componentsWithPayButton[this.selectedAdyenPaymentMethod];this.completePendingPayment(this.selectedAdyenPaymentMethod,t);var n=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter((function(t){return t.type===e.selectedAdyenPaymentMethod}));if(n.length<1&&"googlepay"===this.selectedAdyenPaymentMethod&&(n=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter((function(e){return"paywithgoogle"===e.type}))),!(n.length<1)){var a=n[0];if(adyenCheckoutOptions.amount)if(t.prePayRedirect)this.renderPrePaymentButton(t,a);else{var r=y(t.extra,a,{amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},data:{personalDetails:shopperDetails,billingAddress:activeBillingAddress,deliveryAddress:activeShippingAddress},onClick:function(n,a){if(!t.onClick(n,a,e))return!1;d.a.create(document.body)},onSubmit:function(e,n){if(e.isValid){var a={stateData:JSON.stringify(e.data)},r=c.a.serialize(this.confirmOrderForm);"responseHandler"in t&&(this.responseHandler=t.responseHandler.bind(n,this)),this.confirmOrder(r,a)}else n.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",e)}.bind(this),onCancel:function(n,a){d.a.remove(document.body),t.onCancel(n,a,e)},onError:function(n,a){"PayPal"===a.props.name&&"CANCEL"===n.name&&e._client.post("".concat(adyenCheckoutOptions.cancelOrderTransactionUrl),JSON.stringify({orderId:e.orderId})),d.a.remove(document.body),t.onError(n,a,e),console.log(n)}}),o=this.adyenCheckout.create(a.type,r);try{"isAvailable"in o?o.isAvailable().then(function(){this.mountCustomPayButton(o)}.bind(this)).catch((function(e){console.log(a.type+" is not available",e)})):this.mountCustomPayButton(o)}catch(e){console.log(e)}}else console.error("Failed to fetch Cart/Order total amount.")}}},{key:"renderPrePaymentButton",value:function(e,t){var n=this;"amazonpay"===t.type&&(e.extra=this.setAddressDetails(e.extra));var a=y(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)}}),r=this.adyenCheckout.create(t.type,a);this.mountCustomPayButton(r)}},{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 r=this.adyenCheckout.create(e,(u(a={},t.sessionKey,n.searchParams.get(t.sessionKey)),u(a,"showOrderButton",!1),u(a,"onSubmit",function(e,t){if(e.isValid){var n={stateData:JSON.stringify(e.data)},a=c.a.serialize(this.confirmOrderForm);this.confirmOrder(a,n)}}.bind(this)),a));this.mountCustomPayButton(r),r.submit()}}},{key:"getSelectedPaymentMethodKey",value:function(){return Object.keys(s.a.paymentMethodTypeHandlers).find((function(e){return s.a.paymentMethodTypeHandlers[e]===adyenCheckoutOptions.selectedPaymentMethodHandler}))}},{key:"mountCustomPayButton",value:function(e){var t=document.querySelector("#confirmOrderForm");if(t){var n=t.querySelector("button[type=submit]");if(n&&!n.disabled){var a=document.createElement("div");a.id="adyen-confirm-button",a.setAttribute("data-adyen-confirm-button",""),t.appendChild(a),e.mount(a),n.remove()}}}},{key:"mountPaymentComponent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=y({},e,{data:{personalDetails:shopperDetails,billingAddress:activeBillingAddress,deliveryAddress:activeShippingAddress},onSubmit:function(e,t){if(e.isValid){var n={stateData:JSON.stringify(e.data)},a=c.a.serialize(this.confirmOrderForm);d.a.create(document.body),this.confirmOrder(a,n)}else t.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",e)}.bind(this)});!t&&"scheme"===e.type&&adyenCheckoutOptions.displaySaveCreditCardOption&&(a.enableStoreDetails=!0);var r=t?n:"#"+this.el.id;try{var i=this.adyenCheckout.create(e.type,a);i.mount(r),this.confirmFormSubmit.addEventListener("click",function(e){o.a.querySelector(document,"#confirmOrderForm").checkValidity()&&(e.preventDefault(),this.el.parentNode.scrollIntoView({behavior:"smooth",block:"start"}),i.submit())}.bind(this))}catch(t){return console.error(e.type,t),!1}}},{key:"appendGiftcardSummary",value:function(){if(parseInt(adyenCheckoutOptions.giftcardDiscount,10)&&this.shoppingCartSummaryBlock.length){var e='
'+adyenCheckoutOptions.translationAdyenGiftcardDiscount+'
'+adyenCheckoutOptions.currencySymbol+this.giftcardDiscount+'
'+adyenCheckoutOptions.translationAdyenGiftcardRemainingAmount+'
'+adyenCheckoutOptions.currencySymbol+this.remainingAmount+"
";this.shoppingCartSummaryBlock[0].innerHTML+=e}}},{key:"setAddressDetails",value:function(e){return""!==activeShippingAddress.phoneNumber?e.addressDetails={name:shopperDetails.firstName+" "+shopperDetails.lastName,addressLine1:activeShippingAddress.street,city:activeShippingAddress.city,postalCode:activeShippingAddress.postalCode,countryCode:activeShippingAddress.country,phoneNumber:activeShippingAddress.phoneNumber}:e.productType="PayOnly",e}}])&&f(r.prototype,l),b&&f(r,b),n}(r.a)}).call(this,n("UoTJ"),n("UoTJ"))}},[["TVZM","runtime","vendor-node","vendor-shared"]]]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["adyen-payment-shopware6"],{7815:(e,t,n)=>{var a=n(6285),i=n(3206),o=n(8254),r=n(4690);class d extends a.Z{init(){let e=this;this._client=new o.Z,this.adyenCheckout=Promise,this.paymentMethodInstance=null,this.selectedGiftcard=null,this.initializeCheckoutComponent().then(function(){this.observeGiftcardSelection()}.bind(this)),this.adyenGiftcard=i.Z.querySelectorAll(document,".adyen-giftcard"),this.giftcardHeader=i.Z.querySelector(document,".adyen-giftcard-header"),this.giftcardComponentClose=i.Z.querySelector(document,".adyen-close-giftcard-component"),this.removeGiftcardButton=i.Z.querySelector(document,".adyen-remove-giftcard"),this.remainingBalanceField=i.Z.querySelector(document,".adyen-remaining-balance"),this.minorUnitsQuotient=adyenGiftcardsConfiguration.totalInMinorUnits/adyenGiftcardsConfiguration.totalPrice,this.giftcardDiscount=(adyenGiftcardsConfiguration.giftcardDiscount/this.minorUnitsQuotient).toFixed(2),this.remainingAmount=(adyenGiftcardsConfiguration.totalPrice-this.giftcardDiscount).toFixed(2),this.remainingGiftcardBalance=(adyenGiftcardsConfiguration.giftcardBalance/this.minorUnitsQuotient).toFixed(2),this.shoppingCartSummaryBlock=i.Z.querySelectorAll(document,".checkout-aside-summary-list"),this.offCanvasSummaryDetails=null,this.shoppingCartSummaryDetails=null,this.giftcardComponentClose.onclick=function(t){t.currentTarget.style.display="none",e.selectedGiftcard=null,e.giftcardHeader.innerHTML=" ",e.paymentMethodInstance&&e.paymentMethodInstance.unmount()},this.removeGiftcardButton.onclick=function(t){e.removeGiftcard()},window.addEventListener("DOMContentLoaded",(e=>{parseInt(adyenGiftcardsConfiguration.giftcardDiscount,10)&&this.onGiftcardSelected()}))}async initializeCheckoutComponent(){const{locale:e,clientKey:t,environment:n}=adyenCheckoutConfiguration,a={locale:e,clientKey:t,environment:n,amount:{currency:adyenGiftcardsConfiguration.currency,value:adyenGiftcardsConfiguration.totalInMinorUnits}};this.adyenCheckout=await AdyenCheckout(a)}observeGiftcardSelection(){let e=this;for(let t=0;t0)return;this.paymentMethodInstance&&this.paymentMethodInstance.unmount(),r.Z.create(i.Z.querySelector(document,"#adyen-giftcard-component")),this.giftcardHeader.innerHTML=e.name,this.giftcardComponentClose.style.display="block";const t=Object.assign({},e,{showPayButton:!0,onBalanceCheck:this.handleBalanceCheck.bind(this)});try{this.paymentMethodInstance=this.adyenCheckout.create("giftcard",t),this.paymentMethodInstance.mount("#adyen-giftcard-component")}catch(e){console.log("giftcard not available")}r.Z.remove(i.Z.querySelector(document,"#adyen-giftcard-component"))}handleBalanceCheck(e,t,n){let a={};a.paymentMethod=JSON.stringify(n.paymentMethod),a.amount=JSON.stringify({currency:adyenGiftcardsConfiguration.currency,value:adyenGiftcardsConfiguration.totalInMinorUnits}),this._client.post(`${adyenGiftcardsConfiguration.checkBalanceUrl}`,JSON.stringify(a),function(e){if((e=JSON.parse(e)).hasOwnProperty("pspReference")){const t=e.transactionLimit?parseFloat(e.transactionLimit.value):parseFloat(e.balance.value);let a=t-adyenGiftcardsConfiguration.totalInMinorUnits;t>=adyenGiftcardsConfiguration.totalInMinorUnits?(this.remainingGiftcardBalance=(a/this.minorUnitsQuotient).toFixed(2),this.setGiftcardAsPaymentMethod(n,a)):(this.remainingAmount=((adyenGiftcardsConfiguration.totalInMinorUnits-t)/this.minorUnitsQuotient).toFixed(2),this.saveGiftcardStateData(n,t.toString(),0,this.selectedGiftcard.id)),this.remainingBalanceField.style.display="block";let i=adyenGiftcardsConfiguration.translationAdyenGiftcardRemainingBalance+": "+adyenGiftcardsConfiguration.currencySymbol+this.remainingGiftcardBalance;this.remainingBalanceField.innerHTML=i}else console.error(e.resultCode),t(e.resultCode)}.bind(this))}saveGiftcardStateData(e,t,n,a){e=JSON.stringify(e),this._client.post(adyenGiftcardsConfiguration.setGiftcardUrl,JSON.stringify({stateData:e,amount:t,balance:n,paymentMethodId:a}),function(e){"paymentMethodId"in(e=JSON.parse(e))&&(this.giftcardDiscount=(t/this.minorUnitsQuotient).toFixed(2),this.remainingAmount=(adyenGiftcardsConfiguration.totalPrice-this.giftcardDiscount).toFixed(2),this.onGiftcardSelected(),r.Z.remove(document.body))}.bind(this))}setGiftcardAsPaymentMethod(e,t){this._client.patch(adyenGiftcardsConfiguration.switchContextUrl,JSON.stringify({paymentMethodId:this.selectedGiftcard.id}),function(n){this.saveGiftcardStateData(e,adyenGiftcardsConfiguration.totalInMinorUnits,t,this.selectedGiftcard.id)}.bind(this))}removeGiftcard(){r.Z.create(document.body),this._client.post(adyenGiftcardsConfiguration.removeGiftcardUrl,new FormData,function(e){if("token"in(e=JSON.parse(e))){if(this.giftcardDiscount=0,this.remainingAmount=(adyenGiftcardsConfiguration.totalPrice-this.giftcardDiscount).toFixed(2),this.shoppingCartSummaryBlock.length){let e=this.shoppingCartSummaryBlock[0].querySelectorAll(".adyen-giftcard-summary");for(let t=0;t
'+adyenGiftcardsConfiguration.currencySymbol+this.giftcardDiscount+'
'+adyenGiftcardsConfiguration.translationAdyenGiftcardRemainingAmount+'
'+adyenGiftcardsConfiguration.currencySymbol+this.remainingAmount+"
";this.shoppingCartSummaryBlock[0].innerHTML+=e}}onGiftcardSelected(){this.paymentMethodInstance&&this.paymentMethodInstance.unmount(),this.giftcardComponentClose.style.display="none";for(var e=0;e{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",googlepay:"handler_adyen_googlepaypaymentmethodhandler",dotpay:"handler_adyen_dotpaypaymentmethodhandler",bcmc:"handler_adyen_bancontactcardpaymentmethodhandler",bcmc_mobile:"handler_adyen_bancontactmobilepaymentmethodhandler",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",givex:"handler_adyen_givexgiftcardpaymentmethodhandler",webshopgiftcard:"handler_adyen_webshopgiftcardpaymentmethodhandler",kadowereld:"handler_adyen_kadowereldgiftcardpaymentmethodhandler",tcstestgiftcard:"handler_adyen_tcstestgiftcardpaymentmethodhandler",albelligiftcard:"handler_adyen_albelligiftcardpaymentmethodhandler",bijcadeaucard:"handler_adyen_bijenkorfgiftcardpaymentmethodhandler",vvvgiftcard:"handler_adyen_vvvgiftcardpaymentmethodhandler",genericgiftcard:"handler_adyen_genericgiftcardpaymentmethodhandler",gallgall:"handler_adyen_gallgallgiftcardpaymentmethodhandler",hmlingerie:"handler_adyen_hunkemollerlingeriegiftcardpaymentmethodhandler",beautycadeaukaart:"handler_adyen_beautygiftcardpaymentmethodhandler",svs:"handler_adyen_svsgiftcardpaymentmethodhandler",fashioncheque:"handler_adyen_fashionchequegiftcardpaymentmethodhandler",decadeaukaart:"handler_adyen_decadeaukaartgiftcardpaymentmethodhandler",mbway:"handler_adyen_mbwaypaymentmethodhandler",multibanco:"handler_adyen_multibancopaymentmethodhandler",wechatpayQR:"handler_adyen_wechatpayqrpaymentmethodhandler",wechatpayWeb:"handler_adyen_wechatpaywebpaymentmethodhandler",mobilepay:"handler_adyen_mobilepaypaymentmethodhandler",vipps:"handler_adyen_vippspaymentmethodhandler",affirm:"handler_adyen_affirmpaymentmethodhandler",paybright:"handler_adyen_paybrightpaymentmethodhandler",paybybank:"handler_adyen_openbankingpaymentmethodhandler"}};class l extends a.Z{init(){this._client=new o.Z,this.selectedAdyenPaymentMethod=this.getSelectedPaymentMethodKey(),this.confirmOrderForm=i.Z.querySelector(document,"#confirmOrderForm"),this.confirmFormSubmit=i.Z.querySelector(document,'#confirmOrderForm button[type="submit"]'),this.shoppingCartSummaryBlock=i.Z.querySelectorAll(document,".checkout-aside-summary-list"),this.minorUnitsQuotient=adyenCheckoutOptions.amount/adyenCheckoutOptions.totalPrice,this.giftcardDiscount=(adyenCheckoutOptions.giftcardDiscount/this.minorUnitsQuotient).toFixed(2),this.remainingAmount=(adyenCheckoutOptions.totalPrice-this.giftcardDiscount).toFixed(2),this.responseHandler=this.handlePaymentAction,this.adyenCheckout=Promise,this.initializeCheckoutComponent().then(function(){adyenCheckoutOptions.selectedPaymentMethodPluginId===adyenCheckoutOptions.adyenPluginId&&(adyenCheckoutOptions&&adyenCheckoutOptions.paymentStatusUrl&&adyenCheckoutOptions.checkoutOrderUrl&&adyenCheckoutOptions.paymentHandleUrl?(this.selectedAdyenPaymentMethod in c.componentsWithPayButton&&this.initializeCustomPayButton(),c.updatablePaymentMethods.includes(this.selectedAdyenPaymentMethod)&&!this.stateData?this.renderPaymentComponent(this.selectedAdyenPaymentMethod):this.confirmFormSubmit.addEventListener("click",this.onConfirmOrderSubmit.bind(this))):console.error("Adyen payment configuration missing."))}.bind(this)),parseInt(adyenCheckoutOptions.payInFullWithGiftcard,10)?parseInt(adyenCheckoutOptions.adyenGiftcardSelected,10)&&this.appendGiftcardSummary():this.appendGiftcardSummary()}async initializeCheckoutComponent(){const{locale:e,clientKey:t,environment:n,merchantAccount:a}=adyenCheckoutConfiguration,i=adyenCheckoutOptions.paymentMethodsResponse,o={locale:e,clientKey:t,environment:n,showPayButton:this.selectedAdyenPaymentMethod in c.componentsWithPayButton,hasHolderName:!0,paymentMethodsResponse:JSON.parse(i),onAdditionalDetails:this.handleOnAdditionalDetails.bind(this),countryCode:activeShippingAddress.country,paymentMethodsConfiguration:{card:{hasHolderName:!0,clickToPayConfiguration:{merchantDisplayName:a,shopperEmail:shopperDetails.shopperEmail}}}};this.adyenCheckout=await AdyenCheckout(o)}handleOnAdditionalDetails(e){this._client.post(`${adyenCheckoutOptions.paymentDetailsUrl}`,JSON.stringify({orderId:this.orderId,stateData:JSON.stringify(e.data)}),function(e){200===this._client._request.status?this.responseHandler(e):location.href=this.errorUrl.toString()}.bind(this))}onConfirmOrderSubmit(e){const t=i.Z.querySelector(document,"#confirmOrderForm");if(!t.checkValidity())return;e.preventDefault(),r.Z.create(document.body);const n=s.Z.serialize(t);this.confirmOrder(n)}renderPaymentComponent(e){if("oneclick"===e)return void this.renderStoredPaymentMethodComponents();let t=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter((function(t){return t.type===e}));if(0===t.length)return void("test"===this.adyenCheckout.options.environment&&console.error("Payment method configuration not found. ",e));let n=t[0];this.mountPaymentComponent(n,!1)}renderStoredPaymentMethodComponents(){this.adyenCheckout.paymentMethodsResponse.storedPaymentMethods.forEach((e=>{let t=`[data-adyen-stored-payment-method-id="${e.id}"]`;this.mountPaymentComponent(e,!0,t)})),this.hideStorePaymentMethodComponents();let e=null;i.Z.querySelectorAll(document,"[name=adyenStoredPaymentMethodId]").forEach((t=>{e||(e=t.value),t.addEventListener("change",this.showSelectedStoredPaymentMethod.bind(this))})),this.showSelectedStoredPaymentMethod(null,e)}showSelectedStoredPaymentMethod(e,t=null){this.hideStorePaymentMethodComponents();let n=`[data-adyen-stored-payment-method-id="${t=e?e.target.value:t}"]`;i.Z.querySelector(document,n).style.display="block"}hideStorePaymentMethodComponents(){i.Z.querySelectorAll(document,".stored-payment-component").forEach((e=>{e.style.display="none"}))}confirmOrder(e,t={}){const n=adyenCheckoutOptions.orderId;e.set("affiliateCode",adyenCheckoutOptions.affiliateCode),e.set("campaignCode",adyenCheckoutOptions.campaignCode),n?this.updatePayment(e,n,t):this.createOrder(e,t)}updatePayment(e,t,n){e.set("orderId",t),this._client.post(adyenCheckoutOptions.updatePaymentUrl,e,this.afterSetPayment.bind(this,n))}createOrder(e,t){parseInt(adyenCheckoutOptions.giftcardDiscount,10)&&!parseInt(adyenCheckoutOptions.payInFullWithGiftcard,10)?this._client.post(adyenCheckoutOptions.createOrderUrl,JSON.stringify({orderAmount:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency}),function(n){const a=JSON.parse(n);"Success"===a.resultCode&&(t=Object.assign(t,{order:a})),this._client.post(adyenCheckoutOptions.checkoutOrderUrl,e,this.afterCreateOrder.bind(this,t))}.bind(this)):this._client.post(adyenCheckoutOptions.checkoutOrderUrl,e,this.afterCreateOrder.bind(this,t))}afterCreateOrder(e={},t){let n;try{n=JSON.parse(t)}catch(e){return r.Z.remove(document.body),void console.log("Error: invalid response from Shopware API",t)}this.orderId=n.id,this.finishUrl=new URL(location.origin+adyenCheckoutOptions.paymentFinishUrl),this.finishUrl.searchParams.set("orderId",n.id),this.errorUrl=new URL(location.origin+adyenCheckoutOptions.paymentErrorUrl),this.errorUrl.searchParams.set("orderId",n.id);let a={orderId:this.orderId,finishUrl:this.finishUrl.toString(),errorUrl:this.errorUrl.toString()};for(const t in e)a[t]=e[t];this._client.post(adyenCheckoutOptions.paymentHandleUrl,JSON.stringify(a),this.afterPayOrder.bind(this,this.orderId))}afterSetPayment(e={},t){try{JSON.parse(t).success&&this.afterCreateOrder(e,JSON.stringify({id:adyenCheckoutOptions.orderId}))}catch(e){return r.Z.remove(document.body),void console.log("Error: invalid response from Shopware API",t)}}afterPayOrder(e,t){try{t=JSON.parse(t),this.returnUrl=t.redirectUrl}catch(e){return r.Z.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(`${adyenCheckoutOptions.paymentStatusUrl}`,JSON.stringify({orderId:e}),this.responseHandler.bind(this))}catch(e){console.log(e)}}handlePaymentAction(e){try{const t=JSON.parse(e);if((t.isFinal||"voucher"===t.action.type)&&(location.href=this.returnUrl),t.action){const e={};"threeDS2"===t.action.type&&(e.challengeWindowSize="05"),this.adyenCheckout.createFromAction(t.action,e).mount("[data-adyen-payment-action-container]");if(["threeDS2","qrCode"].includes(t.action.type))if(window.jQuery)$("[data-adyen-payment-action-modal]").modal({show:!0});else new bootstrap.Modal(document.getElementById("adyen-payment-action-modal"),{keyboard:!1}).show()}}catch(e){console.log(e)}}initializeCustomPayButton(){const e=c.componentsWithPayButton[this.selectedAdyenPaymentMethod];this.completePendingPayment(this.selectedAdyenPaymentMethod,e);let t=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter((e=>e.type===this.selectedAdyenPaymentMethod));if(t.length<1&&"googlepay"===this.selectedAdyenPaymentMethod&&(t=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter((e=>"paywithgoogle"===e.type))),t.length<1)return;let n=t[0];if(!adyenCheckoutOptions.amount)return void console.error("Failed to fetch Cart/Order total amount.");if(e.prePayRedirect)return void this.renderPrePaymentButton(e,n);const a=Object.assign(e.extra,n,{amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},data:{personalDetails:shopperDetails,billingAddress:activeBillingAddress,deliveryAddress:activeShippingAddress},onClick:(t,n)=>{if(!e.onClick(t,n,this))return!1;r.Z.create(document.body)},onSubmit:function(t,n){if(t.isValid){let a={stateData:JSON.stringify(t.data)},i=s.Z.serialize(this.confirmOrderForm);"responseHandler"in e&&(this.responseHandler=e.responseHandler.bind(n,this)),this.confirmOrder(i,a)}else n.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",t)}.bind(this),onCancel:(t,n)=>{r.Z.remove(document.body),e.onCancel(t,n,this)},onError:(t,n)=>{"PayPal"===n.props.name&&"CANCEL"===t.name&&this._client.post(`${adyenCheckoutOptions.cancelOrderTransactionUrl}`,JSON.stringify({orderId:this.orderId})),r.Z.remove(document.body),e.onError(t,n,this),console.log(t)}}),i=this.adyenCheckout.create(n.type,a);try{"isAvailable"in i?i.isAvailable().then(function(){this.mountCustomPayButton(i)}.bind(this)).catch((e=>{console.log(n.type+" is not available",e)})):this.mountCustomPayButton(i)}catch(e){console.log(e)}}renderPrePaymentButton(e,t){"amazonpay"===t.type&&(e.extra=this.setAddressDetails(e.extra));const n=Object.assign(e.extra,t,{configuration:t.configuration,amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},onClick:(t,n)=>{if(!e.onClick(t,n,this))return!1;r.Z.create(document.body)},onError:(t,n)=>{r.Z.remove(document.body),e.onError(t,n,this),console.log(t)}});let a=this.adyenCheckout.create(t.type,n);this.mountCustomPayButton(a)}completePendingPayment(e,t){const n=new URL(location.href);if(n.searchParams.has(t.sessionKey)){r.Z.create(document.body);const a=this.adyenCheckout.create(e,{[t.sessionKey]:n.searchParams.get(t.sessionKey),showOrderButton:!1,onSubmit:function(e,t){if(e.isValid){let t={stateData:JSON.stringify(e.data)},n=s.Z.serialize(this.confirmOrderForm);this.confirmOrder(n,t)}}.bind(this)});this.mountCustomPayButton(a),a.submit()}}getSelectedPaymentMethodKey(){return Object.keys(c.paymentMethodTypeHandlers).find((e=>c.paymentMethodTypeHandlers[e]===adyenCheckoutOptions.selectedPaymentMethodHandler))}mountCustomPayButton(e){let t=document.querySelector("#confirmOrderForm");if(t){let n=t.querySelector("button[type=submit]");if(n&&!n.disabled){let a=document.createElement("div");a.id="adyen-confirm-button",a.setAttribute("data-adyen-confirm-button",""),t.appendChild(a),e.mount(a),n.remove()}}}mountPaymentComponent(e,t=!1,n=null){const a=Object.assign({},e,{data:{personalDetails:shopperDetails,billingAddress:activeBillingAddress,deliveryAddress:activeShippingAddress},onSubmit:function(e,t){if(e.isValid){let t={stateData:JSON.stringify(e.data)},n=s.Z.serialize(this.confirmOrderForm);r.Z.create(document.body),this.confirmOrder(n,t)}else t.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",e)}.bind(this)});!t&&"scheme"===e.type&&adyenCheckoutOptions.displaySaveCreditCardOption&&(a.enableStoreDetails=!0);let o=t?n:"#"+this.el.id;try{const t=this.adyenCheckout.create(e.type,a);t.mount(o),this.confirmFormSubmit.addEventListener("click",function(e){i.Z.querySelector(document,"#confirmOrderForm").checkValidity()&&(e.preventDefault(),this.el.parentNode.scrollIntoView({behavior:"smooth",block:"start"}),t.submit())}.bind(this))}catch(t){return console.error(e.type,t),!1}}appendGiftcardSummary(){if(parseInt(adyenCheckoutOptions.giftcardDiscount,10)&&this.shoppingCartSummaryBlock.length){let e='
'+adyenCheckoutOptions.translationAdyenGiftcardDiscount+'
'+adyenCheckoutOptions.currencySymbol+this.giftcardDiscount+'
'+adyenCheckoutOptions.translationAdyenGiftcardRemainingAmount+'
'+adyenCheckoutOptions.currencySymbol+this.remainingAmount+"
";this.shoppingCartSummaryBlock[0].innerHTML+=e}}setAddressDetails(e){return""!==activeShippingAddress.phoneNumber?e.addressDetails={name:shopperDetails.firstName+" "+shopperDetails.lastName,addressLine1:activeShippingAddress.street,city:activeShippingAddress.city,postalCode:activeShippingAddress.postalCode,countryCode:activeShippingAddress.country,phoneNumber:activeShippingAddress.phoneNumber}:e.productType="PayOnly",e}}class h extends a.Z{init(){this._client=new o.Z,this.adyenCheckout=Promise,this.initializeCheckoutComponent().bind(this)}async initializeCheckoutComponent(){const{locale:e,clientKey:t,environment:n}=adyenCheckoutConfiguration,{currency:a,values:i,backgroundUrl:o,logoUrl:r,name:d,description:s,url:c}=adyenGivingConfiguration,l={locale:e,clientKey:t,environment:n},h={amounts:{currency:a,values:i.split(",").map((e=>Number(e)))},backgroundUrl:o,logoUrl:r,description:s,name:d,url:c,showCancelButton:!0,onDonate:this.handleOnDonate.bind(this),onCancel:this.handleOnCancel.bind(this)};this.adyenCheckout=await AdyenCheckout(l),this.adyenCheckout.create("donation",h).mount("#donation-container")}handleOnDonate(e,t){const n=adyenGivingConfiguration.orderId;let a={stateData:JSON.stringify(e.data),orderId:n};a.returnUrl=window.location.href,this._client.post(`${adyenGivingConfiguration.donationEndpointUrl}`,JSON.stringify({...a}),function(e){200!==this._client._request.status?t.setStatus("error"):t.setStatus("success")}.bind(this))}handleOnCancel(){let e=adyenGivingConfiguration.continueActionUrl;window.location=e}}class y extends a.Z{init(){this.adyenCheckout=Promise,this.initializeCheckoutComponent().bind(this)}async initializeCheckoutComponent(){const{locale:e,clientKey:t,environment:n}=adyenCheckoutConfiguration,{action:a}=adyenSuccessActionConfiguration,i={locale:e,clientKey:t,environment:n};this.adyenCheckout=await AdyenCheckout(i),this.adyenCheckout.createFromAction(JSON.parse(a)).mount("#success-action-container")}}const m=window.PluginManager;m.register("CartPlugin",d,"#adyen-giftcards-container"),m.register("ConfirmOrderPlugin",l,"#adyen-payment-checkout-mask"),m.register("AdyenGivingPlugin",h,"#adyen-giving-container"),m.register("AdyenSuccessAction",y,"#adyen-success-action-container")}},e=>{e.O(0,["vendor-node","vendor-shared"],(()=>{return t=7815,e(e.s=t);var t}));e.O()}]); \ No newline at end of file diff --git a/src/Resources/public/administration/js/adyen-payment-shopware6.js b/src/Resources/public/administration/js/adyen-payment-shopware6.js index 32f52da8..b22b629c 100644 --- a/src/Resources/public/administration/js/adyen-payment-shopware6.js +++ b/src/Resources/public/administration/js/adyen-payment-shopware6.js @@ -1 +1 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/bundles/adyenpaymentshopware6/",n(n.s="RgpO")}({"6MJt":function(e,t,n){},Fxip:function(e,t,n){var r=n("xIYV");r.__esModule&&(r=r.default),"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);(0,n("SZ7m").default)("3299a05e",r,!0,{})},MTTW:function(e,t){var n=Shopware.Component,r=Shopware.Data.Criteria;n.extend("sw-entity-single-select-override","sw-entity-single-select",{props:{criteria:{type:Object,required:!1,default:function(){var e=new r(1,this.resultLimit);return e.addFilter(r.equals("stateMachine.technicalName","order_delivery.state")),e}}}})},RgpO:function(e,t,n){"use strict";n.r(t);n("UvA/");var r=Shopware,o=r.Component,a=r.Mixin;o.register("adyen-config-check-button",{template:'\n',inject:["adyenService"],mixins:[a.getByName("notification")],data:function(){return{isLoading:!1,isSaveSuccessful:!1}},computed:{pluginConfig:function(){for(var e=this.$parent;!e.hasOwnProperty("actualConfigData");)e=e.$parent;var t=e.currentSalesChannelId,n=e.actualConfigData;return Object.assign({},n.null,n[t])}},methods:{saveFinish:function(){this.isSaveSuccessful=!1},check:function(){var e=this;this.isLoading=!0,this.adyenService.check(this.pluginConfig).then((function(t){t.success?(e.isSaveSuccessful=!0,e.createNotificationSuccess({title:e.$tc("adyen.configTestTitle"),message:e.$tc("adyen.configTestSuccess")})):e.createNotificationError({title:e.$tc("adyen.configTestTitle"),message:e.$tc(t.message?t.message:"adyen.configTestFail")}),e.isLoading=!1}))}}});n("hnQ+");var i=Shopware,s=i.Component,c=i.Mixin;s.register("adyen-payment-capture",{template:'\n
\n
\n
\n {{ $tc(\'adyen.noCaptureRequests\') }}\n
\n
\n \n {{ $tc(\'adyen.sendCaptureRequest\') }}\n \n
\n \n \n \n
\n \n \n
\n
\n {{ $tc(\'adyen.error\') }}\n
\n
\n',inject:["adyenService","systemConfigApiService"],mixins:[c.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],showModal:!1,captureRequests:[],allowCapture:!1,captureEnabled:!1,errorOccurred:!1,isLoading:!0,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onSubmitCapture:function(){var e=this;this.isLoading=!0,this.adyenService.capture(this.order.id).then((function(t){t.success?(e.fetchCaptureRequests(),e.createNotificationSuccess({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.captureSuccessful")})):e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoading=!1,e.showModal=!1}))},fetchCaptureRequests:function(){var e=this;this.isLoading=!0,this.adyenService.getCaptureRequests(this.order.id).then((function(t){e.captureRequests=t,e.isCaptureAllowed()})).catch((function(){e.errorOccurred=!0,e.captureRequests=[]})).finally((function(){e.isLoading=!1}))},isManualCaptureEnabled:function(){var e=this;this.isLoading=!0,this.adyenService.isManualCaptureEnabled(this.order.id).then((function(t){e.captureEnabled=t,e.showWidget=e.adyenService.isAdyenOrder(e.order)&&e.captureEnabled})).catch((function(){e.errorOccurred=!0,e.captureEnabled=!1})).finally((function(){e.isLoading=!1}))},isCaptureAllowed:function(){var e=this;this.isLoading=!0,this.adyenService.isCaptureAllowed(this.order.id).then((function(t){e.allowCapture=t})).catch((function(){e.errorOccurred=!0,e.allowCapture=!1})).finally((function(){e.isLoading=!1}))}},beforeMount:function(){this.isManualCaptureEnabled(),this.fetchCaptureRequests()}});n("Fxip");function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n\n
\n
\n
\n {{ $tc(\'adyen.noRefundsCreated\') }}\n
\n
\n \n {{ $tc(\'sw-order.documentCard.labelCreateNew\') }}\n \n
\n \n
\n \n
\n \n
\n
\n \n \n
\n
\n {{ $tc(\'adyen.refundFetchError\') }}\n
\n \n{% endblock %}\n',inject:["adyenService"],mixins:[p.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],refundAmount:0,showModal:!1,refunds:[],allowRefund:!0,isLoadingTable:!0,errorOccurred:!1,isLoadingRefund:!1,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onRefund:function(){var e=this;this.isLoadingRefund=!0,this.adyenService.postRefund(this.order.id,this.refundAmount).then((function(t){t.success?(e.fetchRefunds(),e.createNotificationSuccess({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.refundSuccessful")})):e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoadingRefund=!1,e.showModal=!1}))},fetchRefunds:function(){var e=this;this.isLoadingTable=!0,this.adyenService.getRefunds(this.order.id).then((function(t){e.refunds=t,e.isRefundAllowed()})).catch((function(){e.errorOccurred=!0,e.refunds=[]})).finally((function(){e.isLoadingTable=!1}))},isRefundAllowed:function(){var e,t=0,n=d(this.refunds);try{for(n.s();!(e=n.n()).done;){var r=e.value;"Failed"!==r.status&&(t+=r.rawAmount)}}catch(e){n.e(e)}finally{n.f()}this.allowRefund=this.order.amountTotal>t/100},isAdyenOrder:function(){for(var e=this.order.transactions,t=!1,n=0;n\n \n \n {% block sw_data_grid_body_columns %}\n {% block sw_data_grid_column_actions %}\n \n {% endblock %}\n {% endblock %}\n \n

{{ $tc(\'adyen.noNotificationsReceived\') }}

\n
\n\n',inject:["adyenService"],mixins:[m.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{notifications:[],columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"eventCode",label:this.$tc("adyen.columnHeaders.event")},{property:"success",label:this.$tc("adyen.columnHeaders.success")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")},{property:"errorCount",label:this.$tc("adyen.columnHeaders.errorCount")},{property:"errorMessage",label:this.$tc("adyen.columnHeaders.errorMessage")}],showWidget:!1}},methods:{fetchNotifications:function(){var e=this;this.adyenService.fetchNotifications(this.order.id).then((function(t){e.notifications=t}))},onReschedule:function(e){var t=this;this.adyenService.rescheduleNotification(e.notificationId).then((function(e){t.createNotificationSuccess({title:t.$tc("adyen.reprocessNotification"),message:t.$tc("adyen.notificationRescheduleSuccess")}),t.fetchNotifications()}))}},beforeMount:function(){this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchNotifications()}});Shopware.Component.register("adyen-partial-payments",{template:'
    \n
    {{ $tc(\'adyen.authorisedPayments\') }}
    \n
    \n {{ payment.pspReference }} -\n {{ payment.method }} -\n {{ payment.amount }}\n
    \n
    {{ errorMessage }}
    \n
\n',inject:["adyenService"],props:{order:{type:Object,required:!0}},methods:{fetchAdyenPartialPayments:function(){var e=this;this.adyenService.fetchAdyenPartialPayments(this.order.id).then((function(t){t.length>0?e.partialPayments=t:e.errorMessage=e.$tc("adyen.pendingWebhook")}))}},data:function(){return{errorMessage:"",partialPayments:[],showWidget:!1}},beforeMount:function(){this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchAdyenPartialPayments()}});Shopware.Component.override("sw-order-detail-base",{template:'{% block sw_order_detail_base_custom_fields %}\n {% parent %}\n \n \n \n{% endblock %}\n'});Shopware.Component.override("sw-order-user-card",{template:'{% block sw_order_detail_base_secondary_info_payment %}\n {% parent %}\n\n \n{% endblock %}\n'});n("MTTW");var g=n("bY4/");Shopware.Locale.extend("en-GB",g)},SZ7m:function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},o=0;on.parts.length&&(r.parts.length=n.parts.length)}else{var i=[];for(o=0;o2&&void 0!==arguments[2]?arguments[2]:"adyen";return r(this,u),(n=c.call(this,e,t,o)).headers=n.getBasicHeaders({}),n}return t=u,(n=[{key:"check",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.post("_action/".concat(this.getApiBasePath(),"/verify"),e,{headers:t}).then((function(e){return d.handleResponse(e)}))}},{key:"capture",value:function(e){return this.httpClient.post(this.getApiBasePath()+"/capture",{orderId:e},{headers:this.headers}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"getCaptureRequests",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/captures",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"isCaptureAllowed",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-capture-allowed",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"isManualCaptureEnabled",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-manual-capture-enabled",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"getRefunds",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/refunds",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during refunds request: "+e.message),e}))}},{key:"postRefund",value:function(e,t){var n=this.getBasicHeaders({});return this.httpClient.post(this.getApiBasePath()+"/refunds",{orderId:e,refundAmount:t},{headers:n}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during post refund request: "+e.message),e}))}},{key:"fetchNotifications",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/notifications",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"rescheduleNotification",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/reschedule-notification/"+e,{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"isAdyenOrder",value:function(e){for(var t=e.transactions,n=!1,r=0;r\n Test Configuration\n\n',inject:["adyenService"],mixins:[i.getByName("notification")],data:function(){return{isLoading:!1,isSaveSuccessful:!1}},computed:{pluginConfig:function(){for(var e=this.$parent;!e.hasOwnProperty("actualConfigData");)e=e.$parent;var t=e.currentSalesChannelId,n=e.actualConfigData;return Object.assign({},n.null,n[t])}},methods:{saveFinish:function(){this.isSaveSuccessful=!1},check:function(){var e=this;this.isLoading=!0,this.adyenService.check(this.pluginConfig).then((function(t){t.success?(e.isSaveSuccessful=!0,e.createNotificationSuccess({title:e.$tc("adyen.configTestTitle"),message:e.$tc("adyen.configTestSuccess")})):e.createNotificationError({title:e.$tc("adyen.configTestTitle"),message:e.$tc(t.message?t.message:"adyen.configTestFail")}),e.isLoading=!1}))}}});n("H7Mt");var o=Shopware,s=o.Component,d=o.Mixin;s.register("adyen-payment-capture",{template:'{% block adyen_capture %}\n \n
\n
\n
\n {{ $tc(\'adyen.noCaptureRequests\') }}\n
\n
\n \n {{ $tc(\'adyen.sendCaptureRequest\') }}\n \n
\n \n \n \n
\n \n \n
\n
\n {{ $tc(\'adyen.error\') }}\n
\n
\n{% endblock %}\n',inject:["adyenService","systemConfigApiService"],mixins:[d.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],showModal:!1,captureRequests:[],allowCapture:!1,captureEnabled:!1,errorOccurred:!1,isLoading:!0,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onSubmitCapture:function(){var e=this;this.isLoading=!0,this.adyenService.capture(this.order.id).then((function(t){t.success?(e.fetchCaptureRequests(),e.createNotificationSuccess({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.captureSuccessful")})):e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoading=!1,e.showModal=!1}))},fetchCaptureRequests:function(){var e=this;this.isLoading=!0,this.adyenService.getCaptureRequests(this.order.id).then((function(t){e.captureRequests=t,e.isCaptureAllowed()})).catch((function(){e.errorOccurred=!0,e.captureRequests=[]})).finally((function(){e.isLoading=!1}))},isManualCaptureEnabled:function(){var e=this;this.isLoading=!0,this.adyenService.isManualCaptureEnabled(this.order.id).then((function(t){e.captureEnabled=t,e.showWidget=e.adyenService.isAdyenOrder(e.order)&&e.captureEnabled})).catch((function(){e.errorOccurred=!0,e.captureEnabled=!1})).finally((function(){e.isLoading=!1}))},isCaptureAllowed:function(){var e=this;this.isLoading=!0,this.adyenService.isCaptureAllowed(this.order.id).then((function(t){e.allowCapture=t})).catch((function(){e.errorOccurred=!0,e.allowCapture=!1})).finally((function(){e.isLoading=!1}))}},beforeMount:function(){this.isManualCaptureEnabled(),this.fetchCaptureRequests()}});n("tG31");function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n\n
\n
\n
\n {{ $tc(\'adyen.noRefundsCreated\') }}\n
\n
\n \n {{ $tc(\'sw-order.documentCard.labelCreateNew\') }}\n \n
\n \n
\n \n
\n \n
\n
\n \n \n
\n
\n {{ $tc(\'adyen.refundFetchError\') }}\n
\n \n{% endblock %}\n',inject:["adyenService"],mixins:[p.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],refundAmount:0,showModal:!1,refunds:[],allowRefund:!0,isLoadingTable:!0,errorOccurred:!1,isLoadingRefund:!1,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onRefund:function(){var e=this;this.isLoadingRefund=!0,this.adyenService.postRefund(this.order.id,this.refundAmount).then((function(t){t.success?(e.fetchRefunds(),e.createNotificationSuccess({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.refundSuccessful")})):e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoadingRefund=!1,e.showModal=!1}))},fetchRefunds:function(){var e=this;this.isLoadingTable=!0,this.adyenService.getRefunds(this.order.id).then((function(t){e.refunds=t,e.isRefundAllowed()})).catch((function(){e.errorOccurred=!0,e.refunds=[]})).finally((function(){e.isLoadingTable=!1}))},isRefundAllowed:function(){var e,t=0,n=c(this.refunds);try{for(n.s();!(e=n.n()).done;){var r=e.value;"Failed"!==r.status&&(t+=r.rawAmount)}}catch(e){n.e(e)}finally{n.f()}this.allowRefund=this.order.amountTotal>t/100},isAdyenOrder:function(){for(var e=this.order.transactions,t=!1,n=0;n\n \n \n {% block sw_data_grid_body_columns %}\n {% block sw_data_grid_column_actions %}\n \n {% endblock %}\n {% endblock %}\n \n

{{ $tc(\'adyen.noNotificationsReceived\') }}

\n
\n \n{% endblock %}\n',inject:["adyenService"],mixins:[m.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{notifications:[],columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"eventCode",label:this.$tc("adyen.columnHeaders.event")},{property:"success",label:this.$tc("adyen.columnHeaders.success")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")},{property:"errorCount",label:this.$tc("adyen.columnHeaders.errorCount")},{property:"errorMessage",label:this.$tc("adyen.columnHeaders.errorMessage")}],showWidget:!1}},methods:{fetchNotifications:function(){var e=this;this.adyenService.fetchNotifications(this.order.id).then((function(t){e.notifications=t}))},onReschedule:function(e){var t=this;this.adyenService.rescheduleNotification(e.notificationId).then((function(e){t.createNotificationSuccess({title:t.$tc("adyen.reprocessNotification"),message:t.$tc("adyen.notificationRescheduleSuccess")}),t.fetchNotifications()}))}},beforeMount:function(){this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchNotifications()}});var g={isVersionOlderThan65:function(){var e,t,n=Shopware.Context.app.config.version;return-1===(t="6.5.0.0",(e=n).startsWith(t+"-")?-1:t.startsWith(e+"-")?1:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"case",caseFirst:"upper"}))}},v=g;Shopware.Component.register("adyen-partial-payments",{template:'
\n
    \n
    {{ $tc(\'adyen.authorisedPayments\') }}
    \n
    \n {{ payment.pspReference }} -\n {{ payment.method }} -\n {{ payment.amount }}\n
    \n
    {{ errorMessage }}
    \n
\n
    \n \n
    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n
    \n PSP Reference\n
    \n
    \n
    \n Payment Method\n
    \n
    \n
    \n Amount\n
    \n
    \n \n \n
    \n {{ payment.method }}\n
    \n
    \n
    \n {{ payment.amount }}\n
    \n
    \n
    \n
    \n {{ errorMessage }}\n
\n
\n',inject:["adyenService"],props:{order:{type:Object,required:!0}},methods:{fetchAdyenPartialPayments:function(){var e=this;this.adyenService.fetchAdyenPartialPayments(this.order.id).then((function(t){t.length>0?e.partialPayments=t:e.errorMessage=e.$tc("adyen.pendingWebhook")}))}},data:function(){return{errorMessage:"",partialPayments:[],showWidget:!1,isVersionOlderThan65:!1}},beforeMount:function(){this.isVersionOlderThan65=v.isVersionOlderThan65(),this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchAdyenPartialPayments()}});Shopware.Component.override("sw-order-detail-general",{template:'{% block sw_order_detail_general_line_items_card %}\n {% parent %}\n \n \n \n{% endblock %}\n'});Shopware.Component.override("sw-order-detail-base",{template:'{% block sw_order_detail_base_custom_fields %}\n {% parent %}\n \n \n \n{% endblock %}\n'});Shopware.Component.override("sw-order-user-card",{template:'{% block sw_order_detail_base_secondary_info_payment %}\n {% parent %}\n\n \n{% endblock %}\n'});Shopware.Component.override("sw-order-detail-details",{template:'{% block sw_order_detail_details_payment_method_select %}\n {% parent %}\n\n \n{% endblock %}\n'});n("vNjL");var w=n("GGYj");Shopware.Locale.extend("en-GB",w)},GGYj:function(e){e.exports=JSON.parse('{"adyen":{"configTestTitle":"Configuration test","configTestSuccess":"Configuration is successfully tested","configTestFail":"There\'s an issue in your configuration","adyenRefunds":"Adyen Refunds","refundTitle":"Refund","refundSuccessful":"A refund has been successfully submitted.","invalidRefundAmount":"Refund amount exceeds order total","error":"An error has occurred. Please check the logs.","refundFetchError":"An error has occurred while attempting to get linked refunds.","refundConfirm":"Create refund for order","createRefund":"Create Refund","noRefundsCreated":"No refunds created","columnHeaders":{"pspReference":"PSP Reference","amount":"Amount","status":"Status","event":"Event","success":"Success","created":"Created","updated":"Updated","errorCount":"Error Count","errorMessage":"Error Message"},"reprocessNotification":"Reprocess Notification","notificationRescheduleSuccess":"Notification will be processed again.","notificationsTitle":"Adyen Webhook Notifications","noNotificationsReceived":"No webhook notifications received.","adyenPaymentCaptureTitle":"Adyen Capture Requests","noCaptureRequests":"No capture requests have been sent","sendCaptureRequest":"Send Capture Request","captureConfirm":"Capture payment for order","captureSuccessful":"Capture request has been successfully sent","pendingWebhook":"Order is pending webhook.","authorisedPayments":"Authorised Payments"}}')},H7Mt:function(e,t,n){var r=n("mH+n");r.__esModule&&(r=r.default),"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);(0,n("P8hj").default)("056a1238",r,!0,{})},P8hj:function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},a=0;an.parts.length&&(r.parts.length=n.parts.length)}else{var o=[];for(a=0;a2&&void 0!==arguments[2]?arguments[2]:"adyen";return r(this,l),(n=d.call(this,e,t,a)).headers=n.getBasicHeaders({}),n}return t=l,(n=[{key:"check",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.post("_action/".concat(this.getApiBasePath(),"/verify"),e,{headers:t}).then((function(e){return c.handleResponse(e)}))}},{key:"capture",value:function(e){return this.httpClient.post(this.getApiBasePath()+"/capture",{orderId:e},{headers:this.headers}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"getCaptureRequests",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/captures",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"isCaptureAllowed",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-capture-allowed",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"isManualCaptureEnabled",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-manual-capture-enabled",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"getRefunds",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/refunds",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during refunds request: "+e.message),e}))}},{key:"postRefund",value:function(e,t){var n=this.getBasicHeaders({});return this.httpClient.post(this.getApiBasePath()+"/refunds",{orderId:e,refundAmount:t},{headers:n}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during post refund request: "+e.message),e}))}},{key:"fetchNotifications",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/notifications",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"rescheduleNotification",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/reschedule-notification/"+e,{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"isAdyenOrder",value:function(e){for(var t=e.transactions,n=!1,r=0;r\n Test Configuration\n\n',inject:["adyenService"],mixins:[a.getByName("notification")],data:function(){return{isLoading:!1,isSaveSuccessful:!1}},computed:{pluginConfig:function(){for(var e=this.$parent;!e.hasOwnProperty("actualConfigData");)e=e.$parent;var t=e.currentSalesChannelId,n=e.actualConfigData;return Object.assign({},n.null,n[t])}},methods:{saveFinish:function(){this.isSaveSuccessful=!1},check:function(){var e=this;this.isLoading=!0,this.adyenService.check(this.pluginConfig).then((function(t){t.success?(e.isSaveSuccessful=!0,e.createNotificationSuccess({title:e.$tc("adyen.configTestTitle"),message:e.$tc("adyen.configTestSuccess")})):e.createNotificationError({title:e.$tc("adyen.configTestTitle"),message:e.$tc(t.message?t.message:"adyen.configTestFail")}),e.isLoading=!1}))}}});n("hnQ+");var i=Shopware,s=i.Component,c=i.Mixin;s.register("adyen-payment-capture",{template:'\n
\n
\n
\n {{ $tc(\'adyen.noCaptureRequests\') }}\n
\n
\n \n {{ $tc(\'adyen.sendCaptureRequest\') }}\n \n
\n \n \n \n
\n \n \n
\n
\n {{ $tc(\'adyen.error\') }}\n
\n
\n',inject:["adyenService","systemConfigApiService"],mixins:[c.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],showModal:!1,captureRequests:[],allowCapture:!1,captureEnabled:!1,errorOccurred:!1,isLoading:!0,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onSubmitCapture:function(){var e=this;this.isLoading=!0,this.adyenService.capture(this.order.id).then((function(t){t.success?(e.fetchCaptureRequests(),e.createNotificationSuccess({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.captureSuccessful")})):e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoading=!1,e.showModal=!1}))},fetchCaptureRequests:function(){var e=this;this.isLoading=!0,this.adyenService.getCaptureRequests(this.order.id).then((function(t){e.captureRequests=t,e.isCaptureAllowed()})).catch((function(){e.errorOccurred=!0,e.captureRequests=[]})).finally((function(){e.isLoading=!1}))},isManualCaptureEnabled:function(){var e=this;this.isLoading=!0,this.adyenService.isManualCaptureEnabled(this.order.id).then((function(t){e.captureEnabled=t,e.showWidget=e.adyenService.isAdyenOrder(e.order)&&e.captureEnabled})).catch((function(){e.errorOccurred=!0,e.captureEnabled=!1})).finally((function(){e.isLoading=!1}))},isCaptureAllowed:function(){var e=this;this.isLoading=!0,this.adyenService.isCaptureAllowed(this.order.id).then((function(t){e.allowCapture=t})).catch((function(){e.errorOccurred=!0,e.allowCapture=!1})).finally((function(){e.isLoading=!1}))}},beforeMount:function(){this.isManualCaptureEnabled(),this.fetchCaptureRequests()}});n("Fxip");function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n\n
\n
\n
\n {{ $tc(\'adyen.noRefundsCreated\') }}\n
\n
\n \n {{ $tc(\'sw-order.documentCard.labelCreateNew\') }}\n \n
\n \n
\n \n
\n \n
\n
\n \n \n
\n
\n {{ $tc(\'adyen.refundFetchError\') }}\n
\n \n{% endblock %}\n',inject:["adyenService"],mixins:[p.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],refundAmount:0,showModal:!1,refunds:[],allowRefund:!0,isLoadingTable:!0,errorOccurred:!1,isLoadingRefund:!1,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onRefund:function(){var e=this;this.isLoadingRefund=!0,this.adyenService.postRefund(this.order.id,this.refundAmount).then((function(t){t.success?(e.fetchRefunds(),e.createNotificationSuccess({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.refundSuccessful")})):e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoadingRefund=!1,e.showModal=!1}))},fetchRefunds:function(){var e=this;this.isLoadingTable=!0,this.adyenService.getRefunds(this.order.id).then((function(t){e.refunds=t,e.isRefundAllowed()})).catch((function(){e.errorOccurred=!0,e.refunds=[]})).finally((function(){e.isLoadingTable=!1}))},isRefundAllowed:function(){var e,t=0,n=d(this.refunds);try{for(n.s();!(e=n.n()).done;){var r=e.value;"Failed"!==r.status&&(t+=r.rawAmount)}}catch(e){n.e(e)}finally{n.f()}this.allowRefund=this.order.amountTotal>t/100},isAdyenOrder:function(){for(var e=this.order.transactions,t=!1,n=0;n\n \n \n {% block sw_data_grid_body_columns %}\n {% block sw_data_grid_column_actions %}\n \n {% endblock %}\n {% endblock %}\n \n

{{ $tc(\'adyen.noNotificationsReceived\') }}

\n
\n\n',inject:["adyenService"],mixins:[m.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{notifications:[],columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"eventCode",label:this.$tc("adyen.columnHeaders.event")},{property:"success",label:this.$tc("adyen.columnHeaders.success")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")},{property:"errorCount",label:this.$tc("adyen.columnHeaders.errorCount")},{property:"errorMessage",label:this.$tc("adyen.columnHeaders.errorMessage")}],showWidget:!1}},methods:{fetchNotifications:function(){var e=this;this.adyenService.fetchNotifications(this.order.id).then((function(t){e.notifications=t}))},onReschedule:function(e){var t=this;this.adyenService.rescheduleNotification(e.notificationId).then((function(e){t.createNotificationSuccess({title:t.$tc("adyen.reprocessNotification"),message:t.$tc("adyen.notificationRescheduleSuccess")}),t.fetchNotifications()}))}},beforeMount:function(){this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchNotifications()}});Shopware.Component.register("adyen-partial-payments",{template:'
    \n
    {{ $tc(\'adyen.authorisedPayments\') }}
    \n
    \n {{ payment.pspReference }} -\n {{ payment.method }} -\n {{ payment.amount }}\n
    \n
    {{ errorMessage }}
    \n
\n',inject:["adyenService"],props:{order:{type:Object,required:!0}},methods:{fetchAdyenPartialPayments:function(){var e=this;this.adyenService.fetchAdyenPartialPayments(this.order.id).then((function(t){t.length>0?e.partialPayments=t:e.errorMessage=e.$tc("adyen.pendingWebhook")}))}},data:function(){return{errorMessage:"",partialPayments:[],showWidget:!1}},beforeMount:function(){this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchAdyenPartialPayments()}});Shopware.Component.override("sw-order-detail-base",{template:'{% block sw_order_detail_base_custom_fields %}\n {% parent %}\n \n \n \n{% endblock %}\n'});Shopware.Component.override("sw-order-user-card",{template:'{% block sw_order_detail_base_secondary_info_payment %}\n {% parent %}\n\n \n{% endblock %}\n'});n("MTTW");var g=n("bY4/");Shopware.Locale.extend("en-GB",g)},SZ7m:function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},o=0;on.parts.length&&(r.parts.length=n.parts.length)}else{var i=[];for(o=0;o2&&void 0!==arguments[2]?arguments[2]:"adyen";return r(this,u),(n=c.call(this,e,t,o)).headers=n.getBasicHeaders({}),n}return t=u,(n=[{key:"check",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.post("_action/".concat(this.getApiBasePath(),"/verify"),e,{headers:t}).then((function(e){return d.handleResponse(e)}))}},{key:"capture",value:function(e){return this.httpClient.post(this.getApiBasePath()+"/capture",{orderId:e},{headers:this.headers}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"getCaptureRequests",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/captures",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"isCaptureAllowed",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-capture-allowed",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"isManualCaptureEnabled",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-manual-capture-enabled",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"getRefunds",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/refunds",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during refunds request: "+e.message),e}))}},{key:"postRefund",value:function(e,t){var n=this.getBasicHeaders({});return this.httpClient.post(this.getApiBasePath()+"/refunds",{orderId:e,refundAmount:t},{headers:n}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during post refund request: "+e.message),e}))}},{key:"fetchNotifications",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/notifications",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"rescheduleNotification",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/reschedule-notification/"+e,{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"isAdyenOrder",value:function(e){for(var t=e.transactions,n=!1,r=0;r\n Test Configuration\n\n',inject:["adyenService"],mixins:[i.getByName("notification")],data:function(){return{isLoading:!1,isSaveSuccessful:!1}},computed:{pluginConfig:function(){for(var e=this.$parent;!e.hasOwnProperty("actualConfigData");)e=e.$parent;var t=e.currentSalesChannelId,n=e.actualConfigData;return Object.assign({},n.null,n[t])}},methods:{saveFinish:function(){this.isSaveSuccessful=!1},check:function(){var e=this;this.isLoading=!0,this.adyenService.check(this.pluginConfig).then((function(t){t.success?(e.isSaveSuccessful=!0,e.createNotificationSuccess({title:e.$tc("adyen.configTestTitle"),message:e.$tc("adyen.configTestSuccess")})):e.createNotificationError({title:e.$tc("adyen.configTestTitle"),message:e.$tc(t.message?t.message:"adyen.configTestFail")}),e.isLoading=!1}))}}});n("hnQ+");var o=Shopware,s=o.Component,d=o.Mixin;s.register("adyen-payment-capture",{template:'{% block adyen_capture %}\n \n
\n
\n
\n {{ $tc(\'adyen.noCaptureRequests\') }}\n
\n
\n \n {{ $tc(\'adyen.sendCaptureRequest\') }}\n \n
\n \n \n \n
\n \n \n
\n
\n {{ $tc(\'adyen.error\') }}\n
\n
\n{% endblock %}\n',inject:["adyenService","systemConfigApiService"],mixins:[d.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],showModal:!1,captureRequests:[],allowCapture:!1,captureEnabled:!1,errorOccurred:!1,isLoading:!0,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onSubmitCapture:function(){var e=this;this.isLoading=!0,this.adyenService.capture(this.order.id).then((function(t){t.success?(e.fetchCaptureRequests(),e.createNotificationSuccess({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.captureSuccessful")})):e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoading=!1,e.showModal=!1}))},fetchCaptureRequests:function(){var e=this;this.isLoading=!0,this.adyenService.getCaptureRequests(this.order.id).then((function(t){e.captureRequests=t,e.isCaptureAllowed()})).catch((function(){e.errorOccurred=!0,e.captureRequests=[]})).finally((function(){e.isLoading=!1}))},isManualCaptureEnabled:function(){var e=this;this.isLoading=!0,this.adyenService.isManualCaptureEnabled(this.order.id).then((function(t){e.captureEnabled=t,e.showWidget=e.adyenService.isAdyenOrder(e.order)&&e.captureEnabled})).catch((function(){e.errorOccurred=!0,e.captureEnabled=!1})).finally((function(){e.isLoading=!1}))},isCaptureAllowed:function(){var e=this;this.isLoading=!0,this.adyenService.isCaptureAllowed(this.order.id).then((function(t){e.allowCapture=t})).catch((function(){e.errorOccurred=!0,e.allowCapture=!1})).finally((function(){e.isLoading=!1}))}},beforeMount:function(){this.isManualCaptureEnabled(),this.fetchCaptureRequests()}});n("Fxip");function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n\n
\n
\n
\n {{ $tc(\'adyen.noRefundsCreated\') }}\n
\n
\n \n {{ $tc(\'sw-order.documentCard.labelCreateNew\') }}\n \n
\n \n
\n \n
\n \n
\n
\n \n \n
\n
\n {{ $tc(\'adyen.refundFetchError\') }}\n
\n \n{% endblock %}\n',inject:["adyenService"],mixins:[p.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],refundAmount:0,showModal:!1,refunds:[],allowRefund:!0,isLoadingTable:!0,errorOccurred:!1,isLoadingRefund:!1,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onRefund:function(){var e=this;this.isLoadingRefund=!0,this.adyenService.postRefund(this.order.id,this.refundAmount).then((function(t){t.success?(e.fetchRefunds(),e.createNotificationSuccess({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.refundSuccessful")})):e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoadingRefund=!1,e.showModal=!1}))},fetchRefunds:function(){var e=this;this.isLoadingTable=!0,this.adyenService.getRefunds(this.order.id).then((function(t){e.refunds=t,e.isRefundAllowed()})).catch((function(){e.errorOccurred=!0,e.refunds=[]})).finally((function(){e.isLoadingTable=!1}))},isRefundAllowed:function(){var e,t=0,n=c(this.refunds);try{for(n.s();!(e=n.n()).done;){var r=e.value;"Failed"!==r.status&&(t+=r.rawAmount)}}catch(e){n.e(e)}finally{n.f()}this.allowRefund=this.order.amountTotal>t/100},isAdyenOrder:function(){for(var e=this.order.transactions,t=!1,n=0;n\n \n \n {% block sw_data_grid_body_columns %}\n {% block sw_data_grid_column_actions %}\n \n {% endblock %}\n {% endblock %}\n \n

{{ $tc(\'adyen.noNotificationsReceived\') }}

\n
\n \n{% endblock %}\n',inject:["adyenService"],mixins:[m.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{notifications:[],columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"eventCode",label:this.$tc("adyen.columnHeaders.event")},{property:"success",label:this.$tc("adyen.columnHeaders.success")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")},{property:"errorCount",label:this.$tc("adyen.columnHeaders.errorCount")},{property:"errorMessage",label:this.$tc("adyen.columnHeaders.errorMessage")}],showWidget:!1}},methods:{fetchNotifications:function(){var e=this;this.adyenService.fetchNotifications(this.order.id).then((function(t){e.notifications=t}))},onReschedule:function(e){var t=this;this.adyenService.rescheduleNotification(e.notificationId).then((function(e){t.createNotificationSuccess({title:t.$tc("adyen.reprocessNotification"),message:t.$tc("adyen.notificationRescheduleSuccess")}),t.fetchNotifications()}))}},beforeMount:function(){this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchNotifications()}});var g={isVersionOlderThan65:function(){var e,t,n=Shopware.Context.app.config.version;return-1===(t="6.5.0.0",(e=n).startsWith(t+"-")?-1:t.startsWith(e+"-")?1:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"case",caseFirst:"upper"}))}},v=g;Shopware.Component.register("adyen-partial-payments",{template:'
\n
    \n
    {{ $tc(\'adyen.authorisedPayments\') }}
    \n
    \n {{ payment.pspReference }} -\n {{ payment.method }} -\n {{ payment.amount }}\n
    \n
    {{ errorMessage }}
    \n
\n
    \n \n
    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n
    \n PSP Reference\n
    \n
    \n
    \n Payment Method\n
    \n
    \n
    \n Amount\n
    \n
    \n \n \n
    \n {{ payment.method }}\n
    \n
    \n
    \n {{ payment.amount }}\n
    \n
    \n
    \n
    \n {{ errorMessage }}\n
\n
\n',inject:["adyenService"],props:{order:{type:Object,required:!0}},methods:{fetchAdyenPartialPayments:function(){var e=this;this.adyenService.fetchAdyenPartialPayments(this.order.id).then((function(t){t.length>0?e.partialPayments=t:e.errorMessage=e.$tc("adyen.pendingWebhook")}))}},data:function(){return{errorMessage:"",partialPayments:[],showWidget:!1,isVersionOlderThan65:!1}},beforeMount:function(){this.isVersionOlderThan65=v.isVersionOlderThan65(),this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchAdyenPartialPayments()}});Shopware.Component.override("sw-order-detail-general",{template:'{% block sw_order_detail_general_line_items_card %}\n {% parent %}\n \n \n \n{% endblock %}\n'});Shopware.Component.override("sw-order-detail-base",{template:'{% block sw_order_detail_base_custom_fields %}\n {% parent %}\n \n \n \n{% endblock %}\n'});Shopware.Component.override("sw-order-user-card",{template:'{% block sw_order_detail_base_secondary_info_payment %}\n {% parent %}\n\n \n{% endblock %}\n'});Shopware.Component.override("sw-order-detail-details",{template:'{% block sw_order_detail_details_payment_method_select %}\n {% parent %}\n\n \n{% endblock %}\n'});n("MTTW");var w=n("bY4/");Shopware.Locale.extend("en-GB",w)},SZ7m:function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},a=0;an.parts.length&&(r.parts.length=n.parts.length)}else{var o=[];for(a=0;a2&&void 0!==arguments[2]?arguments[2]:"adyen";return r(this,l),(n=d.call(this,e,t,a)).headers=n.getBasicHeaders({}),n}return t=l,(n=[{key:"check",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.post("_action/".concat(this.getApiBasePath(),"/verify"),e,{headers:t}).then((function(e){return c.handleResponse(e)}))}},{key:"capture",value:function(e){return this.httpClient.post(this.getApiBasePath()+"/capture",{orderId:e},{headers:this.headers}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"getCaptureRequests",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/captures",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"isCaptureAllowed",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-capture-allowed",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"isManualCaptureEnabled",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-manual-capture-enabled",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"getRefunds",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/refunds",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during refunds request: "+e.message),e}))}},{key:"postRefund",value:function(e,t){var n=this.getBasicHeaders({});return this.httpClient.post(this.getApiBasePath()+"/refunds",{orderId:e,refundAmount:t},{headers:n}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during post refund request: "+e.message),e}))}},{key:"fetchNotifications",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/notifications",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"rescheduleNotification",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/reschedule-notification/"+e,{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"isAdyenOrder",value:function(e){for(var t=e.transactions,n=!1,r=0;r\n Test Configuration\n\n',inject:["adyenService"],mixins:[a.getByName("notification")],data:function(){return{isLoading:!1,isSaveSuccessful:!1}},computed:{pluginConfig:function(){for(var e=this.$parent;!e.hasOwnProperty("actualConfigData");)e=e.$parent;var t=e.currentSalesChannelId,n=e.actualConfigData;return Object.assign({},n.null,n[t])}},methods:{saveFinish:function(){this.isSaveSuccessful=!1},check:function(){var e=this;this.isLoading=!0,this.adyenService.check(this.pluginConfig).then((function(t){t.success?(e.isSaveSuccessful=!0,e.createNotificationSuccess({title:e.$tc("adyen.configTestTitle"),message:e.$tc("adyen.configTestSuccess")})):e.createNotificationError({title:e.$tc("adyen.configTestTitle"),message:e.$tc(t.message?t.message:"adyen.configTestFail")}),e.isLoading=!1}))}}});n("H7Mt");var i=Shopware,s=i.Component,c=i.Mixin;s.register("adyen-payment-capture",{template:'\n
\n
\n
\n {{ $tc(\'adyen.noCaptureRequests\') }}\n
\n
\n \n {{ $tc(\'adyen.sendCaptureRequest\') }}\n \n
\n \n \n \n
\n \n \n
\n
\n {{ $tc(\'adyen.error\') }}\n
\n
\n',inject:["adyenService","systemConfigApiService"],mixins:[c.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],showModal:!1,captureRequests:[],allowCapture:!1,captureEnabled:!1,errorOccurred:!1,isLoading:!0,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onSubmitCapture:function(){var e=this;this.isLoading=!0,this.adyenService.capture(this.order.id).then((function(t){t.success?(e.fetchCaptureRequests(),e.createNotificationSuccess({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.captureSuccessful")})):e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoading=!1,e.showModal=!1}))},fetchCaptureRequests:function(){var e=this;this.isLoading=!0,this.adyenService.getCaptureRequests(this.order.id).then((function(t){e.captureRequests=t,e.isCaptureAllowed()})).catch((function(){e.errorOccurred=!0,e.captureRequests=[]})).finally((function(){e.isLoading=!1}))},isManualCaptureEnabled:function(){var e=this;this.isLoading=!0,this.adyenService.isManualCaptureEnabled(this.order.id).then((function(t){e.captureEnabled=t,e.showWidget=e.adyenService.isAdyenOrder(e.order)&&e.captureEnabled})).catch((function(){e.errorOccurred=!0,e.captureEnabled=!1})).finally((function(){e.isLoading=!1}))},isCaptureAllowed:function(){var e=this;this.isLoading=!0,this.adyenService.isCaptureAllowed(this.order.id).then((function(t){e.allowCapture=t})).catch((function(){e.errorOccurred=!0,e.allowCapture=!1})).finally((function(){e.isLoading=!1}))}},beforeMount:function(){this.isManualCaptureEnabled(),this.fetchCaptureRequests()}});n("tG31");function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n\n
\n
\n
\n {{ $tc(\'adyen.noRefundsCreated\') }}\n
\n
\n \n {{ $tc(\'sw-order.documentCard.labelCreateNew\') }}\n \n
\n \n
\n \n
\n \n
\n
\n \n \n
\n
\n {{ $tc(\'adyen.refundFetchError\') }}\n
\n \n{% endblock %}\n',inject:["adyenService"],mixins:[p.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],refundAmount:0,showModal:!1,refunds:[],allowRefund:!0,isLoadingTable:!0,errorOccurred:!1,isLoadingRefund:!1,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onRefund:function(){var e=this;this.isLoadingRefund=!0,this.adyenService.postRefund(this.order.id,this.refundAmount).then((function(t){t.success?(e.fetchRefunds(),e.createNotificationSuccess({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.refundSuccessful")})):e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoadingRefund=!1,e.showModal=!1}))},fetchRefunds:function(){var e=this;this.isLoadingTable=!0,this.adyenService.getRefunds(this.order.id).then((function(t){e.refunds=t,e.isRefundAllowed()})).catch((function(){e.errorOccurred=!0,e.refunds=[]})).finally((function(){e.isLoadingTable=!1}))},isRefundAllowed:function(){var e,t=0,n=d(this.refunds);try{for(n.s();!(e=n.n()).done;){var r=e.value;"Failed"!==r.status&&(t+=r.rawAmount)}}catch(e){n.e(e)}finally{n.f()}this.allowRefund=this.order.amountTotal>t/100},isAdyenOrder:function(){for(var e=this.order.transactions,t=!1,n=0;n\n \n \n {% block sw_data_grid_body_columns %}\n {% block sw_data_grid_column_actions %}\n \n {% endblock %}\n {% endblock %}\n \n

{{ $tc(\'adyen.noNotificationsReceived\') }}

\n
\n\n',inject:["adyenService"],mixins:[m.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{notifications:[],columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"eventCode",label:this.$tc("adyen.columnHeaders.event")},{property:"success",label:this.$tc("adyen.columnHeaders.success")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")},{property:"errorCount",label:this.$tc("adyen.columnHeaders.errorCount")},{property:"errorMessage",label:this.$tc("adyen.columnHeaders.errorMessage")}],showWidget:!1}},methods:{fetchNotifications:function(){var e=this;this.adyenService.fetchNotifications(this.order.id).then((function(t){e.notifications=t}))},onReschedule:function(e){var t=this;this.adyenService.rescheduleNotification(e.notificationId).then((function(e){t.createNotificationSuccess({title:t.$tc("adyen.reprocessNotification"),message:t.$tc("adyen.notificationRescheduleSuccess")}),t.fetchNotifications()}))}},beforeMount:function(){this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchNotifications()}});Shopware.Component.register("adyen-partial-payments",{template:'
    \n
    {{ $tc(\'adyen.authorisedPayments\') }}
    \n
    \n {{ payment.pspReference }} -\n {{ payment.method }} -\n {{ payment.amount }}\n
    \n
    {{ errorMessage }}
    \n
\n',inject:["adyenService"],props:{order:{type:Object,required:!0}},methods:{fetchAdyenPartialPayments:function(){var e=this;this.adyenService.fetchAdyenPartialPayments(this.order.id).then((function(t){t.length>0?e.partialPayments=t:e.errorMessage=e.$tc("adyen.pendingWebhook")}))}},data:function(){return{errorMessage:"",partialPayments:[],showWidget:!1}},beforeMount:function(){this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchAdyenPartialPayments()}});Shopware.Component.override("sw-order-detail-base",{template:'{% block sw_order_detail_base_custom_fields %}\n {% parent %}\n \n \n \n{% endblock %}\n'});Shopware.Component.override("sw-order-user-card",{template:'{% block sw_order_detail_base_secondary_info_payment %}\n {% parent %}\n\n \n{% endblock %}\n'});n("vNjL");var g=n("GGYj");Shopware.Locale.extend("en-GB",g)},GGYj:function(e){e.exports=JSON.parse('{"adyen":{"configTestTitle":"Configuration test","configTestSuccess":"Configuration is successfully tested","configTestFail":"There\'s an issue in your configuration","adyenRefunds":"Adyen Refunds","refundTitle":"Refund","refundSuccessful":"A refund has been successfully submitted.","invalidRefundAmount":"Refund amount exceeds order total","error":"An error has occurred. Please check the logs.","refundFetchError":"An error has occurred while attempting to get linked refunds.","refundConfirm":"Create refund for order","createRefund":"Create Refund","noRefundsCreated":"No refunds created","columnHeaders":{"pspReference":"PSP Reference","amount":"Amount","status":"Status","event":"Event","success":"Success","created":"Created","updated":"Updated","errorCount":"Error Count","errorMessage":"Error Message"},"reprocessNotification":"Reprocess Notification","notificationRescheduleSuccess":"Notification will be processed again.","notificationsTitle":"Adyen Webhook Notifications","noNotificationsReceived":"No webhook notifications received.","adyenPaymentCaptureTitle":"Adyen Capture Requests","noCaptureRequests":"No capture requests have been sent","sendCaptureRequest":"Send Capture Request","captureConfirm":"Capture payment for order","captureSuccessful":"Capture request has been successfully sent","pendingWebhook":"Order is pending webhook.","authorisedPayments":"Authorised Payments"}}')},H7Mt:function(e,t,n){var r=n("mH+n");r.__esModule&&(r=r.default),"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);(0,n("P8hj").default)("056a1238",r,!0,{})},P8hj:function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},o=0;on.parts.length&&(r.parts.length=n.parts.length)}else{var i=[];for(o=0;o2&&void 0!==arguments[2]?arguments[2]:"adyen";return r(this,u),(n=c.call(this,e,t,o)).headers=n.getBasicHeaders({}),n}return t=u,(n=[{key:"check",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.post("_action/".concat(this.getApiBasePath(),"/verify"),e,{headers:t}).then((function(e){return d.handleResponse(e)}))}},{key:"capture",value:function(e){return this.httpClient.post(this.getApiBasePath()+"/capture",{orderId:e},{headers:this.headers}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"getCaptureRequests",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/captures",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"isCaptureAllowed",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-capture-allowed",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"isManualCaptureEnabled",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-manual-capture-enabled",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"getRefunds",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/refunds",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during refunds request: "+e.message),e}))}},{key:"postRefund",value:function(e,t){var n=this.getBasicHeaders({});return this.httpClient.post(this.getApiBasePath()+"/refunds",{orderId:e,refundAmount:t},{headers:n}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during post refund request: "+e.message),e}))}},{key:"fetchNotifications",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/notifications",{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"rescheduleNotification",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/reschedule-notification/"+e,{headers:t}).then((function(e){return d.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"isAdyenOrder",value:function(e){for(var t=e.transactions,n=!1,r=0;r\n Test Configuration\n\n',inject:["adyenService"],mixins:[i.getByName("notification")],data:function(){return{isLoading:!1,isSaveSuccessful:!1}},computed:{pluginConfig:function(){for(var e=this.$parent;!e.hasOwnProperty("actualConfigData");)e=e.$parent;var t=e.currentSalesChannelId,n=e.actualConfigData;return Object.assign({},n.null,n[t])}},methods:{saveFinish:function(){this.isSaveSuccessful=!1},check:function(){var e=this;this.isLoading=!0,this.adyenService.check(this.pluginConfig).then((function(t){t.success?(e.isSaveSuccessful=!0,e.createNotificationSuccess({title:e.$tc("adyen.configTestTitle"),message:e.$tc("adyen.configTestSuccess")})):e.createNotificationError({title:e.$tc("adyen.configTestTitle"),message:e.$tc(t.message?t.message:"adyen.configTestFail")}),e.isLoading=!1}))}}});n("H7Mt");var o=Shopware,s=o.Component,d=o.Mixin;s.register("adyen-payment-capture",{template:'{% block adyen_capture %}\n \n
\n
\n
\n {{ $tc(\'adyen.noCaptureRequests\') }}\n
\n
\n \n {{ $tc(\'adyen.sendCaptureRequest\') }}\n \n
\n \n \n \n
\n \n \n
\n
\n {{ $tc(\'adyen.error\') }}\n
\n
\n{% endblock %}\n',inject:["adyenService","systemConfigApiService"],mixins:[d.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],showModal:!1,captureRequests:[],allowCapture:!1,captureEnabled:!1,errorOccurred:!1,isLoading:!0,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onSubmitCapture:function(){var e=this;this.isLoading=!0,this.adyenService.capture(this.order.id).then((function(t){t.success?(e.fetchCaptureRequests(),e.createNotificationSuccess({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.captureSuccessful")})):e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.adyenPaymentCaptureTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoading=!1,e.showModal=!1}))},fetchCaptureRequests:function(){var e=this;this.isLoading=!0,this.adyenService.getCaptureRequests(this.order.id).then((function(t){e.captureRequests=t,e.isCaptureAllowed()})).catch((function(){e.errorOccurred=!0,e.captureRequests=[]})).finally((function(){e.isLoading=!1}))},isManualCaptureEnabled:function(){var e=this;this.isLoading=!0,this.adyenService.isManualCaptureEnabled(this.order.id).then((function(t){e.captureEnabled=t,e.showWidget=e.adyenService.isAdyenOrder(e.order)&&e.captureEnabled})).catch((function(){e.errorOccurred=!0,e.captureEnabled=!1})).finally((function(){e.isLoading=!1}))},isCaptureAllowed:function(){var e=this;this.isLoading=!0,this.adyenService.isCaptureAllowed(this.order.id).then((function(t){e.allowCapture=t})).catch((function(){e.errorOccurred=!0,e.allowCapture=!1})).finally((function(){e.isLoading=!1}))}},beforeMount:function(){this.isManualCaptureEnabled(),this.fetchCaptureRequests()}});n("tG31");function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n\n
\n
\n
\n {{ $tc(\'adyen.noRefundsCreated\') }}\n
\n
\n \n {{ $tc(\'sw-order.documentCard.labelCreateNew\') }}\n \n
\n \n
\n \n
\n \n
\n
\n \n \n
\n
\n {{ $tc(\'adyen.refundFetchError\') }}\n
\n \n{% endblock %}\n',inject:["adyenService"],mixins:[p.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")}],refundAmount:0,showModal:!1,refunds:[],allowRefund:!0,isLoadingTable:!0,errorOccurred:!1,isLoadingRefund:!1,showWidget:!1}},methods:{openModal:function(){this.showModal=!0},onCloseModal:function(){this.showModal=!1},onRefund:function(){var e=this;this.isLoadingRefund=!0,this.adyenService.postRefund(this.order.id,this.refundAmount).then((function(t){t.success?(e.fetchRefunds(),e.createNotificationSuccess({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.refundSuccessful")})):e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc(t.message?t.message:"adyen.error")})})).catch((function(){e.createNotificationError({title:e.$tc("adyen.refundTitle"),message:e.$tc("adyen.error")})})).finally((function(){e.isLoadingRefund=!1,e.showModal=!1}))},fetchRefunds:function(){var e=this;this.isLoadingTable=!0,this.adyenService.getRefunds(this.order.id).then((function(t){e.refunds=t,e.isRefundAllowed()})).catch((function(){e.errorOccurred=!0,e.refunds=[]})).finally((function(){e.isLoadingTable=!1}))},isRefundAllowed:function(){var e,t=0,n=c(this.refunds);try{for(n.s();!(e=n.n()).done;){var r=e.value;"Failed"!==r.status&&(t+=r.rawAmount)}}catch(e){n.e(e)}finally{n.f()}this.allowRefund=this.order.amountTotal>t/100},isAdyenOrder:function(){for(var e=this.order.transactions,t=!1,n=0;n\n \n \n {% block sw_data_grid_body_columns %}\n {% block sw_data_grid_column_actions %}\n \n {% endblock %}\n {% endblock %}\n \n

{{ $tc(\'adyen.noNotificationsReceived\') }}

\n
\n \n{% endblock %}\n',inject:["adyenService"],mixins:[m.getByName("notification")],props:{order:{type:Object,required:!0}},data:function(){return{notifications:[],columns:[{property:"pspReference",label:this.$tc("adyen.columnHeaders.pspReference")},{property:"eventCode",label:this.$tc("adyen.columnHeaders.event")},{property:"success",label:this.$tc("adyen.columnHeaders.success")},{property:"amount",label:this.$tc("adyen.columnHeaders.amount")},{property:"status",label:this.$tc("adyen.columnHeaders.status")},{property:"createdAt",label:this.$tc("adyen.columnHeaders.created")},{property:"updatedAt",label:this.$tc("adyen.columnHeaders.updated")},{property:"errorCount",label:this.$tc("adyen.columnHeaders.errorCount")},{property:"errorMessage",label:this.$tc("adyen.columnHeaders.errorMessage")}],showWidget:!1}},methods:{fetchNotifications:function(){var e=this;this.adyenService.fetchNotifications(this.order.id).then((function(t){e.notifications=t}))},onReschedule:function(e){var t=this;this.adyenService.rescheduleNotification(e.notificationId).then((function(e){t.createNotificationSuccess({title:t.$tc("adyen.reprocessNotification"),message:t.$tc("adyen.notificationRescheduleSuccess")}),t.fetchNotifications()}))}},beforeMount:function(){this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchNotifications()}});var g={isVersionOlderThan65:function(){var e,t,n=Shopware.Context.app.config.version;return-1===(t="6.5.0.0",(e=n).startsWith(t+"-")?-1:t.startsWith(e+"-")?1:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"case",caseFirst:"upper"}))}},v=g;Shopware.Component.register("adyen-partial-payments",{template:'
\n
    \n
    {{ $tc(\'adyen.authorisedPayments\') }}
    \n
    \n {{ payment.pspReference }} -\n {{ payment.method }} -\n {{ payment.amount }}\n
    \n
    {{ errorMessage }}
    \n
\n
    \n \n
    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n
    \n PSP Reference\n
    \n
    \n
    \n Payment Method\n
    \n
    \n
    \n Amount\n
    \n
    \n \n \n
    \n {{ payment.method }}\n
    \n
    \n
    \n {{ payment.amount }}\n
    \n
    \n
    \n
    \n {{ errorMessage }}\n
\n
\n',inject:["adyenService"],props:{order:{type:Object,required:!0}},methods:{fetchAdyenPartialPayments:function(){var e=this;this.adyenService.fetchAdyenPartialPayments(this.order.id).then((function(t){t.length>0?e.partialPayments=t:e.errorMessage=e.$tc("adyen.pendingWebhook")}))}},data:function(){return{errorMessage:"",partialPayments:[],showWidget:!1,isVersionOlderThan65:!1}},beforeMount:function(){this.isVersionOlderThan65=v.isVersionOlderThan65(),this.showWidget=this.adyenService.isAdyenOrder(this.order),this.showWidget&&this.fetchAdyenPartialPayments()}});Shopware.Component.override("sw-order-detail-general",{template:'{% block sw_order_detail_general_line_items_card %}\n {% parent %}\n \n \n \n{% endblock %}\n'});Shopware.Component.override("sw-order-detail-base",{template:'{% block sw_order_detail_base_custom_fields %}\n {% parent %}\n \n \n \n{% endblock %}\n'});Shopware.Component.override("sw-order-user-card",{template:'{% block sw_order_detail_base_secondary_info_payment %}\n {% parent %}\n\n \n{% endblock %}\n'});Shopware.Component.override("sw-order-detail-details",{template:'{% block sw_order_detail_details_payment_method_select %}\n {% parent %}\n\n \n{% endblock %}\n'});n("vNjL");var w=n("GGYj");Shopware.Locale.extend("en-GB",w)},GGYj:function(e){e.exports=JSON.parse('{"adyen":{"configTestTitle":"Configuration test","configTestSuccess":"Configuration is successfully tested","configTestFail":"There\'s an issue in your configuration","adyenRefunds":"Adyen Refunds","refundTitle":"Refund","refundSuccessful":"A refund has been successfully submitted.","invalidRefundAmount":"Refund amount exceeds order total","error":"An error has occurred. Please check the logs.","refundFetchError":"An error has occurred while attempting to get linked refunds.","refundConfirm":"Create refund for order","createRefund":"Create Refund","noRefundsCreated":"No refunds created","columnHeaders":{"pspReference":"PSP Reference","amount":"Amount","status":"Status","event":"Event","success":"Success","created":"Created","updated":"Updated","errorCount":"Error Count","errorMessage":"Error Message"},"reprocessNotification":"Reprocess Notification","notificationRescheduleSuccess":"Notification will be processed again.","notificationsTitle":"Adyen Webhook Notifications","noNotificationsReceived":"No webhook notifications received.","adyenPaymentCaptureTitle":"Adyen Capture Requests","noCaptureRequests":"No capture requests have been sent","sendCaptureRequest":"Send Capture Request","captureConfirm":"Capture payment for order","captureSuccessful":"Capture request has been successfully sent","pendingWebhook":"Order is pending webhook.","authorisedPayments":"Authorised Payments"}}')},H7Mt:function(e,t,n){var r=n("mH+n");r.__esModule&&(r=r.default),"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);(0,n("P8hj").default)("056a1238",r,!0,{})},P8hj:function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},a=0;an.parts.length&&(r.parts.length=n.parts.length)}else{var o=[];for(a=0;a2&&void 0!==arguments[2]?arguments[2]:"adyen";return r(this,l),(n=d.call(this,e,t,a)).headers=n.getBasicHeaders({}),n}return t=l,(n=[{key:"check",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.post("_action/".concat(this.getApiBasePath(),"/verify"),e,{headers:t}).then((function(e){return c.handleResponse(e)}))}},{key:"capture",value:function(e){return this.httpClient.post(this.getApiBasePath()+"/capture",{orderId:e},{headers:this.headers}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"getCaptureRequests",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/captures",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during capture request: "+e.message),e}))}},{key:"isCaptureAllowed",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-capture-allowed",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"isManualCaptureEnabled",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/is-manual-capture-enabled",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during is-capture-allowed request: "+e.message),e}))}},{key:"getRefunds",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/refunds",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during refunds request: "+e.message),e}))}},{key:"postRefund",value:function(e,t){var n=this.getBasicHeaders({});return this.httpClient.post(this.getApiBasePath()+"/refunds",{orderId:e,refundAmount:t},{headers:n}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred during post refund request: "+e.message),e}))}},{key:"fetchNotifications",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/orders/"+e+"/notifications",{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"rescheduleNotification",value:function(e){var t=this.getBasicHeaders({});return this.httpClient.get(this.getApiBasePath()+"/reschedule-notification/"+e,{headers:t}).then((function(e){return c.handleResponse(e)})).catch((function(e){throw console.error("An error occurred: "+e.message),e}))}},{key:"isAdyenOrder",value:function(e){for(var t=e.transactions,n=!1,r=0;r