From 1c6242f774505ebba8a961175dd0d4f4af24355b Mon Sep 17 00:00:00 2001 From: "a.wink" Date: Tue, 22 Sep 2020 15:58:39 +0200 Subject: [PATCH 01/15] [HEIDELPAY-205] Move plugin configuration to plugin list instead of plugin manager --- .../extension/sw-plugin-list/index.js | 7 ------- .../sw-plugin-list/sw-plugin-list.html.twig | 15 --------------- .../extension/sw-settings-index/index.js | 8 ++++++++ .../sw-settings-index/sw-settings-index.html.twig | 11 +++++++++++ .../sw-settings-index/sw-settings-index.scss | 3 +++ .../module/heidel-payment-configuration/index.js | 2 +- .../public/administration/css/heidel-payment6.css | 2 +- .../public/administration/js/heidel-payment6.js | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-plugin-list/index.js delete mode 100644 src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-plugin-list/sw-plugin-list.html.twig create mode 100644 src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/index.js create mode 100644 src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/sw-settings-index.html.twig create mode 100644 src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/sw-settings-index.scss diff --git a/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-plugin-list/index.js b/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-plugin-list/index.js deleted file mode 100644 index 9eeaccb..0000000 --- a/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-plugin-list/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import template from './sw-plugin-list.html.twig'; - -const { Component } = Shopware; - -Component.override('sw-plugin-list', { - template -}); diff --git a/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-plugin-list/sw-plugin-list.html.twig b/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-plugin-list/sw-plugin-list.html.twig deleted file mode 100644 index 00c72b3..0000000 --- a/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-plugin-list/sw-plugin-list.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% block sw_plugin_list_grid_columns_actions_update %} - - - {% parent %} -{% endblock %} - -{% block sw_plugin_list_grid_columns_actions_settings %} - -{% endblock %} diff --git a/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/index.js b/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/index.js new file mode 100644 index 0000000..14ecf67 --- /dev/null +++ b/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/index.js @@ -0,0 +1,8 @@ +import template from './sw-settings-index.html.twig'; +import './sw-settings-index.scss'; + +const { Component } = Shopware; + +Component.override('sw-settings-index', { + template +}); diff --git a/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/sw-settings-index.html.twig b/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/sw-settings-index.html.twig new file mode 100644 index 0000000..f8b4697 --- /dev/null +++ b/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/sw-settings-index.html.twig @@ -0,0 +1,11 @@ +{% block sw_settings_content_card_slot_plugins %} + {% parent %} + + + + +{% endblock %} diff --git a/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/sw-settings-index.scss b/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/sw-settings-index.scss new file mode 100644 index 0000000..da8a442 --- /dev/null +++ b/src/Resources/app/administration/src/module/heidel-payment-configuration/extension/sw-settings-index/sw-settings-index.scss @@ -0,0 +1,3 @@ +.heidel-payment-icon { + height: 100%; +} diff --git a/src/Resources/app/administration/src/module/heidel-payment-configuration/index.js b/src/Resources/app/administration/src/module/heidel-payment-configuration/index.js index 46d7a31..72e616d 100644 --- a/src/Resources/app/administration/src/module/heidel-payment-configuration/index.js +++ b/src/Resources/app/administration/src/module/heidel-payment-configuration/index.js @@ -1,6 +1,6 @@ import './component/register-webhook'; -import './extension/sw-plugin-list'; +import './extension/sw-settings-index'; import './page/heidel-payment-settings'; diff --git a/src/Resources/public/administration/css/heidel-payment6.css b/src/Resources/public/administration/css/heidel-payment6.css index cc3267a..0fb8838 100644 --- a/src/Resources/public/administration/css/heidel-payment6.css +++ b/src/Resources/public/administration/css/heidel-payment6.css @@ -1 +1 @@ -.heidel-payment-detail--webhook-modal .sw-modal__body{padding:0}.heidel-payment-detail--webhook-modal .sw-modal__footer{border-top:1px solid #d1d9e0}.heidel-payment-detail--webhook-modal .heidel-payment-detail--webhook-modal{padding:20px 30px}.heidel-payment-detail--webhook-modal .sw-data-grid__bulk{display:none}.heidel-payment-actions--input .sw-field{margin-bottom:0}.heidel-payment-actions--button .sw-button{height:100%}.heidel-payment-detail{line-height:15px}.heidel-payment-detail dd,.heidel-payment-detail dt{padding:0;border-bottom:none}.heidel-payment-detail dt{font-weight:600}.heidel-payment-detail dt:not(:first-child),.heidel-payment-detail dt:only-of-type{padding-top:10px}.heidel-payment-detail .sw-button{margin-top:20px} \ No newline at end of file +.heidel-payment-detail--webhook-modal .sw-modal__body{padding:0}.heidel-payment-detail--webhook-modal .sw-modal__footer{border-top:1px solid #d1d9e0}.heidel-payment-detail--webhook-modal .heidel-payment-detail--webhook-modal{padding:20px 30px}.heidel-payment-detail--webhook-modal .sw-data-grid__bulk{display:none}.heidel-payment-icon{height:100%}.heidel-payment-actions--input .sw-field{margin-bottom:0}.heidel-payment-actions--button .sw-button{height:100%}.heidel-payment-detail{line-height:15px}.heidel-payment-detail dd,.heidel-payment-detail dt{padding:0;border-bottom:none}.heidel-payment-detail dt{font-weight:600}.heidel-payment-detail dt:not(:first-child),.heidel-payment-detail dt:only-of-type{padding-top:10px}.heidel-payment-detail .sw-button{margin-top:20px} \ No newline at end of file diff --git a/src/Resources/public/administration/js/heidel-payment6.js b/src/Resources/public/administration/js/heidel-payment6.js index 33bb3bc..3db9336 100644 --- a/src/Resources/public/administration/js/heidel-payment6.js +++ b/src/Resources/public/administration/js/heidel-payment6.js @@ -1 +1 @@ -(this.webpackJsonp=this.webpackJsonp||[]).push([["heidel-payment6"],{"+xjU":function(e,t,n){var i=n("ZiRu");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("79e04434",i,!0,{})},"/IMF":function(e,t){e.exports='{% block heidel_payment_history %}\n \n {% block heidel_payment_history_container %}\n \n {% block heidel_payment_history_data_grid %}\n \n\n {% block heidel_payment_history_actions %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}\n'},"11ZX":function(e,t){e.exports='{% block sw_order_create_details_footer_payment_method %}\n \n \n{% endblock %}\n'},D7mA:function(e,t){e.exports="{% block heidel_payment_detail %}\n \n {% block heidel_payment_detail_container %}\n \n {% block heidel_payment_detail_container_left %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotal') }}
\n
{{ paymentResource.basket.amountTotalGross | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotalVat') }}
\n
{{ paymentResource.basket.amountTotalVat | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.currency') }}
\n
{{ paymentResource.currency }}
\n\n {% block heidel_payment_detail_container_left_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_center %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountRemaining') }}
\n
{{ paymentResource.amount.remaining | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCancelled') }}
\n
{{ paymentResource.amount.canceled | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCharged') }}
\n
{{ paymentResource.amount.charged | currency(paymentResource.currency) }}
\n\n {% block heidel_payment_detail_container_center_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_right %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.shortId') }}
\n
{{ paymentResource.shortId }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.id') }}
\n
{{ paymentResource.id }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.state') }}
\n
{{ paymentResource.state.name }}
\n\n {% block heidel_payment_detail_container_right_inner %}{% endblock %}\n
\n
\n {% endblock %}\n
\n {% endblock %}\n\n {% block heidel_payment_detail_ship_button %}\n \n \n {{ $tc('heidel-payment.paymentDetails.actions.shipButton') }}\n \n \n {% endblock %}\n
\n{% endblock %}\n"},H5kE:function(e,t){e.exports="{% block sw_plugin_list_grid_columns_actions_update %}\n \n\n {% parent %}\n{% endblock %}\n\n{% block sw_plugin_list_grid_columns_actions_settings %}\n \n{% endblock %}\n"},"OOd+":function(e,t,n){var i=n("y/Ib");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("76c179b3",i,!0,{})},RLhL:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidel_payment"){super(e,t,n)}validateCredentials(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-credentials`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}registerWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/register-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}clearWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/clear-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentConfigurationService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},TEY7:function(e,t){e.exports='{% block heidel_payment_settings %}\n\n {% block heidel_payment_settings_header %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_actions %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},TqQ9:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Payment History","column":{"type":"Type","amount":"Amount","date":"Date"},"type":{"authorization":"Authorization","charge":"Charging","shipment":"Shipping notification","cancellation":"Refund","default":""}},"actions":{"chargeButton":"Charge","shipButton":"Shipping notice","refundButton":"Refund"},"detail":{"cardTitle":"Payment Details","amountTotal":"Amount (gross)","amountTotalVat":"Amount (net)","currency":"Currency","shortId":"Short-ID","id":"Payment-ID","state":"State","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)"},"metadata":{"cardTitle":"Metadata","column":{"key":"Key","value":"Value"}},"basket":{"cardTitle":"Basket","column":{"quantity":"Quantity","title":"Title","amountGross":"Amount (gross)","amountNet":"Amount (net)"}},"notifications":{"genericErrorMessage":"An error has occoured!","refundSuccessTitle":"Refund","refundSuccessMessage":"The reimbursement was successfully completed.","refundErrorTitle":"Refund","chargeSuccessTitle":"Charge","chargeSuccessMessage":"The collection of the payment was carried out successfully.","chargeErrorTitle":"Charge","shipSuccessTitle":"Shipping notice","shipSuccessMessage":"The shipping notification was successfully sent.","shipErrorTitle":"Shipping notice","invoiceNotFoundMessage":"No invoice was found for this order."}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test succeeded","message":"The provided credentials are valid!"},"error":{"title":"Test failed","message":"API Credentials are invalid, please correct them and try again!"}},"testButton":"Test API credentials","webhookButton":"Register webhooks"},"modal":{"close":"Close","webhook":{"title":"Webhooks","submit":{"register":"Register webhooks","clear":"Clear webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registered | Webhooks registered","error":"Webhook could not be registered | Webhooks could not be registered"},"clear":{"done":"Webhook cleared | Webhooks cleared","error":"Webhook could not be cleared | Webhooks could not be cleared"},"missing":{"fields":"Some mandatory fields are missing","context":"The context could not be refreshed","selection":"No domain was selected"},"notFound":{"salesChannelDomain":"The selected domain could not be found"},"globalError":{"title":"An error occured","message":"Please contact us for more information"}}}}')},VWDt:function(e,t){e.exports='{% block heidel_payment_metadata %}\n \n{% endblock %}\n'},YOLB:function(e,t){e.exports='{% block heidel_payment_payment_details %}\n
\n
\n {% block heidel_payment_payment_details_content %}\n \n {% endblock %}\n
\n\n \n
\n{% endblock %}\n'},ZiRu:function(e,t,n){},d37p:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Zahlungsverlauf","column":{"type":"Typ","amount":"Betrag","date":"Datum"},"type":{"authorization":"Reservierung","charge":"Einzug","shipment":"Versandtmitteilung","cancellation":"Rückerstattung","default":""}},"actions":{"chargeButton":"Einziehen","shipButton":"Versandmitteilung","refundButton":"Rückerstatten"},"detail":{"cardTitle":"Zahlungsdetails","amountTotal":"Betrag (brutto)","amountTotalVat":"Betrag (netto)","currency":"Währung","shortId":"Short-ID","id":"Zahlungs-ID","state":"Status","amountRemaining":"Betrag (Rest)","amountCancelled":"Betrag (Rückerstattet)","amountCharged":"Betrag (Eingezogen)"},"metadata":{"cardTitle":"Metadaten","column":{"key":"Schlüssel","value":"Wert"}},"basket":{"cardTitle":"Warenkorb","column":{"quantity":"Anzahl","title":"Titel","amountGross":"Betrag (brutto)","amountNet":"Betrag (netto)"}},"notifications":{"genericErrorMessage":"Es ist ein Fehler aufgetreten!","refundSuccessTitle":"Rückerstatten","refundSuccessMessage":"Die Rückerstattung wurde erfolgreich durchgeführt.","refundErrorTitle":"Rückerstatten","chargeSuccessTitle":"Einziehen","chargeSuccessMessage":"Das Einziehen der Zahlung wurde erfolgreich durchgeführt.","chargeErrorTitle":"Einziehen","shipSuccessTitle":"Versandmitteilung","shipSuccessMessage":"Die Versandmitteilung wurde erfolgreich gesendet.","shipErrorTitle":"Versandmitteilung","invoiceNotFoundMessage":"Zu dieser Bestellung wurde keine Rechnung gefunden"}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test erfolgreich","message":"Die angegebenen API-Zugangsdaten sind korrekt!"},"error":{"title":"Test fehlgeschlagen","message":"Die angegebenen API-Zugangsdaten sind nicht korret! Bitte korrigieren Sie die Eingabe und versuchen Sie es erneut."}},"testButton":"API Zugangsdaten testen","webhookButton":"Webhooks registrieren testen"},"modal":{"close":"Schließen","webhook":{"title":"Webhooks","submit":{"register":"Webhooks registrieren","clear":"Webhooks entfernen"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registriert | Webhooks registriert","error":"Der Webhook konnte nicht registriert werden | Die Webhooks konnten nicht registriert werden"},"clear":{"done":"Webhook entfernt | Webhooks entfernt","error":"Der Webhook konnte nicht entfernt werden | Die Webhooks konnten nicht entfernt werden"},"missing":{"fields":"Nicht alle benötigten Felder sind vorhanden","context":"Der Kontext konnte nicht aktualisiert werden","selection":"Es wurden keine Domains selektiert"},"notFound":{"salesChannelDomain":"Die spezifizierte Domain wurde nicht gefunden"},"globalError":{"title":"Ein Fehler ist aufgetreten","message":"Bitte kontaktieren sie uns für mehr Informationen"}}}}')},"f+5a":function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidelpay"){super(e,t,n)}fetchPaymentDetails(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/details`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}chargeTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}refundTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${t}/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}ship(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/ship`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},"fTS/":function(e,t){e.exports="{% block sw_order_detail_content_tabs_general %}\n {% parent %}\n\n {% block heidel_payment_payment_tab %}\n \n {{ $tc('heidel-payment.tabTitle') }}\n \n {% endblock %}\n{% endblock %}"},feyk:function(e,t){e.exports='{% block heidel_payment_payment_register_webhook %}\n
\n \n {{ $tc(\'heidel-payment-settings.form.webhookButton\') }}\n \n \n \n \n\n \n \n
\n{% endblock %}\n'},gh25:function(e,t,n){"use strict";n.r(t);var i=n("npHV"),s=n.n(i);const{Component:a,Mixin:o}=Shopware;a.register("heidel-payment-actions",{template:s.a,inject:["HeidelPaymentService"],mixins:[o.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1,transactionAmount:0}),props:{transactionResource:{type:Object,required:!0},paymentResource:{type:Object,required:!0}},computed:{isChargePossible:function(){return"authorization"===this.transactionResource.type},isRefundPossible:function(){return"charge"===this.transactionResource.type},maxTransactionAmount(){let e=0;return this.isRefundPossible?e=this.paymentResource.amount.charged-this.paymentResource.amount.canceled:this.isChargePossible&&(e=this.paymentResource.amount.remaining),e}},created(){this.transactionAmount=this.maxTransactionAmount},methods:{charge(){this.isLoading=!0,this.HeidelPaymentService.chargeTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeErrorTitle"),message:t}),this.isLoading=!1})},refund(){this.isLoading=!0,this.HeidelPaymentService.refundTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.refundErrorTitle"),message:t}),this.isLoading=!1})}}});var r=n("D7mA"),c=n.n(r);const{Component:l,Mixin:d}=Shopware;l.register("heidel-payment-detail",{template:c.a,inject:["HeidelPaymentService"],mixins:[d.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1}),props:{paymentResource:{type:Object,required:!0}},methods:{ship(){this.isLoading=!0,this.HeidelPaymentService.ship(this.paymentResource.orderId).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t?t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage"):"invoice-missing-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.invoiceNotFoundMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.shipErrorTitle"),message:t}),this.isLoading=!1})}}});var h=n("/IMF"),m=n.n(h);const{Component:p}=Shopware;p.register("heidel-payment-history",{template:m.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.transactions.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amount),this.paymentResource.currency),i=this.$options.filters.date(t.date,{hour:"numeric",minute:"numeric",second:"numeric"});e.push({type:this.transactionTypeRenderer(t.type),amount:n,date:i,resource:t})}),e},columns:function(){return[{property:"type",label:this.$tc("heidel-payment.paymentDetails.history.column.type"),rawData:!0},{property:"amount",label:this.$tc("heidel-payment.paymentDetails.history.column.amount"),rawData:!0},{property:"date",label:this.$tc("heidel-payment.paymentDetails.history.column.date"),rawData:!0}]}},methods:{transactionTypeRenderer:function(e){switch(e){case"authorization":return this.$tc("heidel-payment.paymentDetails.history.type.authorization");case"charge":return this.$tc("heidel-payment.paymentDetails.history.type.charge");case"shipment":return this.$tc("heidel-payment.paymentDetails.history.type.shipment");case"cancellation":return this.$tc("heidel-payment.paymentDetails.history.type.cancellation");default:return this.$tc("heidel-payment.paymentDetails.history.type.default")}},reloadPaymentDetails:function(){this.$emit("reload")}}});var u=n("VWDt"),y=n.n(u);const{Component:g}=Shopware;g.register("heidel-payment-metadata",{template:y.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.metadata.forEach(t=>{e.push({key:t.key,value:t.value})}),e},columns:function(){return[{property:"key",label:this.$tc("heidel-payment.paymentDetails.metadata.column.key"),rawData:!0},{property:"value",label:this.$tc("heidel-payment.paymentDetails.metadata.column.value"),rawData:!0}]}}});var b=n("psnh"),f=n.n(b);const{Component:k}=Shopware;k.register("heidel-payment-basket",{template:f.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.basket.basketItems.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amountGross),this.paymentResource.currency),i=this.$options.filters.currency(parseFloat(t.amountNet),this.paymentResource.currency);e.push({quantity:t.quantity,title:t.title,amountGross:n,amountNet:i})}),e},columns:function(){return[{property:"quantity",label:this.$tc("heidel-payment.paymentDetails.basket.column.quantity"),rawData:!0},{property:"title",label:this.$tc("heidel-payment.paymentDetails.basket.column.title"),rawData:!0},{property:"amountGross",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountGross"),rawData:!0},{property:"amountNet",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountNet"),rawData:!0}]}}});var w=n("fTS/"),_=n.n(w);const{Component:S,Context:v}=Shopware,{Criteria:D}=Shopware.Data;S.override("sw-order-detail",{template:_.a,data:()=>({isHeidelpayPayment:!1}),computed:{showTabs:()=>!0,paymentMethodStore:()=>State.getStore("payment_method")},watch:{orderId:{deep:!0,handler(){if(!this.orderId)return void(this.isHeidelpayPayment=!1);const e=this.repositoryFactory.create("order"),t=new D(1,1);t.addAssociation("transactions"),e.get(this.orderId,v.api,t).then(e=>{e.transactions.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&(this.isHeidelpayPayment=!0)})})},immediate:!0}}});var C=n("11ZX"),R=n.n(C);const{Component:$,Context:T}=Shopware,{Criteria:P}=Shopware.Data;$.override("sw-order-create-details-footer",{template:R.a,computed:{paymentMethodCriteria(){const e=new P;return this.salesChannelId&&e.addFilter(P.equals("salesChannels.id",this.salesChannelId)),e.addFilter(P.not("AND",[P.contains("handlerIdentifier","HeidelPayment6\\Components")])),e}}});var B=n("YOLB"),x=n.n(B);const{Component:L,StateDeprecated:A}=Shopware;L.register("heidel-payment-tab",{template:x.a,inject:["HeidelPaymentService"],data:()=>({paymentResources:[],isLoading:!0}),created(){this.createdComponent()},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},methods:{createdComponent(){this.loadData()},orderStore:()=>A.getStore("order"),resetDataAttributes(){this.paymentResources=[],this.isLoading=!0},reloadPaymentDetails(){this.resetDataAttributes(),this.loadData()},loadData(){const e=this.$route.params.id;this.orderStore().getByIdAsync(e).then(e=>{this.order=e,this.order.getAssociation("transactions").getList({}).then(e=>{e.items.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&this.HeidelPaymentService.fetchPaymentDetails(e.id).then(e=>{this.isLoading=!1,this.paymentResources.push(e)}).catch(()=>{this.isLoading=!1})})})})}}});var E=n("d37p"),M=n("TqQ9");const{Module:W}=Shopware;W.register("heidel-payment",{type:"plugin",name:"HeidelPayment",title:"heidel-payment.general.title",description:"heidel-payment.general.descriptionTextModule",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":E,"en-GB":M},routeMiddleware(e,t){"sw.order.detail"===t.name&&t.children.push({component:"heidel-payment-tab",name:"heidel-payment.payment.detail",isChildren:!0,path:"/sw/order/heidelpayment/detail/:id"}),e(t)}});var H=n("feyk"),I=n.n(H);n("+xjU");Shopware.Component.register("heidel-payment-register-webhook",{template:I.a,mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],computed:{salesChannelDomainColumns:()=>[{property:"id",dataIndex:"id",label:"ID"},{property:"url",dataIndex:"url",label:"URL"}],salesChannelDomainRepository(){return this.repositoryFactory.create("sales_channel_domain")}},data:()=>({showWebhookModal:!1,isLoading:!1,isRegistering:!1,isRegistrationSuccessful:!1,isClearing:!1,isClearingSuccessful:!1,salesChannelDomains:{},selection:[]}),created(){this.salesChannelDomainRepository.search(new Shopware.Data.Criteria,Shopware.Context.api).then(e=>{this.salesChannelDomains=e})},methods:{openModal(){this.showWebhookModal=!0},closeModal(){this.showWebhookModal=!1},registerWebhooks(){const e=this;this.isRegistrationSuccessful=!1,this.isRegistering=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.registerWebhooks({selection:this.selection}).then(t=>{e.isRegistrationSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isRegistering=!1})},clearWebhooks(){const e=this;this.isClearingSuccessful=!1,this.isClearing=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.clearWebhooks({selection:this.selection}).then(t=>{e.isClearingSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isClearing=!1})},onRegistrationFinished(){this.isRegistrationSuccessful=!1},onClearingFinished(){this.isClearingSuccessful=!1},onSelectItem(e){this.selection=e},messageGeneration(e){const t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n})})}}});var N=n("H5kE"),F=n.n(N);const{Component:V}=Shopware;V.override("sw-plugin-list",{template:F.a});var q=n("TEY7"),z=n.n(q);const{Component:j,Mixin:O}=Shopware,{Criteria:Z}=Shopware.Data;j.register("heidel-payment-settings",{template:z.a,mixins:[O.getByName("notification"),O.getByName("sw-inline-snippet")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],data:()=>({isLoading:!1,isTesting:!1,isTestSuccessful:!1,isSaveSuccessful:!1,config:{},showWebhookModal:!1}),metaInfo:()=>({title:"Heidelpay"}),computed:{paymentMethodRepository(){return this.repositoryFactory.create("payment_method")}},methods:{getConfigValue(e){const t=this.$refs.systemConfig.actualConfigData.null;return this.config[`HeidelPayment6.settings.${e}`]||t[`HeidelPayment6.settings.${e}`]},onValidateCredentials(){this.isTestSuccessful=!1,this.isTesting=!0;const e={publicKey:this.getConfigValue("publicKey"),privateKey:this.getConfigValue("privateKey"),salesChannel:this.$refs.systemConfig.currentSalesChannelId};this.HeidelPaymentConfigurationService.validateCredentials(e).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment-settings.form.message.success.title"),message:this.$tc("heidel-payment-settings.form.message.success.message")}),this.isTestSuccessful=!0,this.isTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.form.message.error.title"),message:this.$tc("heidel-payment-settings.form.message.error.message")}),this.isTesting=!1})},onTestFinished(){this.isTestSuccessful=!1},onSave(){this.isLoading=!0,this.$refs.systemConfig.saveAll().then(()=>{this.createNotificationSuccess({title:this.$tc("sw-plugin-config.titleSaveSuccess"),message:this.$tc("sw-plugin-config.messageSaveSuccess")}),this.isLoading=!1}).catch(e=>{this.createNotificationError({title:this.$tc("sw-plugin-config.titleSaveError"),message:e}),this.isLoading=!1})},onConfigChange(e){this.config=e},getBind(e,t){return t!==this.config&&(this.config=t),e},getDeliveryStatusCriteria(){const e=new Z(1,100);return e.addFilter(Z.equals("stateMachine.technicalName","order_delivery.state")),e},openWebhookModal(){this.showWebhookModal=!0},closeWebhookModal(){this.showWebhookModal=!1}}});const{Module:G}=Shopware;G.register("heidel-payment-configuration",{type:"plugin",name:"HeidelPayment",title:"heidel-payment-settings.module.title",description:"heidel-payment-settings.module.description",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":E,"en-GB":M},routes:{settings:{component:"heidel-payment-settings",path:"settings",meta:{parentPath:"sw.settings.index"}}}});n("f+5a"),n("RLhL"),n("OOd+")},npHV:function(e,t){e.exports='{% block heidel_payment_actions %}\n \n {% block heidel_payment_actions_amount_field %}\n
\n \n \n
\n {% endblock %}\n\n
\n {% block heidel_payment_actions_charge_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_refund_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.refundButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_default_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_button_container_inner %}{% endblock %}\n
\n
\n{% endblock %}\n'},psnh:function(e,t){e.exports='{% block heidel_payment_basket %}\n \n \n {% block heidel_payment_basket_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}\n'},"y/Ib":function(e,t,n){}},[["gh25","runtime","vendors-node"]]]); \ No newline at end of file +(this.webpackJsonp=this.webpackJsonp||[]).push([["heidel-payment6"],{"+cM6":function(e,t){e.exports="{% block sw_order_detail_content_tabs_general %}\n {% parent %}\n\n {% block heidel_payment_payment_tab %}\n \n {{ $tc('heidel-payment.tabTitle') }}\n \n {% endblock %}\n{% endblock %}"},"/l8L":function(e,t){e.exports='{% block heidel_payment_basket %}\n \n \n {% block heidel_payment_basket_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}\n'},"6Oo3":function(e,t,n){var i=n("xsxW");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("0071a1da",i,!0,{})},"940f":function(e,t){e.exports="{% block heidel_payment_detail %}\n \n {% block heidel_payment_detail_container %}\n \n {% block heidel_payment_detail_container_left %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotal') }}
\n
{{ paymentResource.basket.amountTotalGross | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotalVat') }}
\n
{{ paymentResource.basket.amountTotalVat | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.currency') }}
\n
{{ paymentResource.currency }}
\n\n {% block heidel_payment_detail_container_left_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_center %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountRemaining') }}
\n
{{ paymentResource.amount.remaining | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCancelled') }}
\n
{{ paymentResource.amount.canceled | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCharged') }}
\n
{{ paymentResource.amount.charged | currency(paymentResource.currency) }}
\n\n {% block heidel_payment_detail_container_center_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_right %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.shortId') }}
\n
{{ paymentResource.shortId }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.id') }}
\n
{{ paymentResource.id }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.state') }}
\n
{{ paymentResource.state.name }}
\n\n {% block heidel_payment_detail_container_right_inner %}{% endblock %}\n
\n
\n {% endblock %}\n
\n {% endblock %}\n\n {% block heidel_payment_detail_ship_button %}\n \n \n {{ $tc('heidel-payment.paymentDetails.actions.shipButton') }}\n \n \n {% endblock %}\n
\n{% endblock %}\n"},BgHK:function(e,t){e.exports='{% block heidel_payment_settings %}\n\n {% block heidel_payment_settings_header %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_actions %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},CWl0:function(e,t,n){"use strict";n.r(t);var i=n("RT+u"),s=n.n(i);const{Component:a,Mixin:o}=Shopware;a.register("heidel-payment-actions",{template:s.a,inject:["HeidelPaymentService"],mixins:[o.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1,transactionAmount:0}),props:{transactionResource:{type:Object,required:!0},paymentResource:{type:Object,required:!0}},computed:{isChargePossible:function(){return"authorization"===this.transactionResource.type},isRefundPossible:function(){return"charge"===this.transactionResource.type},maxTransactionAmount(){let e=0;return this.isRefundPossible?e=this.paymentResource.amount.charged-this.paymentResource.amount.canceled:this.isChargePossible&&(e=this.paymentResource.amount.remaining),e}},created(){this.transactionAmount=this.maxTransactionAmount},methods:{charge(){this.isLoading=!0,this.HeidelPaymentService.chargeTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeErrorTitle"),message:t}),this.isLoading=!1})},refund(){this.isLoading=!0,this.HeidelPaymentService.refundTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.refundErrorTitle"),message:t}),this.isLoading=!1})}}});var r=n("940f"),c=n.n(r);const{Component:l,Mixin:d}=Shopware;l.register("heidel-payment-detail",{template:c.a,inject:["HeidelPaymentService"],mixins:[d.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1}),props:{paymentResource:{type:Object,required:!0}},methods:{ship(){this.isLoading=!0,this.HeidelPaymentService.ship(this.paymentResource.orderId).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t?t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage"):"invoice-missing-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.invoiceNotFoundMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.shipErrorTitle"),message:t}),this.isLoading=!1})}}});var h=n("tPMm"),m=n.n(h);const{Component:p}=Shopware;p.register("heidel-payment-history",{template:m.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.transactions.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amount),this.paymentResource.currency),i=this.$options.filters.date(t.date,{hour:"numeric",minute:"numeric",second:"numeric"});e.push({type:this.transactionTypeRenderer(t.type),amount:n,date:i,resource:t})}),e},columns:function(){return[{property:"type",label:this.$tc("heidel-payment.paymentDetails.history.column.type"),rawData:!0},{property:"amount",label:this.$tc("heidel-payment.paymentDetails.history.column.amount"),rawData:!0},{property:"date",label:this.$tc("heidel-payment.paymentDetails.history.column.date"),rawData:!0}]}},methods:{transactionTypeRenderer:function(e){switch(e){case"authorization":return this.$tc("heidel-payment.paymentDetails.history.type.authorization");case"charge":return this.$tc("heidel-payment.paymentDetails.history.type.charge");case"shipment":return this.$tc("heidel-payment.paymentDetails.history.type.shipment");case"cancellation":return this.$tc("heidel-payment.paymentDetails.history.type.cancellation");default:return this.$tc("heidel-payment.paymentDetails.history.type.default")}},reloadPaymentDetails:function(){this.$emit("reload")}}});var u=n("OPFU"),y=n.n(u);const{Component:g}=Shopware;g.register("heidel-payment-metadata",{template:y.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.metadata.forEach(t=>{e.push({key:t.key,value:t.value})}),e},columns:function(){return[{property:"key",label:this.$tc("heidel-payment.paymentDetails.metadata.column.key"),rawData:!0},{property:"value",label:this.$tc("heidel-payment.paymentDetails.metadata.column.value"),rawData:!0}]}}});var b=n("/l8L"),f=n.n(b);const{Component:k}=Shopware;k.register("heidel-payment-basket",{template:f.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.basket.basketItems.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amountGross),this.paymentResource.currency),i=this.$options.filters.currency(parseFloat(t.amountNet),this.paymentResource.currency);e.push({quantity:t.quantity,title:t.title,amountGross:n,amountNet:i})}),e},columns:function(){return[{property:"quantity",label:this.$tc("heidel-payment.paymentDetails.basket.column.quantity"),rawData:!0},{property:"title",label:this.$tc("heidel-payment.paymentDetails.basket.column.title"),rawData:!0},{property:"amountGross",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountGross"),rawData:!0},{property:"amountNet",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountNet"),rawData:!0}]}}});var w=n("+cM6"),_=n.n(w);const{Component:S,Context:v}=Shopware,{Criteria:C}=Shopware.Data;S.override("sw-order-detail",{template:_.a,data:()=>({isHeidelpayPayment:!1}),computed:{showTabs:()=>!0,paymentMethodStore:()=>State.getStore("payment_method")},watch:{orderId:{deep:!0,handler(){if(!this.orderId)return void(this.isHeidelpayPayment=!1);const e=this.repositoryFactory.create("order"),t=new C(1,1);t.addAssociation("transactions"),e.get(this.orderId,v.api,t).then(e=>{e.transactions.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&(this.isHeidelpayPayment=!0)})})},immediate:!0}}});var D=n("zkbf"),R=n.n(D);const{Component:$,Context:T}=Shopware,{Criteria:P}=Shopware.Data;$.override("sw-order-create-details-footer",{template:R.a,computed:{paymentMethodCriteria(){const e=new P;return this.salesChannelId&&e.addFilter(P.equals("salesChannels.id",this.salesChannelId)),e.addFilter(P.not("AND",[P.contains("handlerIdentifier","HeidelPayment6\\Components")])),e}}});var x=n("kZaU"),B=n.n(x);const{Component:M,StateDeprecated:L}=Shopware;M.register("heidel-payment-tab",{template:B.a,inject:["HeidelPaymentService"],data:()=>({paymentResources:[],isLoading:!0}),created(){this.createdComponent()},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},methods:{createdComponent(){this.loadData()},orderStore:()=>L.getStore("order"),resetDataAttributes(){this.paymentResources=[],this.isLoading=!0},reloadPaymentDetails(){this.resetDataAttributes(),this.loadData()},loadData(){const e=this.$route.params.id;this.orderStore().getByIdAsync(e).then(e=>{this.order=e,this.order.getAssociation("transactions").getList({}).then(e=>{e.items.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&this.HeidelPaymentService.fetchPaymentDetails(e.id).then(e=>{this.isLoading=!1,this.paymentResources.push(e)}).catch(()=>{this.isLoading=!1})})})})}}});var A=n("mtIW"),E=n("LUCd");const{Module:W}=Shopware;W.register("heidel-payment",{type:"plugin",name:"HeidelPayment",title:"heidel-payment.general.title",description:"heidel-payment.general.descriptionTextModule",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":A,"en-GB":E},routeMiddleware(e,t){"sw.order.detail"===t.name&&t.children.push({component:"heidel-payment-tab",name:"heidel-payment.payment.detail",isChildren:!0,path:"/sw/order/heidelpayment/detail/:id"}),e(t)}});var H=n("jmLH"),N=n.n(H);n("gOz8");Shopware.Component.register("heidel-payment-register-webhook",{template:N.a,mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],computed:{salesChannelDomainColumns:()=>[{property:"id",dataIndex:"id",label:"ID"},{property:"url",dataIndex:"url",label:"URL"}],salesChannelDomainRepository(){return this.repositoryFactory.create("sales_channel_domain")}},data:()=>({showWebhookModal:!1,isLoading:!1,isRegistering:!1,isRegistrationSuccessful:!1,isClearing:!1,isClearingSuccessful:!1,salesChannelDomains:{},selection:[]}),created(){this.salesChannelDomainRepository.search(new Shopware.Data.Criteria,Shopware.Context.api).then(e=>{this.salesChannelDomains=e})},methods:{openModal(){this.showWebhookModal=!0},closeModal(){this.showWebhookModal=!1},registerWebhooks(){const e=this;this.isRegistrationSuccessful=!1,this.isRegistering=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.registerWebhooks({selection:this.selection}).then(t=>{e.isRegistrationSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isRegistering=!1})},clearWebhooks(){const e=this;this.isClearingSuccessful=!1,this.isClearing=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.clearWebhooks({selection:this.selection}).then(t=>{e.isClearingSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isClearing=!1})},onRegistrationFinished(){this.isRegistrationSuccessful=!1},onClearingFinished(){this.isClearingSuccessful=!1},onSelectItem(e){this.selection=e},messageGeneration(e){const t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n})})}}});var I=n("crgo"),F=n.n(I);n("nrpx");const{Component:z}=Shopware;z.override("sw-settings-index",{template:F.a});var V=n("BgHK"),j=n.n(V);const{Component:O,Mixin:q}=Shopware,{Criteria:G}=Shopware.Data;O.register("heidel-payment-settings",{template:j.a,mixins:[q.getByName("notification"),q.getByName("sw-inline-snippet")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],data:()=>({isLoading:!1,isTesting:!1,isTestSuccessful:!1,isSaveSuccessful:!1,config:{},showWebhookModal:!1}),metaInfo:()=>({title:"Heidelpay"}),computed:{paymentMethodRepository(){return this.repositoryFactory.create("payment_method")}},methods:{getConfigValue(e){const t=this.$refs.systemConfig.actualConfigData.null;return this.config[`HeidelPayment6.settings.${e}`]||t[`HeidelPayment6.settings.${e}`]},onValidateCredentials(){this.isTestSuccessful=!1,this.isTesting=!0;const e={publicKey:this.getConfigValue("publicKey"),privateKey:this.getConfigValue("privateKey"),salesChannel:this.$refs.systemConfig.currentSalesChannelId};this.HeidelPaymentConfigurationService.validateCredentials(e).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment-settings.form.message.success.title"),message:this.$tc("heidel-payment-settings.form.message.success.message")}),this.isTestSuccessful=!0,this.isTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.form.message.error.title"),message:this.$tc("heidel-payment-settings.form.message.error.message")}),this.isTesting=!1})},onTestFinished(){this.isTestSuccessful=!1},onSave(){this.isLoading=!0,this.$refs.systemConfig.saveAll().then(()=>{this.createNotificationSuccess({title:this.$tc("sw-plugin-config.titleSaveSuccess"),message:this.$tc("sw-plugin-config.messageSaveSuccess")}),this.isLoading=!1}).catch(e=>{this.createNotificationError({title:this.$tc("sw-plugin-config.titleSaveError"),message:e}),this.isLoading=!1})},onConfigChange(e){this.config=e},getBind(e,t){return t!==this.config&&(this.config=t),e},getDeliveryStatusCriteria(){const e=new G(1,100);return e.addFilter(G.equals("stateMachine.technicalName","order_delivery.state")),e},openWebhookModal(){this.showWebhookModal=!0},closeWebhookModal(){this.showWebhookModal=!1}}});const{Module:Z}=Shopware;Z.register("heidel-payment-configuration",{type:"plugin",name:"HeidelPayment",title:"heidel-payment-settings.module.title",description:"heidel-payment-settings.module.description",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":A,"en-GB":E},routes:{settings:{component:"heidel-payment-settings",path:"settings",meta:{parentPath:"sw.settings.index"}}}});n("yrsN"),n("s9yU"),n("6Oo3")},Kh9Q:function(e,t,n){},LUCd:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Payment History","column":{"type":"Type","amount":"Amount","date":"Date"},"type":{"authorization":"Authorization","charge":"Charging","shipment":"Shipping notification","cancellation":"Refund","default":""}},"actions":{"chargeButton":"Charge","shipButton":"Shipping notice","refundButton":"Refund"},"detail":{"cardTitle":"Payment Details","amountTotal":"Amount (gross)","amountTotalVat":"Amount (net)","currency":"Currency","shortId":"Short-ID","id":"Payment-ID","state":"State","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)"},"metadata":{"cardTitle":"Metadata","column":{"key":"Key","value":"Value"}},"basket":{"cardTitle":"Basket","column":{"quantity":"Quantity","title":"Title","amountGross":"Amount (gross)","amountNet":"Amount (net)"}},"notifications":{"genericErrorMessage":"An error has occoured!","refundSuccessTitle":"Refund","refundSuccessMessage":"The reimbursement was successfully completed.","refundErrorTitle":"Refund","chargeSuccessTitle":"Charge","chargeSuccessMessage":"The collection of the payment was carried out successfully.","chargeErrorTitle":"Charge","shipSuccessTitle":"Shipping notice","shipSuccessMessage":"The shipping notification was successfully sent.","shipErrorTitle":"Shipping notice","invoiceNotFoundMessage":"No invoice was found for this order."}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test succeeded","message":"The provided credentials are valid!"},"error":{"title":"Test failed","message":"API Credentials are invalid, please correct them and try again!"}},"testButton":"Test API credentials","webhookButton":"Register webhooks"},"modal":{"close":"Close","webhook":{"title":"Webhooks","submit":{"register":"Register webhooks","clear":"Clear webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registered | Webhooks registered","error":"Webhook could not be registered | Webhooks could not be registered"},"clear":{"done":"Webhook cleared | Webhooks cleared","error":"Webhook could not be cleared | Webhooks could not be cleared"},"missing":{"fields":"Some mandatory fields are missing","context":"The context could not be refreshed","selection":"No domain was selected"},"notFound":{"salesChannelDomain":"The selected domain could not be found"},"globalError":{"title":"An error occured","message":"Please contact us for more information"}}}}')},OPFU:function(e,t){e.exports='{% block heidel_payment_metadata %}\n \n{% endblock %}\n'},PPSw:function(e,t,n){},"RT+u":function(e,t){e.exports='{% block heidel_payment_actions %}\n \n {% block heidel_payment_actions_amount_field %}\n
\n \n \n
\n {% endblock %}\n\n
\n {% block heidel_payment_actions_charge_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_refund_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.refundButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_default_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_button_container_inner %}{% endblock %}\n
\n
\n{% endblock %}\n'},crgo:function(e,t){e.exports='{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'},gOz8:function(e,t,n){var i=n("PPSw");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("21d79666",i,!0,{})},jmLH:function(e,t){e.exports='{% block heidel_payment_payment_register_webhook %}\n
\n \n {{ $tc(\'heidel-payment-settings.form.webhookButton\') }}\n \n \n \n \n\n \n \n
\n{% endblock %}\n'},kZaU:function(e,t){e.exports='{% block heidel_payment_payment_details %}\n
\n
\n {% block heidel_payment_payment_details_content %}\n \n {% endblock %}\n
\n\n \n
\n{% endblock %}\n'},mtIW:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Zahlungsverlauf","column":{"type":"Typ","amount":"Betrag","date":"Datum"},"type":{"authorization":"Reservierung","charge":"Einzug","shipment":"Versandtmitteilung","cancellation":"Rückerstattung","default":""}},"actions":{"chargeButton":"Einziehen","shipButton":"Versandmitteilung","refundButton":"Rückerstatten"},"detail":{"cardTitle":"Zahlungsdetails","amountTotal":"Betrag (brutto)","amountTotalVat":"Betrag (netto)","currency":"Währung","shortId":"Short-ID","id":"Zahlungs-ID","state":"Status","amountRemaining":"Betrag (Rest)","amountCancelled":"Betrag (Rückerstattet)","amountCharged":"Betrag (Eingezogen)"},"metadata":{"cardTitle":"Metadaten","column":{"key":"Schlüssel","value":"Wert"}},"basket":{"cardTitle":"Warenkorb","column":{"quantity":"Anzahl","title":"Titel","amountGross":"Betrag (brutto)","amountNet":"Betrag (netto)"}},"notifications":{"genericErrorMessage":"Es ist ein Fehler aufgetreten!","refundSuccessTitle":"Rückerstatten","refundSuccessMessage":"Die Rückerstattung wurde erfolgreich durchgeführt.","refundErrorTitle":"Rückerstatten","chargeSuccessTitle":"Einziehen","chargeSuccessMessage":"Das Einziehen der Zahlung wurde erfolgreich durchgeführt.","chargeErrorTitle":"Einziehen","shipSuccessTitle":"Versandmitteilung","shipSuccessMessage":"Die Versandmitteilung wurde erfolgreich gesendet.","shipErrorTitle":"Versandmitteilung","invoiceNotFoundMessage":"Zu dieser Bestellung wurde keine Rechnung gefunden"}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test erfolgreich","message":"Die angegebenen API-Zugangsdaten sind korrekt!"},"error":{"title":"Test fehlgeschlagen","message":"Die angegebenen API-Zugangsdaten sind nicht korret! Bitte korrigieren Sie die Eingabe und versuchen Sie es erneut."}},"testButton":"API Zugangsdaten testen","webhookButton":"Webhooks registrieren testen"},"modal":{"close":"Schließen","webhook":{"title":"Webhooks","submit":{"register":"Webhooks registrieren","clear":"Webhooks entfernen"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registriert | Webhooks registriert","error":"Der Webhook konnte nicht registriert werden | Die Webhooks konnten nicht registriert werden"},"clear":{"done":"Webhook entfernt | Webhooks entfernt","error":"Der Webhook konnte nicht entfernt werden | Die Webhooks konnten nicht entfernt werden"},"missing":{"fields":"Nicht alle benötigten Felder sind vorhanden","context":"Der Kontext konnte nicht aktualisiert werden","selection":"Es wurden keine Domains selektiert"},"notFound":{"salesChannelDomain":"Die spezifizierte Domain wurde nicht gefunden"},"globalError":{"title":"Ein Fehler ist aufgetreten","message":"Bitte kontaktieren sie uns für mehr Informationen"}}}}')},nrpx:function(e,t,n){var i=n("Kh9Q");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("56b4b8b2",i,!0,{})},s9yU:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidel_payment"){super(e,t,n)}validateCredentials(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-credentials`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}registerWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/register-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}clearWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/clear-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentConfigurationService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},tPMm:function(e,t){e.exports='{% block heidel_payment_history %}\n \n {% block heidel_payment_history_container %}\n \n {% block heidel_payment_history_data_grid %}\n \n\n {% block heidel_payment_history_actions %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}\n'},xsxW:function(e,t,n){},yrsN:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidelpay"){super(e,t,n)}fetchPaymentDetails(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/details`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}chargeTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}refundTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${t}/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}ship(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/ship`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},zkbf:function(e,t){e.exports='{% block sw_order_create_details_footer_payment_method %}\n \n \n{% endblock %}\n'}},[["CWl0","runtime","vendors-node"]]]); \ No newline at end of file From e5c3e9049b4cd892994c504e31a98785c0812788 Mon Sep 17 00:00:00 2001 From: "a.wink" Date: Fri, 25 Sep 2020 14:56:09 +0200 Subject: [PATCH 02/15] [HEIDELPAY-205] Rebuild administration and storefront --- .../app/storefront/dist/storefront/js/heidel-payment6.js | 2 +- src/Resources/public/administration/js/heidel-payment6.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Resources/app/storefront/dist/storefront/js/heidel-payment6.js b/src/Resources/app/storefront/dist/storefront/js/heidel-payment6.js index 93d8f25..fe173c4 100644 --- a/src/Resources/app/storefront/dist/storefront/js/heidel-payment6.js +++ b/src/Resources/app/storefront/dist/storefront/js/heidel-payment6.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([["heidel-payment6"],{XtTf:function(e,t,n){"use strict";n.r(t);var i=n("FGIj");function r(e){return(r="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 o(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=document.getElementsByClassName(this.options.errorWrapperClass).item(0),i=document.querySelectorAll(this.options.errorContentSelector)[0];t&&""!==i.innerText?i.innerText="".concat(i.innerText,"\n").concat(e.message):i.innerText=e.message,n.hidden=!1,n.scrollIntoView({block:"end",behavior:"smooth"}),this.setSubmitButtonActive(!0)}},{key:"renderErrorToElement",value:function(e,t){var n=document.getElementsByClassName(this.options.errorWrapperClass).item(0);document.querySelectorAll(this.options.errorContentSelector)[0].innerText=e.message,n.hidden=!1,t.appendChild(n)}},{key:"_registerEvents",value:function(){this.submitButton.addEventListener("click",this._onSubmitButtonClick.bind(this))}},{key:"_onSubmitButtonClick",value:function(e){e.preventDefault(),this._validateForm()?(this.setSubmitButtonActive(!1),this.$emitter.publish("heidelpayBase_createResource")):this.setSubmitButtonActive(!0)}},{key:"_validateForm",value:function(){var e=!0,t=document.forms[this.options.confirmFormId].elements;this._clearErrorMessage();for(var n=0;n0&&this.showError({message:this.options.errorShouldNotBeEmpty.replace(/%field%/,i.labels[0].innerText)},!0),e=!1):i.classList.remove("is-invalid")}return e}},{key:"_clearErrorMessage",value:function(){var e=document.getElementsByClassName(this.options.errorWrapperClass).item(0);document.querySelectorAll(this.options.errorContentSelector)[0].innerText="",e.hidden=!0}},{key:"getB2bCustomerObject",value:function(e){return{firstname:e.firstName,lastname:e.lastName,company:e.activeBillingAddress.company,salutation:e.salutation.salutationKey,birthDate:e.lastName.birthday,email:e.email,billingAddress:{street:e.activeBillingAddress.street,zip:e.activeBillingAddress.zipcode,city:e.activeBillingAddress.city,country:e.activeBillingAddress.country.name},shippingAddress:{street:e.activeShippingAddress.street,zip:e.activeShippingAddress.zipcode,city:e.activeShippingAddress.city,country:e.activeShippingAddress.country.name}}}}])&&o(n.prototype,i),r&&o(n,r),t}(i.a);c(l,"options",{publicKey:null,submitButtonId:"confirmFormSubmit",disabledClass:"disabled",resourceIdElementId:"heidelpayResourceId",confirmFormId:"confirmOrderForm",errorWrapperClass:"heidelpay-error-wrapper",errorContentSelector:".heidelpay-error-wrapper .alert-content",errorShouldNotBeEmpty:"%field% should not be empty",isOrderEdit:!1}),c(l,"heidelpayInstance",null);var h=n("gHbT");function d(e){return(d="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 p(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=document.getElementsByClassName(this.options.errorWrapperClass).item(0),i=document.querySelectorAll(this.options.errorContentSelector)[0];t&&""!==i.innerText?i.innerText="".concat(i.innerText,"\n").concat(e.message):i.innerText=e.message,n.hidden=!1,n.scrollIntoView({block:"end",behavior:"smooth"}),this.setSubmitButtonActive(!0)}},{key:"renderErrorToElement",value:function(e,t){var n=document.getElementsByClassName(this.options.errorWrapperClass).item(0);document.querySelectorAll(this.options.errorContentSelector)[0].innerText=e.message,n.hidden=!1,t.appendChild(n)}},{key:"_registerEvents",value:function(){this.submitButton.addEventListener("click",this._onSubmitButtonClick.bind(this))}},{key:"_onSubmitButtonClick",value:function(e){e.preventDefault(),this._validateForm()?(this.setSubmitButtonActive(!1),this.$emitter.publish("heidelpayBase_createResource")):this.setSubmitButtonActive(!0)}},{key:"_validateForm",value:function(){var e=!0,t=document.forms[this.options.confirmFormId].elements;this._clearErrorMessage();for(var n=0;n0&&this.showError({message:this.options.errorShouldNotBeEmpty.replace(/%field%/,i.labels[0].innerText)},!0),e=!1):i.classList.remove("is-invalid")}return e}},{key:"_clearErrorMessage",value:function(){var e=document.getElementsByClassName(this.options.errorWrapperClass).item(0);document.querySelectorAll(this.options.errorContentSelector)[0].innerText="",e.hidden=!0}},{key:"getB2bCustomerObject",value:function(e){return{firstname:e.firstName,lastname:e.lastName,company:e.activeBillingAddress.company,salutation:e.salutation.salutationKey,birthDate:e.lastName.birthday,email:e.email,billingAddress:{street:e.activeBillingAddress.street,zip:e.activeBillingAddress.zipcode,city:e.activeBillingAddress.city,country:e.activeBillingAddress.country.name},shippingAddress:{street:e.activeShippingAddress.street,zip:e.activeShippingAddress.zipcode,city:e.activeShippingAddress.city,country:e.activeShippingAddress.country.name}}}}])&&o(n.prototype,i),r&&o(n,r),t}(i.a);c(l,"options",{publicKey:null,submitButtonId:"confirmFormSubmit",disabledClass:"disabled",resourceIdElementId:"heidelpayResourceId",confirmFormId:"confirmOrderForm",errorWrapperClass:"heidelpay-error-wrapper",errorContentSelector:".heidelpay-error-wrapper .alert-content",errorShouldNotBeEmpty:"%field% should not be empty",isOrderEdit:!1}),c(l,"heidelpayInstance",null);var h=n("gHbT");function d(e){return(d="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 p(e,t){for(var n=0;n\n {{ $tc('heidel-payment.tabTitle') }}\n \n {% endblock %}\n{% endblock %}"},"/l8L":function(e,t){e.exports='{% block heidel_payment_basket %}\n \n \n {% block heidel_payment_basket_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}\n'},"6Oo3":function(e,t,n){var i=n("xsxW");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("0071a1da",i,!0,{})},"940f":function(e,t){e.exports="{% block heidel_payment_detail %}\n \n {% block heidel_payment_detail_container %}\n \n {% block heidel_payment_detail_container_left %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotal') }}
\n
{{ paymentResource.basket.amountTotalGross | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotalVat') }}
\n
{{ paymentResource.basket.amountTotalVat | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.currency') }}
\n
{{ paymentResource.currency }}
\n\n {% block heidel_payment_detail_container_left_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_center %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountRemaining') }}
\n
{{ paymentResource.amount.remaining | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCancelled') }}
\n
{{ paymentResource.amount.canceled | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCharged') }}
\n
{{ paymentResource.amount.charged | currency(paymentResource.currency) }}
\n\n {% block heidel_payment_detail_container_center_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_right %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.shortId') }}
\n
{{ paymentResource.shortId }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.id') }}
\n
{{ paymentResource.id }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.state') }}
\n
{{ paymentResource.state.name }}
\n\n {% block heidel_payment_detail_container_right_inner %}{% endblock %}\n
\n
\n {% endblock %}\n
\n {% endblock %}\n\n {% block heidel_payment_detail_ship_button %}\n \n \n {{ $tc('heidel-payment.paymentDetails.actions.shipButton') }}\n \n \n {% endblock %}\n
\n{% endblock %}\n"},BgHK:function(e,t){e.exports='{% block heidel_payment_settings %}\n\n {% block heidel_payment_settings_header %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_actions %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},CWl0:function(e,t,n){"use strict";n.r(t);var i=n("RT+u"),s=n.n(i);const{Component:a,Mixin:o}=Shopware;a.register("heidel-payment-actions",{template:s.a,inject:["HeidelPaymentService"],mixins:[o.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1,transactionAmount:0}),props:{transactionResource:{type:Object,required:!0},paymentResource:{type:Object,required:!0}},computed:{isChargePossible:function(){return"authorization"===this.transactionResource.type},isRefundPossible:function(){return"charge"===this.transactionResource.type},maxTransactionAmount(){let e=0;return this.isRefundPossible?e=this.paymentResource.amount.charged-this.paymentResource.amount.canceled:this.isChargePossible&&(e=this.paymentResource.amount.remaining),e}},created(){this.transactionAmount=this.maxTransactionAmount},methods:{charge(){this.isLoading=!0,this.HeidelPaymentService.chargeTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeErrorTitle"),message:t}),this.isLoading=!1})},refund(){this.isLoading=!0,this.HeidelPaymentService.refundTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.refundErrorTitle"),message:t}),this.isLoading=!1})}}});var r=n("940f"),c=n.n(r);const{Component:l,Mixin:d}=Shopware;l.register("heidel-payment-detail",{template:c.a,inject:["HeidelPaymentService"],mixins:[d.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1}),props:{paymentResource:{type:Object,required:!0}},methods:{ship(){this.isLoading=!0,this.HeidelPaymentService.ship(this.paymentResource.orderId).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t?t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage"):"invoice-missing-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.invoiceNotFoundMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.shipErrorTitle"),message:t}),this.isLoading=!1})}}});var h=n("tPMm"),m=n.n(h);const{Component:p}=Shopware;p.register("heidel-payment-history",{template:m.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.transactions.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amount),this.paymentResource.currency),i=this.$options.filters.date(t.date,{hour:"numeric",minute:"numeric",second:"numeric"});e.push({type:this.transactionTypeRenderer(t.type),amount:n,date:i,resource:t})}),e},columns:function(){return[{property:"type",label:this.$tc("heidel-payment.paymentDetails.history.column.type"),rawData:!0},{property:"amount",label:this.$tc("heidel-payment.paymentDetails.history.column.amount"),rawData:!0},{property:"date",label:this.$tc("heidel-payment.paymentDetails.history.column.date"),rawData:!0}]}},methods:{transactionTypeRenderer:function(e){switch(e){case"authorization":return this.$tc("heidel-payment.paymentDetails.history.type.authorization");case"charge":return this.$tc("heidel-payment.paymentDetails.history.type.charge");case"shipment":return this.$tc("heidel-payment.paymentDetails.history.type.shipment");case"cancellation":return this.$tc("heidel-payment.paymentDetails.history.type.cancellation");default:return this.$tc("heidel-payment.paymentDetails.history.type.default")}},reloadPaymentDetails:function(){this.$emit("reload")}}});var u=n("OPFU"),y=n.n(u);const{Component:g}=Shopware;g.register("heidel-payment-metadata",{template:y.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.metadata.forEach(t=>{e.push({key:t.key,value:t.value})}),e},columns:function(){return[{property:"key",label:this.$tc("heidel-payment.paymentDetails.metadata.column.key"),rawData:!0},{property:"value",label:this.$tc("heidel-payment.paymentDetails.metadata.column.value"),rawData:!0}]}}});var b=n("/l8L"),f=n.n(b);const{Component:k}=Shopware;k.register("heidel-payment-basket",{template:f.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.basket.basketItems.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amountGross),this.paymentResource.currency),i=this.$options.filters.currency(parseFloat(t.amountNet),this.paymentResource.currency);e.push({quantity:t.quantity,title:t.title,amountGross:n,amountNet:i})}),e},columns:function(){return[{property:"quantity",label:this.$tc("heidel-payment.paymentDetails.basket.column.quantity"),rawData:!0},{property:"title",label:this.$tc("heidel-payment.paymentDetails.basket.column.title"),rawData:!0},{property:"amountGross",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountGross"),rawData:!0},{property:"amountNet",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountNet"),rawData:!0}]}}});var w=n("+cM6"),_=n.n(w);const{Component:S,Context:v}=Shopware,{Criteria:C}=Shopware.Data;S.override("sw-order-detail",{template:_.a,data:()=>({isHeidelpayPayment:!1}),computed:{showTabs:()=>!0,paymentMethodStore:()=>State.getStore("payment_method")},watch:{orderId:{deep:!0,handler(){if(!this.orderId)return void(this.isHeidelpayPayment=!1);const e=this.repositoryFactory.create("order"),t=new C(1,1);t.addAssociation("transactions"),e.get(this.orderId,v.api,t).then(e=>{e.transactions.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&(this.isHeidelpayPayment=!0)})})},immediate:!0}}});var D=n("zkbf"),R=n.n(D);const{Component:$,Context:T}=Shopware,{Criteria:P}=Shopware.Data;$.override("sw-order-create-details-footer",{template:R.a,computed:{paymentMethodCriteria(){const e=new P;return this.salesChannelId&&e.addFilter(P.equals("salesChannels.id",this.salesChannelId)),e.addFilter(P.not("AND",[P.contains("handlerIdentifier","HeidelPayment6\\Components")])),e}}});var x=n("kZaU"),B=n.n(x);const{Component:M,StateDeprecated:L}=Shopware;M.register("heidel-payment-tab",{template:B.a,inject:["HeidelPaymentService"],data:()=>({paymentResources:[],isLoading:!0}),created(){this.createdComponent()},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},methods:{createdComponent(){this.loadData()},orderStore:()=>L.getStore("order"),resetDataAttributes(){this.paymentResources=[],this.isLoading=!0},reloadPaymentDetails(){this.resetDataAttributes(),this.loadData()},loadData(){const e=this.$route.params.id;this.orderStore().getByIdAsync(e).then(e=>{this.order=e,this.order.getAssociation("transactions").getList({}).then(e=>{e.items.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&this.HeidelPaymentService.fetchPaymentDetails(e.id).then(e=>{this.isLoading=!1,this.paymentResources.push(e)}).catch(()=>{this.isLoading=!1})})})})}}});var A=n("mtIW"),E=n("LUCd");const{Module:W}=Shopware;W.register("heidel-payment",{type:"plugin",name:"HeidelPayment",title:"heidel-payment.general.title",description:"heidel-payment.general.descriptionTextModule",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":A,"en-GB":E},routeMiddleware(e,t){"sw.order.detail"===t.name&&t.children.push({component:"heidel-payment-tab",name:"heidel-payment.payment.detail",isChildren:!0,path:"/sw/order/heidelpayment/detail/:id"}),e(t)}});var H=n("jmLH"),N=n.n(H);n("gOz8");Shopware.Component.register("heidel-payment-register-webhook",{template:N.a,mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],computed:{salesChannelDomainColumns:()=>[{property:"id",dataIndex:"id",label:"ID"},{property:"url",dataIndex:"url",label:"URL"}],salesChannelDomainRepository(){return this.repositoryFactory.create("sales_channel_domain")}},data:()=>({showWebhookModal:!1,isLoading:!1,isRegistering:!1,isRegistrationSuccessful:!1,isClearing:!1,isClearingSuccessful:!1,salesChannelDomains:{},selection:[]}),created(){this.salesChannelDomainRepository.search(new Shopware.Data.Criteria,Shopware.Context.api).then(e=>{this.salesChannelDomains=e})},methods:{openModal(){this.showWebhookModal=!0},closeModal(){this.showWebhookModal=!1},registerWebhooks(){const e=this;this.isRegistrationSuccessful=!1,this.isRegistering=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.registerWebhooks({selection:this.selection}).then(t=>{e.isRegistrationSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isRegistering=!1})},clearWebhooks(){const e=this;this.isClearingSuccessful=!1,this.isClearing=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.clearWebhooks({selection:this.selection}).then(t=>{e.isClearingSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isClearing=!1})},onRegistrationFinished(){this.isRegistrationSuccessful=!1},onClearingFinished(){this.isClearingSuccessful=!1},onSelectItem(e){this.selection=e},messageGeneration(e){const t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n})})}}});var I=n("crgo"),F=n.n(I);n("nrpx");const{Component:z}=Shopware;z.override("sw-settings-index",{template:F.a});var V=n("BgHK"),j=n.n(V);const{Component:O,Mixin:q}=Shopware,{Criteria:G}=Shopware.Data;O.register("heidel-payment-settings",{template:j.a,mixins:[q.getByName("notification"),q.getByName("sw-inline-snippet")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],data:()=>({isLoading:!1,isTesting:!1,isTestSuccessful:!1,isSaveSuccessful:!1,config:{},showWebhookModal:!1}),metaInfo:()=>({title:"Heidelpay"}),computed:{paymentMethodRepository(){return this.repositoryFactory.create("payment_method")}},methods:{getConfigValue(e){const t=this.$refs.systemConfig.actualConfigData.null;return this.config[`HeidelPayment6.settings.${e}`]||t[`HeidelPayment6.settings.${e}`]},onValidateCredentials(){this.isTestSuccessful=!1,this.isTesting=!0;const e={publicKey:this.getConfigValue("publicKey"),privateKey:this.getConfigValue("privateKey"),salesChannel:this.$refs.systemConfig.currentSalesChannelId};this.HeidelPaymentConfigurationService.validateCredentials(e).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment-settings.form.message.success.title"),message:this.$tc("heidel-payment-settings.form.message.success.message")}),this.isTestSuccessful=!0,this.isTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.form.message.error.title"),message:this.$tc("heidel-payment-settings.form.message.error.message")}),this.isTesting=!1})},onTestFinished(){this.isTestSuccessful=!1},onSave(){this.isLoading=!0,this.$refs.systemConfig.saveAll().then(()=>{this.createNotificationSuccess({title:this.$tc("sw-plugin-config.titleSaveSuccess"),message:this.$tc("sw-plugin-config.messageSaveSuccess")}),this.isLoading=!1}).catch(e=>{this.createNotificationError({title:this.$tc("sw-plugin-config.titleSaveError"),message:e}),this.isLoading=!1})},onConfigChange(e){this.config=e},getBind(e,t){return t!==this.config&&(this.config=t),e},getDeliveryStatusCriteria(){const e=new G(1,100);return e.addFilter(G.equals("stateMachine.technicalName","order_delivery.state")),e},openWebhookModal(){this.showWebhookModal=!0},closeWebhookModal(){this.showWebhookModal=!1}}});const{Module:Z}=Shopware;Z.register("heidel-payment-configuration",{type:"plugin",name:"HeidelPayment",title:"heidel-payment-settings.module.title",description:"heidel-payment-settings.module.description",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":A,"en-GB":E},routes:{settings:{component:"heidel-payment-settings",path:"settings",meta:{parentPath:"sw.settings.index"}}}});n("yrsN"),n("s9yU"),n("6Oo3")},Kh9Q:function(e,t,n){},LUCd:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Payment History","column":{"type":"Type","amount":"Amount","date":"Date"},"type":{"authorization":"Authorization","charge":"Charging","shipment":"Shipping notification","cancellation":"Refund","default":""}},"actions":{"chargeButton":"Charge","shipButton":"Shipping notice","refundButton":"Refund"},"detail":{"cardTitle":"Payment Details","amountTotal":"Amount (gross)","amountTotalVat":"Amount (net)","currency":"Currency","shortId":"Short-ID","id":"Payment-ID","state":"State","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)"},"metadata":{"cardTitle":"Metadata","column":{"key":"Key","value":"Value"}},"basket":{"cardTitle":"Basket","column":{"quantity":"Quantity","title":"Title","amountGross":"Amount (gross)","amountNet":"Amount (net)"}},"notifications":{"genericErrorMessage":"An error has occoured!","refundSuccessTitle":"Refund","refundSuccessMessage":"The reimbursement was successfully completed.","refundErrorTitle":"Refund","chargeSuccessTitle":"Charge","chargeSuccessMessage":"The collection of the payment was carried out successfully.","chargeErrorTitle":"Charge","shipSuccessTitle":"Shipping notice","shipSuccessMessage":"The shipping notification was successfully sent.","shipErrorTitle":"Shipping notice","invoiceNotFoundMessage":"No invoice was found for this order."}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test succeeded","message":"The provided credentials are valid!"},"error":{"title":"Test failed","message":"API Credentials are invalid, please correct them and try again!"}},"testButton":"Test API credentials","webhookButton":"Register webhooks"},"modal":{"close":"Close","webhook":{"title":"Webhooks","submit":{"register":"Register webhooks","clear":"Clear webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registered | Webhooks registered","error":"Webhook could not be registered | Webhooks could not be registered"},"clear":{"done":"Webhook cleared | Webhooks cleared","error":"Webhook could not be cleared | Webhooks could not be cleared"},"missing":{"fields":"Some mandatory fields are missing","context":"The context could not be refreshed","selection":"No domain was selected"},"notFound":{"salesChannelDomain":"The selected domain could not be found"},"globalError":{"title":"An error occured","message":"Please contact us for more information"}}}}')},OPFU:function(e,t){e.exports='{% block heidel_payment_metadata %}\n \n{% endblock %}\n'},PPSw:function(e,t,n){},"RT+u":function(e,t){e.exports='{% block heidel_payment_actions %}\n \n {% block heidel_payment_actions_amount_field %}\n
\n \n \n
\n {% endblock %}\n\n
\n {% block heidel_payment_actions_charge_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_refund_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.refundButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_default_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_button_container_inner %}{% endblock %}\n
\n
\n{% endblock %}\n'},crgo:function(e,t){e.exports='{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'},gOz8:function(e,t,n){var i=n("PPSw");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("21d79666",i,!0,{})},jmLH:function(e,t){e.exports='{% block heidel_payment_payment_register_webhook %}\n
\n \n {{ $tc(\'heidel-payment-settings.form.webhookButton\') }}\n \n \n \n \n\n \n \n
\n{% endblock %}\n'},kZaU:function(e,t){e.exports='{% block heidel_payment_payment_details %}\n
\n
\n {% block heidel_payment_payment_details_content %}\n \n {% endblock %}\n
\n\n \n
\n{% endblock %}\n'},mtIW:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Zahlungsverlauf","column":{"type":"Typ","amount":"Betrag","date":"Datum"},"type":{"authorization":"Reservierung","charge":"Einzug","shipment":"Versandtmitteilung","cancellation":"Rückerstattung","default":""}},"actions":{"chargeButton":"Einziehen","shipButton":"Versandmitteilung","refundButton":"Rückerstatten"},"detail":{"cardTitle":"Zahlungsdetails","amountTotal":"Betrag (brutto)","amountTotalVat":"Betrag (netto)","currency":"Währung","shortId":"Short-ID","id":"Zahlungs-ID","state":"Status","amountRemaining":"Betrag (Rest)","amountCancelled":"Betrag (Rückerstattet)","amountCharged":"Betrag (Eingezogen)"},"metadata":{"cardTitle":"Metadaten","column":{"key":"Schlüssel","value":"Wert"}},"basket":{"cardTitle":"Warenkorb","column":{"quantity":"Anzahl","title":"Titel","amountGross":"Betrag (brutto)","amountNet":"Betrag (netto)"}},"notifications":{"genericErrorMessage":"Es ist ein Fehler aufgetreten!","refundSuccessTitle":"Rückerstatten","refundSuccessMessage":"Die Rückerstattung wurde erfolgreich durchgeführt.","refundErrorTitle":"Rückerstatten","chargeSuccessTitle":"Einziehen","chargeSuccessMessage":"Das Einziehen der Zahlung wurde erfolgreich durchgeführt.","chargeErrorTitle":"Einziehen","shipSuccessTitle":"Versandmitteilung","shipSuccessMessage":"Die Versandmitteilung wurde erfolgreich gesendet.","shipErrorTitle":"Versandmitteilung","invoiceNotFoundMessage":"Zu dieser Bestellung wurde keine Rechnung gefunden"}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test erfolgreich","message":"Die angegebenen API-Zugangsdaten sind korrekt!"},"error":{"title":"Test fehlgeschlagen","message":"Die angegebenen API-Zugangsdaten sind nicht korret! Bitte korrigieren Sie die Eingabe und versuchen Sie es erneut."}},"testButton":"API Zugangsdaten testen","webhookButton":"Webhooks registrieren testen"},"modal":{"close":"Schließen","webhook":{"title":"Webhooks","submit":{"register":"Webhooks registrieren","clear":"Webhooks entfernen"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registriert | Webhooks registriert","error":"Der Webhook konnte nicht registriert werden | Die Webhooks konnten nicht registriert werden"},"clear":{"done":"Webhook entfernt | Webhooks entfernt","error":"Der Webhook konnte nicht entfernt werden | Die Webhooks konnten nicht entfernt werden"},"missing":{"fields":"Nicht alle benötigten Felder sind vorhanden","context":"Der Kontext konnte nicht aktualisiert werden","selection":"Es wurden keine Domains selektiert"},"notFound":{"salesChannelDomain":"Die spezifizierte Domain wurde nicht gefunden"},"globalError":{"title":"Ein Fehler ist aufgetreten","message":"Bitte kontaktieren sie uns für mehr Informationen"}}}}')},nrpx:function(e,t,n){var i=n("Kh9Q");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("56b4b8b2",i,!0,{})},s9yU:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidel_payment"){super(e,t,n)}validateCredentials(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-credentials`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}registerWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/register-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}clearWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/clear-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentConfigurationService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},tPMm:function(e,t){e.exports='{% block heidel_payment_history %}\n \n {% block heidel_payment_history_container %}\n \n {% block heidel_payment_history_data_grid %}\n \n\n {% block heidel_payment_history_actions %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}\n'},xsxW:function(e,t,n){},yrsN:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidelpay"){super(e,t,n)}fetchPaymentDetails(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/details`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}chargeTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}refundTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${t}/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}ship(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/ship`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},zkbf:function(e,t){e.exports='{% block sw_order_create_details_footer_payment_method %}\n \n \n{% endblock %}\n'}},[["CWl0","runtime","vendors-node"]]]); \ No newline at end of file +(this.webpackJsonp=this.webpackJsonp||[]).push([["heidel-payment6"],{"+kxS":function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidel_payment"){super(e,t,n)}validateCredentials(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-credentials`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}registerWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/register-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}clearWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/clear-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentConfigurationService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},"1iz7":function(e,t,n){},"42IN":function(e,t){e.exports='{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'},"4aeB":function(e,t){e.exports='{% block heidel_payment_settings %}\n\n {% block heidel_payment_settings_header %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_actions %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},"5j/b":function(e,t){e.exports="{% block heidel_payment_detail %}\n \n {% block heidel_payment_detail_container %}\n \n {% block heidel_payment_detail_container_left %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotal') }}
\n
{{ paymentResource.basket.amountTotalGross | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotalVat') }}
\n
{{ paymentResource.basket.amountTotalVat | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.currency') }}
\n
{{ paymentResource.currency }}
\n\n {% block heidel_payment_detail_container_left_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_center %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountRemaining') }}
\n
{{ paymentResource.amount.remaining | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCancelled') }}
\n
{{ paymentResource.amount.canceled | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCharged') }}
\n
{{ paymentResource.amount.charged | currency(paymentResource.currency) }}
\n\n {% block heidel_payment_detail_container_center_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_right %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.shortId') }}
\n
{{ paymentResource.shortId }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.id') }}
\n
{{ paymentResource.id }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.state') }}
\n
{{ paymentResource.state.name }}
\n\n {% block heidel_payment_detail_container_right_inner %}{% endblock %}\n
\n
\n {% endblock %}\n
\n {% endblock %}\n\n {% block heidel_payment_detail_ship_button %}\n \n \n {{ $tc('heidel-payment.paymentDetails.actions.shipButton') }}\n \n \n {% endblock %}\n
\n{% endblock %}\n"},"6gNM":function(e,t,n){},BzwZ:function(e,t,n){var i=n("1iz7");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("0d46815a",i,!0,{})},Eq9y:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Payment History","column":{"type":"Type","amount":"Amount","date":"Date"},"type":{"authorization":"Authorization","charge":"Charging","shipment":"Shipping notification","cancellation":"Refund","default":""}},"actions":{"chargeButton":"Charge","shipButton":"Shipping notice","refundButton":"Refund"},"detail":{"cardTitle":"Payment Details","amountTotal":"Amount (gross)","amountTotalVat":"Amount (net)","currency":"Currency","shortId":"Short-ID","id":"Payment-ID","state":"State","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)"},"metadata":{"cardTitle":"Metadata","column":{"key":"Key","value":"Value"}},"basket":{"cardTitle":"Basket","column":{"quantity":"Quantity","title":"Title","amountGross":"Amount (gross)","amountNet":"Amount (net)"}},"notifications":{"genericErrorMessage":"An error has occoured!","refundSuccessTitle":"Refund","refundSuccessMessage":"The reimbursement was successfully completed.","refundErrorTitle":"Refund","chargeSuccessTitle":"Charge","chargeSuccessMessage":"The collection of the payment was carried out successfully.","chargeErrorTitle":"Charge","shipSuccessTitle":"Shipping notice","shipSuccessMessage":"The shipping notification was successfully sent.","shipErrorTitle":"Shipping notice","invoiceNotFoundMessage":"No invoice was found for this order."}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test succeeded","message":"The provided credentials are valid!"},"error":{"title":"Test failed","message":"API Credentials are invalid, please correct them and try again!"}},"testButton":"Test API credentials","webhookButton":"Register webhooks"},"modal":{"close":"Close","webhook":{"title":"Webhooks","submit":{"register":"Register webhooks","clear":"Clear webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registered | Webhooks registered","error":"Webhook could not be registered | Webhooks could not be registered"},"clear":{"done":"Webhook cleared | Webhooks cleared","error":"Webhook could not be cleared | Webhooks could not be cleared"},"missing":{"fields":"Some mandatory fields are missing","context":"The context could not be refreshed","selection":"No domain was selected"},"notFound":{"salesChannelDomain":"The selected domain could not be found"},"globalError":{"title":"An error occured","message":"Please contact us for more information"}}}}')},EsnK:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Zahlungsverlauf","column":{"type":"Typ","amount":"Betrag","date":"Datum"},"type":{"authorization":"Reservierung","charge":"Einzug","shipment":"Versandtmitteilung","cancellation":"Rückerstattung","default":""}},"actions":{"chargeButton":"Einziehen","shipButton":"Versandmitteilung","refundButton":"Rückerstatten"},"detail":{"cardTitle":"Zahlungsdetails","amountTotal":"Betrag (brutto)","amountTotalVat":"Betrag (netto)","currency":"Währung","shortId":"Short-ID","id":"Zahlungs-ID","state":"Status","amountRemaining":"Betrag (Rest)","amountCancelled":"Betrag (Rückerstattet)","amountCharged":"Betrag (Eingezogen)"},"metadata":{"cardTitle":"Metadaten","column":{"key":"Schlüssel","value":"Wert"}},"basket":{"cardTitle":"Warenkorb","column":{"quantity":"Anzahl","title":"Titel","amountGross":"Betrag (brutto)","amountNet":"Betrag (netto)"}},"notifications":{"genericErrorMessage":"Es ist ein Fehler aufgetreten!","refundSuccessTitle":"Rückerstatten","refundSuccessMessage":"Die Rückerstattung wurde erfolgreich durchgeführt.","refundErrorTitle":"Rückerstatten","chargeSuccessTitle":"Einziehen","chargeSuccessMessage":"Das Einziehen der Zahlung wurde erfolgreich durchgeführt.","chargeErrorTitle":"Einziehen","shipSuccessTitle":"Versandmitteilung","shipSuccessMessage":"Die Versandmitteilung wurde erfolgreich gesendet.","shipErrorTitle":"Versandmitteilung","invoiceNotFoundMessage":"Zu dieser Bestellung wurde keine Rechnung gefunden"}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test erfolgreich","message":"Die angegebenen API-Zugangsdaten sind korrekt!"},"error":{"title":"Test fehlgeschlagen","message":"Die angegebenen API-Zugangsdaten sind nicht korret! Bitte korrigieren Sie die Eingabe und versuchen Sie es erneut."}},"testButton":"API Zugangsdaten testen","webhookButton":"Webhooks registrieren testen"},"modal":{"close":"Schließen","webhook":{"title":"Webhooks","submit":{"register":"Webhooks registrieren","clear":"Webhooks entfernen"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registriert | Webhooks registriert","error":"Der Webhook konnte nicht registriert werden | Die Webhooks konnten nicht registriert werden"},"clear":{"done":"Webhook entfernt | Webhooks entfernt","error":"Der Webhook konnte nicht entfernt werden | Die Webhooks konnten nicht entfernt werden"},"missing":{"fields":"Nicht alle benötigten Felder sind vorhanden","context":"Der Kontext konnte nicht aktualisiert werden","selection":"Es wurden keine Domains selektiert"},"notFound":{"salesChannelDomain":"Die spezifizierte Domain wurde nicht gefunden"},"globalError":{"title":"Ein Fehler ist aufgetreten","message":"Bitte kontaktieren sie uns für mehr Informationen"}}}}')},Gaz2:function(e,t){e.exports='{% block heidel_payment_basket %}\n \n \n {% block heidel_payment_basket_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}\n'},JnMH:function(e,t,n){},KEl0:function(e,t){e.exports='{% block heidel_payment_actions %}\n \n {% block heidel_payment_actions_amount_field %}\n
\n \n \n
\n {% endblock %}\n\n
\n {% block heidel_payment_actions_charge_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_refund_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.refundButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_default_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_button_container_inner %}{% endblock %}\n
\n
\n{% endblock %}\n'},KmwY:function(e,t){e.exports='{% block sw_order_create_details_footer_payment_method %}\n \n \n{% endblock %}\n'},PMv5:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidelpay"){super(e,t,n)}fetchPaymentDetails(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/details`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}chargeTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}refundTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${t}/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}ship(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/ship`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},R5Kq:function(e,t){e.exports="{% block sw_order_detail_content_tabs_general %}\n {% parent %}\n\n {% block heidel_payment_payment_tab %}\n \n {{ $tc('heidel-payment.tabTitle') }}\n \n {% endblock %}\n{% endblock %}"},SAZ9:function(e,t,n){"use strict";n.r(t);var i=n("KEl0"),s=n.n(i);const{Component:a,Mixin:o}=Shopware;a.register("heidel-payment-actions",{template:s.a,inject:["HeidelPaymentService"],mixins:[o.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1,transactionAmount:0}),props:{transactionResource:{type:Object,required:!0},paymentResource:{type:Object,required:!0}},computed:{isChargePossible:function(){return"authorization"===this.transactionResource.type},isRefundPossible:function(){return"charge"===this.transactionResource.type},maxTransactionAmount(){let e=0;return this.isRefundPossible?e=this.paymentResource.amount.charged-this.paymentResource.amount.canceled:this.isChargePossible&&(e=this.paymentResource.amount.remaining),e}},created(){this.transactionAmount=this.maxTransactionAmount},methods:{charge(){this.isLoading=!0,this.HeidelPaymentService.chargeTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeErrorTitle"),message:t}),this.isLoading=!1})},refund(){this.isLoading=!0,this.HeidelPaymentService.refundTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.refundErrorTitle"),message:t}),this.isLoading=!1})}}});var r=n("5j/b"),c=n.n(r);const{Component:l,Mixin:d}=Shopware;l.register("heidel-payment-detail",{template:c.a,inject:["HeidelPaymentService"],mixins:[d.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1}),props:{paymentResource:{type:Object,required:!0}},methods:{ship(){this.isLoading=!0,this.HeidelPaymentService.ship(this.paymentResource.orderId).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t?t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage"):"invoice-missing-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.invoiceNotFoundMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.shipErrorTitle"),message:t}),this.isLoading=!1})}}});var h=n("fpPm"),m=n.n(h);const{Component:p}=Shopware;p.register("heidel-payment-history",{template:m.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.transactions.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amount),this.paymentResource.currency),i=this.$options.filters.date(t.date,{hour:"numeric",minute:"numeric",second:"numeric"});e.push({type:this.transactionTypeRenderer(t.type),amount:n,date:i,resource:t})}),e},columns:function(){return[{property:"type",label:this.$tc("heidel-payment.paymentDetails.history.column.type"),rawData:!0},{property:"amount",label:this.$tc("heidel-payment.paymentDetails.history.column.amount"),rawData:!0},{property:"date",label:this.$tc("heidel-payment.paymentDetails.history.column.date"),rawData:!0}]}},methods:{transactionTypeRenderer:function(e){switch(e){case"authorization":return this.$tc("heidel-payment.paymentDetails.history.type.authorization");case"charge":return this.$tc("heidel-payment.paymentDetails.history.type.charge");case"shipment":return this.$tc("heidel-payment.paymentDetails.history.type.shipment");case"cancellation":return this.$tc("heidel-payment.paymentDetails.history.type.cancellation");default:return this.$tc("heidel-payment.paymentDetails.history.type.default")}},reloadPaymentDetails:function(){this.$emit("reload")}}});var u=n("nmHs"),y=n.n(u);const{Component:g}=Shopware;g.register("heidel-payment-metadata",{template:y.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.metadata.forEach(t=>{e.push({key:t.key,value:t.value})}),e},columns:function(){return[{property:"key",label:this.$tc("heidel-payment.paymentDetails.metadata.column.key"),rawData:!0},{property:"value",label:this.$tc("heidel-payment.paymentDetails.metadata.column.value"),rawData:!0}]}}});var b=n("Gaz2"),f=n.n(b);const{Component:w}=Shopware;w.register("heidel-payment-basket",{template:f.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.basket.basketItems.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amountGross),this.paymentResource.currency),i=this.$options.filters.currency(parseFloat(t.amountNet),this.paymentResource.currency);e.push({quantity:t.quantity,title:t.title,amountGross:n,amountNet:i})}),e},columns:function(){return[{property:"quantity",label:this.$tc("heidel-payment.paymentDetails.basket.column.quantity"),rawData:!0},{property:"title",label:this.$tc("heidel-payment.paymentDetails.basket.column.title"),rawData:!0},{property:"amountGross",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountGross"),rawData:!0},{property:"amountNet",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountNet"),rawData:!0}]}}});var k=n("R5Kq"),_=n.n(k);const{Component:S,Context:v}=Shopware,{Criteria:D}=Shopware.Data;S.override("sw-order-detail",{template:_.a,data:()=>({isHeidelpayPayment:!1}),computed:{showTabs:()=>!0,paymentMethodStore:()=>State.getStore("payment_method")},watch:{orderId:{deep:!0,handler(){if(!this.orderId)return void(this.isHeidelpayPayment=!1);const e=this.repositoryFactory.create("order"),t=new D(1,1);t.addAssociation("transactions"),e.get(this.orderId,v.api,t).then(e=>{e.transactions.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&(this.isHeidelpayPayment=!0)})})},immediate:!0}}});var C=n("KmwY"),R=n.n(C);const{Component:$,Context:T}=Shopware,{Criteria:P}=Shopware.Data;$.override("sw-order-create-details-footer",{template:R.a,computed:{paymentMethodCriteria(){const e=new P;return this.salesChannelId&&e.addFilter(P.equals("salesChannels.id",this.salesChannelId)),e.addFilter(P.not("AND",[P.contains("handlerIdentifier","HeidelPayment6\\Components")])),e}}});var B=n("xTmB"),x=n.n(B);const{Component:M,StateDeprecated:E}=Shopware;M.register("heidel-payment-tab",{template:x.a,inject:["HeidelPaymentService"],data:()=>({paymentResources:[],isLoading:!0}),created(){this.createdComponent()},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},methods:{createdComponent(){this.loadData()},orderStore:()=>E.getStore("order"),resetDataAttributes(){this.paymentResources=[],this.isLoading=!0},reloadPaymentDetails(){this.resetDataAttributes(),this.loadData()},loadData(){const e=this.$route.params.id;this.orderStore().getByIdAsync(e).then(e=>{this.order=e,this.order.getAssociation("transactions").getList({}).then(e=>{e.items.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&this.HeidelPaymentService.fetchPaymentDetails(e.id).then(e=>{this.isLoading=!1,this.paymentResources.push(e)}).catch(()=>{this.isLoading=!1})})})})}}});var A=n("EsnK"),L=n("Eq9y");const{Module:H}=Shopware;H.register("heidel-payment",{type:"plugin",name:"HeidelPayment",title:"heidel-payment.general.title",description:"heidel-payment.general.descriptionTextModule",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":A,"en-GB":L},routeMiddleware(e,t){"sw.order.detail"===t.name&&t.children.push({component:"heidel-payment-tab",name:"heidel-payment.payment.detail",isChildren:!0,path:"/sw/order/heidelpayment/detail/:id"}),e(t)}});var W=n("ectR"),N=n.n(W);n("vrVC");Shopware.Component.register("heidel-payment-register-webhook",{template:N.a,mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],computed:{salesChannelDomainColumns:()=>[{property:"id",dataIndex:"id",label:"ID"},{property:"url",dataIndex:"url",label:"URL"}],salesChannelDomainRepository(){return this.repositoryFactory.create("sales_channel_domain")}},data:()=>({showWebhookModal:!1,isLoading:!1,isRegistering:!1,isRegistrationSuccessful:!1,isClearing:!1,isClearingSuccessful:!1,salesChannelDomains:{},selection:[]}),created(){this.salesChannelDomainRepository.search(new Shopware.Data.Criteria,Shopware.Context.api).then(e=>{this.salesChannelDomains=e})},methods:{openModal(){this.showWebhookModal=!0},closeModal(){this.showWebhookModal=!1},registerWebhooks(){const e=this;this.isRegistrationSuccessful=!1,this.isRegistering=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.registerWebhooks({selection:this.selection}).then(t=>{e.isRegistrationSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isRegistering=!1})},clearWebhooks(){const e=this;this.isClearingSuccessful=!1,this.isClearing=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.clearWebhooks({selection:this.selection}).then(t=>{e.isClearingSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isClearing=!1})},onRegistrationFinished(){this.isRegistrationSuccessful=!1},onClearingFinished(){this.isClearingSuccessful=!1},onSelectItem(e){this.selection=e},messageGeneration(e){const t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n})})}}});var I=n("42IN"),F=n.n(I);n("cKyv");const{Component:z}=Shopware;z.override("sw-settings-index",{template:F.a});var V=n("4aeB"),q=n.n(V);const{Component:K,Mixin:j}=Shopware,{Criteria:G}=Shopware.Data;K.register("heidel-payment-settings",{template:q.a,mixins:[j.getByName("notification"),j.getByName("sw-inline-snippet")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],data:()=>({isLoading:!1,isTesting:!1,isTestSuccessful:!1,isSaveSuccessful:!1,config:{},showWebhookModal:!1}),metaInfo:()=>({title:"Heidelpay"}),computed:{paymentMethodRepository(){return this.repositoryFactory.create("payment_method")}},methods:{getConfigValue(e){const t=this.$refs.systemConfig.actualConfigData.null;return this.config[`HeidelPayment6.settings.${e}`]||t[`HeidelPayment6.settings.${e}`]},onValidateCredentials(){this.isTestSuccessful=!1,this.isTesting=!0;const e={publicKey:this.getConfigValue("publicKey"),privateKey:this.getConfigValue("privateKey"),salesChannel:this.$refs.systemConfig.currentSalesChannelId};this.HeidelPaymentConfigurationService.validateCredentials(e).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment-settings.form.message.success.title"),message:this.$tc("heidel-payment-settings.form.message.success.message")}),this.isTestSuccessful=!0,this.isTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.form.message.error.title"),message:this.$tc("heidel-payment-settings.form.message.error.message")}),this.isTesting=!1})},onTestFinished(){this.isTestSuccessful=!1},onSave(){this.isLoading=!0,this.$refs.systemConfig.saveAll().then(()=>{this.createNotificationSuccess({title:this.$tc("sw-plugin-config.titleSaveSuccess"),message:this.$tc("sw-plugin-config.messageSaveSuccess")}),this.isLoading=!1}).catch(e=>{this.createNotificationError({title:this.$tc("sw-plugin-config.titleSaveError"),message:e}),this.isLoading=!1})},onConfigChange(e){this.config=e},getBind(e,t){return t!==this.config&&(this.config=t),e},getDeliveryStatusCriteria(){const e=new G(1,100);return e.addFilter(G.equals("stateMachine.technicalName","order_delivery.state")),e},openWebhookModal(){this.showWebhookModal=!0},closeWebhookModal(){this.showWebhookModal=!1}}});const{Module:Z}=Shopware;Z.register("heidel-payment-configuration",{type:"plugin",name:"HeidelPayment",title:"heidel-payment-settings.module.title",description:"heidel-payment-settings.module.description",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":A,"en-GB":L},routes:{settings:{component:"heidel-payment-settings",path:"settings",meta:{parentPath:"sw.settings.index"}}}});n("PMv5"),n("+kxS"),n("BzwZ")},cKyv:function(e,t,n){var i=n("JnMH");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("383408f2",i,!0,{})},ectR:function(e,t){e.exports='{% block heidel_payment_payment_register_webhook %}\n
\n \n {{ $tc(\'heidel-payment-settings.form.webhookButton\') }}\n \n \n \n \n\n \n \n
\n{% endblock %}\n'},fpPm:function(e,t){e.exports='{% block heidel_payment_history %}\n \n {% block heidel_payment_history_container %}\n \n {% block heidel_payment_history_data_grid %}\n \n\n {% block heidel_payment_history_actions %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}\n'},nmHs:function(e,t){e.exports='{% block heidel_payment_metadata %}\n \n{% endblock %}\n'},vrVC:function(e,t,n){var i=n("6gNM");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("eb0a43b4",i,!0,{})},xTmB:function(e,t){e.exports='{% block heidel_payment_payment_details %}\n
\n
\n {% block heidel_payment_payment_details_content %}\n \n {% endblock %}\n
\n\n \n
\n{% endblock %}\n'}},[["SAZ9","runtime","vendors-node"]]]); \ No newline at end of file From ca2a68df32f27980158d833d64176dcf868e3a24 Mon Sep 17 00:00:00 2001 From: Steffen Beisenherz Date: Mon, 5 Oct 2020 13:55:38 +0200 Subject: [PATCH 03/15] [HEIDELPAYSUPPORT-20] Remove getClient Function Call on constructor in WebhookRegistrator --- .../WebhookRegistrator/WebhookRegistrator.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Components/WebhookRegistrator/WebhookRegistrator.php b/src/Components/WebhookRegistrator/WebhookRegistrator.php index 7435a6f..6dcb402 100644 --- a/src/Components/WebhookRegistrator/WebhookRegistrator.php +++ b/src/Components/WebhookRegistrator/WebhookRegistrator.php @@ -6,7 +6,6 @@ use HeidelPayment6\Components\ClientFactory\ClientFactoryInterface; use heidelpayPHP\Exceptions\HeidelpayApiException; -use heidelpayPHP\Heidelpay; use Psr\Log\LoggerInterface; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; @@ -30,8 +29,8 @@ class WebhookRegistrator implements WebhookRegistratorInterface /** @var null|RequestContext */ protected $context; - /** @var Heidelpay */ - private $client; + /** @var ClientFactoryInterface */ + private $clientFactory; /** @var Router */ private $router; @@ -48,7 +47,7 @@ public function __construct( EntityRepositoryInterface $salesChannelRepository, LoggerInterface $logger ) { - $this->client = $clientFactory->createClient(); + $this->clientFactory = $clientFactory; $this->router = $router; $this->salesChannelRepository = $salesChannelRepository; $this->logger = $logger; @@ -70,7 +69,7 @@ public function registerWebhook(RequestDataBag $salesChannelDomains): array try { $url = $this->router->generate('heidelpay.webhook.execute', [], UrlGeneratorInterface::ABSOLUTE_URL); - $result = $this->client->createWebhook($url, 'all'); + $result = $this->clientFactory->createClient()->createWebhook($url, 'all'); $returnData[$salesChannelDomain->get('url', '')] = [ 'success' => true, @@ -112,7 +111,7 @@ public function clearWebhooks(RequestDataBag $salesChannelDomains): array } try { - $this->client->deleteAllWebhooks(); + $this->clientFactory->createClient()->deleteAllWebhooks(); $returnData[$salesChannelDomain->get('url', '')] = [ 'success' => true, From 2f4c1e0cc1e751e750263d48304a3347e27289f9 Mon Sep 17 00:00:00 2001 From: Steffen Beisenherz Date: Thu, 8 Oct 2020 08:56:41 +0200 Subject: [PATCH 04/15] [HEIDELPAYSUPPORT-21] Discounts haben eine amountDiscount statt amountGross --- .../BasketResourceHydrator.php | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/Components/ResourceHydrator/BasketResourceHydrator.php b/src/Components/ResourceHydrator/BasketResourceHydrator.php index d2e2044..e5cbcce 100755 --- a/src/Components/ResourceHydrator/BasketResourceHydrator.php +++ b/src/Components/ResourceHydrator/BasketResourceHydrator.php @@ -52,11 +52,13 @@ public function hydrateObject( } foreach ($transaction->getOrder()->getLineItems() as $lineItem) { + $type = $lineItem->getType(); + if ($lineItem->getPrice() === null) { $heidelBasket->addBasketItem(new BasketItem( $lineItem->getLabel(), - round($this->getAmountByItemType($lineItem->getType(), $lineItem->getTotalPrice()), $currencyPrecision), - round($this->getAmountByItemType($lineItem->getType(), $lineItem->getUnitPrice()), $currencyPrecision), + round($this->getAmountByItemType($type, $lineItem->getTotalPrice()), $currencyPrecision), + round($this->getAmountByItemType($type, $lineItem->getUnitPrice()), $currencyPrecision), $lineItem->getQuantity()) ); @@ -66,13 +68,21 @@ public function hydrateObject( $amountTax = 0; $taxRate = 0.0; foreach ($lineItem->getPrice()->getCalculatedTaxes() as $tax) { - $amountTax += round($this->getAmountByItemType($lineItem->getType(), $tax->getTax()), $currencyPrecision); + $amountTax += round($this->getAmountByItemType($type, $tax->getTax()), $currencyPrecision); $taxRate += $tax->getTaxRate(); } - $unitPrice = round($this->getAmountByItemType($lineItem->getType(), $lineItem->getUnitPrice()), $currencyPrecision); - $amountGross = round($this->getAmountByItemType($lineItem->getType(), $lineItem->getTotalPrice()), $currencyPrecision); - $amountNet = round($amountGross - $amountTax, $currencyPrecision); + if ($this->lineItemIsTypePromotion($type)) { + $unitPrice = 0; + $amountGross = 0; + $amountNet = 0; + $amountDiscount = round($this->getAmountByItemType($type, $lineItem->getTotalPrice()), $currencyPrecision); + } else { + $unitPrice = round($this->getAmountByItemType($type, $lineItem->getUnitPrice()), $currencyPrecision); + $amountGross = round($this->getAmountByItemType($type, $lineItem->getTotalPrice()), $currencyPrecision); + $amountNet = round($amountGross - $amountTax, $currencyPrecision); + $amountDiscount = 0; + } $basketItem = new BasketItem( $lineItem->getLabel(), @@ -82,9 +92,10 @@ public function hydrateObject( ); $basketItem->setVat($taxRate); - $basketItem->setType($this->getMappedLineItemType($lineItem->getType())); + $basketItem->setType($this->getMappedLineItemType($type)); $basketItem->setAmountVat($amountTax); $basketItem->setAmountGross($amountGross); + $basketItem->setAmountDiscount($amountDiscount); $basketItem->setImageUrl($lineItem->getCover() ? $lineItem->getCover()->getUrl() : null); $heidelBasket->addBasketItem($basketItem); @@ -102,7 +113,7 @@ public function hydrateObject( protected function getAmountByItemType(string $type, float $price): float { - if ($type === PromotionProcessor::LINE_ITEM_TYPE) { + if ($this->lineItemIsTypePromotion($type)) { return $price * -1; } @@ -111,13 +122,18 @@ protected function getAmountByItemType(string $type, float $price): float protected function getMappedLineItemType(string $type): string { - if ($type === PromotionProcessor::LINE_ITEM_TYPE) { + if ($this->lineItemIsTypePromotion($type)) { return BasketItemTypes::VOUCHER; } return BasketItemTypes::GOODS; } + private function lineItemIsTypePromotion(string $type): bool + { + return $type === PromotionProcessor::LINE_ITEM_TYPE; + } + /** * @param AsyncPaymentTransactionStruct|OrderTransactionEntity $transaction */ From 64c8644866c6ef4a9fdb938f9e04a87d2bad3724 Mon Sep 17 00:00:00 2001 From: Steffen Beisenherz Date: Thu, 8 Oct 2020 10:46:45 +0200 Subject: [PATCH 05/15] [HEIDELPAYSUPPORT-21] Merge both HEIDELPAYSUPPORT-21 PRs --- .../BasketResourceHydrator.php | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/Components/ResourceHydrator/BasketResourceHydrator.php b/src/Components/ResourceHydrator/BasketResourceHydrator.php index e5cbcce..81bef2a 100755 --- a/src/Components/ResourceHydrator/BasketResourceHydrator.php +++ b/src/Components/ResourceHydrator/BasketResourceHydrator.php @@ -10,6 +10,7 @@ use heidelpayPHP\Resources\EmbeddedResources\BasketItem; use InvalidArgumentException; use Shopware\Core\Checkout\Cart\Price\Struct\CartPrice; +use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemCollection; use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Promotion\Cart\PromotionProcessor; @@ -31,7 +32,15 @@ public function hydrateObject( $currencyPrecision = $transaction->getOrder()->getCurrency() !== null ? $transaction->getOrder()->getCurrency()->getDecimalPrecision() : 4; $currencyPrecision = min($currencyPrecision, 4); - $amountTotalVat = round($transaction->getOrder()->getAmountTotal() - $transaction->getOrder()->getAmountNet(), $currencyPrecision); + $amountTotalVat = round( + $transaction->getOrder()->getAmountTotal() - $transaction->getOrder()->getAmountNet(), + $currencyPrecision + ); + + $amountTotalDiscount = round( + $this->calculateAmountTotalDiscount($transaction->getOrder()->getLineItems()), + $currencyPrecision + ); if ($transaction instanceof AsyncPaymentTransactionStruct) { $transactionId = $transaction->getOrderTransaction()->getId(); @@ -46,6 +55,7 @@ public function hydrateObject( ); $heidelBasket->setAmountTotalVat($amountTotalVat); + $heidelBasket->setAmountTotalDiscount($amountTotalDiscount); if (null === $transaction->getOrder()->getLineItems()) { return $heidelBasket; @@ -72,7 +82,7 @@ public function hydrateObject( $taxRate += $tax->getTaxRate(); } - if ($this->lineItemIsTypePromotion($type)) { + if ($this->isPromotionLineItemType($type)) { $unitPrice = 0; $amountGross = 0; $amountNet = 0; @@ -113,7 +123,7 @@ public function hydrateObject( protected function getAmountByItemType(string $type, float $price): float { - if ($this->lineItemIsTypePromotion($type)) { + if ($this->isPromotionLineItemType($type)) { return $price * -1; } @@ -122,14 +132,14 @@ protected function getAmountByItemType(string $type, float $price): float protected function getMappedLineItemType(string $type): string { - if ($this->lineItemIsTypePromotion($type)) { + if ($this->isPromotionLineItemType($type)) { return BasketItemTypes::VOUCHER; } return BasketItemTypes::GOODS; } - private function lineItemIsTypePromotion(string $type): bool + private function isPromotionLineItemType(string $type): bool { return $type === PromotionProcessor::LINE_ITEM_TYPE; } @@ -175,4 +185,16 @@ private function hydrateShippingCosts($transaction, Basket $basket, int $currenc $basket->addBasketItem($dispatchBasketItem); } } + + private function calculateAmountTotalDiscount(OrderLineItemCollection $lineItems): float + { + $lineItems = array_map( + function ($lineItem) { + return $this->isPromotionLineItemType($lineItem->getType()) ? $lineItem->getTotalPrice() * -1 : 0.0; + }, + $lineItems->getElements() + ); + + return array_sum($lineItems); + } } From 950102011e83a3fc73d477f95b5b6ef0f8209426 Mon Sep 17 00:00:00 2001 From: Steffen Beisenherz Date: Fri, 9 Oct 2020 11:08:11 +0200 Subject: [PATCH 06/15] =?UTF-8?q?[HEIDELPAYSUPPORT-21]=20Erh=C3=B6hen=20de?= =?UTF-8?q?r=20Versionsnummer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fac2828..2b14b75 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "heidelpay/shopware-6", "description": "Heidelpay payment integration for Shopware 6", - "version": "0.0.1.2", + "version": "0.0.1.3", "type": "shopware-platform-plugin", "license": "MIT", "minimum-stability": "dev", From 7db6e6da4f3c18cbabbedbe5432b355d36961a4a Mon Sep 17 00:00:00 2001 From: "a.wink" Date: Tue, 13 Oct 2020 17:15:18 +0200 Subject: [PATCH 07/15] [HEIDELPAY-246] Add metadata to requests --- src/Commands/RegisterWebhookCommand.php | 2 +- ...delDirectDebitGuaranteedPaymentHandler.php | 5 +--- .../HeidelDirectDebitPaymentHandler.php | 5 +--- .../HeidelIdealPaymentHandler.php | 5 +--- .../MetadataResourceHydrator.php | 30 +++++++++++++++++-- .../HeidelpayPaymentDeviceCollection.php | 4 +-- .../HeidelpayTransferInfoEntityCollection.php | 4 +-- src/DependencyInjection/hydrators.xml | 6 ++-- 8 files changed, 39 insertions(+), 22 deletions(-) diff --git a/src/Commands/RegisterWebhookCommand.php b/src/Commands/RegisterWebhookCommand.php index c967247..3cd3ef5 100644 --- a/src/Commands/RegisterWebhookCommand.php +++ b/src/Commands/RegisterWebhookCommand.php @@ -38,7 +38,7 @@ public function __construct(WebhookRegistrator $webhookRegistrator, EntityReposi /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $this->setName('heidelpay:register-webhooks'); $this->setDescription('Registers the heidelpay webhook'); diff --git a/src/Components/PaymentHandler/HeidelDirectDebitGuaranteedPaymentHandler.php b/src/Components/PaymentHandler/HeidelDirectDebitGuaranteedPaymentHandler.php index 8998800..096bc71 100644 --- a/src/Components/PaymentHandler/HeidelDirectDebitGuaranteedPaymentHandler.php +++ b/src/Components/PaymentHandler/HeidelDirectDebitGuaranteedPaymentHandler.php @@ -65,10 +65,7 @@ public function pay( $currentRequest = $this->getCurrentRequestFromStack($transaction->getOrderTransaction()->getId()); if (!$this->isPaymentAllowed($transaction->getOrderTransaction()->getId())) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - 'SEPA direct debit mandate has not been accepted by the customer.' - ); + throw new AsyncPaymentProcessException($transaction->getOrderTransaction()->getId(), 'SEPA direct debit mandate has not been accepted by the customer.'); } $registerDirectDebit = $this->pluginConfig->get(ConfigReader::CONFIG_KEY_REGISTER_DIRECT_DEBIT, false); diff --git a/src/Components/PaymentHandler/HeidelDirectDebitPaymentHandler.php b/src/Components/PaymentHandler/HeidelDirectDebitPaymentHandler.php index 6041888..db22333 100644 --- a/src/Components/PaymentHandler/HeidelDirectDebitPaymentHandler.php +++ b/src/Components/PaymentHandler/HeidelDirectDebitPaymentHandler.php @@ -67,10 +67,7 @@ public function pay( parent::pay($transaction, $dataBag, $salesChannelContext); if (!$this->isPaymentAllowed($transaction->getOrderTransaction()->getId())) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - 'SEPA direct debit mandate has not been accepted by the customer.' - ); + throw new AsyncPaymentProcessException($transaction->getOrderTransaction()->getId(), 'SEPA direct debit mandate has not been accepted by the customer.'); } $registerDirectDebit = $this->pluginConfig->get(ConfigReader::CONFIG_KEY_REGISTER_DIRECT_DEBIT, false); diff --git a/src/Components/PaymentHandler/HeidelIdealPaymentHandler.php b/src/Components/PaymentHandler/HeidelIdealPaymentHandler.php index e486992..77018f6 100644 --- a/src/Components/PaymentHandler/HeidelIdealPaymentHandler.php +++ b/src/Components/PaymentHandler/HeidelIdealPaymentHandler.php @@ -31,10 +31,7 @@ public function pay( return new RedirectResponse($returnUrl); } catch (HeidelpayApiException $apiException) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $apiException->getClientMessage() - ); + throw new AsyncPaymentProcessException($transaction->getOrderTransaction()->getId(), $apiException->getClientMessage()); } } } diff --git a/src/Components/ResourceHydrator/MetadataResourceHydrator.php b/src/Components/ResourceHydrator/MetadataResourceHydrator.php index 275b452..e4e6f60 100755 --- a/src/Components/ResourceHydrator/MetadataResourceHydrator.php +++ b/src/Components/ResourceHydrator/MetadataResourceHydrator.php @@ -6,26 +6,52 @@ use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Resources\Metadata; +use Shopware\Core\Framework\Context; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; +use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; +use Shopware\Core\Framework\Plugin\PluginEntity; use Shopware\Core\System\SalesChannel\SalesChannelContext; class MetadataResourceHydrator implements ResourceHydratorInterface { + public const PLUGIN_NAME = 'HeidelPayment6'; + /** @var string */ private $shopwareVersion; - public function __construct(string $shopwareVersion) + /** @var EntityRepositoryInterface */ + private $pluginRepository; + + public function __construct(string $shopwareVersion, EntityRepositoryInterface $pluginRepository) { - $this->shopwareVersion = $shopwareVersion; + $this->shopwareVersion = $shopwareVersion; + $this->pluginRepository = $pluginRepository; } public function hydrateObject( SalesChannelContext $channelContext, $transaction = null ): AbstractHeidelpayResource { + $pluginData = $this->getPluginData($channelContext->getContext()); + $heidelMetadata = new Metadata(); $heidelMetadata->setShopType('Shopware 6'); $heidelMetadata->setShopVersion($this->shopwareVersion); + if ($pluginData !== null) { + $heidelMetadata->addMetadata('pluginVersion', $pluginData->getVersion()); + } + $heidelMetadata->addMetadata('pluginType', self::PLUGIN_NAME); + return $heidelMetadata; } + + protected function getPluginData(Context $context): ?PluginEntity + { + $pluginSearchCriteria = new Criteria(); + $pluginSearchCriteria->addFilter(new EqualsFilter('name', self::PLUGIN_NAME)); + + return $this->pluginRepository->search($pluginSearchCriteria, $context)->first(); + } } diff --git a/src/DataAbstractionLayer/Entity/PaymentDevice/HeidelpayPaymentDeviceCollection.php b/src/DataAbstractionLayer/Entity/PaymentDevice/HeidelpayPaymentDeviceCollection.php index f41bdcd..5aa5b3d 100644 --- a/src/DataAbstractionLayer/Entity/PaymentDevice/HeidelpayPaymentDeviceCollection.php +++ b/src/DataAbstractionLayer/Entity/PaymentDevice/HeidelpayPaymentDeviceCollection.php @@ -7,8 +7,8 @@ use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; /** - * @method void add(HeidelpayPaymentDeviceEntity $entity) - * @method void set(string $key, HeidelpayPaymentDeviceEntity $entity) + * @method void add(HeidelpayPaymentDeviceEntity $entity) + * @method void set(string $key, HeidelpayPaymentDeviceEntity $entity) * @method HeidelpayPaymentDeviceEntity[] getIterator() * @method HeidelpayPaymentDeviceEntity[] getElements() * @method null|HeidelpayPaymentDeviceEntity get(string $key) diff --git a/src/DataAbstractionLayer/Entity/TransferInfo/HeidelpayTransferInfoEntityCollection.php b/src/DataAbstractionLayer/Entity/TransferInfo/HeidelpayTransferInfoEntityCollection.php index d25d6e1..3254af1 100644 --- a/src/DataAbstractionLayer/Entity/TransferInfo/HeidelpayTransferInfoEntityCollection.php +++ b/src/DataAbstractionLayer/Entity/TransferInfo/HeidelpayTransferInfoEntityCollection.php @@ -7,8 +7,8 @@ use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; /** - * @method void add(HeidelpayTransferInfoEntity $entity) - * @method void set(string $key, HeidelpayTransferInfoEntity $entity) + * @method void add(HeidelpayTransferInfoEntity $entity) + * @method void set(string $key, HeidelpayTransferInfoEntity $entity) * @method HeidelpayTransferInfoEntity[] getIterator() * @method HeidelpayTransferInfoEntity[] getElements() * @method null|HeidelpayTransferInfoEntity get(string $key) diff --git a/src/DependencyInjection/hydrators.xml b/src/DependencyInjection/hydrators.xml index df1e829..dfce631 100755 --- a/src/DependencyInjection/hydrators.xml +++ b/src/DependencyInjection/hydrators.xml @@ -2,18 +2,18 @@ - + + %kernel.shopware_version% + - - From 2b2a33488a2774930c0492c165de1b3ad9bbf038 Mon Sep 17 00:00:00 2001 From: "a.wink" Date: Wed, 14 Oct 2020 10:12:14 +0200 Subject: [PATCH 08/15] [HEIDELPAY-220] Add heidelpay transaction id to order list --- .../{sw-order => sw-order-detail}/index.js | 2 +- .../sw-order-detail.html.twig} | 0 .../extension/sw-order-list/index.js | 25 +++++++++++++++++++ .../sw-order-list/sw-order-list.html.twig | 11 ++++++++ .../src/module/heidel-payment/index.js | 3 ++- .../administration/src/snippets/de-DE.json | 3 +++ .../administration/src/snippets/en-GB.json | 3 +++ .../administration/js/heidel-payment6.js | 2 +- 8 files changed, 46 insertions(+), 3 deletions(-) rename src/Resources/app/administration/src/module/heidel-payment/extension/{sw-order => sw-order-detail}/index.js (96%) rename src/Resources/app/administration/src/module/heidel-payment/extension/{sw-order/sw-order.html.twig => sw-order-detail/sw-order-detail.html.twig} (100%) create mode 100644 src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-list/index.js create mode 100644 src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-list/sw-order-list.html.twig diff --git a/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order/index.js b/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-detail/index.js similarity index 96% rename from src/Resources/app/administration/src/module/heidel-payment/extension/sw-order/index.js rename to src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-detail/index.js index 453a442..d41bc40 100644 --- a/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order/index.js +++ b/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-detail/index.js @@ -1,4 +1,4 @@ -import template from './sw-order.html.twig'; +import template from './sw-order-detail.html.twig'; const { Component, Context } = Shopware; const { Criteria } = Shopware.Data; diff --git a/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order/sw-order.html.twig b/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-detail/sw-order-detail.html.twig similarity index 100% rename from src/Resources/app/administration/src/module/heidel-payment/extension/sw-order/sw-order.html.twig rename to src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-detail/sw-order-detail.html.twig diff --git a/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-list/index.js b/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-list/index.js new file mode 100644 index 0000000..976ebcb --- /dev/null +++ b/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-list/index.js @@ -0,0 +1,25 @@ +import template from './sw-order-list.html.twig'; + +Shopware.Component.override('sw-order-list', { + template, + + computed: { + orderColumns() { + return this.getEnhancedOrderColumns(); + } + }, + + methods: { + getEnhancedOrderColumns() { + const baseColumns = this.getOrderColumns(); + + baseColumns.splice(1, 0, { + property: 'heidelTransactionId', + label: 'heidel-payment.order-list.transactionId', + allowResize: true + }); + + return baseColumns; + } + } +}); diff --git a/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-list/sw-order-list.html.twig b/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-list/sw-order-list.html.twig new file mode 100644 index 0000000..3d9e6a0 --- /dev/null +++ b/src/Resources/app/administration/src/module/heidel-payment/extension/sw-order-list/sw-order-list.html.twig @@ -0,0 +1,11 @@ +{% block sw_order_list_grid_columns %} + {% parent %} + + {% block heidelpay_column_transaction %} + + {% endblock %} +{% endblock %} diff --git a/src/Resources/app/administration/src/module/heidel-payment/index.js b/src/Resources/app/administration/src/module/heidel-payment/index.js index a0497a7..a5c5aba 100644 --- a/src/Resources/app/administration/src/module/heidel-payment/index.js +++ b/src/Resources/app/administration/src/module/heidel-payment/index.js @@ -3,7 +3,8 @@ import './component/heidel-payment-detail'; import './component/heidel-payment-history'; import './component/heidel-payment-metadata'; import './component/heidel-payment-basket'; -import './extension/sw-order'; +import './extension/sw-order-detail'; +import './extension/sw-order-list'; import './extension/sw-order-create-details-footer'; import './page/heidel-payment-tab'; diff --git a/src/Resources/app/administration/src/snippets/de-DE.json b/src/Resources/app/administration/src/snippets/de-DE.json index c54da33..19d5316 100644 --- a/src/Resources/app/administration/src/snippets/de-DE.json +++ b/src/Resources/app/administration/src/snippets/de-DE.json @@ -63,6 +63,9 @@ "shipErrorTitle": "Versandmitteilung", "invoiceNotFoundMessage": "Zu dieser Bestellung wurde keine Rechnung gefunden" } + }, + "order-list": { + "transactionId": "Heidelpay Transaktions ID" } }, "heidel-payment-settings": { diff --git a/src/Resources/app/administration/src/snippets/en-GB.json b/src/Resources/app/administration/src/snippets/en-GB.json index fcc59d4..8f6e181 100644 --- a/src/Resources/app/administration/src/snippets/en-GB.json +++ b/src/Resources/app/administration/src/snippets/en-GB.json @@ -63,6 +63,9 @@ "shipErrorTitle": "Shipping notice", "invoiceNotFoundMessage": "No invoice was found for this order." } + }, + "order-list": { + "transactionId": "Heidelpay transaction ID" } }, "heidel-payment-settings": { diff --git a/src/Resources/public/administration/js/heidel-payment6.js b/src/Resources/public/administration/js/heidel-payment6.js index 3be525c..2923e86 100644 --- a/src/Resources/public/administration/js/heidel-payment6.js +++ b/src/Resources/public/administration/js/heidel-payment6.js @@ -1 +1 @@ -(this.webpackJsonp=this.webpackJsonp||[]).push([["heidel-payment6"],{"+k6L":function(e,t){e.exports='{% block heidel_payment_actions %}\n \n {% block heidel_payment_actions_amount_field %}\n
\n \n \n
\n {% endblock %}\n\n
\n {% block heidel_payment_actions_charge_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_refund_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.refundButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_default_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_button_container_inner %}{% endblock %}\n
\n
\n{% endblock %}\n'},"5Wb7":function(e,t){e.exports="{% block sw_plugin_list_grid_columns_actions_update %}\n \n\n {% parent %}\n{% endblock %}\n\n{% block sw_plugin_list_grid_columns_actions_settings %}\n \n{% endblock %}\n"},D4rn:function(e,t,n){"use strict";n.r(t);var i=n("+k6L"),s=n.n(i);const{Component:a,Mixin:o}=Shopware;a.register("heidel-payment-actions",{template:s.a,inject:["HeidelPaymentService"],mixins:[o.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1,transactionAmount:0}),props:{transactionResource:{type:Object,required:!0},paymentResource:{type:Object,required:!0}},computed:{isChargePossible:function(){return"authorization"===this.transactionResource.type},isRefundPossible:function(){return"charge"===this.transactionResource.type},refundAmount:function(){return this.paymentResource.calculatedAmounts.charged-this.paymentResource.calculatedAmounts.cancelled},chargeAmount:function(){return this.paymentResource.calculatedAmounts.remaining},maxTransactionAmount(){let e=0;return this.isRefundPossible?e=this.refundAmount:this.isChargePossible&&(e=this.chargeAmount),e}},created(){this.transactionAmount=this.maxTransactionAmount},methods:{charge(){this.isLoading=!0,this.HeidelPaymentService.chargeTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeErrorTitle"),message:t}),this.isLoading=!1})},refund(){this.isLoading=!0,this.HeidelPaymentService.refundTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.refundErrorTitle"),message:t}),this.isLoading=!1})}}});var r=n("gQ1j"),c=n.n(r);const{Component:l,Mixin:d}=Shopware;l.register("heidel-payment-detail",{template:c.a,inject:["HeidelPaymentService"],mixins:[d.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1}),props:{paymentResource:{type:Object,required:!0}},methods:{ship(){this.isLoading=!0,this.HeidelPaymentService.ship(this.paymentResource.orderId).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t?t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage"):"invoice-missing-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.invoiceNotFoundMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.shipErrorTitle"),message:t}),this.isLoading=!1})}}});var h=n("ofTY"),m=n.n(h);const{Component:p}=Shopware;p.register("heidel-payment-history",{template:m.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.transactions.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amount),this.paymentResource.currency),i=this.$options.filters.date(t.date,{hour:"numeric",minute:"numeric",second:"numeric"});e.push({type:this.transactionTypeRenderer(t.type),amount:n,date:i,resource:t})}),e},columns:function(){return[{property:"type",label:this.$tc("heidel-payment.paymentDetails.history.column.type"),rawData:!0},{property:"amount",label:this.$tc("heidel-payment.paymentDetails.history.column.amount"),rawData:!0},{property:"date",label:this.$tc("heidel-payment.paymentDetails.history.column.date"),rawData:!0}]}},methods:{transactionTypeRenderer:function(e){switch(e){case"authorization":return this.$tc("heidel-payment.paymentDetails.history.type.authorization");case"charge":return this.$tc("heidel-payment.paymentDetails.history.type.charge");case"shipment":return this.$tc("heidel-payment.paymentDetails.history.type.shipment");case"cancellation":return this.$tc("heidel-payment.paymentDetails.history.type.cancellation");default:return this.$tc("heidel-payment.paymentDetails.history.type.default")}},reloadPaymentDetails:function(){this.$emit("reload")}}});var u=n("thoX"),y=n.n(u);const{Component:g}=Shopware;g.register("heidel-payment-metadata",{template:y.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.metadata.forEach(t=>{e.push({key:t.key,value:t.value})}),e},columns:function(){return[{property:"key",label:this.$tc("heidel-payment.paymentDetails.metadata.column.key"),rawData:!0},{property:"value",label:this.$tc("heidel-payment.paymentDetails.metadata.column.value"),rawData:!0}]}}});var b=n("zXXx"),f=n.n(b);const{Component:k}=Shopware;k.register("heidel-payment-basket",{template:f.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.basket.basketItems.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amountGross),this.paymentResource.currency),i=this.$options.filters.currency(parseFloat(t.amountNet),this.paymentResource.currency);e.push({quantity:t.quantity,title:t.title,amountGross:n,amountNet:i})}),e},columns:function(){return[{property:"quantity",label:this.$tc("heidel-payment.paymentDetails.basket.column.quantity"),rawData:!0},{property:"title",label:this.$tc("heidel-payment.paymentDetails.basket.column.title"),rawData:!0},{property:"amountGross",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountGross"),rawData:!0},{property:"amountNet",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountNet"),rawData:!0}]}}});var w=n("TXG+"),_=n.n(w);const{Component:S,Context:v}=Shopware,{Criteria:D}=Shopware.Data;S.override("sw-order-detail",{template:_.a,data:()=>({isHeidelpayPayment:!1}),computed:{showTabs:()=>!0,paymentMethodStore:()=>State.getStore("payment_method")},watch:{orderId:{deep:!0,handler(){if(!this.orderId)return void(this.isHeidelpayPayment=!1);const e=this.repositoryFactory.create("order"),t=new D(1,1);t.addAssociation("transactions"),e.get(this.orderId,v.api,t).then(e=>{e.transactions.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&(this.isHeidelpayPayment=!0)})})},immediate:!0}}});var C=n("IGRu"),R=n.n(C);const{Component:$,Context:T}=Shopware,{Criteria:A}=Shopware.Data;$.override("sw-order-create-details-footer",{template:R.a,computed:{paymentMethodCriteria(){const e=new A;return this.salesChannelId&&e.addFilter(A.equals("salesChannels.id",this.salesChannelId)),e.addFilter(A.not("AND",[A.contains("handlerIdentifier","HeidelPayment6\\Components")])),e}}});var P=n("btqN"),x=n.n(P);const{Component:B,StateDeprecated:M}=Shopware;B.register("heidel-payment-tab",{template:x.a,inject:["HeidelPaymentService"],data:()=>({paymentResources:[],isLoading:!0}),created(){this.createdComponent()},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},methods:{createdComponent(){this.loadData()},orderStore:()=>M.getStore("order"),resetDataAttributes(){this.paymentResources=[],this.isLoading=!0},reloadPaymentDetails(){this.resetDataAttributes(),this.loadData()},loadData(){const e=this.$route.params.id;this.orderStore().getByIdAsync(e).then(e=>{this.order=e,this.order.getAssociation("transactions").getList({}).then(e=>{e.items.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&this.HeidelPaymentService.fetchPaymentDetails(e.id).then(e=>{this.isLoading=!1,this.paymentResources.push(this.calculateAmounts(e))}).catch(()=>{this.isLoading=!1})})})})},calculateAmounts:e=>(e.calculatedAmounts={remaining:e.basket.amountTotalGross,charged:0,cancelled:0},e.transactions.forEach(t=>{"cancellation"===t.type?e.calculatedAmounts.cancelled+=t.amount:"charge"===t.type&&(e.calculatedAmounts.charged+=t.amount,e.calculatedAmounts.remaining-=t.amount)}),e)}});var L=n("yZy9"),E=n("Q9fF");const{Module:W}=Shopware;W.register("heidel-payment",{type:"plugin",name:"HeidelPayment",title:"heidel-payment.general.title",description:"heidel-payment.general.descriptionTextModule",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":L,"en-GB":E},routeMiddleware(e,t){"sw.order.detail"===t.name&&t.children.push({component:"heidel-payment-tab",name:"heidel-payment.payment.detail",isChildren:!0,path:"/sw/order/heidelpayment/detail/:id"}),e(t)}});var N=n("bmxS"),H=n.n(N);n("GDrB");Shopware.Component.register("heidel-payment-register-webhook",{template:H.a,mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],computed:{salesChannelDomainColumns:()=>[{property:"id",dataIndex:"id",label:"ID"},{property:"url",dataIndex:"url",label:"URL"}],salesChannelDomainRepository(){return this.repositoryFactory.create("sales_channel_domain")}},data:()=>({showWebhookModal:!1,isLoading:!1,isRegistering:!1,isRegistrationSuccessful:!1,isClearing:!1,isClearingSuccessful:!1,salesChannelDomains:{},selection:[]}),created(){this.salesChannelDomainRepository.search(new Shopware.Data.Criteria,Shopware.Context.api).then(e=>{this.salesChannelDomains=e})},methods:{openModal(){this.showWebhookModal=!0},closeModal(){this.showWebhookModal=!1},registerWebhooks(){const e=this;this.isRegistrationSuccessful=!1,this.isRegistering=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.registerWebhooks({selection:this.selection}).then(t=>{e.isRegistrationSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isRegistering=!1})},clearWebhooks(){const e=this;this.isClearingSuccessful=!1,this.isClearing=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.clearWebhooks({selection:this.selection}).then(t=>{e.isClearingSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isClearing=!1})},onRegistrationFinished(){this.isRegistrationSuccessful=!1},onClearingFinished(){this.isClearingSuccessful=!1},onSelectItem(e){this.selection=e},messageGeneration(e){const t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n})})}}});var F=n("5Wb7"),I=n.n(F);const{Component:z}=Shopware;z.override("sw-plugin-list",{template:I.a});var q=n("QtAk"),G=n.n(q);const{Component:V,Mixin:j}=Shopware,{Criteria:Z}=Shopware.Data;V.register("heidel-payment-settings",{template:G.a,mixins:[j.getByName("notification"),j.getByName("sw-inline-snippet")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],data:()=>({isLoading:!1,isTesting:!1,isTestSuccessful:!1,isSaveSuccessful:!1,config:{},showWebhookModal:!1}),metaInfo:()=>({title:"Heidelpay"}),computed:{paymentMethodRepository(){return this.repositoryFactory.create("payment_method")}},methods:{getConfigValue(e){const t=this.$refs.systemConfig.actualConfigData.null;return this.config[`HeidelPayment6.settings.${e}`]||t[`HeidelPayment6.settings.${e}`]},onValidateCredentials(){this.isTestSuccessful=!1,this.isTesting=!0;const e={publicKey:this.getConfigValue("publicKey"),privateKey:this.getConfigValue("privateKey"),salesChannel:this.$refs.systemConfig.currentSalesChannelId};this.HeidelPaymentConfigurationService.validateCredentials(e).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment-settings.form.message.success.title"),message:this.$tc("heidel-payment-settings.form.message.success.message")}),this.isTestSuccessful=!0,this.isTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.form.message.error.title"),message:this.$tc("heidel-payment-settings.form.message.error.message")}),this.isTesting=!1})},onTestFinished(){this.isTestSuccessful=!1},onSave(){this.isLoading=!0,this.$refs.systemConfig.saveAll().then(()=>{this.createNotificationSuccess({title:this.$tc("sw-plugin-config.titleSaveSuccess"),message:this.$tc("sw-plugin-config.messageSaveSuccess")}),this.isLoading=!1}).catch(e=>{this.createNotificationError({title:this.$tc("sw-plugin-config.titleSaveError"),message:e}),this.isLoading=!1})},onConfigChange(e){this.config=e},getBind(e,t){return t!==this.config&&(this.config=t),e},getDeliveryStatusCriteria(){const e=new Z(1,100);return e.addFilter(Z.equals("stateMachine.technicalName","order_delivery.state")),e},openWebhookModal(){this.showWebhookModal=!0},closeWebhookModal(){this.showWebhookModal=!1}}});const{Module:O}=Shopware;O.register("heidel-payment-configuration",{type:"plugin",name:"HeidelPayment",title:"heidel-payment-settings.module.title",description:"heidel-payment-settings.module.description",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":L,"en-GB":E},routes:{settings:{component:"heidel-payment-settings",path:"settings",meta:{parentPath:"sw.settings.index"}}}});n("mAjF"),n("quVS"),n("ycwP")},GDrB:function(e,t,n){var i=n("qz9Q");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("1494dfff",i,!0,{})},IGRu:function(e,t){e.exports='{% block sw_order_create_details_footer_payment_method %}\n \n \n{% endblock %}\n'},Q9fF:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Payment History","column":{"type":"Type","amount":"Amount","date":"Date"},"type":{"authorization":"Authorization","charge":"Charging","shipment":"Shipping notification","cancellation":"Refund","default":""}},"actions":{"chargeButton":"Charge","shipButton":"Shipping notice","refundButton":"Refund"},"detail":{"cardTitle":"Payment Details","amountTotal":"Amount (gross)","amountTotalVat":"Amount (net)","currency":"Currency","shortId":"Short-ID","id":"Payment-ID","state":"State","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)"},"metadata":{"cardTitle":"Metadata","column":{"key":"Key","value":"Value"}},"basket":{"cardTitle":"Basket","column":{"quantity":"Quantity","title":"Title","amountGross":"Amount (gross)","amountNet":"Amount (net)"}},"notifications":{"genericErrorMessage":"An error has occoured!","refundSuccessTitle":"Refund","refundSuccessMessage":"The reimbursement was successfully completed.","refundErrorTitle":"Refund","chargeSuccessTitle":"Charge","chargeSuccessMessage":"The collection of the payment was carried out successfully.","chargeErrorTitle":"Charge","shipSuccessTitle":"Shipping notice","shipSuccessMessage":"The shipping notification was successfully sent.","shipErrorTitle":"Shipping notice","invoiceNotFoundMessage":"No invoice was found for this order."}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test succeeded","message":"The provided credentials are valid!"},"error":{"title":"Test failed","message":"API Credentials are invalid, please correct them and try again!"}},"testButton":"Test API credentials","webhookButton":"Register webhooks"},"modal":{"close":"Close","webhook":{"title":"Webhooks","submit":{"register":"Register webhooks","clear":"Clear webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registered | Webhooks registered","error":"Webhook could not be registered | Webhooks could not be registered"},"clear":{"done":"Webhook cleared | Webhooks cleared","error":"Webhook could not be cleared | Webhooks could not be cleared"},"missing":{"fields":"Some mandatory fields are missing","context":"The context could not be refreshed","selection":"No domain was selected"},"notFound":{"salesChannelDomain":"The selected domain could not be found"},"globalError":{"title":"An error occured","message":"Please contact us for more information"}}}}')},QtAk:function(e,t){e.exports='{% block heidel_payment_settings %}\n\n {% block heidel_payment_settings_header %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_actions %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},"TXG+":function(e,t){e.exports="{% block sw_order_detail_content_tabs_general %}\n {% parent %}\n\n {% block heidel_payment_payment_tab %}\n \n {{ $tc('heidel-payment.tabTitle') }}\n \n {% endblock %}\n{% endblock %}"},bmxS:function(e,t){e.exports='{% block heidel_payment_payment_register_webhook %}\n
\n \n {{ $tc(\'heidel-payment-settings.form.webhookButton\') }}\n \n \n \n \n\n \n \n
\n{% endblock %}\n'},btqN:function(e,t){e.exports='{% block heidel_payment_payment_details %}\n
\n
\n {% block heidel_payment_payment_details_content %}\n \n {% endblock %}\n
\n\n \n
\n{% endblock %}\n'},gQ1j:function(e,t){e.exports="{% block heidel_payment_detail %}\n \n {% block heidel_payment_detail_container %}\n \n {% block heidel_payment_detail_container_left %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotal') }}
\n
{{ paymentResource.basket.amountTotalGross | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotalVat') }}
\n
{{ paymentResource.basket.amountTotalVat | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.currency') }}
\n
{{ paymentResource.currency }}
\n\n {% block heidel_payment_detail_container_left_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_center %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountRemaining') }}
\n
{{ paymentResource.calculatedAmounts.remaining | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCancelled') }}
\n
{{ paymentResource.calculatedAmounts.cancelled | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCharged') }}
\n
{{ paymentResource.calculatedAmounts.charged | currency(paymentResource.currency) }}
\n\n {% block heidel_payment_detail_container_center_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_right %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.shortId') }}
\n
{{ paymentResource.shortId }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.id') }}
\n
{{ paymentResource.id }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.state') }}
\n
{{ paymentResource.state.name }}
\n\n {% block heidel_payment_detail_container_right_inner %}{% endblock %}\n
\n
\n {% endblock %}\n
\n {% endblock %}\n\n {% block heidel_payment_detail_ship_button %}\n \n \n {{ $tc('heidel-payment.paymentDetails.actions.shipButton') }}\n \n \n {% endblock %}\n
\n{% endblock %}\n"},mAjF:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidelpay"){super(e,t,n)}fetchPaymentDetails(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/details`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}chargeTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}refundTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${t}/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}ship(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/ship`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},ofTY:function(e,t){e.exports='{% block heidel_payment_history %}\n \n {% block heidel_payment_history_container %}\n \n {% block heidel_payment_history_data_grid %}\n \n\n {% block heidel_payment_history_actions %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}\n'},quVS:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidel_payment"){super(e,t,n)}validateCredentials(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-credentials`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}registerWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/register-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}clearWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/clear-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentConfigurationService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},qz9Q:function(e,t,n){},thoX:function(e,t){e.exports='{% block heidel_payment_metadata %}\n \n{% endblock %}\n'},yZy9:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Zahlungsverlauf","column":{"type":"Typ","amount":"Betrag","date":"Datum"},"type":{"authorization":"Reservierung","charge":"Einzug","shipment":"Versandtmitteilung","cancellation":"Rückerstattung","default":""}},"actions":{"chargeButton":"Einziehen","shipButton":"Versandmitteilung","refundButton":"Rückerstatten"},"detail":{"cardTitle":"Zahlungsdetails","amountTotal":"Betrag (brutto)","amountTotalVat":"Betrag (netto)","currency":"Währung","shortId":"Short-ID","id":"Zahlungs-ID","state":"Status","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)"},"metadata":{"cardTitle":"Metadaten","column":{"key":"Schlüssel","value":"Wert"}},"basket":{"cardTitle":"Warenkorb","column":{"quantity":"Anzahl","title":"Titel","amountGross":"Betrag (brutto)","amountNet":"Betrag (netto)"}},"notifications":{"genericErrorMessage":"Es ist ein Fehler aufgetreten!","refundSuccessTitle":"Rückerstatten","refundSuccessMessage":"Die Rückerstattung wurde erfolgreich durchgeführt.","refundErrorTitle":"Rückerstatten","chargeSuccessTitle":"Einziehen","chargeSuccessMessage":"Das Einziehen der Zahlung wurde erfolgreich durchgeführt.","chargeErrorTitle":"Einziehen","shipSuccessTitle":"Versandmitteilung","shipSuccessMessage":"Die Versandmitteilung wurde erfolgreich gesendet.","shipErrorTitle":"Versandmitteilung","invoiceNotFoundMessage":"Zu dieser Bestellung wurde keine Rechnung gefunden"}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test erfolgreich","message":"Die angegebenen API-Zugangsdaten sind korrekt!"},"error":{"title":"Test fehlgeschlagen","message":"Die angegebenen API-Zugangsdaten sind nicht korret! Bitte korrigieren Sie die Eingabe und versuchen Sie es erneut."}},"testButton":"API Zugangsdaten testen","webhookButton":"Webhooks registrieren testen"},"modal":{"close":"Schließen","webhook":{"title":"Webhooks","submit":{"register":"Webhooks registrieren","clear":"Webhooks entfernen"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registriert | Webhooks registriert","error":"Der Webhook konnte nicht registriert werden | Die Webhooks konnten nicht registriert werden"},"clear":{"done":"Webhook entfernt | Webhooks entfernt","error":"Der Webhook konnte nicht entfernt werden | Die Webhooks konnten nicht entfernt werden"},"missing":{"fields":"Nicht alle benötigten Felder sind vorhanden","context":"Der Kontext konnte nicht aktualisiert werden","selection":"Es wurden keine Domains selektiert"},"notFound":{"salesChannelDomain":"Die spezifizierte Domain wurde nicht gefunden"},"globalError":{"title":"Ein Fehler ist aufgetreten","message":"Bitte kontaktieren sie uns für mehr Informationen"}}}}')},ycwP:function(e,t,n){var i=n("zRs7");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("767f10c8",i,!0,{})},zRs7:function(e,t,n){},zXXx:function(e,t){e.exports='{% block heidel_payment_basket %}\n \n \n {% block heidel_payment_basket_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}\n'}},[["D4rn","runtime","vendors-node"]]]); \ No newline at end of file +(this.webpackJsonp=this.webpackJsonp||[]).push([["heidel-payment6"],{"+kxS":function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidel_payment"){super(e,t,n)}validateCredentials(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-credentials`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}registerWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/register-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}clearWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/clear-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentConfigurationService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},"1iz7":function(e,t,n){},"4aeB":function(e,t){e.exports='{% block heidel_payment_settings %}\n\n {% block heidel_payment_settings_header %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_actions %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},"5j/b":function(e,t){e.exports="{% block heidel_payment_detail %}\n \n {% block heidel_payment_detail_container %}\n \n {% block heidel_payment_detail_container_left %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotal') }}
\n
{{ paymentResource.basket.amountTotalGross | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotalVat') }}
\n
{{ paymentResource.basket.amountTotalVat | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.currency') }}
\n
{{ paymentResource.currency }}
\n\n {% block heidel_payment_detail_container_left_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_center %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountRemaining') }}
\n
{{ paymentResource.calculatedAmounts.remaining | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCancelled') }}
\n
{{ paymentResource.calculatedAmounts.cancelled | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCharged') }}
\n
{{ paymentResource.calculatedAmounts.charged | currency(paymentResource.currency) }}
\n\n {% block heidel_payment_detail_container_center_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_right %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.shortId') }}
\n
{{ paymentResource.shortId }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.id') }}
\n
{{ paymentResource.id }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.state') }}
\n
{{ paymentResource.state.name }}
\n\n {% block heidel_payment_detail_container_right_inner %}{% endblock %}\n
\n
\n {% endblock %}\n
\n {% endblock %}\n\n {% block heidel_payment_detail_ship_button %}\n \n \n {{ $tc('heidel-payment.paymentDetails.actions.shipButton') }}\n \n \n {% endblock %}\n
\n{% endblock %}\n"},"6E3l":function(e,t){e.exports="{% block sw_plugin_list_grid_columns_actions_update %}\n \n\n {% parent %}\n{% endblock %}\n\n{% block sw_plugin_list_grid_columns_actions_settings %}\n \n{% endblock %}\n"},"6gNM":function(e,t,n){},BzwZ:function(e,t,n){var i=n("1iz7");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("0d46815a",i,!0,{})},Eq9y:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Payment History","column":{"type":"Type","amount":"Amount","date":"Date"},"type":{"authorization":"Authorization","charge":"Charging","shipment":"Shipping notification","cancellation":"Refund","default":""}},"actions":{"chargeButton":"Charge","shipButton":"Shipping notice","refundButton":"Refund"},"detail":{"cardTitle":"Payment Details","amountTotal":"Amount (gross)","amountTotalVat":"Amount (net)","currency":"Currency","shortId":"Short-ID","id":"Payment-ID","state":"State","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)"},"metadata":{"cardTitle":"Metadata","column":{"key":"Key","value":"Value"}},"basket":{"cardTitle":"Basket","column":{"quantity":"Quantity","title":"Title","amountGross":"Amount (gross)","amountNet":"Amount (net)"}},"notifications":{"genericErrorMessage":"An error has occoured!","refundSuccessTitle":"Refund","refundSuccessMessage":"The reimbursement was successfully completed.","refundErrorTitle":"Refund","chargeSuccessTitle":"Charge","chargeSuccessMessage":"The collection of the payment was carried out successfully.","chargeErrorTitle":"Charge","shipSuccessTitle":"Shipping notice","shipSuccessMessage":"The shipping notification was successfully sent.","shipErrorTitle":"Shipping notice","invoiceNotFoundMessage":"No invoice was found for this order."}},"order-list":{"transactionId":"Heidelpay transaction ID"}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test succeeded","message":"The provided credentials are valid!"},"error":{"title":"Test failed","message":"API Credentials are invalid, please correct them and try again!"}},"testButton":"Test API credentials","webhookButton":"Register webhooks"},"modal":{"close":"Close","webhook":{"title":"Webhooks","submit":{"register":"Register webhooks","clear":"Clear webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registered | Webhooks registered","error":"Webhook could not be registered | Webhooks could not be registered"},"clear":{"done":"Webhook cleared | Webhooks cleared","error":"Webhook could not be cleared | Webhooks could not be cleared"},"missing":{"fields":"Some mandatory fields are missing","context":"The context could not be refreshed","selection":"No domain was selected"},"notFound":{"salesChannelDomain":"The selected domain could not be found"},"globalError":{"title":"An error occured","message":"Please contact us for more information"}}}}')},EsnK:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Zahlungsverlauf","column":{"type":"Typ","amount":"Betrag","date":"Datum"},"type":{"authorization":"Reservierung","charge":"Einzug","shipment":"Versandtmitteilung","cancellation":"Rückerstattung","default":""}},"actions":{"chargeButton":"Einziehen","shipButton":"Versandmitteilung","refundButton":"Rückerstatten"},"detail":{"cardTitle":"Zahlungsdetails","amountTotal":"Betrag (brutto)","amountTotalVat":"Betrag (netto)","currency":"Währung","shortId":"Short-ID","id":"Zahlungs-ID","state":"Status","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)"},"metadata":{"cardTitle":"Metadaten","column":{"key":"Schlüssel","value":"Wert"}},"basket":{"cardTitle":"Warenkorb","column":{"quantity":"Anzahl","title":"Titel","amountGross":"Betrag (brutto)","amountNet":"Betrag (netto)"}},"notifications":{"genericErrorMessage":"Es ist ein Fehler aufgetreten!","refundSuccessTitle":"Rückerstatten","refundSuccessMessage":"Die Rückerstattung wurde erfolgreich durchgeführt.","refundErrorTitle":"Rückerstatten","chargeSuccessTitle":"Einziehen","chargeSuccessMessage":"Das Einziehen der Zahlung wurde erfolgreich durchgeführt.","chargeErrorTitle":"Einziehen","shipSuccessTitle":"Versandmitteilung","shipSuccessMessage":"Die Versandmitteilung wurde erfolgreich gesendet.","shipErrorTitle":"Versandmitteilung","invoiceNotFoundMessage":"Zu dieser Bestellung wurde keine Rechnung gefunden"}},"order-list":{"transactionId":"Heidelpay Transaktions ID"}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test erfolgreich","message":"Die angegebenen API-Zugangsdaten sind korrekt!"},"error":{"title":"Test fehlgeschlagen","message":"Die angegebenen API-Zugangsdaten sind nicht korret! Bitte korrigieren Sie die Eingabe und versuchen Sie es erneut."}},"testButton":"API Zugangsdaten testen","webhookButton":"Webhooks registrieren testen"},"modal":{"close":"Schließen","webhook":{"title":"Webhooks","submit":{"register":"Webhooks registrieren","clear":"Webhooks entfernen"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registriert | Webhooks registriert","error":"Der Webhook konnte nicht registriert werden | Die Webhooks konnten nicht registriert werden"},"clear":{"done":"Webhook entfernt | Webhooks entfernt","error":"Der Webhook konnte nicht entfernt werden | Die Webhooks konnten nicht entfernt werden"},"missing":{"fields":"Nicht alle benötigten Felder sind vorhanden","context":"Der Kontext konnte nicht aktualisiert werden","selection":"Es wurden keine Domains selektiert"},"notFound":{"salesChannelDomain":"Die spezifizierte Domain wurde nicht gefunden"},"globalError":{"title":"Ein Fehler ist aufgetreten","message":"Bitte kontaktieren sie uns für mehr Informationen"}}}}')},Gaz2:function(e,t){e.exports='{% block heidel_payment_basket %}\n \n \n {% block heidel_payment_basket_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}\n'},KEl0:function(e,t){e.exports='{% block heidel_payment_actions %}\n \n {% block heidel_payment_actions_amount_field %}\n
\n \n \n
\n {% endblock %}\n\n
\n {% block heidel_payment_actions_charge_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_refund_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.refundButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_default_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_button_container_inner %}{% endblock %}\n
\n
\n{% endblock %}\n'},KmwY:function(e,t){e.exports='{% block sw_order_create_details_footer_payment_method %}\n \n \n{% endblock %}\n'},PMv5:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidelpay"){super(e,t,n)}fetchPaymentDetails(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/details`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}chargeTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}refundTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${t}/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}ship(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/ship`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},SAZ9:function(e,t,n){"use strict";n.r(t);var i=n("KEl0"),s=n.n(i);const{Component:a,Mixin:o}=Shopware;a.register("heidel-payment-actions",{template:s.a,inject:["HeidelPaymentService"],mixins:[o.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1,transactionAmount:0}),props:{transactionResource:{type:Object,required:!0},paymentResource:{type:Object,required:!0}},computed:{isChargePossible:function(){return"authorization"===this.transactionResource.type},isRefundPossible:function(){return"charge"===this.transactionResource.type},refundAmount:function(){return this.paymentResource.calculatedAmounts.charged-this.paymentResource.calculatedAmounts.cancelled},chargeAmount:function(){return this.paymentResource.calculatedAmounts.remaining},maxTransactionAmount(){let e=0;return this.isRefundPossible?e=this.refundAmount:this.isChargePossible&&(e=this.chargeAmount),e}},created(){this.transactionAmount=this.maxTransactionAmount},methods:{charge(){this.isLoading=!0,this.HeidelPaymentService.chargeTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeErrorTitle"),message:t}),this.isLoading=!1})},refund(){this.isLoading=!0,this.HeidelPaymentService.refundTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.refundErrorTitle"),message:t}),this.isLoading=!1})}}});var r=n("5j/b"),c=n.n(r);const{Component:l,Mixin:d}=Shopware;l.register("heidel-payment-detail",{template:c.a,inject:["HeidelPaymentService"],mixins:[d.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1}),props:{paymentResource:{type:Object,required:!0}},methods:{ship(){this.isLoading=!0,this.HeidelPaymentService.ship(this.paymentResource.orderId).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t?t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage"):"invoice-missing-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.invoiceNotFoundMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.shipErrorTitle"),message:t}),this.isLoading=!1})}}});var h=n("fpPm"),m=n.n(h);const{Component:p}=Shopware;p.register("heidel-payment-history",{template:m.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.transactions.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amount),this.paymentResource.currency),i=this.$options.filters.date(t.date,{hour:"numeric",minute:"numeric",second:"numeric"});e.push({type:this.transactionTypeRenderer(t.type),amount:n,date:i,resource:t})}),e},columns:function(){return[{property:"type",label:this.$tc("heidel-payment.paymentDetails.history.column.type"),rawData:!0},{property:"amount",label:this.$tc("heidel-payment.paymentDetails.history.column.amount"),rawData:!0},{property:"date",label:this.$tc("heidel-payment.paymentDetails.history.column.date"),rawData:!0}]}},methods:{transactionTypeRenderer:function(e){switch(e){case"authorization":return this.$tc("heidel-payment.paymentDetails.history.type.authorization");case"charge":return this.$tc("heidel-payment.paymentDetails.history.type.charge");case"shipment":return this.$tc("heidel-payment.paymentDetails.history.type.shipment");case"cancellation":return this.$tc("heidel-payment.paymentDetails.history.type.cancellation");default:return this.$tc("heidel-payment.paymentDetails.history.type.default")}},reloadPaymentDetails:function(){this.$emit("reload")}}});var u=n("nmHs"),y=n.n(u);const{Component:g}=Shopware;g.register("heidel-payment-metadata",{template:y.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.metadata.forEach(t=>{e.push({key:t.key,value:t.value})}),e},columns:function(){return[{property:"key",label:this.$tc("heidel-payment.paymentDetails.metadata.column.key"),rawData:!0},{property:"value",label:this.$tc("heidel-payment.paymentDetails.metadata.column.value"),rawData:!0}]}}});var b=n("Gaz2"),f=n.n(b);const{Component:w}=Shopware;w.register("heidel-payment-basket",{template:f.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.basket.basketItems.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amountGross),this.paymentResource.currency),i=this.$options.filters.currency(parseFloat(t.amountNet),this.paymentResource.currency);e.push({quantity:t.quantity,title:t.title,amountGross:n,amountNet:i})}),e},columns:function(){return[{property:"quantity",label:this.$tc("heidel-payment.paymentDetails.basket.column.quantity"),rawData:!0},{property:"title",label:this.$tc("heidel-payment.paymentDetails.basket.column.title"),rawData:!0},{property:"amountGross",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountGross"),rawData:!0},{property:"amountNet",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountNet"),rawData:!0}]}}});var k=n("YlXO"),_=n.n(k);const{Component:S,Context:v}=Shopware,{Criteria:C}=Shopware.Data;S.override("sw-order-detail",{template:_.a,data:()=>({isHeidelpayPayment:!1}),computed:{showTabs:()=>!0,paymentMethodStore:()=>State.getStore("payment_method")},watch:{orderId:{deep:!0,handler(){if(!this.orderId)return void(this.isHeidelpayPayment=!1);const e=this.repositoryFactory.create("order"),t=new C(1,1);t.addAssociation("transactions"),e.get(this.orderId,v.api,t).then(e=>{e.transactions.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&(this.isHeidelpayPayment=!0)})})},immediate:!0}}});var D=n("gur3"),R=n.n(D);Shopware.Component.override("sw-order-list",{template:R.a,computed:{orderColumns(){return this.getEnhancedOrderColumns()}},methods:{getEnhancedOrderColumns(){const e=this.getOrderColumns();return e.splice(1,0,{property:"heidelTransactionId",label:"heidel-payment.order-list.transactionId",allowResize:!0}),e}}});var $=n("KmwY"),T=n.n($);const{Component:A,Context:P}=Shopware,{Criteria:x}=Shopware.Data;A.override("sw-order-create-details-footer",{template:T.a,computed:{paymentMethodCriteria(){const e=new x;return this.salesChannelId&&e.addFilter(x.equals("salesChannels.id",this.salesChannelId)),e.addFilter(x.not("AND",[x.contains("handlerIdentifier","HeidelPayment6\\Components")])),e}}});var B=n("xTmB"),E=n.n(B);const{Component:M,StateDeprecated:L}=Shopware;M.register("heidel-payment-tab",{template:E.a,inject:["HeidelPaymentService"],data:()=>({paymentResources:[],isLoading:!0}),created(){this.createdComponent()},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},methods:{createdComponent(){this.loadData()},orderStore:()=>L.getStore("order"),resetDataAttributes(){this.paymentResources=[],this.isLoading=!0},reloadPaymentDetails(){this.resetDataAttributes(),this.loadData()},loadData(){const e=this.$route.params.id;this.orderStore().getByIdAsync(e).then(e=>{this.order=e,this.order.getAssociation("transactions").getList({}).then(e=>{e.items.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&this.HeidelPaymentService.fetchPaymentDetails(e.id).then(e=>{this.isLoading=!1,this.paymentResources.push(this.calculateAmounts(e))}).catch(()=>{this.isLoading=!1})})})})},calculateAmounts:e=>(e.calculatedAmounts={remaining:e.basket.amountTotalGross,charged:0,cancelled:0},e.transactions.forEach(t=>{"cancellation"===t.type?e.calculatedAmounts.cancelled+=t.amount:"charge"===t.type&&(e.calculatedAmounts.charged+=t.amount,e.calculatedAmounts.remaining-=t.amount)}),e)}});var H=n("EsnK"),I=n("Eq9y");const{Module:W}=Shopware;W.register("heidel-payment",{type:"plugin",name:"HeidelPayment",title:"heidel-payment.general.title",description:"heidel-payment.general.descriptionTextModule",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":H,"en-GB":I},routeMiddleware(e,t){"sw.order.detail"===t.name&&t.children.push({component:"heidel-payment-tab",name:"heidel-payment.payment.detail",isChildren:!0,path:"/sw/order/heidelpayment/detail/:id"}),e(t)}});var N=n("ectR"),F=n.n(N);n("vrVC");Shopware.Component.register("heidel-payment-register-webhook",{template:F.a,mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],computed:{salesChannelDomainColumns:()=>[{property:"id",dataIndex:"id",label:"ID"},{property:"url",dataIndex:"url",label:"URL"}],salesChannelDomainRepository(){return this.repositoryFactory.create("sales_channel_domain")}},data:()=>({showWebhookModal:!1,isLoading:!1,isRegistering:!1,isRegistrationSuccessful:!1,isClearing:!1,isClearingSuccessful:!1,salesChannelDomains:{},selection:[]}),created(){this.salesChannelDomainRepository.search(new Shopware.Data.Criteria,Shopware.Context.api).then(e=>{this.salesChannelDomains=e})},methods:{openModal(){this.showWebhookModal=!0},closeModal(){this.showWebhookModal=!1},registerWebhooks(){const e=this;this.isRegistrationSuccessful=!1,this.isRegistering=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.registerWebhooks({selection:this.selection}).then(t=>{e.isRegistrationSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isRegistering=!1})},clearWebhooks(){const e=this;this.isClearingSuccessful=!1,this.isClearing=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.clearWebhooks({selection:this.selection}).then(t=>{e.isClearingSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isClearing=!1})},onRegistrationFinished(){this.isRegistrationSuccessful=!1},onClearingFinished(){this.isClearingSuccessful=!1},onSelectItem(e){this.selection=e},messageGeneration(e){const t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n})})}}});var z=n("6E3l"),V=n.n(z);const{Component:q}=Shopware;q.override("sw-plugin-list",{template:V.a});var G=n("4aeB"),j=n.n(G);const{Component:O,Mixin:Z}=Shopware,{Criteria:K}=Shopware.Data;O.register("heidel-payment-settings",{template:j.a,mixins:[Z.getByName("notification"),Z.getByName("sw-inline-snippet")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],data:()=>({isLoading:!1,isTesting:!1,isTestSuccessful:!1,isSaveSuccessful:!1,config:{},showWebhookModal:!1}),metaInfo:()=>({title:"Heidelpay"}),computed:{paymentMethodRepository(){return this.repositoryFactory.create("payment_method")}},methods:{getConfigValue(e){const t=this.$refs.systemConfig.actualConfigData.null;return this.config[`HeidelPayment6.settings.${e}`]||t[`HeidelPayment6.settings.${e}`]},onValidateCredentials(){this.isTestSuccessful=!1,this.isTesting=!0;const e={publicKey:this.getConfigValue("publicKey"),privateKey:this.getConfigValue("privateKey"),salesChannel:this.$refs.systemConfig.currentSalesChannelId};this.HeidelPaymentConfigurationService.validateCredentials(e).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment-settings.form.message.success.title"),message:this.$tc("heidel-payment-settings.form.message.success.message")}),this.isTestSuccessful=!0,this.isTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.form.message.error.title"),message:this.$tc("heidel-payment-settings.form.message.error.message")}),this.isTesting=!1})},onTestFinished(){this.isTestSuccessful=!1},onSave(){this.isLoading=!0,this.$refs.systemConfig.saveAll().then(()=>{this.createNotificationSuccess({title:this.$tc("sw-plugin-config.titleSaveSuccess"),message:this.$tc("sw-plugin-config.messageSaveSuccess")}),this.isLoading=!1}).catch(e=>{this.createNotificationError({title:this.$tc("sw-plugin-config.titleSaveError"),message:e}),this.isLoading=!1})},onConfigChange(e){this.config=e},getBind(e,t){return t!==this.config&&(this.config=t),e},getDeliveryStatusCriteria(){const e=new K(1,100);return e.addFilter(K.equals("stateMachine.technicalName","order_delivery.state")),e},openWebhookModal(){this.showWebhookModal=!0},closeWebhookModal(){this.showWebhookModal=!1}}});const{Module:J}=Shopware;J.register("heidel-payment-configuration",{type:"plugin",name:"HeidelPayment",title:"heidel-payment-settings.module.title",description:"heidel-payment-settings.module.description",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":H,"en-GB":I},routes:{settings:{component:"heidel-payment-settings",path:"settings",meta:{parentPath:"sw.settings.index"}}}});n("PMv5"),n("+kxS"),n("BzwZ")},YlXO:function(e,t){e.exports="{% block sw_order_detail_content_tabs_general %}\n {% parent %}\n\n {% block heidel_payment_payment_tab %}\n \n {{ $tc('heidel-payment.tabTitle') }}\n \n {% endblock %}\n{% endblock %}"},ectR:function(e,t){e.exports='{% block heidel_payment_payment_register_webhook %}\n
\n \n {{ $tc(\'heidel-payment-settings.form.webhookButton\') }}\n \n \n \n \n\n \n \n
\n{% endblock %}\n'},fpPm:function(e,t){e.exports='{% block heidel_payment_history %}\n \n {% block heidel_payment_history_container %}\n \n {% block heidel_payment_history_data_grid %}\n \n\n {% block heidel_payment_history_actions %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}\n'},gur3:function(e,t){e.exports='{% block sw_order_list_grid_columns %}\n {% parent %}\n\n {% block heidelpay_column_transaction %}\n \n {% endblock %}\n{% endblock %}\n'},nmHs:function(e,t){e.exports='{% block heidel_payment_metadata %}\n \n{% endblock %}\n'},vrVC:function(e,t,n){var i=n("6gNM");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("eb0a43b4",i,!0,{})},xTmB:function(e,t){e.exports='{% block heidel_payment_payment_details %}\n
\n
\n {% block heidel_payment_payment_details_content %}\n \n {% endblock %}\n
\n\n \n
\n{% endblock %}\n'}},[["SAZ9","runtime","vendors-node"]]]); \ No newline at end of file From 8906e2129739f7f777b0075ae9eabcbfd037e039 Mon Sep 17 00:00:00 2001 From: Steffen Beisenherz Date: Wed, 14 Oct 2020 17:40:27 +0200 Subject: [PATCH 09/15] [HEIDELPAYSUPPORT-21] refactor the basketResourceHydrator to handle the basket Request differently --- .../BasketResourceHydrator.php | 65 +++++++++++-------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/src/Components/ResourceHydrator/BasketResourceHydrator.php b/src/Components/ResourceHydrator/BasketResourceHydrator.php index 81bef2a..ddea35d 100755 --- a/src/Components/ResourceHydrator/BasketResourceHydrator.php +++ b/src/Components/ResourceHydrator/BasketResourceHydrator.php @@ -10,7 +10,7 @@ use heidelpayPHP\Resources\EmbeddedResources\BasketItem; use InvalidArgumentException; use Shopware\Core\Checkout\Cart\Price\Struct\CartPrice; -use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemCollection; +use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemEntity; use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Promotion\Cart\PromotionProcessor; @@ -32,22 +32,16 @@ public function hydrateObject( $currencyPrecision = $transaction->getOrder()->getCurrency() !== null ? $transaction->getOrder()->getCurrency()->getDecimalPrecision() : 4; $currencyPrecision = min($currencyPrecision, 4); - $amountTotalVat = round( - $transaction->getOrder()->getAmountTotal() - $transaction->getOrder()->getAmountNet(), - $currencyPrecision - ); - - $amountTotalDiscount = round( - $this->calculateAmountTotalDiscount($transaction->getOrder()->getLineItems()), - $currencyPrecision - ); - if ($transaction instanceof AsyncPaymentTransactionStruct) { $transactionId = $transaction->getOrderTransaction()->getId(); } else { $transactionId = $transaction->getId(); } + $amountTotalDiscount = 0; + $amountTotalGross = 0; + $amountTotalVat = 0; + $heidelBasket = new Basket( $transactionId, round($transaction->getOrder()->getAmountTotal(), $currencyPrecision), @@ -61,7 +55,11 @@ public function hydrateObject( return $heidelBasket; } + /** @var OrderLineItemEntity $lineItem */ foreach ($transaction->getOrder()->getLineItems() as $lineItem) { + $amountDiscount = 0; + $amountGross = 0; + $type = $lineItem->getType(); if ($lineItem->getPrice() === null) { @@ -86,14 +84,25 @@ public function hydrateObject( $unitPrice = 0; $amountGross = 0; $amountNet = 0; + $amountTax = 0; $amountDiscount = round($this->getAmountByItemType($type, $lineItem->getTotalPrice()), $currencyPrecision); } else { - $unitPrice = round($this->getAmountByItemType($type, $lineItem->getUnitPrice()), $currencyPrecision); - $amountGross = round($this->getAmountByItemType($type, $lineItem->getTotalPrice()), $currencyPrecision); - $amountNet = round($amountGross - $amountTax, $currencyPrecision); - $amountDiscount = 0; + $unitPrice = round($this->getAmountByItemType($type, $lineItem->getUnitPrice()), $currencyPrecision); + $amountGross = round($this->getAmountByItemType($type, $lineItem->getTotalPrice()), $currencyPrecision); + $amountNet = round($amountGross - $amountTax, $currencyPrecision); + + if (null !== $lineItem->getProduct()) { + $product = $lineItem->getProduct(); + $amountDiscount = round(($product->getPrice() - $lineItem->getTotalPrice()) * -1, $currencyPrecision); + } else { + $amountDiscount = 0; + } } + $amountTotalDiscount += $amountDiscount; + $amountTotalGross += $amountGross; + $amountTotalVat += $amountTax; + $basketItem = new BasketItem( $lineItem->getLabel(), $amountNet, @@ -118,6 +127,20 @@ public function hydrateObject( $channelContext->getShippingMethod()->getName() ); + $heidelBasketItems = $heidelBasket->getBasketItems(); + /** @var BasketItem $shippingItem */ + $shippingItem = end($heidelBasketItems); + + if ($shippingItem !== false && $shippingItem->getType() === BasketItemTypes::SHIPMENT) { + $amountTotalDiscount += $shippingItem->getAmountDiscount(); + $amountTotalGross += $shippingItem->getAmountGross(); + $amountTotalVat += $shippingItem->getAmountVat(); + } + + $heidelBasket->setAmountTotalDiscount($amountTotalDiscount); + $heidelBasket->setAmountTotalGross($amountTotalGross); + $heidelBasket->setAmountTotalVat($amountTotalVat); + return $heidelBasket; } @@ -185,16 +208,4 @@ private function hydrateShippingCosts($transaction, Basket $basket, int $currenc $basket->addBasketItem($dispatchBasketItem); } } - - private function calculateAmountTotalDiscount(OrderLineItemCollection $lineItems): float - { - $lineItems = array_map( - function ($lineItem) { - return $this->isPromotionLineItemType($lineItem->getType()) ? $lineItem->getTotalPrice() * -1 : 0.0; - }, - $lineItems->getElements() - ); - - return array_sum($lineItems); - } } From 50c11c9a84089b4019b4bb339b2e08b07f325d29 Mon Sep 17 00:00:00 2001 From: Steffen Beisenherz Date: Wed, 14 Oct 2020 17:51:58 +0200 Subject: [PATCH 10/15] [HEIDELPAYSUPPORT-21] refactor the basketResourceHydrator to handle the basket Request differently --- src/Components/ResourceHydrator/BasketResourceHydrator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/ResourceHydrator/BasketResourceHydrator.php b/src/Components/ResourceHydrator/BasketResourceHydrator.php index ddea35d..442cafe 100755 --- a/src/Components/ResourceHydrator/BasketResourceHydrator.php +++ b/src/Components/ResourceHydrator/BasketResourceHydrator.php @@ -92,7 +92,7 @@ public function hydrateObject( $amountNet = round($amountGross - $amountTax, $currencyPrecision); if (null !== $lineItem->getProduct()) { - $product = $lineItem->getProduct(); + $product = $lineItem->getProduct(); $amountDiscount = round(($product->getPrice() - $lineItem->getTotalPrice()) * -1, $currencyPrecision); } else { $amountDiscount = 0; From 375980f310ec71c302d9a09e8a1579821765eaa8 Mon Sep 17 00:00:00 2001 From: Steffen Beisenherz Date: Thu, 15 Oct 2020 08:47:20 +0200 Subject: [PATCH 11/15] [HEIDELPAYSUPPORT-21] taxRate on Vouchers should always be 0 for the basket request --- src/Components/ResourceHydrator/BasketResourceHydrator.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Components/ResourceHydrator/BasketResourceHydrator.php b/src/Components/ResourceHydrator/BasketResourceHydrator.php index 442cafe..930e89f 100755 --- a/src/Components/ResourceHydrator/BasketResourceHydrator.php +++ b/src/Components/ResourceHydrator/BasketResourceHydrator.php @@ -85,6 +85,7 @@ public function hydrateObject( $amountGross = 0; $amountNet = 0; $amountTax = 0; + $taxRate = 0; $amountDiscount = round($this->getAmountByItemType($type, $lineItem->getTotalPrice()), $currencyPrecision); } else { $unitPrice = round($this->getAmountByItemType($type, $lineItem->getUnitPrice()), $currencyPrecision); From e70182da23e3d4fff97099df186ec9d8b63350f8 Mon Sep 17 00:00:00 2001 From: Steffen Beisenherz Date: Thu, 15 Oct 2020 10:41:35 +0200 Subject: [PATCH 12/15] [HEIDELPAYSUPPORT-21] code style cleanup and dispatch items adding up to amountTotal values --- .../BasketResourceHydrator.php | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/src/Components/ResourceHydrator/BasketResourceHydrator.php b/src/Components/ResourceHydrator/BasketResourceHydrator.php index 930e89f..98da3cc 100755 --- a/src/Components/ResourceHydrator/BasketResourceHydrator.php +++ b/src/Components/ResourceHydrator/BasketResourceHydrator.php @@ -63,11 +63,13 @@ public function hydrateObject( $type = $lineItem->getType(); if ($lineItem->getPrice() === null) { - $heidelBasket->addBasketItem(new BasketItem( - $lineItem->getLabel(), - round($this->getAmountByItemType($type, $lineItem->getTotalPrice()), $currencyPrecision), - round($this->getAmountByItemType($type, $lineItem->getUnitPrice()), $currencyPrecision), - $lineItem->getQuantity()) + $heidelBasket->addBasketItem( + new BasketItem( + $lineItem->getLabel(), + round($this->getAmountByItemType($type, $lineItem->getTotalPrice()), $currencyPrecision), + round($this->getAmountByItemType($type, $lineItem->getUnitPrice()), $currencyPrecision), + $lineItem->getQuantity() + ) ); continue; @@ -92,7 +94,7 @@ public function hydrateObject( $amountGross = round($this->getAmountByItemType($type, $lineItem->getTotalPrice()), $currencyPrecision); $amountNet = round($amountGross - $amountTax, $currencyPrecision); - if (null !== $lineItem->getProduct()) { + if ($lineItem->getProduct() !== null) { $product = $lineItem->getProduct(); $amountDiscount = round(($product->getPrice() - $lineItem->getTotalPrice()) * -1, $currencyPrecision); } else { @@ -125,19 +127,12 @@ public function hydrateObject( $transaction, $heidelBasket, $currencyPrecision, - $channelContext->getShippingMethod()->getName() + $channelContext->getShippingMethod()->getName(), + $amountTotalDiscount, + $amountTotalGross, + $amountTotalVat ); - $heidelBasketItems = $heidelBasket->getBasketItems(); - /** @var BasketItem $shippingItem */ - $shippingItem = end($heidelBasketItems); - - if ($shippingItem !== false && $shippingItem->getType() === BasketItemTypes::SHIPMENT) { - $amountTotalDiscount += $shippingItem->getAmountDiscount(); - $amountTotalGross += $shippingItem->getAmountGross(); - $amountTotalVat += $shippingItem->getAmountVat(); - } - $heidelBasket->setAmountTotalDiscount($amountTotalDiscount); $heidelBasket->setAmountTotalGross($amountTotalGross); $heidelBasket->setAmountTotalVat($amountTotalVat); @@ -171,8 +166,15 @@ private function isPromotionLineItemType(string $type): bool /** * @param AsyncPaymentTransactionStruct|OrderTransactionEntity $transaction */ - private function hydrateShippingCosts($transaction, Basket $basket, int $currencyPrecision, string $shippingMethodName): void - { + private function hydrateShippingCosts( + $transaction, + Basket $basket, + int $currencyPrecision, + string $shippingMethodName, + float &$amountTotalDiscount, + float &$amountTotalGross, + float &$amountTotalVat + ): void { $shippingCosts = $transaction->getOrder()->getShippingCosts(); if ($transaction->getOrder()->getTaxStatus() === CartPrice::TAX_STATE_FREE) { @@ -184,6 +186,10 @@ private function hydrateShippingCosts($transaction, Basket $basket, int $currenc $dispatchBasketItem->setAmountNet(round($shippingCosts->getTotalPrice(), $currencyPrecision)); $dispatchBasketItem->setQuantity($shippingCosts->getQuantity()); + $amountTotalDiscount += $dispatchBasketItem->getAmountDiscount(); + $amountTotalGross += $dispatchBasketItem->getAmountGross(); + $amountTotalVat += $dispatchBasketItem->getAmountVat(); + $basket->addBasketItem($dispatchBasketItem); return; @@ -206,6 +212,10 @@ private function hydrateShippingCosts($transaction, Basket $basket, int $currenc $dispatchBasketItem->setQuantity($shippingCosts->getQuantity()); $dispatchBasketItem->setVat($tax->getTaxRate()); + $amountTotalDiscount += $dispatchBasketItem->getAmountDiscount(); + $amountTotalGross += $dispatchBasketItem->getAmountGross(); + $amountTotalVat += $dispatchBasketItem->getAmountVat(); + $basket->addBasketItem($dispatchBasketItem); } } From f868231a3054eeda57e31318af4d4cd18b18613d Mon Sep 17 00:00:00 2001 From: Steffen Beisenherz Date: Mon, 19 Oct 2020 15:07:21 +0200 Subject: [PATCH 13/15] [HEIDELPAY-251] Remove unused payment details in template and snippets --- .../heidel-payment-detail.html.twig | 21 ++----------------- .../administration/src/snippets/de-DE.json | 3 --- .../administration/src/snippets/en-GB.json | 3 --- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/Resources/app/administration/src/module/heidel-payment/component/heidel-payment-detail/heidel-payment-detail.html.twig b/src/Resources/app/administration/src/module/heidel-payment/component/heidel-payment-detail/heidel-payment-detail.html.twig index 9e708a4..94fa392 100644 --- a/src/Resources/app/administration/src/module/heidel-payment/component/heidel-payment-detail/heidel-payment-detail.html.twig +++ b/src/Resources/app/administration/src/module/heidel-payment/component/heidel-payment-detail/heidel-payment-detail.html.twig @@ -1,25 +1,8 @@ {% block heidel_payment_detail %} {% block heidel_payment_detail_container %} - + {% block heidel_payment_detail_container_left %} - - -
{{ $tc('heidel-payment.paymentDetails.detail.amountTotal') }}
-
{{ paymentResource.basket.amountTotalGross | currency(paymentResource.currency) }}
- -
{{ $tc('heidel-payment.paymentDetails.detail.amountTotalVat') }}
-
{{ paymentResource.basket.amountTotalVat | currency(paymentResource.currency) }}
- -
{{ $tc('heidel-payment.paymentDetails.detail.currency') }}
-
{{ paymentResource.currency }}
- - {% block heidel_payment_detail_container_left_inner %}{% endblock %} -
-
- {% endblock %} - - {% block heidel_payment_detail_container_center %}
{{ $tc('heidel-payment.paymentDetails.detail.amountRemaining') }}
@@ -31,7 +14,7 @@
{{ $tc('heidel-payment.paymentDetails.detail.amountCharged') }}
{{ paymentResource.amount.charged | currency(paymentResource.currency) }}
- {% block heidel_payment_detail_container_center_inner %}{% endblock %} + {% block heidel_payment_detail_container_left_inner %}{% endblock %}
{% endblock %} diff --git a/src/Resources/app/administration/src/snippets/de-DE.json b/src/Resources/app/administration/src/snippets/de-DE.json index ea8bfec..0ded613 100644 --- a/src/Resources/app/administration/src/snippets/de-DE.json +++ b/src/Resources/app/administration/src/snippets/de-DE.json @@ -24,9 +24,6 @@ }, "detail": { "cardTitle": "Zahlungsdetails", - "amountTotal": "Betrag (brutto)", - "amountTotalVat": "Betrag (netto)", - "currency": "Währung", "shortId": "Short-ID", "id": "Zahlungs-ID", "state": "Status", diff --git a/src/Resources/app/administration/src/snippets/en-GB.json b/src/Resources/app/administration/src/snippets/en-GB.json index 8f6e181..849cdd0 100644 --- a/src/Resources/app/administration/src/snippets/en-GB.json +++ b/src/Resources/app/administration/src/snippets/en-GB.json @@ -24,9 +24,6 @@ }, "detail": { "cardTitle": "Payment Details", - "amountTotal": "Amount (gross)", - "amountTotalVat": "Amount (net)", - "currency": "Currency", "shortId": "Short-ID", "id": "Payment-ID", "state": "State", From 6c7311baa39cfed8baecbb8d4d4483c2aaf7b334 Mon Sep 17 00:00:00 2001 From: Steffen Beisenherz Date: Wed, 21 Oct 2020 09:58:37 +0200 Subject: [PATCH 14/15] [HEIDELPAY-251] Rebundle Administration javascript --- src/Resources/public/administration/js/heidel-payment6.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Resources/public/administration/js/heidel-payment6.js b/src/Resources/public/administration/js/heidel-payment6.js index 3d57a58..46c8951 100644 --- a/src/Resources/public/administration/js/heidel-payment6.js +++ b/src/Resources/public/administration/js/heidel-payment6.js @@ -1,2 +1 @@ - -(this.webpackJsonp=this.webpackJsonp||[]).push([["heidel-payment6"],{"+kxS":function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidel_payment"){super(e,t,n)}validateCredentials(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-credentials`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}registerWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/register-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}clearWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/clear-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentConfigurationService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},"1iz7":function(e,t,n){},"42IN":function(e,t){e.exports='{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'},"4aeB":function(e,t){e.exports='{% block heidel_payment_settings %}\n\n {% block heidel_payment_settings_header %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_actions %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},"5j/b":function(e,t){e.exports="{% block heidel_payment_detail %}\n \n {% block heidel_payment_detail_container %}\n \n {% block heidel_payment_detail_container_left %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotal') }}
\n
{{ paymentResource.basket.amountTotalGross | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountTotalVat') }}
\n
{{ paymentResource.basket.amountTotalVat | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.currency') }}
\n
{{ paymentResource.currency }}
\n\n {% block heidel_payment_detail_container_left_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_center %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.amountRemaining') }}
\n
{{ paymentResource.amount.remaining | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCancelled') }}
\n
{{ paymentResource.amount.canceled | currency(paymentResource.currency) }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.amountCharged') }}
\n
{{ paymentResource.amount.charged | currency(paymentResource.currency) }}
\n\n {% block heidel_payment_detail_container_center_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_right %}\n \n \n
{{ $tc('heidel-payment.paymentDetails.detail.shortId') }}
\n
{{ paymentResource.shortId }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.id') }}
\n
{{ paymentResource.id }}
\n\n
{{ $tc('heidel-payment.paymentDetails.detail.state') }}
\n
{{ paymentResource.state.name }}
\n\n {% block heidel_payment_detail_container_right_inner %}{% endblock %}\n
\n
\n {% endblock %}\n
\n {% endblock %}\n\n {% block heidel_payment_detail_ship_button %}\n \n \n {{ $tc('heidel-payment.paymentDetails.actions.shipButton') }}\n \n \n {% endblock %}\n
\n{% endblock %}\n"},"6gNM":function(e,t,n){},BzwZ:function(e,t,n){var i=n("1iz7");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("0d46815a",i,!0,{})},Eq9y:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Payment History","column":{"type":"Type","amount":"Amount","date":"Date"},"type":{"authorization":"Authorization","charge":"Charging","shipment":"Shipping notification","cancellation":"Refund","default":""}},"actions":{"chargeButton":"Charge","shipButton":"Shipping notice","refundButton":"Refund"},"detail":{"cardTitle":"Payment Details","amountTotal":"Amount (gross)","amountTotalVat":"Amount (net)","currency":"Currency","shortId":"Short-ID","id":"Payment-ID","state":"State","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)"},"metadata":{"cardTitle":"Metadata","column":{"key":"Key","value":"Value"}},"basket":{"cardTitle":"Basket","column":{"quantity":"Quantity","title":"Title","amountGross":"Amount (gross)","amountNet":"Amount (net)"}},"notifications":{"genericErrorMessage":"An error has occoured!","refundSuccessTitle":"Refund","refundSuccessMessage":"The reimbursement was successfully completed.","refundErrorTitle":"Refund","chargeSuccessTitle":"Charge","chargeSuccessMessage":"The collection of the payment was carried out successfully.","chargeErrorTitle":"Charge","shipSuccessTitle":"Shipping notice","shipSuccessMessage":"The shipping notification was successfully sent.","shipErrorTitle":"Shipping notice","invoiceNotFoundMessage":"No invoice was found for this order."}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test succeeded","message":"The provided credentials are valid!"},"error":{"title":"Test failed","message":"API Credentials are invalid, please correct them and try again!"}},"testButton":"Test API credentials","webhookButton":"Register webhooks"},"modal":{"close":"Close","webhook":{"title":"Webhooks","submit":{"register":"Register webhooks","clear":"Clear webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registered | Webhooks registered","error":"Webhook could not be registered | Webhooks could not be registered"},"clear":{"done":"Webhook cleared | Webhooks cleared","error":"Webhook could not be cleared | Webhooks could not be cleared"},"missing":{"fields":"Some mandatory fields are missing","context":"The context could not be refreshed","selection":"No domain was selected"},"notFound":{"salesChannelDomain":"The selected domain could not be found"},"globalError":{"title":"An error occured","message":"Please contact us for more information"}}}}')},EsnK:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Zahlungsverlauf","column":{"type":"Typ","amount":"Betrag","date":"Datum"},"type":{"authorization":"Reservierung","charge":"Einzug","shipment":"Versandtmitteilung","cancellation":"Rückerstattung","default":""}},"actions":{"chargeButton":"Einziehen","shipButton":"Versandmitteilung","refundButton":"Rückerstatten"},"detail":{"cardTitle":"Zahlungsdetails","amountTotal":"Betrag (brutto)","amountTotalVat":"Betrag (netto)","currency":"Währung","shortId":"Short-ID","id":"Zahlungs-ID","state":"Status","amountRemaining":"Betrag (Rest)","amountCancelled":"Betrag (Rückerstattet)","amountCharged":"Betrag (Eingezogen)"},"metadata":{"cardTitle":"Metadaten","column":{"key":"Schlüssel","value":"Wert"}},"basket":{"cardTitle":"Warenkorb","column":{"quantity":"Anzahl","title":"Titel","amountGross":"Betrag (brutto)","amountNet":"Betrag (netto)"}},"notifications":{"genericErrorMessage":"Es ist ein Fehler aufgetreten!","refundSuccessTitle":"Rückerstatten","refundSuccessMessage":"Die Rückerstattung wurde erfolgreich durchgeführt.","refundErrorTitle":"Rückerstatten","chargeSuccessTitle":"Einziehen","chargeSuccessMessage":"Das Einziehen der Zahlung wurde erfolgreich durchgeführt.","chargeErrorTitle":"Einziehen","shipSuccessTitle":"Versandmitteilung","shipSuccessMessage":"Die Versandmitteilung wurde erfolgreich gesendet.","shipErrorTitle":"Versandmitteilung","invoiceNotFoundMessage":"Zu dieser Bestellung wurde keine Rechnung gefunden"}}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test erfolgreich","message":"Die angegebenen API-Zugangsdaten sind korrekt!"},"error":{"title":"Test fehlgeschlagen","message":"Die angegebenen API-Zugangsdaten sind nicht korret! Bitte korrigieren Sie die Eingabe und versuchen Sie es erneut."}},"testButton":"API Zugangsdaten testen","webhookButton":"Webhooks registrieren testen"},"modal":{"close":"Schließen","webhook":{"title":"Webhooks","submit":{"register":"Webhooks registrieren","clear":"Webhooks entfernen"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registriert | Webhooks registriert","error":"Der Webhook konnte nicht registriert werden | Die Webhooks konnten nicht registriert werden"},"clear":{"done":"Webhook entfernt | Webhooks entfernt","error":"Der Webhook konnte nicht entfernt werden | Die Webhooks konnten nicht entfernt werden"},"missing":{"fields":"Nicht alle benötigten Felder sind vorhanden","context":"Der Kontext konnte nicht aktualisiert werden","selection":"Es wurden keine Domains selektiert"},"notFound":{"salesChannelDomain":"Die spezifizierte Domain wurde nicht gefunden"},"globalError":{"title":"Ein Fehler ist aufgetreten","message":"Bitte kontaktieren sie uns für mehr Informationen"}}}}')},Gaz2:function(e,t){e.exports='{% block heidel_payment_basket %}\n \n \n {% block heidel_payment_basket_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}\n'},JnMH:function(e,t,n){},KEl0:function(e,t){e.exports='{% block heidel_payment_actions %}\n \n {% block heidel_payment_actions_amount_field %}\n
\n \n \n
\n {% endblock %}\n\n
\n {% block heidel_payment_actions_charge_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_refund_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.refundButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_default_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_button_container_inner %}{% endblock %}\n
\n
\n{% endblock %}\n'},KmwY:function(e,t){e.exports='{% block sw_order_create_details_footer_payment_method %}\n \n \n{% endblock %}\n'},PMv5:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidelpay"){super(e,t,n)}fetchPaymentDetails(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/details`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}chargeTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}refundTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${t}/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}ship(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/ship`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},R5Kq:function(e,t){e.exports="{% block sw_order_detail_content_tabs_general %}\n {% parent %}\n\n {% block heidel_payment_payment_tab %}\n \n {{ $tc('heidel-payment.tabTitle') }}\n \n {% endblock %}\n{% endblock %}"},SAZ9:function(e,t,n){"use strict";n.r(t);var i=n("KEl0"),s=n.n(i);const{Component:a,Mixin:o}=Shopware;a.register("heidel-payment-actions",{template:s.a,inject:["HeidelPaymentService"],mixins:[o.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1,transactionAmount:0}),props:{transactionResource:{type:Object,required:!0},paymentResource:{type:Object,required:!0}},computed:{isChargePossible:function(){return"authorization"===this.transactionResource.type},isRefundPossible:function(){return"charge"===this.transactionResource.type},maxTransactionAmount(){let e=0;return this.isRefundPossible?e=this.paymentResource.amount.charged-this.paymentResource.amount.canceled:this.isChargePossible&&(e=this.paymentResource.amount.remaining),e}},created(){this.transactionAmount=this.maxTransactionAmount},methods:{charge(){this.isLoading=!0,this.HeidelPaymentService.chargeTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeErrorTitle"),message:t}),this.isLoading=!1})},refund(){this.isLoading=!0,this.HeidelPaymentService.refundTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.refundErrorTitle"),message:t}),this.isLoading=!1})}}});var r=n("5j/b"),c=n.n(r);const{Component:l,Mixin:d}=Shopware;l.register("heidel-payment-detail",{template:c.a,inject:["HeidelPaymentService"],mixins:[d.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1}),props:{paymentResource:{type:Object,required:!0}},methods:{ship(){this.isLoading=!0,this.HeidelPaymentService.ship(this.paymentResource.orderId).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t?t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage"):"invoice-missing-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.invoiceNotFoundMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.shipErrorTitle"),message:t}),this.isLoading=!1})}}});var h=n("fpPm"),m=n.n(h);const{Component:p}=Shopware;p.register("heidel-payment-history",{template:m.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.transactions.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amount),this.paymentResource.currency),i=this.$options.filters.date(t.date,{hour:"numeric",minute:"numeric",second:"numeric"});e.push({type:this.transactionTypeRenderer(t.type),amount:n,date:i,resource:t})}),e},columns:function(){return[{property:"type",label:this.$tc("heidel-payment.paymentDetails.history.column.type"),rawData:!0},{property:"amount",label:this.$tc("heidel-payment.paymentDetails.history.column.amount"),rawData:!0},{property:"date",label:this.$tc("heidel-payment.paymentDetails.history.column.date"),rawData:!0}]}},methods:{transactionTypeRenderer:function(e){switch(e){case"authorization":return this.$tc("heidel-payment.paymentDetails.history.type.authorization");case"charge":return this.$tc("heidel-payment.paymentDetails.history.type.charge");case"shipment":return this.$tc("heidel-payment.paymentDetails.history.type.shipment");case"cancellation":return this.$tc("heidel-payment.paymentDetails.history.type.cancellation");default:return this.$tc("heidel-payment.paymentDetails.history.type.default")}},reloadPaymentDetails:function(){this.$emit("reload")}}});var u=n("nmHs"),y=n.n(u);const{Component:g}=Shopware;g.register("heidel-payment-metadata",{template:y.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.metadata.forEach(t=>{e.push({key:t.key,value:t.value})}),e},columns:function(){return[{property:"key",label:this.$tc("heidel-payment.paymentDetails.metadata.column.key"),rawData:!0},{property:"value",label:this.$tc("heidel-payment.paymentDetails.metadata.column.value"),rawData:!0}]}}});var b=n("Gaz2"),f=n.n(b);const{Component:w}=Shopware;w.register("heidel-payment-basket",{template:f.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.basket.basketItems.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amountGross),this.paymentResource.currency),i=this.$options.filters.currency(parseFloat(t.amountNet),this.paymentResource.currency);e.push({quantity:t.quantity,title:t.title,amountGross:n,amountNet:i})}),e},columns:function(){return[{property:"quantity",label:this.$tc("heidel-payment.paymentDetails.basket.column.quantity"),rawData:!0},{property:"title",label:this.$tc("heidel-payment.paymentDetails.basket.column.title"),rawData:!0},{property:"amountGross",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountGross"),rawData:!0},{property:"amountNet",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountNet"),rawData:!0}]}}});var k=n("R5Kq"),_=n.n(k);const{Component:S,Context:v}=Shopware,{Criteria:D}=Shopware.Data;S.override("sw-order-detail",{template:_.a,data:()=>({isHeidelpayPayment:!1}),computed:{showTabs:()=>!0,paymentMethodStore:()=>State.getStore("payment_method")},watch:{orderId:{deep:!0,handler(){if(!this.orderId)return void(this.isHeidelpayPayment=!1);const e=this.repositoryFactory.create("order"),t=new D(1,1);t.addAssociation("transactions"),e.get(this.orderId,v.api,t).then(e=>{e.transactions.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&(this.isHeidelpayPayment=!0)})})},immediate:!0}}});var C=n("KmwY"),R=n.n(C);const{Component:$,Context:T}=Shopware,{Criteria:P}=Shopware.Data;$.override("sw-order-create-details-footer",{template:R.a,computed:{paymentMethodCriteria(){const e=new P;return this.salesChannelId&&e.addFilter(P.equals("salesChannels.id",this.salesChannelId)),e.addFilter(P.not("AND",[P.contains("handlerIdentifier","HeidelPayment6\\Components")])),e}}});var B=n("xTmB"),x=n.n(B);const{Component:M,StateDeprecated:E}=Shopware;M.register("heidel-payment-tab",{template:x.a,inject:["HeidelPaymentService"],data:()=>({paymentResources:[],isLoading:!0}),created(){this.createdComponent()},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},methods:{createdComponent(){this.loadData()},orderStore:()=>E.getStore("order"),resetDataAttributes(){this.paymentResources=[],this.isLoading=!0},reloadPaymentDetails(){this.resetDataAttributes(),this.loadData()},loadData(){const e=this.$route.params.id;this.orderStore().getByIdAsync(e).then(e=>{this.order=e,this.order.getAssociation("transactions").getList({}).then(e=>{e.items.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&this.HeidelPaymentService.fetchPaymentDetails(e.id).then(e=>{this.isLoading=!1,this.paymentResources.push(e)}).catch(()=>{this.isLoading=!1})})})})}}});var A=n("EsnK"),L=n("Eq9y");const{Module:H}=Shopware;H.register("heidel-payment",{type:"plugin",name:"HeidelPayment",title:"heidel-payment.general.title",description:"heidel-payment.general.descriptionTextModule",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":A,"en-GB":L},routeMiddleware(e,t){"sw.order.detail"===t.name&&t.children.push({component:"heidel-payment-tab",name:"heidel-payment.payment.detail",isChildren:!0,path:"/sw/order/heidelpayment/detail/:id"}),e(t)}});var W=n("ectR"),N=n.n(W);n("vrVC");Shopware.Component.register("heidel-payment-register-webhook",{template:N.a,mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],computed:{salesChannelDomainColumns:()=>[{property:"id",dataIndex:"id",label:"ID"},{property:"url",dataIndex:"url",label:"URL"}],salesChannelDomainRepository(){return this.repositoryFactory.create("sales_channel_domain")}},data:()=>({showWebhookModal:!1,isLoading:!1,isRegistering:!1,isRegistrationSuccessful:!1,isClearing:!1,isClearingSuccessful:!1,salesChannelDomains:{},selection:[]}),created(){this.salesChannelDomainRepository.search(new Shopware.Data.Criteria,Shopware.Context.api).then(e=>{this.salesChannelDomains=e})},methods:{openModal(){this.showWebhookModal=!0},closeModal(){this.showWebhookModal=!1},registerWebhooks(){const e=this;this.isRegistrationSuccessful=!1,this.isRegistering=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.registerWebhooks({selection:this.selection}).then(t=>{e.isRegistrationSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isRegistering=!1})},clearWebhooks(){const e=this;this.isClearingSuccessful=!1,this.isClearing=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.clearWebhooks({selection:this.selection}).then(t=>{e.isClearingSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isClearing=!1})},onRegistrationFinished(){this.isRegistrationSuccessful=!1},onClearingFinished(){this.isClearingSuccessful=!1},onSelectItem(e){this.selection=e},messageGeneration(e){const t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n})})}}});var I=n("42IN"),F=n.n(I);n("cKyv");const{Component:z}=Shopware;z.override("sw-settings-index",{template:F.a});var V=n("4aeB"),q=n.n(V);const{Component:K,Mixin:j}=Shopware,{Criteria:G}=Shopware.Data;K.register("heidel-payment-settings",{template:q.a,mixins:[j.getByName("notification"),j.getByName("sw-inline-snippet")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],data:()=>({isLoading:!1,isTesting:!1,isTestSuccessful:!1,isSaveSuccessful:!1,config:{},showWebhookModal:!1}),metaInfo:()=>({title:"Heidelpay"}),computed:{paymentMethodRepository(){return this.repositoryFactory.create("payment_method")}},methods:{getConfigValue(e){const t=this.$refs.systemConfig.actualConfigData.null;return this.config[`HeidelPayment6.settings.${e}`]||t[`HeidelPayment6.settings.${e}`]},onValidateCredentials(){this.isTestSuccessful=!1,this.isTesting=!0;const e={publicKey:this.getConfigValue("publicKey"),privateKey:this.getConfigValue("privateKey"),salesChannel:this.$refs.systemConfig.currentSalesChannelId};this.HeidelPaymentConfigurationService.validateCredentials(e).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment-settings.form.message.success.title"),message:this.$tc("heidel-payment-settings.form.message.success.message")}),this.isTestSuccessful=!0,this.isTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.form.message.error.title"),message:this.$tc("heidel-payment-settings.form.message.error.message")}),this.isTesting=!1})},onTestFinished(){this.isTestSuccessful=!1},onSave(){this.isLoading=!0,this.$refs.systemConfig.saveAll().then(()=>{this.createNotificationSuccess({title:this.$tc("sw-plugin-config.titleSaveSuccess"),message:this.$tc("sw-plugin-config.messageSaveSuccess")}),this.isLoading=!1}).catch(e=>{this.createNotificationError({title:this.$tc("sw-plugin-config.titleSaveError"),message:e}),this.isLoading=!1})},onConfigChange(e){this.config=e},getBind(e,t){return t!==this.config&&(this.config=t),e},getDeliveryStatusCriteria(){const e=new G(1,100);return e.addFilter(G.equals("stateMachine.technicalName","order_delivery.state")),e},openWebhookModal(){this.showWebhookModal=!0},closeWebhookModal(){this.showWebhookModal=!1}}});const{Module:Z}=Shopware;Z.register("heidel-payment-configuration",{type:"plugin",name:"HeidelPayment",title:"heidel-payment-settings.module.title",description:"heidel-payment-settings.module.description",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":A,"en-GB":L},routes:{settings:{component:"heidel-payment-settings",path:"settings",meta:{parentPath:"sw.settings.index"}}}});n("PMv5"),n("+kxS"),n("BzwZ")},cKyv:function(e,t,n){var i=n("JnMH");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("383408f2",i,!0,{})},ectR:function(e,t){e.exports='{% block heidel_payment_payment_register_webhook %}\n
\n \n {{ $tc(\'heidel-payment-settings.form.webhookButton\') }}\n \n \n \n \n\n \n \n
\n{% endblock %}\n'},fpPm:function(e,t){e.exports='{% block heidel_payment_history %}\n \n {% block heidel_payment_history_container %}\n \n {% block heidel_payment_history_data_grid %}\n \n\n {% block heidel_payment_history_actions %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}\n'},nmHs:function(e,t){e.exports='{% block heidel_payment_metadata %}\n \n{% endblock %}\n'},vrVC:function(e,t,n){var i=n("6gNM");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("eb0a43b4",i,!0,{})},xTmB:function(e,t){e.exports='{% block heidel_payment_payment_details %}\n
\n
\n {% block heidel_payment_payment_details_content %}\n \n {% endblock %}\n
\n\n \n
\n{% endblock %}\n'}},[["SAZ9","runtime","vendors-node"]]]); +(this.webpackJsonp=this.webpackJsonp||[]).push([["heidel-payment6"],{"/l8L":function(e,t){e.exports='{% block heidel_payment_basket %}\n \n \n {% block heidel_payment_basket_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}\n'},"5MfU":function(e,t){e.exports='{% block sw_order_list_grid_columns %}\n {% parent %}\n\n {% block heidelpay_column_transaction %}\n \n {% endblock %}\n{% endblock %}\n'},"6Oo3":function(e,t,n){var i=n("xsxW");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("0071a1da",i,!0,{})},"940f":function(e,t){e.exports='{% block heidel_payment_detail %}\n \n {% block heidel_payment_detail_container %}\n \n {% block heidel_payment_detail_container_left %}\n \n \n
{{ $tc(\'heidel-payment.paymentDetails.detail.amountRemaining\') }}
\n
{{ paymentResource.amount.remaining | currency(paymentResource.currency) }}
\n\n
{{ $tc(\'heidel-payment.paymentDetails.detail.amountCancelled\') }}
\n
{{ paymentResource.amount.canceled | currency(paymentResource.currency) }}
\n\n
{{ $tc(\'heidel-payment.paymentDetails.detail.amountCharged\') }}
\n
{{ paymentResource.amount.charged | currency(paymentResource.currency) }}
\n\n {% block heidel_payment_detail_container_left_inner %}{% endblock %}\n
\n
\n {% endblock %}\n\n {% block heidel_payment_detail_container_right %}\n \n \n
{{ $tc(\'heidel-payment.paymentDetails.detail.shortId\') }}
\n
{{ paymentResource.shortId }}
\n\n
{{ $tc(\'heidel-payment.paymentDetails.detail.id\') }}
\n
{{ paymentResource.id }}
\n\n
{{ $tc(\'heidel-payment.paymentDetails.detail.state\') }}
\n
{{ paymentResource.state.name }}
\n\n {% block heidel_payment_detail_container_right_inner %}{% endblock %}\n
\n
\n {% endblock %}\n
\n {% endblock %}\n\n {% block heidel_payment_detail_ship_button %}\n \n \n {{ $tc(\'heidel-payment.paymentDetails.actions.shipButton\') }}\n \n \n {% endblock %}\n
\n{% endblock %}\n'},BgHK:function(e,t){e.exports='{% block heidel_payment_settings %}\n\n {% block heidel_payment_settings_header %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_actions %}\n \n {% endblock %}\n\n {% block heidel_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},CWl0:function(e,t,n){"use strict";n.r(t);var i=n("RT+u"),s=n.n(i);const{Component:a,Mixin:o}=Shopware;a.register("heidel-payment-actions",{template:s.a,inject:["HeidelPaymentService"],mixins:[o.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1,transactionAmount:0}),props:{transactionResource:{type:Object,required:!0},paymentResource:{type:Object,required:!0}},computed:{isChargePossible:function(){return"authorization"===this.transactionResource.type},isRefundPossible:function(){return"charge"===this.transactionResource.type},maxTransactionAmount(){let e=0;return this.isRefundPossible?e=this.paymentResource.amount.charged-this.paymentResource.amount.canceled:this.isChargePossible&&(e=this.paymentResource.amount.remaining),e}},created(){this.transactionAmount=this.maxTransactionAmount},methods:{charge(){this.isLoading=!0,this.HeidelPaymentService.chargeTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.chargeSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.chargeErrorTitle"),message:t}),this.isLoading=!1})},refund(){this.isLoading=!0,this.HeidelPaymentService.refundTransaction(this.paymentResource.orderId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.refundSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.refundErrorTitle"),message:t}),this.isLoading=!1})}}});var r=n("940f"),c=n.n(r);const{Component:l,Mixin:d}=Shopware;l.register("heidel-payment-detail",{template:c.a,inject:["HeidelPaymentService"],mixins:[d.getByName("notification")],data:()=>({isLoading:!1,isSuccessful:!1}),props:{paymentResource:{type:Object,required:!0}},methods:{ship(){this.isLoading=!0,this.HeidelPaymentService.ship(this.paymentResource.orderId).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessTitle"),message:this.$tc("heidel-payment.paymentDetails.notifications.shipSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.message;"generic-error"===t?t=this.$tc("heidel-payment.paymentDetails.notifications.genericErrorMessage"):"invoice-missing-error"===t&&(t=this.$tc("heidel-payment.paymentDetails.notifications.invoiceNotFoundMessage")),this.createNotificationError({title:this.$tc("heidel-payment.paymentDetails.notifications.shipErrorTitle"),message:t}),this.isLoading=!1})}}});var h=n("tPMm"),m=n.n(h);const{Component:p}=Shopware;p.register("heidel-payment-history",{template:m.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.transactions.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amount),this.paymentResource.currency),i=this.$options.filters.date(t.date,{hour:"numeric",minute:"numeric",second:"numeric"});e.push({type:this.transactionTypeRenderer(t.type),amount:n,date:i,resource:t})}),e},columns:function(){return[{property:"type",label:this.$tc("heidel-payment.paymentDetails.history.column.type"),rawData:!0},{property:"amount",label:this.$tc("heidel-payment.paymentDetails.history.column.amount"),rawData:!0},{property:"date",label:this.$tc("heidel-payment.paymentDetails.history.column.date"),rawData:!0}]}},methods:{transactionTypeRenderer:function(e){switch(e){case"authorization":return this.$tc("heidel-payment.paymentDetails.history.type.authorization");case"charge":return this.$tc("heidel-payment.paymentDetails.history.type.charge");case"shipment":return this.$tc("heidel-payment.paymentDetails.history.type.shipment");case"cancellation":return this.$tc("heidel-payment.paymentDetails.history.type.cancellation");default:return this.$tc("heidel-payment.paymentDetails.history.type.default")}},reloadPaymentDetails:function(){this.$emit("reload")}}});var u=n("OPFU"),g=n.n(u);const{Component:y}=Shopware;y.register("heidel-payment-metadata",{template:g.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.metadata.forEach(t=>{e.push({key:t.key,value:t.value})}),e},columns:function(){return[{property:"key",label:this.$tc("heidel-payment.paymentDetails.metadata.column.key"),rawData:!0},{property:"value",label:this.$tc("heidel-payment.paymentDetails.metadata.column.value"),rawData:!0}]}}});var b=n("/l8L"),f=n.n(b);const{Component:k}=Shopware;k.register("heidel-payment-basket",{template:f.a,props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){const e=[];return this.paymentResource.basket.basketItems.forEach(t=>{const n=this.$options.filters.currency(parseFloat(t.amountGross),this.paymentResource.currency),i=this.$options.filters.currency(parseFloat(t.amountNet),this.paymentResource.currency);e.push({quantity:t.quantity,title:t.title,amountGross:n,amountNet:i})}),e},columns:function(){return[{property:"quantity",label:this.$tc("heidel-payment.paymentDetails.basket.column.quantity"),rawData:!0},{property:"title",label:this.$tc("heidel-payment.paymentDetails.basket.column.title"),rawData:!0},{property:"amountGross",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountGross"),rawData:!0},{property:"amountNet",label:this.$tc("heidel-payment.paymentDetails.basket.column.amountNet"),rawData:!0}]}}});var w=n("FADd"),_=n.n(w);const{Component:S,Context:v}=Shopware,{Criteria:C}=Shopware.Data;S.override("sw-order-detail",{template:_.a,data:()=>({isHeidelpayPayment:!1}),computed:{showTabs:()=>!0,paymentMethodStore:()=>State.getStore("payment_method")},watch:{orderId:{deep:!0,handler(){if(!this.orderId)return void(this.isHeidelpayPayment=!1);const e=this.repositoryFactory.create("order"),t=new C(1,1);t.addAssociation("transactions"),e.get(this.orderId,v.api,t).then(e=>{e.transactions.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&(this.isHeidelpayPayment=!0)})})},immediate:!0}}});var D=n("5MfU"),R=n.n(D);Shopware.Component.override("sw-order-list",{template:R.a,computed:{orderColumns(){return this.getEnhancedOrderColumns()}},methods:{getEnhancedOrderColumns(){const e=this.getOrderColumns();return e.splice(1,0,{property:"heidelTransactionId",label:"heidel-payment.order-list.transactionId",allowResize:!0}),e}}});var $=n("zkbf"),T=n.n($);const{Component:P,Context:x}=Shopware,{Criteria:B}=Shopware.Data;P.override("sw-order-create-details-footer",{template:T.a,computed:{paymentMethodCriteria(){const e=new B;return this.salesChannelId&&e.addFilter(B.equals("salesChannels.id",this.salesChannelId)),e.addFilter(B.not("AND",[B.contains("handlerIdentifier","HeidelPayment6\\Components")])),e}}});var M=n("kZaU"),L=n.n(M);const{Component:E,StateDeprecated:A}=Shopware;E.register("heidel-payment-tab",{template:L.a,inject:["HeidelPaymentService"],data:()=>({paymentResources:[],isLoading:!0}),created(){this.createdComponent()},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},methods:{createdComponent(){this.loadData()},orderStore:()=>A.getStore("order"),resetDataAttributes(){this.paymentResources=[],this.isLoading=!0},reloadPaymentDetails(){this.resetDataAttributes(),this.loadData()},loadData(){const e=this.$route.params.id;this.orderStore().getByIdAsync(e).then(e=>{this.order=e,this.order.getAssociation("transactions").getList({}).then(e=>{e.items.forEach(e=>{e.customFields&&e.customFields.heidelpay_is_transaction&&this.HeidelPaymentService.fetchPaymentDetails(e.id).then(e=>{this.isLoading=!1,this.paymentResources.push(e)}).catch(()=>{this.isLoading=!1})})})})}}});var W=n("mtIW"),H=n("LUCd");const{Module:I}=Shopware;I.register("heidel-payment",{type:"plugin",name:"HeidelPayment",title:"heidel-payment.general.title",description:"heidel-payment.general.descriptionTextModule",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":W,"en-GB":H},routeMiddleware(e,t){"sw.order.detail"===t.name&&t.children.push({component:"heidel-payment-tab",name:"heidel-payment.payment.detail",isChildren:!0,path:"/sw/order/heidelpayment/detail/:id"}),e(t)}});var F=n("jmLH"),N=n.n(F);n("gOz8");Shopware.Component.register("heidel-payment-register-webhook",{template:N.a,mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],computed:{salesChannelDomainColumns:()=>[{property:"id",dataIndex:"id",label:"ID"},{property:"url",dataIndex:"url",label:"URL"}],salesChannelDomainRepository(){return this.repositoryFactory.create("sales_channel_domain")}},data:()=>({showWebhookModal:!1,isLoading:!1,isRegistering:!1,isRegistrationSuccessful:!1,isClearing:!1,isClearingSuccessful:!1,salesChannelDomains:{},selection:[]}),created(){this.salesChannelDomainRepository.search(new Shopware.Data.Criteria,Shopware.Context.api).then(e=>{this.salesChannelDomains=e})},methods:{openModal(){this.showWebhookModal=!0},closeModal(){this.showWebhookModal=!1},registerWebhooks(){const e=this;this.isRegistrationSuccessful=!1,this.isRegistering=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.registerWebhooks({selection:this.selection}).then(t=>{e.isRegistrationSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isRegistering=!1})},clearWebhooks(){const e=this;this.isClearingSuccessful=!1,this.isClearing=!0,this.isLoading=!0,this.HeidelPaymentConfigurationService.clearWebhooks({selection:this.selection}).then(t=>{e.isClearingSuccessful=!0,void 0!==t&&e.messageGeneration(t)}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.webhook.globalError.title"),message:this.$tc("heidel-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isLoading=!1,e.isClearing=!1})},onRegistrationFinished(){this.isRegistrationSuccessful=!1},onClearingFinished(){this.isClearingSuccessful=!1},onSelectItem(e){this.selection=e},messageGeneration(e){const t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("heidel-payment-settings.webhook.messagePrefix",t)+n})})}}});var z=n("crgo"),O=n.n(z);n("nrpx");const{Component:j}=Shopware;j.override("sw-settings-index",{template:O.a});var q=n("BgHK"),V=n.n(q);const{Component:Z,Mixin:G}=Shopware,{Criteria:U}=Shopware.Data;Z.register("heidel-payment-settings",{template:V.a,mixins:[G.getByName("notification"),G.getByName("sw-inline-snippet")],inject:["repositoryFactory","HeidelPaymentConfigurationService"],data:()=>({isLoading:!1,isTesting:!1,isTestSuccessful:!1,isSaveSuccessful:!1,config:{},showWebhookModal:!1}),metaInfo:()=>({title:"Heidelpay"}),computed:{paymentMethodRepository(){return this.repositoryFactory.create("payment_method")}},methods:{getConfigValue(e){const t=this.$refs.systemConfig.actualConfigData.null;return this.config["HeidelPayment6.settings."+e]||t["HeidelPayment6.settings."+e]},onValidateCredentials(){this.isTestSuccessful=!1,this.isTesting=!0;const e={publicKey:this.getConfigValue("publicKey"),privateKey:this.getConfigValue("privateKey"),salesChannel:this.$refs.systemConfig.currentSalesChannelId};this.HeidelPaymentConfigurationService.validateCredentials(e).then(()=>{this.createNotificationSuccess({title:this.$tc("heidel-payment-settings.form.message.success.title"),message:this.$tc("heidel-payment-settings.form.message.success.message")}),this.isTestSuccessful=!0,this.isTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("heidel-payment-settings.form.message.error.title"),message:this.$tc("heidel-payment-settings.form.message.error.message")}),this.isTesting=!1})},onTestFinished(){this.isTestSuccessful=!1},onSave(){this.isLoading=!0,this.$refs.systemConfig.saveAll().then(()=>{this.createNotificationSuccess({title:this.$tc("sw-plugin-config.titleSaveSuccess"),message:this.$tc("sw-plugin-config.messageSaveSuccess")}),this.isLoading=!1}).catch(e=>{this.createNotificationError({title:this.$tc("sw-plugin-config.titleSaveError"),message:e}),this.isLoading=!1})},onConfigChange(e){this.config=e},getBind(e,t){return t!==this.config&&(this.config=t),e},getDeliveryStatusCriteria(){const e=new U(1,100);return e.addFilter(U.equals("stateMachine.technicalName","order_delivery.state")),e},openWebhookModal(){this.showWebhookModal=!0},closeWebhookModal(){this.showWebhookModal=!1}}});const{Module:K}=Shopware;K.register("heidel-payment-configuration",{type:"plugin",name:"HeidelPayment",title:"heidel-payment-settings.module.title",description:"heidel-payment-settings.module.description",version:"0.0.1",targetVersion:"0.0.1",snippets:{"de-DE":W,"en-GB":H},routes:{settings:{component:"heidel-payment-settings",path:"settings",meta:{parentPath:"sw.settings.index"}}}});n("yrsN"),n("s9yU"),n("6Oo3")},FADd:function(e,t){e.exports="{% block sw_order_detail_content_tabs_general %}\n {% parent %}\n\n {% block heidel_payment_payment_tab %}\n \n {{ $tc('heidel-payment.tabTitle') }}\n \n {% endblock %}\n{% endblock %}"},Kh9Q:function(e,t,n){},LUCd:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Payment History","column":{"type":"Type","amount":"Amount","date":"Date"},"type":{"authorization":"Authorization","charge":"Charging","shipment":"Shipping notification","cancellation":"Refund","default":""}},"actions":{"chargeButton":"Charge","shipButton":"Shipping notice","refundButton":"Refund"},"detail":{"cardTitle":"Payment Details","shortId":"Short-ID","id":"Payment-ID","state":"State","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)"},"metadata":{"cardTitle":"Metadata","column":{"key":"Key","value":"Value"}},"basket":{"cardTitle":"Basket","column":{"quantity":"Quantity","title":"Title","amountGross":"Amount (gross)","amountNet":"Amount (net)"}},"notifications":{"genericErrorMessage":"An error has occoured!","refundSuccessTitle":"Refund","refundSuccessMessage":"The reimbursement was successfully completed.","refundErrorTitle":"Refund","chargeSuccessTitle":"Charge","chargeSuccessMessage":"The collection of the payment was carried out successfully.","chargeErrorTitle":"Charge","shipSuccessTitle":"Shipping notice","shipSuccessMessage":"The shipping notification was successfully sent.","shipErrorTitle":"Shipping notice","invoiceNotFoundMessage":"No invoice was found for this order."}},"order-list":{"transactionId":"Heidelpay transaction ID"}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test succeeded","message":"The provided credentials are valid!"},"error":{"title":"Test failed","message":"API Credentials are invalid, please correct them and try again!"}},"testButton":"Test API credentials","webhookButton":"Register webhooks"},"modal":{"close":"Close","webhook":{"title":"Webhooks","submit":{"register":"Register webhooks","clear":"Clear webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registered | Webhooks registered","error":"Webhook could not be registered | Webhooks could not be registered"},"clear":{"done":"Webhook cleared | Webhooks cleared","error":"Webhook could not be cleared | Webhooks could not be cleared"},"missing":{"fields":"Some mandatory fields are missing","context":"The context could not be refreshed","selection":"No domain was selected"},"notFound":{"salesChannelDomain":"The selected domain could not be found"},"globalError":{"title":"An error occured","message":"Please contact us for more information"}}}}')},OPFU:function(e,t){e.exports='{% block heidel_payment_metadata %}\n \n{% endblock %}\n'},PPSw:function(e,t,n){},"RT+u":function(e,t){e.exports='{% block heidel_payment_actions %}\n \n {% block heidel_payment_actions_amount_field %}\n
\n \n \n
\n {% endblock %}\n\n
\n {% block heidel_payment_actions_charge_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_refund_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.refundButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_default_button %}\n \n {{ $tc(\'heidel-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block heidel_payment_actions_button_container_inner %}{% endblock %}\n
\n
\n{% endblock %}\n'},crgo:function(e,t){e.exports='{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'},gOz8:function(e,t,n){var i=n("PPSw");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("21d79666",i,!0,{})},jmLH:function(e,t){e.exports='{% block heidel_payment_payment_register_webhook %}\n
\n \n {{ $tc(\'heidel-payment-settings.form.webhookButton\') }}\n \n \n \n \n\n \n \n
\n{% endblock %}\n'},kZaU:function(e,t){e.exports='{% block heidel_payment_payment_details %}\n
\n
\n {% block heidel_payment_payment_details_content %}\n \n {% endblock %}\n
\n\n \n
\n{% endblock %}\n'},mtIW:function(e){e.exports=JSON.parse('{"heidel-payment":{"tabTitle":"Heidelpay","paymentDetails":{"history":{"cardTitle":"Zahlungsverlauf","column":{"type":"Typ","amount":"Betrag","date":"Datum"},"type":{"authorization":"Reservierung","charge":"Einzug","shipment":"Versandtmitteilung","cancellation":"Rückerstattung","default":""}},"actions":{"chargeButton":"Einziehen","shipButton":"Versandmitteilung","refundButton":"Rückerstatten"},"detail":{"cardTitle":"Zahlungsdetails","shortId":"Short-ID","id":"Zahlungs-ID","state":"Status","amountRemaining":"Betrag (Rest)","amountCancelled":"Betrag (Rückerstattet)","amountCharged":"Betrag (Eingezogen)"},"metadata":{"cardTitle":"Metadaten","column":{"key":"Schlüssel","value":"Wert"}},"basket":{"cardTitle":"Warenkorb","column":{"quantity":"Anzahl","title":"Titel","amountGross":"Betrag (brutto)","amountNet":"Betrag (netto)"}},"notifications":{"genericErrorMessage":"Es ist ein Fehler aufgetreten!","refundSuccessTitle":"Rückerstatten","refundSuccessMessage":"Die Rückerstattung wurde erfolgreich durchgeführt.","refundErrorTitle":"Rückerstatten","chargeSuccessTitle":"Einziehen","chargeSuccessMessage":"Das Einziehen der Zahlung wurde erfolgreich durchgeführt.","chargeErrorTitle":"Einziehen","shipSuccessTitle":"Versandmitteilung","shipSuccessMessage":"Die Versandmitteilung wurde erfolgreich gesendet.","shipErrorTitle":"Versandmitteilung","invoiceNotFoundMessage":"Zu dieser Bestellung wurde keine Rechnung gefunden"}},"order-list":{"transactionId":"Heidelpay Transaktions ID"}},"heidel-payment-settings":{"module":{"title":"Heidelpay","description":"Heidelpay"},"form":{"message":{"success":{"title":"Test erfolgreich","message":"Die angegebenen API-Zugangsdaten sind korrekt!"},"error":{"title":"Test fehlgeschlagen","message":"Die angegebenen API-Zugangsdaten sind nicht korret! Bitte korrigieren Sie die Eingabe und versuchen Sie es erneut."}},"testButton":"API Zugangsdaten testen","webhookButton":"Webhooks registrieren testen"},"modal":{"close":"Schließen","webhook":{"title":"Webhooks","submit":{"register":"Webhooks registrieren","clear":"Webhooks entfernen"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registriert | Webhooks registriert","error":"Der Webhook konnte nicht registriert werden | Die Webhooks konnten nicht registriert werden"},"clear":{"done":"Webhook entfernt | Webhooks entfernt","error":"Der Webhook konnte nicht entfernt werden | Die Webhooks konnten nicht entfernt werden"},"missing":{"fields":"Nicht alle benötigten Felder sind vorhanden","context":"Der Kontext konnte nicht aktualisiert werden","selection":"Es wurden keine Domains selektiert"},"notFound":{"salesChannelDomain":"Die spezifizierte Domain wurde nicht gefunden"},"globalError":{"title":"Ein Fehler ist aufgetreten","message":"Bitte kontaktieren sie uns für mehr Informationen"}}}}')},nrpx:function(e,t,n){var i=n("Kh9Q");"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("56b4b8b2",i,!0,{})},s9yU:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidel_payment"){super(e,t,n)}validateCredentials(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-credentials`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}registerWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/register-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}clearWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/clear-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentConfigurationService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},tPMm:function(e,t){e.exports='{% block heidel_payment_history %}\n \n {% block heidel_payment_history_container %}\n \n {% block heidel_payment_history_data_grid %}\n \n\n {% block heidel_payment_history_actions %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}\n'},xsxW:function(e,t,n){},yrsN:function(e,t){const{Application:n}=Shopware,i=Shopware.Classes.ApiService;class s extends i{constructor(e,t,n="heidelpay"){super(e,t,n)}fetchPaymentDetails(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/details`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}chargeTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}refundTransaction(e,t,n){const s=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${t}/${n}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}ship(e){const t=`_action/${this.getApiBasePath()}/transaction/${e}/ship`;return this.httpClient.get(t,{headers:this.getBasicHeaders()}).then(e=>i.handleResponse(e))}}n.addServiceProvider("HeidelPaymentService",e=>{const t=n.getContainer("init");return new s(t.httpClient,e.loginService)})},zkbf:function(e,t){e.exports='{% block sw_order_create_details_footer_payment_method %}\n \n \n{% endblock %}\n'}},[["CWl0","runtime","vendors-node"]]]); \ No newline at end of file From a941d4b8db9f9fea341e768107c408fb80faa0b8 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 25 Nov 2020 17:32:49 +0100 Subject: [PATCH 15/15] (change) Add abandonment information. --- README.md | 6 ++++++ composer.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index addc434..2eb9d77 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +# *** ATTENTION *** +Due to the recent re-branding of the company `heidelpay GmbH` to `Unzer GmbH`this repository is replaced by https://github.com/unzerdev/shopware6 +and the old heidelpay repository will soon be archived. + +Please switch to the Unzer Shopware 6 plugin https://packagist.org/packages/unzerdev/shopware6 + # HeidelPayment Heidelpay payment integration for Shopware 6.2 including the following payment methods: diff --git a/composer.json b/composer.json index 2b14b75..7af4c73 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "heidelpay/shopware-6", "description": "Heidelpay payment integration for Shopware 6", - "version": "0.0.1.3", + "version": "0.0.1.4", "type": "shopware-platform-plugin", "license": "MIT", "minimum-stability": "dev",