From 9a111c2cd2ffd8a063070d8acaeb20d7956f9eaf Mon Sep 17 00:00:00 2001 From: Frederik Rommel Date: Thu, 18 Jul 2024 11:44:34 +0200 Subject: [PATCH] webhook forward: update labels & add success message on save --- .../page/payone-notification-target-detail/index.js | 11 ++++++++++- .../payone-notification-target/snippet/de_DE.json | 11 ++++++----- .../payone-notification-target/snippet/en_GB.json | 13 +++++++------ .../public/administration/js/payone-payment.js | 6 +++--- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-detail/index.js b/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-detail/index.js index 22de21bd3..ecd605db7 100644 --- a/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-detail/index.js +++ b/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-detail/index.js @@ -116,8 +116,17 @@ export default { this.notificationTargetRepository.save(this.notificationTarget, Shopware.Context.api).then(() => { this.isLoading = false; this.isSaveSuccessful = true; + this.createNotificationSuccess({ + message: this.$tc( + 'payonePayment.notificationTarget.messages.successfullySaved' + ), + }); + if (this.notificationTargetId === null) { - this.$router.push({ name: 'payone.notification.target.detail', params: { id: this.notificationTarget.id } }); + this.$router.push({ + name: 'payone.notification.target.detail', + params: {id: this.notificationTarget.id} + }); return; } diff --git a/src/Resources/app/administration/src/module/payone-notification-target/snippet/de_DE.json b/src/Resources/app/administration/src/module/payone-notification-target/snippet/de_DE.json index 09fe70b91..329457017 100644 --- a/src/Resources/app/administration/src/module/payone-notification-target/snippet/de_DE.json +++ b/src/Resources/app/administration/src/module/payone-notification-target/snippet/de_DE.json @@ -2,16 +2,16 @@ "payonePayment": { "notificationTarget": { "module": { - "title": "Payone Notificationweiterleitungen", - "buttonTitle": "Notifications" + "title": "PAYONE Webhook-Weiterleitungen", + "buttonTitle": "Webhook Weiterleitungen" }, "list": { - "title": "Notificationweiterleitungen", + "title": "Webhook Weiterleitungen", "empty": "Keine Einträge", "buttonCreate": "Weiterleitungsziel anlegen" }, "detail": { - "headline": "Notificationweiterleitung", + "headline": "Webhook-Weiterleitung", "placeholder": { "url": "Url", "username": "Benutzer", @@ -36,7 +36,8 @@ "requeue": "Erneut senden" }, "messages": { - "success": "Die Weiterleitung wurde erfolgreich in Auftrag gegeben." + "success": "Die Weiterleitung wurde erfolgreich in Auftrag gegeben.", + "successfullySaved": "Das Weiterleitungsziel wurde erfolgreich gespeichert." } } } diff --git a/src/Resources/app/administration/src/module/payone-notification-target/snippet/en_GB.json b/src/Resources/app/administration/src/module/payone-notification-target/snippet/en_GB.json index 1d0e8102f..b6dc65737 100644 --- a/src/Resources/app/administration/src/module/payone-notification-target/snippet/en_GB.json +++ b/src/Resources/app/administration/src/module/payone-notification-target/snippet/en_GB.json @@ -2,16 +2,16 @@ "payonePayment": { "notificationTarget": { "module": { - "title": "Payone notification forward", - "buttonTitle": "Notifications" + "title": "PAYONE webhook forward", + "buttonTitle": "Webhook forwards" }, "list": { - "title": "Notification forward", + "title": "Webhook forward", "empty": "No entries", - "buttonCreate": "Add new notification target" + "buttonCreate": "Add new forward target" }, "detail": { - "headline": "Notification forward", + "headline": "Webhook forward", "placeholder": { "url": "Url", "username": "Username", @@ -36,7 +36,8 @@ "requeue": "Requeue" }, "messages": { - "success": "The notification forward has been successfully queued." + "success": "The notification forward has been successfully queued.", + "successfullySaved": "The forwarding target has been saved successfully." } } } diff --git a/src/Resources/public/administration/js/payone-payment.js b/src/Resources/public/administration/js/payone-payment.js index 82f221a22..358b976dd 100755 --- a/src/Resources/public/administration/js/payone-payment.js +++ b/src/Resources/public/administration/js/payone-payment.js @@ -292,7 +292,7 @@ {% endblock %} {% endblock %} -`});var B=i(()=>{});var z={};r(z,{default:()=>Xe});var Y,Xe,G=i(()=>{M();B();({Mixin:Y}=Shopware),Xe={template:q,mixins:[Y.getByName("notification"),Y.getByName("sw-inline-snippet")],inject:["PayonePaymentSettingsService"],data(){return{isLoading:!1,isTesting:!1,isSaveSuccessful:!1,isTestSuccessful:!1,isApplePayCertConfigured:!0,isSupportModalOpen:!1,stateMachineTransitionActions:[],displayStatusMapping:{}}},created(){this.createdComponent()},metaInfo(){return{title:this.$createTitle()}},methods:{createdComponent(){this.PayonePaymentSettingsService.hasApplePayCert().then(e=>{this.isApplePayCertConfigured=e})},saveFinish(){this.isSaveSuccessful=!1},testFinish(){this.isTestSuccessful=!1},getConfigValue(e){let t=this.$refs.systemConfig.actualConfigData,a=t.null,n=this.$refs.systemConfig.currentSalesChannelId;return n===null?t.null[`PayonePayment.settings.${e}`]:t[n][`PayonePayment.settings.${e}`]||a[`PayonePayment.settings.${e}`]},getPaymentConfigValue(e,t){let a=e.charAt(0).toUpperCase()+e.slice(1);return this.getConfigValue(t+a)||this.getConfigValue(e)},onSave(){this.isSaveSuccessful=!1,this.isLoading=!0,this.$refs.systemConfig.saveAll().then(e=>{this.handleRatepayProfileUpdates(e),this.isSaveSuccessful=!0}).finally(()=>{this.isLoading=!1})},onTest(){this.isTesting=!0,this.isTestSuccessful=!1;let e={};this.$refs.systemConfig.config.forEach(t=>{let a=t.name.match(/^payment_(.+)$/),n=a?a[1]:null;n&&(e[n]={merchantId:this.getPaymentConfigValue("merchantId",n),accountId:this.getPaymentConfigValue("accountId",n),portalId:this.getPaymentConfigValue("portalId",n),portalKey:this.getPaymentConfigValue("portalKey",n)})}),this.PayonePaymentSettingsService.validateApiCredentials(e).then(t=>{let a=t.testCount,n=t.credentialsValid,o=t.errors;if(n)this.createNotificationSuccess({title:this.$tc("payone-payment.settingsForm.titleSuccess"),message:a>0?this.$tc("payone-payment.settingsForm.messageTestSuccess"):this.$tc("payone-payment.settingsForm.messageTestNoTestedPayments")}),this.isTestSuccessful=!0;else for(let s in o)if(o.hasOwnProperty(s)){this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageTestError."+s)});let l=o[s];typeof l=="string"&&this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:l})}}).finally(t=>{this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageTestError.general")}),this.isTesting=!1})},handleRatepayProfileUpdates(e){let t=this.$refs.systemConfig.currentSalesChannelId;if(e.payoneRatepayProfilesUpdateResult&&e.payoneRatepayProfilesUpdateResult[t]){let a=e.payoneRatepayProfilesUpdateResult[t];this.$root.$emit("payone-ratepay-profiles-update-result",a),Array.isArray(a.errors)||this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageSaveError.ratepayProfilesUpdateFailed")})}}}}});var U,K=i(()=>{U=`{% block payone_notification_target_detail %} +`});var B=i(()=>{});var W={};r(W,{default:()=>Xe});var Y,Xe,z=i(()=>{M();B();({Mixin:Y}=Shopware),Xe={template:q,mixins:[Y.getByName("notification"),Y.getByName("sw-inline-snippet")],inject:["PayonePaymentSettingsService"],data(){return{isLoading:!1,isTesting:!1,isSaveSuccessful:!1,isTestSuccessful:!1,isApplePayCertConfigured:!0,isSupportModalOpen:!1,stateMachineTransitionActions:[],displayStatusMapping:{}}},created(){this.createdComponent()},metaInfo(){return{title:this.$createTitle()}},methods:{createdComponent(){this.PayonePaymentSettingsService.hasApplePayCert().then(e=>{this.isApplePayCertConfigured=e})},saveFinish(){this.isSaveSuccessful=!1},testFinish(){this.isTestSuccessful=!1},getConfigValue(e){let t=this.$refs.systemConfig.actualConfigData,a=t.null,n=this.$refs.systemConfig.currentSalesChannelId;return n===null?t.null[`PayonePayment.settings.${e}`]:t[n][`PayonePayment.settings.${e}`]||a[`PayonePayment.settings.${e}`]},getPaymentConfigValue(e,t){let a=e.charAt(0).toUpperCase()+e.slice(1);return this.getConfigValue(t+a)||this.getConfigValue(e)},onSave(){this.isSaveSuccessful=!1,this.isLoading=!0,this.$refs.systemConfig.saveAll().then(e=>{this.handleRatepayProfileUpdates(e),this.isSaveSuccessful=!0}).finally(()=>{this.isLoading=!1})},onTest(){this.isTesting=!0,this.isTestSuccessful=!1;let e={};this.$refs.systemConfig.config.forEach(t=>{let a=t.name.match(/^payment_(.+)$/),n=a?a[1]:null;n&&(e[n]={merchantId:this.getPaymentConfigValue("merchantId",n),accountId:this.getPaymentConfigValue("accountId",n),portalId:this.getPaymentConfigValue("portalId",n),portalKey:this.getPaymentConfigValue("portalKey",n)})}),this.PayonePaymentSettingsService.validateApiCredentials(e).then(t=>{let a=t.testCount,n=t.credentialsValid,o=t.errors;if(n)this.createNotificationSuccess({title:this.$tc("payone-payment.settingsForm.titleSuccess"),message:a>0?this.$tc("payone-payment.settingsForm.messageTestSuccess"):this.$tc("payone-payment.settingsForm.messageTestNoTestedPayments")}),this.isTestSuccessful=!0;else for(let s in o)if(o.hasOwnProperty(s)){this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageTestError."+s)});let l=o[s];typeof l=="string"&&this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:l})}}).finally(t=>{this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageTestError.general")}),this.isTesting=!1})},handleRatepayProfileUpdates(e){let t=this.$refs.systemConfig.currentSalesChannelId;if(e.payoneRatepayProfilesUpdateResult&&e.payoneRatepayProfilesUpdateResult[t]){let a=e.payoneRatepayProfilesUpdateResult[t];this.$root.$emit("payone-ratepay-profiles-update-result",a),Array.isArray(a.errors)||this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageSaveError.ratepayProfilesUpdateFailed")})}}}}});var U,K=i(()=>{U=`{% block payone_notification_target_detail %} {% block payone_notification_target_detail_header %} @@ -409,7 +409,7 @@ {% endblock %} -`});var V={};r(V,{default:()=>it});var nt,it,j=i(()=>{K();({Mixin:nt}=Shopware),it={template:U,inject:["repositoryFactory"],mixins:[nt.getByName("notification")],shortcuts:{"SYSTEMKEY+S":"onSave",ESCAPE:"onCancel"},props:{notificationTargetId:{type:String,required:!1,default:null}},data(){return{notificationTarget:null,isLoading:!1,isSaveSuccessful:!1,processSuccess:!1}},metaInfo(){return{title:this.$createTitle(this.identifier)}},computed:{notificationTargetIsLoading(){return this.isLoading||this.notificationTarget==null},notificationTargetRepository(){return this.repositoryFactory.create("payone_payment_notification_target")}},watch:{notificationTargetId(){this.createdComponent()}},created(){this.createdComponent()},methods:{createdComponent(){if(this.notificationTargetId){this.loadEntityData();return}Shopware.State.commit("context/resetLanguageToDefault"),this.notificationTarget=this.notificationTargetRepository.create(Shopware.Context.api)},loadEntityData(){this.isLoading=!0,this.notificationTargetRepository.get(this.notificationTargetId,Shopware.Context.api).then(e=>{this.isLoading=!1,this.notificationTarget=e,e.txactions!==null&&(e.txactions.length||(this.notificationTarget.txactions=null))})},isInvalid(){return this.notificationTarget.isBasicAuth!==!0||this.notificationTarget.username&&this.notificationTarget.password?!1:(this.createNotificationError({message:this.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),!0)},onSave(){this.isInvalid()||(this.isLoading=!0,this.notificationTargetRepository.save(this.notificationTarget,Shopware.Context.api).then(()=>{if(this.isLoading=!1,this.isSaveSuccessful=!0,this.notificationTargetId===null){this.$router.push({name:"payone.notification.target.detail",params:{id:this.notificationTarget.id}});return}this.loadEntityData()}).catch(e=>{throw this.isLoading=!1,this.createNotificationError({message:this.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),e}))},onCancel(){this.$router.push({name:"payone.notification.target.list"})}}}});var Q,H=i(()=>{Q=`{% block payone_notification_target_list %} +`});var V={};r(V,{default:()=>it});var nt,it,j=i(()=>{K();({Mixin:nt}=Shopware),it={template:U,inject:["repositoryFactory"],mixins:[nt.getByName("notification")],shortcuts:{"SYSTEMKEY+S":"onSave",ESCAPE:"onCancel"},props:{notificationTargetId:{type:String,required:!1,default:null}},data(){return{notificationTarget:null,isLoading:!1,isSaveSuccessful:!1,processSuccess:!1}},metaInfo(){return{title:this.$createTitle(this.identifier)}},computed:{notificationTargetIsLoading(){return this.isLoading||this.notificationTarget==null},notificationTargetRepository(){return this.repositoryFactory.create("payone_payment_notification_target")}},watch:{notificationTargetId(){this.createdComponent()}},created(){this.createdComponent()},methods:{createdComponent(){if(this.notificationTargetId){this.loadEntityData();return}Shopware.State.commit("context/resetLanguageToDefault"),this.notificationTarget=this.notificationTargetRepository.create(Shopware.Context.api)},loadEntityData(){this.isLoading=!0,this.notificationTargetRepository.get(this.notificationTargetId,Shopware.Context.api).then(e=>{this.isLoading=!1,this.notificationTarget=e,e.txactions!==null&&(e.txactions.length||(this.notificationTarget.txactions=null))})},isInvalid(){return this.notificationTarget.isBasicAuth!==!0||this.notificationTarget.username&&this.notificationTarget.password?!1:(this.createNotificationError({message:this.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),!0)},onSave(){this.isInvalid()||(this.isLoading=!0,this.notificationTargetRepository.save(this.notificationTarget,Shopware.Context.api).then(()=>{if(this.isLoading=!1,this.isSaveSuccessful=!0,this.createNotificationSuccess({message:this.$tc("payonePayment.notificationTarget.messages.successfullySaved")}),this.notificationTargetId===null){this.$router.push({name:"payone.notification.target.detail",params:{id:this.notificationTarget.id}});return}this.loadEntityData()}).catch(e=>{throw this.isLoading=!1,this.createNotificationError({message:this.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),e}))},onCancel(){this.$router.push({name:"payone.notification.target.list"})}}}});var Q,H=i(()=>{Q=`{% block payone_notification_target_list %} {% block payone_notification_target_list_smart_bar_header %} @@ -891,4 +891,4 @@ Create a pem-File afterwards by using the following command:
openssl x509 -inform der -in merchant_id.cer -out merchant_id.pem

Copy certificate (merchant_id.pem) and key (merchant_id.key) file into the following folder:
-
%shopwareRoot%/config/apple-pay-cert
`}},transitionActionNames:{cancel:"Cancel",complete:"Complete",pay:"Pay",pay_partially:"Pay partially",process:"Process",refund:"Refund",refund_partially:"Refund partially",remind:"Remind",reopen:"Reopen",retour:"Retour",retour_partially:"Retour partially",ship:"Ship",ship_partially:"Ship partially"},messageNotBlank:"This field must not be empty.",error:{transaction:{notFound:"No matching transaction could be found",orderNotFound:"No matching order could be found"}}},"sw-privileges":{additional_permissions:{Payone:{label:"PAYONE",payone_order_management:"PAYONE transaction management"}}}};var{Filter:P}=Shopware;P.register("payone_currency",(e,t,a)=>e===null?"-":(e/=100,P.getByName("currency")(e,t,a)));var{Component:Ze,Utils:k}=Shopware;Ze.extend("payone-payment-settings","sw-system-config",{inject:["PayonePaymentSettingsService"],methods:{_getShowPaymentStatusFieldsFieldName(e){return`PayonePayment.settings.${e}_show_status_mapping`},async readConfig(){this.stateMaschineOptions=await this.PayonePaymentSettingsService.getStateMachineTransitionActions().then(e=>e.data.map(t=>{let a=`payone-payment.transitionActionNames.${t.label}`,n=this.$t(a);return n===a&&(n=t.label),{id:t.value,name:n}})),await this.$super("readConfig"),this.config.forEach(e=>{let t=e.name.match(/^payment_(.*)$/),a=t?t[1]:null;a&&(this.addApiConfigurationFieldsToPaymentSettingCard(e,a),this.addPaymentStatusFieldsToPaymentSettingCard(e,a)),(e.name.startsWith("payment_")||e.name==="status_mapping")&&(e.setShowFields=n=>{e.showFields=n,e.elements.forEach(o=>{o.hidden=!n}),this.showPaymentStatusFieldsBasedOnToggle(e)},e.setShowFields(!1))})},addApiConfigurationFieldsToPaymentSettingCard(e,t){let a=["merchantId","accountId","portalId","portalKey"],n=this.config.find(s=>s.name==="basic_configuration"),o=[];n.elements.forEach(s=>{let l=s.name.match(/\.([^.]+)$/),c=l?l[1]:null;if(!c||!a.includes(c))return;let u=k.object.cloneDeep(s);u.name=s.name.replace("."+c,"."+t+(c[0].toUpperCase()+c.slice(1))),u.config.helpText={"en-GB":"The basic configuration value is used, if nothing is entered here.","de-DE":"Es wird der Wert aus der Grundeinstellung verwendet, wenn hier kein Wert eingetragen ist."},o.push(u)}),e.elements=o.concat(e.elements)},addPaymentStatusFieldsToPaymentSettingCard(e,t){e.elements.push({config:{componentName:"sw-switch-field",label:{"en-GB":"Display state mapping configuration","de-DE":"Statusmappingkonfiguration einblenden"},helpText:{"en-GB":"If not configured the general status mapping config will be applied.","de-DE":"Sie k\xF6nnen f\xFCr jede Zahlungsart ein spezifisches Statusmapping konfigurieren. Existiert eine solche Konfiguration nicht, wird auf die allgemeine Konfiguration zur\xFCckgegriffen."}},name:this._getShowPaymentStatusFieldsFieldName(e.name)}),this.config.find(n=>n.name==="status_mapping").elements.forEach(n=>{let o=k.object.cloneDeep(n);o.name=n.name.replace(".paymentStatus",`.${t}PaymentStatus`),e.elements.push(o)})},getElementBind(e,t){let a=this.$super("getElementBind",e,t);return(e.name.includes("PaymentStatus")||e.name.includes(".paymentStatus"))&&(a.config.options=this.stateMaschineOptions),a},getInheritWrapperBind(e){let t=this.$super("getInheritWrapperBind",e);return t.hidden=e.hidden,t},showPaymentStatusFieldsBasedOnToggle(e){let t=this.actualConfigData[this.currentSalesChannelId];if(!t)return;let a=t[this._getShowPaymentStatusFieldsFieldName(e.name)];e.elements.forEach(n=>{n.name.includes("PaymentStatus")&&(n.hidden=!a)})},emitConfig(){this.config.forEach(e=>this.showPaymentStatusFieldsBasedOnToggle(e)),this.$super("emitConfig")}}});Shopware.Component.register("payone-payment-plugin-icon",()=>Promise.resolve().then(()=>(C(),T)));Shopware.Component.register("payone-ratepay-profile-configurations",()=>Promise.resolve().then(()=>(D(),$)));Shopware.Component.register("payone-ratepay-profiles",()=>Promise.resolve().then(()=>(F(),R)));Shopware.Component.register("payone-settings",()=>Promise.resolve().then(()=>(G(),z)));Shopware.Module.register("payone-payment",{type:"plugin",name:"PayonePayment",title:"payone-payment.general.mainMenuItemGeneral",description:"payone-payment.general.descriptionTextModule",version:"1.0.0",targetVersion:"1.0.0",icon:"regular-cog",snippets:{"de-DE":w,"en-GB":_},routeMiddleware(e,t){e(t)},routes:{index:{component:"payone-settings",path:"index",meta:{parentPath:"sw.settings.index"}}},settingsItem:[{name:"payone-payment",to:"payone.payment.index",label:"payone-payment.general.mainMenuItemGeneral",group:"plugins",iconComponent:"payone-payment-plugin-icon",backgroundEnabled:!1}]});var Z={payonePayment:{notificationTarget:{module:{title:"Payone Notificationweiterleitungen",buttonTitle:"Notifications"},list:{title:"Notificationweiterleitungen",empty:"Keine Eintr\xE4ge",buttonCreate:"Weiterleitungsziel anlegen"},detail:{headline:"Notificationweiterleitung",placeholder:{url:"Url",username:"Benutzer",password:"Passwort"},label:{url:"Url",isBasicAuth:"Basic Auth",txactions:"txactions",buttonSave:"Speichern",buttonCancel:"Abbrechen",username:"Benutzer",password:"Passwort"}},columns:{url:"Url",isBasicAuth:"Basic Auth",txactions:"txactions"},actions:{requeue:"Erneut senden"},messages:{success:"Die Weiterleitung wurde erfolgreich in Auftrag gegeben."}}}};var W={payonePayment:{notificationTarget:{module:{title:"Payone notification forward",buttonTitle:"Notifications"},list:{title:"Notification forward",empty:"No entries",buttonCreate:"Add new notification target"},detail:{headline:"Notification forward",placeholder:{url:"Url",username:"Username",password:"Password"},label:{url:"Url",isBasicAuth:"Basic Auth",txactions:"txactions",buttonSave:"Save",buttonCancel:"Cancel",username:"Username",password:"Password"}},columns:{url:"Url",isBasicAuth:"Basic Auth",txactions:"txactions"},actions:{requeue:"Requeue"},messages:{success:"The notification forward has been successfully queued."}}}};Shopware.Component.register("payone-notification-target-detail",Promise.resolve().then(()=>(j(),V)));Shopware.Component.register("payone-notification-target-list",Promise.resolve().then(()=>(X(),J)));Shopware.Module.register("payone-notification-target",{type:"plugin",name:"PayoneNotificationTarget",title:"payonePayment.notificationTarget.module.title",description:"payonePayment.notificationTarget.module.title",icon:"regular-cog",snippets:{"de-DE":Z,"en-GB":W},routes:{list:{component:"payone-notification-target-list",path:"list"},detail:{component:"payone-notification-target-detail",path:"detail/:id",props:{default(e){return{notificationTargetId:e.params.id}}},meta:{parentPath:"payone.notification.target.list"}},create:{component:"payone-notification-target-detail",path:"create",meta:{parentPath:"payone.notification.target.list"}}}});Shopware.Component.register("payone-capture-button",()=>Promise.resolve().then(()=>(oe(),ie)));Shopware.Component.register("payone-order-items",()=>Promise.resolve().then(()=>(de(),ce)));Shopware.Component.register("payone-payment-management",()=>Promise.resolve().then(()=>(he(),ye)));Shopware.Component.register("payone-payment-order-action-log",()=>Promise.resolve().then(()=>(we(),be)));Shopware.Component.register("payone-payment-webhook-log",()=>Promise.resolve().then(()=>(ve(),Ae)));Shopware.Component.register("payone-refund-button",()=>Promise.resolve().then(()=>(Ee(),Ie)));Shopware.Component.register("sw-order-detail-payone",()=>Promise.resolve().then(()=>(Ne(),Le)));Shopware.Component.override("sw-order-detail",()=>Promise.resolve().then(()=>(Me(),Fe)));Shopware.Module.register("sw-order-detail-tab-payone",{routeMiddleware(e,t){t.name==="sw.order.detail"&&t.children.push({name:"sw.order.detail.payone",path:"payone",component:"sw-order-detail-payone",meta:{parentPath:"sw.order.detail",meta:{parentPath:"sw.order.index",privilege:"order.viewer"}}}),e(t)}});var{Application:qe}=Shopware,p=Shopware.Classes.ApiService,f=class extends p{constructor(t,a,n="payone"){super(t,a,n)}requeueNotificationForward(t){let a=`_action/${this.getApiBasePath()}/requeue-forward`;return this.httpClient.post(a,t,{headers:this.getBasicHeaders()}).then(n=>p.handleResponse(n))}capturePayment(t){let a=`_action/${this.getApiBasePath()}/capture-payment`;return this.httpClient.post(a,t,{headers:this.getBasicHeaders()}).then(n=>p.handleResponse(n))}refundPayment(t){let a=`_action/${this.getApiBasePath()}/refund-payment`;return this.httpClient.post(a,t,{headers:this.getBasicHeaders()}).then(n=>p.handleResponse(n))}};qe.addServiceProvider("PayonePaymentService",e=>{let t=qe.getContainer("init");return new f(t.httpClient,e.loginService)});var{Application:Be}=Shopware,g=Shopware.Classes.ApiService,b=class extends g{constructor(t,a,n="payone_payment"){super(t,a,n)}validateApiCredentials(t){let a=this.getBasicHeaders();return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-api-credentials`,{credentials:t},{headers:a}).then(n=>g.handleResponse(n))}getStateMachineTransitionActions(){let t=this.getBasicHeaders();return this.httpClient.get(`_action/${this.getApiBasePath()}/get-state-machine-transition-actions`,{headers:t}).then(a=>g.handleResponse(a))}hasApplePayCert(){let t=this.getBasicHeaders();return this.httpClient.get(`_action/${this.getApiBasePath()}/check-apple-pay-cert`,{headers:t}).catch(()=>!1).then(a=>!!a)}};Be.addServiceProvider("PayonePaymentSettingsService",e=>{let t=Be.getContainer("init");return new b(t.httpClient,e.loginService)});try{Shopware.Service("privileges").addPrivilegeMappingEntry({category:"additional_permissions",parent:null,key:"Payone",roles:{payone_order_management:{privileges:["order_transaction:update","order_line_item:update","state_machine_history:create",Shopware.Service("privileges").getPrivileges("order.viewer")],dependencies:[]}}})}catch{}})(); +
%shopwareRoot%/config/apple-pay-cert
`}},transitionActionNames:{cancel:"Cancel",complete:"Complete",pay:"Pay",pay_partially:"Pay partially",process:"Process",refund:"Refund",refund_partially:"Refund partially",remind:"Remind",reopen:"Reopen",retour:"Retour",retour_partially:"Retour partially",ship:"Ship",ship_partially:"Ship partially"},messageNotBlank:"This field must not be empty.",error:{transaction:{notFound:"No matching transaction could be found",orderNotFound:"No matching order could be found"}}},"sw-privileges":{additional_permissions:{Payone:{label:"PAYONE",payone_order_management:"PAYONE transaction management"}}}};var{Filter:P}=Shopware;P.register("payone_currency",(e,t,a)=>e===null?"-":(e/=100,P.getByName("currency")(e,t,a)));var{Component:Ge,Utils:k}=Shopware;Ge.extend("payone-payment-settings","sw-system-config",{inject:["PayonePaymentSettingsService"],methods:{_getShowPaymentStatusFieldsFieldName(e){return`PayonePayment.settings.${e}_show_status_mapping`},async readConfig(){this.stateMaschineOptions=await this.PayonePaymentSettingsService.getStateMachineTransitionActions().then(e=>e.data.map(t=>{let a=`payone-payment.transitionActionNames.${t.label}`,n=this.$t(a);return n===a&&(n=t.label),{id:t.value,name:n}})),await this.$super("readConfig"),this.config.forEach(e=>{let t=e.name.match(/^payment_(.*)$/),a=t?t[1]:null;a&&(this.addApiConfigurationFieldsToPaymentSettingCard(e,a),this.addPaymentStatusFieldsToPaymentSettingCard(e,a)),(e.name.startsWith("payment_")||e.name==="status_mapping")&&(e.setShowFields=n=>{e.showFields=n,e.elements.forEach(o=>{o.hidden=!n}),this.showPaymentStatusFieldsBasedOnToggle(e)},e.setShowFields(!1))})},addApiConfigurationFieldsToPaymentSettingCard(e,t){let a=["merchantId","accountId","portalId","portalKey"],n=this.config.find(s=>s.name==="basic_configuration"),o=[];n.elements.forEach(s=>{let l=s.name.match(/\.([^.]+)$/),c=l?l[1]:null;if(!c||!a.includes(c))return;let u=k.object.cloneDeep(s);u.name=s.name.replace("."+c,"."+t+(c[0].toUpperCase()+c.slice(1))),u.config.helpText={"en-GB":"The basic configuration value is used, if nothing is entered here.","de-DE":"Es wird der Wert aus der Grundeinstellung verwendet, wenn hier kein Wert eingetragen ist."},o.push(u)}),e.elements=o.concat(e.elements)},addPaymentStatusFieldsToPaymentSettingCard(e,t){e.elements.push({config:{componentName:"sw-switch-field",label:{"en-GB":"Display state mapping configuration","de-DE":"Statusmappingkonfiguration einblenden"},helpText:{"en-GB":"If not configured the general status mapping config will be applied.","de-DE":"Sie k\xF6nnen f\xFCr jede Zahlungsart ein spezifisches Statusmapping konfigurieren. Existiert eine solche Konfiguration nicht, wird auf die allgemeine Konfiguration zur\xFCckgegriffen."}},name:this._getShowPaymentStatusFieldsFieldName(e.name)}),this.config.find(n=>n.name==="status_mapping").elements.forEach(n=>{let o=k.object.cloneDeep(n);o.name=n.name.replace(".paymentStatus",`.${t}PaymentStatus`),e.elements.push(o)})},getElementBind(e,t){let a=this.$super("getElementBind",e,t);return(e.name.includes("PaymentStatus")||e.name.includes(".paymentStatus"))&&(a.config.options=this.stateMaschineOptions),a},getInheritWrapperBind(e){let t=this.$super("getInheritWrapperBind",e);return t.hidden=e.hidden,t},showPaymentStatusFieldsBasedOnToggle(e){let t=this.actualConfigData[this.currentSalesChannelId];if(!t)return;let a=t[this._getShowPaymentStatusFieldsFieldName(e.name)];e.elements.forEach(n=>{n.name.includes("PaymentStatus")&&(n.hidden=!a)})},emitConfig(){this.config.forEach(e=>this.showPaymentStatusFieldsBasedOnToggle(e)),this.$super("emitConfig")}}});Shopware.Component.register("payone-payment-plugin-icon",()=>Promise.resolve().then(()=>(C(),T)));Shopware.Component.register("payone-ratepay-profile-configurations",()=>Promise.resolve().then(()=>(D(),$)));Shopware.Component.register("payone-ratepay-profiles",()=>Promise.resolve().then(()=>(F(),R)));Shopware.Component.register("payone-settings",()=>Promise.resolve().then(()=>(z(),W)));Shopware.Module.register("payone-payment",{type:"plugin",name:"PayonePayment",title:"payone-payment.general.mainMenuItemGeneral",description:"payone-payment.general.descriptionTextModule",version:"1.0.0",targetVersion:"1.0.0",icon:"regular-cog",snippets:{"de-DE":w,"en-GB":_},routeMiddleware(e,t){e(t)},routes:{index:{component:"payone-settings",path:"index",meta:{parentPath:"sw.settings.index"}}},settingsItem:[{name:"payone-payment",to:"payone.payment.index",label:"payone-payment.general.mainMenuItemGeneral",group:"plugins",iconComponent:"payone-payment-plugin-icon",backgroundEnabled:!1}]});var G={payonePayment:{notificationTarget:{module:{title:"PAYONE Webhook-Weiterleitungen",buttonTitle:"Webhook Weiterleitungen"},list:{title:"Webhook Weiterleitungen",empty:"Keine Eintr\xE4ge",buttonCreate:"Weiterleitungsziel anlegen"},detail:{headline:"Webhook-Weiterleitung",placeholder:{url:"Url",username:"Benutzer",password:"Passwort"},label:{url:"Url",isBasicAuth:"Basic Auth",txactions:"txactions",buttonSave:"Speichern",buttonCancel:"Abbrechen",username:"Benutzer",password:"Passwort"}},columns:{url:"Url",isBasicAuth:"Basic Auth",txactions:"txactions"},actions:{requeue:"Erneut senden"},messages:{success:"Die Weiterleitung wurde erfolgreich in Auftrag gegeben.",successfullySaved:"Das Weiterleitungsziel wurde erfolgreich gespeichert."}}}};var Z={payonePayment:{notificationTarget:{module:{title:"PAYONE webhook forward",buttonTitle:"Webhook forwards"},list:{title:"Webhook forward",empty:"No entries",buttonCreate:"Add new forward target"},detail:{headline:"Webhook forward",placeholder:{url:"Url",username:"Username",password:"Password"},label:{url:"Url",isBasicAuth:"Basic Auth",txactions:"txactions",buttonSave:"Save",buttonCancel:"Cancel",username:"Username",password:"Password"}},columns:{url:"Url",isBasicAuth:"Basic Auth",txactions:"txactions"},actions:{requeue:"Requeue"},messages:{success:"The notification forward has been successfully queued.",successfullySaved:"The forwarding target has been saved successfully."}}}};Shopware.Component.register("payone-notification-target-detail",Promise.resolve().then(()=>(j(),V)));Shopware.Component.register("payone-notification-target-list",Promise.resolve().then(()=>(X(),J)));Shopware.Module.register("payone-notification-target",{type:"plugin",name:"PayoneNotificationTarget",title:"payonePayment.notificationTarget.module.title",description:"payonePayment.notificationTarget.module.title",icon:"regular-cog",snippets:{"de-DE":G,"en-GB":Z},routes:{list:{component:"payone-notification-target-list",path:"list"},detail:{component:"payone-notification-target-detail",path:"detail/:id",props:{default(e){return{notificationTargetId:e.params.id}}},meta:{parentPath:"payone.notification.target.list"}},create:{component:"payone-notification-target-detail",path:"create",meta:{parentPath:"payone.notification.target.list"}}}});Shopware.Component.register("payone-capture-button",()=>Promise.resolve().then(()=>(oe(),ie)));Shopware.Component.register("payone-order-items",()=>Promise.resolve().then(()=>(de(),ce)));Shopware.Component.register("payone-payment-management",()=>Promise.resolve().then(()=>(he(),ye)));Shopware.Component.register("payone-payment-order-action-log",()=>Promise.resolve().then(()=>(we(),be)));Shopware.Component.register("payone-payment-webhook-log",()=>Promise.resolve().then(()=>(ve(),Ae)));Shopware.Component.register("payone-refund-button",()=>Promise.resolve().then(()=>(Ee(),Ie)));Shopware.Component.register("sw-order-detail-payone",()=>Promise.resolve().then(()=>(Ne(),Le)));Shopware.Component.override("sw-order-detail",()=>Promise.resolve().then(()=>(Me(),Fe)));Shopware.Module.register("sw-order-detail-tab-payone",{routeMiddleware(e,t){t.name==="sw.order.detail"&&t.children.push({name:"sw.order.detail.payone",path:"payone",component:"sw-order-detail-payone",meta:{parentPath:"sw.order.detail",meta:{parentPath:"sw.order.index",privilege:"order.viewer"}}}),e(t)}});var{Application:qe}=Shopware,p=Shopware.Classes.ApiService,f=class extends p{constructor(t,a,n="payone"){super(t,a,n)}requeueNotificationForward(t){let a=`_action/${this.getApiBasePath()}/requeue-forward`;return this.httpClient.post(a,t,{headers:this.getBasicHeaders()}).then(n=>p.handleResponse(n))}capturePayment(t){let a=`_action/${this.getApiBasePath()}/capture-payment`;return this.httpClient.post(a,t,{headers:this.getBasicHeaders()}).then(n=>p.handleResponse(n))}refundPayment(t){let a=`_action/${this.getApiBasePath()}/refund-payment`;return this.httpClient.post(a,t,{headers:this.getBasicHeaders()}).then(n=>p.handleResponse(n))}};qe.addServiceProvider("PayonePaymentService",e=>{let t=qe.getContainer("init");return new f(t.httpClient,e.loginService)});var{Application:Be}=Shopware,g=Shopware.Classes.ApiService,b=class extends g{constructor(t,a,n="payone_payment"){super(t,a,n)}validateApiCredentials(t){let a=this.getBasicHeaders();return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-api-credentials`,{credentials:t},{headers:a}).then(n=>g.handleResponse(n))}getStateMachineTransitionActions(){let t=this.getBasicHeaders();return this.httpClient.get(`_action/${this.getApiBasePath()}/get-state-machine-transition-actions`,{headers:t}).then(a=>g.handleResponse(a))}hasApplePayCert(){let t=this.getBasicHeaders();return this.httpClient.get(`_action/${this.getApiBasePath()}/check-apple-pay-cert`,{headers:t}).catch(()=>!1).then(a=>!!a)}};Be.addServiceProvider("PayonePaymentSettingsService",e=>{let t=Be.getContainer("init");return new b(t.httpClient,e.loginService)});try{Shopware.Service("privileges").addPrivilegeMappingEntry({category:"additional_permissions",parent:null,key:"Payone",roles:{payone_order_management:{privileges:["order_transaction:update","order_line_item:update","state_machine_history:create",Shopware.Service("privileges").getPrivileges("order.viewer")],dependencies:[]}}})}catch{}})();