diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cd2f08..702b492 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 4.0.2 +- Fixed shipping line item name + # 4.0.1 - Fixed tax calculation for custom products diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md index ed08374..d0c63bf 100644 --- a/CHANGELOG_de-DE.md +++ b/CHANGELOG_de-DE.md @@ -1,3 +1,6 @@ +# 4.0.2 +- Der Name der Versand-Einzelposten wurde korrigiert + # 4.0.1 - Feste Steuerberechnung für kundenspezifische Produkte diff --git a/README.md b/README.md index 71f228f..5ebe598 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ tail -f var/log/postfinancecheckout_payment*.log ## Documentation -[Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/shopware-6/4.0.1/docs/en/documentation.html) +[Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/shopware-6/4.0.2/docs/en/documentation.html) ## License diff --git a/composer.json b/composer.json index 24ab901..8a8facc 100644 --- a/composer.json +++ b/composer.json @@ -54,5 +54,5 @@ "postfinancecheckout/sdk": "3.0.0" }, "type": "shopware-platform-plugin", - "version": "4.0.1" + "version": "4.0.2" } \ No newline at end of file diff --git a/docs/en/documentation.html b/docs/en/documentation.html index 2a40f3f..63ae9f0 100644 --- a/docs/en/documentation.html +++ b/docs/en/documentation.html @@ -22,7 +22,7 @@

Documentation

  • - + Source
  • diff --git a/src/Core/Api/WebHooks/Controller/WebHookController.php b/src/Core/Api/WebHooks/Controller/WebHookController.php index c16ddda..bc2d9fc 100644 --- a/src/Core/Api/WebHooks/Controller/WebHookController.php +++ b/src/Core/Api/WebHooks/Controller/WebHookController.php @@ -15,6 +15,7 @@ Checkout\Order\SalesChannel\OrderService, Framework\Context, Framework\DataAbstractionLayer\Search\Criteria, + Framework\DataAbstractionLayer\Search\Sorting\FieldSorting, Framework\Routing\Annotation\RouteScope, System\StateMachine\Aggregation\StateMachineTransition\StateMachineTransitionActions, System\StateMachine\Exception\IllegalTransitionException}; @@ -362,7 +363,9 @@ private function getOrderTransaction(String $orderId, Context $context): OrderTr private function getOrderEntity(string $orderId, Context $context): OrderEntity { if (is_null($this->orderEntity)) { - $criteria = (new Criteria([$orderId]))->addAssociations(['deliveries', 'transactions',]); + $criteria = (new Criteria([$orderId])) + ->addAssociations(['deliveries', 'transactions',]) + ->addSorting(new FieldSorting('createdAt')); try { $this->orderEntity = $this->container->get('order.repository')->search( diff --git a/src/Core/Util/Payload/TransactionPayload.php b/src/Core/Util/Payload/TransactionPayload.php index 0a890f3..33e367f 100644 --- a/src/Core/Util/Payload/TransactionPayload.php +++ b/src/Core/Util/Payload/TransactionPayload.php @@ -363,10 +363,10 @@ protected function getShippingLineItem(): ?LineItemCreate ->setName($this->fixLength($shippingName . ' ' . $this->translator->trans('postfinancecheckout.payload.shipping.lineItem'), 150)) ->setQuantity($this->transaction->getOrder()->getShippingCosts()->getQuantity() ?? 1) ->setTaxes($taxes) - ->setSku($this->fixLength($shippingName . '-Shipping-Line-Item', 200)) + ->setSku($this->fixLength($shippingName . '-Shipping', 200)) /** @noinspection PhpParamsInspection */ ->setType(LineItemType::SHIPPING) - ->setUniqueId($this->fixLength($shippingName . '-Shipping-Line-Item', 200)); + ->setUniqueId($this->fixLength($shippingName . '-Shipping', 200)); if (!$lineItem->valid()) { $this->logger->critical('Shipping LineItem payload invalid:', $lineItem->listInvalidProperties()); diff --git a/src/Resources/app/administration/src/module/postfinancecheckout-order/page/postfinancecheckout-order-detail/index.js b/src/Resources/app/administration/src/module/postfinancecheckout-order/page/postfinancecheckout-order-detail/index.js index 34e554c..4c55a65 100644 --- a/src/Resources/app/administration/src/module/postfinancecheckout-order/page/postfinancecheckout-order-detail/index.js +++ b/src/Resources/app/administration/src/module/postfinancecheckout-order/page/postfinancecheckout-order-detail/index.js @@ -167,6 +167,7 @@ Component.register('postfinancecheckout-order-detail', { const orderRepository = this.repositoryFactory.create('order'); const orderCriteria = new Criteria(1, 1); orderCriteria.addAssociation('transactions'); + orderCriteria.getAssociation('transactions').addSorting(Criteria.sort('createdAt', 'DESC')); orderRepository.get(this.orderId, Context.api, orderCriteria).then((order) => { this.order = order; diff --git a/src/Resources/app/storefront/dist/storefront/js/post-finance-checkout-payment.js b/src/Resources/app/storefront/dist/storefront/js/post-finance-checkout-payment.js new file mode 100644 index 0000000..28f6cac --- /dev/null +++ b/src/Resources/app/storefront/dist/storefront/js/post-finance-checkout-payment.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([["post-finance-checkout-payment"],{N4Fx:function(e,t,n){"use strict";n.r(t);var o=n("FGIj"),r=n("k8s9");function a(e){return(a="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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n\n\n\t{% block postfinancecheckout_order_action_completion_amount %}\n\t\t\n\t{% endblock %}\n\n\t{% block postfinancecheckout_order_action_completion_confirm_button %}\n\t\n\t{% endblock %}\n\n\t\n\n{% endblock %}\n'},H4Kp:function(t,e){t.exports='{% block postfinancecheckout_order_action_refund %}\n\n\n\t{% block postfinancecheckout_order_action_refund_amount %}\n\t\t\n\t\t\n\t{% endblock %}\n\n\t{% block postfinancecheckout_order_action_refund_confirm_button %}\n\t\n\t{% endblock %}\n\n\t\n\n{% endblock %}\n'},Hmsx:function(t,e){t.exports='{% block postfinancecheckout_settings %}\n\n\n\t{% block postfinancecheckout_settings_header %}\n\t\n\t{% endblock %}\n\n\t{% block postfinancecheckout_settings_actions %}\n\t\n\t{% endblock %}\n\n\t{% block postfinancecheckout_settings_content %}\n\t\n\t{% endblock %}\n\n{% endblock %}'},PwZK:function(t,e,n){var a=n("ADsd");"string"==typeof a&&(a=[[t.i,a,""]]),a.locals&&(t.exports=a.locals);(0,n("SZ7m").default)("409bd55c",a,!0,{})},TeG4:function(t,e){t.exports='{% block postfinancecheckout_settings_content_card_channel_config_options %}\n\t\n\n\t\t{% block postfinancecheckout_settings_content_card_channel_config_credentials_card_container %}\n\t\t\t\n\n\t\t\t\t{% block postfinancecheckout_settings_content_card_channel_config_credentials_card_container_settings %}\n\t\t\t\t\t
    \n\n\t\t\t\t\t\t{% block postfinancecheckout_settings_content_card_channel_config_credentials_card_container_settings_space_view_id %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block postfinancecheckout_settings_content_card_channel_config_credentials_card_container_settings_integration %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block postfinancecheckout_settings_content_card_channel_config_credentials_card_container_settings_line_item_consistency_enabled %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block postfinancecheckout_settings_content_card_channel_config_credentials_card_container_settings_email_enabled %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\t\t\t\t\t
    \n\t\t\t\t{% endblock %}\n\t\t\t
    \n\t\t{% endblock %}\n\t
    \n\n{% endblock %}\n'},VP8G:function(t,e){t.exports='{% block postfinancecheckout_order_detail %}\n
    \n\t
    \n\t\t\n\t\t\t\n\t\t\n\t\t{% block postfinancecheckout_order_transaction_history_card %}\n\t\t\n\t\t\t\n\n\t\t\n\t\t{% endblock %}\n\t\t{% block postfinancecheckout_order_transaction_line_items_card %}\n\t\t\n\t\t\t\n\t\t\n\t\t{% endblock %}\n\t\t{% block postfinancecheckout_order_transaction_refunds_card %}\n\t\t\n\t\t\t\n\n\t\t\n\t\t{% endblock %}\n\t\t{% block postfinancecheckout_order_actions_modal_refund %}\n\t\t\n\t\t\n\t\t{% endblock %}\n\t\t{% block postfinancecheckout_order_actions_modal_completion%}\n\t\t\n\t\t\n\t\t{% endblock %}\n\t\t{% block postfinancecheckout_order_actions_modal_void %}\n\t\t\n\t\t\n\t\t{% endblock %}\n\t
    \n\t\n
    \n{% endblock %}\n'},aubh:function(t,e){Shopware.Service("privileges").addPrivilegeMappingEntry({category:"permissions",parent:"postfinancecheckout",key:"postfinancecheckout",roles:{viewer:{privileges:["sales_channel:read","sales_channel_payment_method:read","system_config:read"],dependencies:[]},editor:{privileges:["sales_channel:update","sales_channel_payment_method:create","sales_channel_payment_method:update","system_config:update","system_config:create","system_config:delete"],dependencies:["postfinancecheckout.viewer"]}}}),Shopware.Service("privileges").addPrivilegeMappingEntry({category:"permissions",parent:null,key:"sales_channel",roles:{viewer:{privileges:["sales_channel_payment_method:read"]},editor:{privileges:["payment_method:update"]},creator:{privileges:["payment_method:create","shipping_method:create","delivery_time:create"]},deleter:{privileges:["payment_method:delete"]}}})},heDV:function(t,e){t.exports='{% block postfinancecheckout_settings_content_card_channel_config_credentials %}\n\t\n\n\t\t{% block postfinancecheckout_settings_content_card_channel_config_credentials_card_container %}\n\t\t\t\n\n\t\t\t\t{% block postfinancecheckout_settings_content_card_channel_config_credentials_card_container_settings %}\n\t\t\t\t\t
    \n\n\t\t\t\t\t\t{% block postfinancecheckout_settings_content_card_channel_config_credentials_card_container_settings_space_id %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block postfinancecheckout_settings_content_card_channel_config_credentials_card_container_settings_user_id %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block postfinancecheckout_settings_content_card_channel_config_credentials_card_container_settings_application_key %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\t\t\t\t\t
    \n\t\t\t\t{% endblock %}\n\t\t\t
    \n\t\t{% endblock %}\n\t\n\n{% endblock %}\n'},juBS:function(t,e){t.exports='\n\t\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
    \n\t
    \n
    \n\n'},tYm5:function(t,e){t.exports='{% block sw_order_detail_content_tabs_general %}\n {% parent %}\n\n\n\t{{ $tc(\'postfinancecheckout-order.header\') }}\n\n{% endblock %}\n\n{% block sw_order_detail_actions_slot_smart_bar_actions %}\n\n{% endblock %}\n'},wwge:function(t,e){t.exports='{% block postfinancecheckout_settings_icon %}\n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n{% endblock %}\n'},ygOZ:function(t,e){t.exports='{% block postfinancecheckout_order_action_void %}\n\n\n\t{% block postfinancecheckout_order_action_void_amount %}\n\t\t\n\t{% endblock %}\n\n\t{% block postfinancecheckout_order_action_void_confirm_button %}\n\t\n\t{% endblock %}\n\n\t\n\n{% endblock %}\n'},ypuE:function(t,e,n){"use strict";n.r(e);var a=n("tYm5"),i=n.n(a);n("PwZK");const{Component:o,Context:s}=Shopware,c=Shopware.Data.Criteria;o.override("sw-order-detail",{template:i.a,data:()=>({isPostFinanceCheckoutPayment:!1}),computed:{isEditable(){return!this.isPostFinanceCheckoutPayment||"postfinancecheckout.order.detail"!==this.$route.name},showTabs:()=>!0},watch:{orderId:{deep:!0,handler(){if(!this.orderId)return void this.setIsPostFinanceCheckoutPayment(null);const t=this.repositoryFactory.create("order"),e=new c(1,1);e.addAssociation("transactions"),t.get(this.orderId,s.api,e).then((t=>{if(t.amountTotal<=0||t.transactions.length<=0||!t.transactions[0].paymentMethodId)return void this.setIsPostFinanceCheckoutPayment(null);const e=t.transactions[0].paymentMethodId;null!=e&&this.setIsPostFinanceCheckoutPayment(e)}))},immediate:!0}},methods:{setIsPostFinanceCheckoutPayment(t){if(!t)return;this.repositoryFactory.create("payment_method").get(t,s.api).then((t=>{this.isPostFinanceCheckoutPayment="handler_postfinancecheckoutpayment_postfinancecheckoutpaymenthandler"===t.formattedHandlerIdentifier}))}}});var r=n("FLPB"),l=n.n(r);const{Component:d,Mixin:h,Filter:u,Utils:p}=Shopware;d.register("postfinancecheckout-order-action-completion",{template:l.a,inject:["PostFinanceCheckoutTransactionCompletionService"],mixins:[h.getByName("notification")],props:{transactionData:{type:Object,required:!0}},data:()=>({isLoading:!0,isCompletion:!1}),computed:{dateFilter:()=>u.getByName("date")},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1},completion(){this.isCompletion&&(this.isLoading=!0,this.PostFinanceCheckoutTransactionCompletionService.createTransactionCompletion(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id).then((()=>{this.createNotificationSuccess({title:this.$tc("postfinancecheckout-order.captureAction.successTitle"),message:this.$tc("postfinancecheckout-order.captureAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick((()=>{this.$router.replace(`${this.$route.path}?hash=${p.createId()}`)}))})).catch((t=>{try{this.createNotificationError({title:t.response.data.errors[0].title,message:t.response.data.errors[0].detail,autoClose:!1})}catch(e){this.createNotificationError({title:t.title,message:t.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick((()=>{this.$router.replace(`${this.$route.path}?hash=${p.createId()}`)}))}})))}}});var f=n("H4Kp"),m=n.n(f);const{Component:g,Mixin:_,Filter:k,Utils:I}=Shopware;g.register("postfinancecheckout-order-action-refund",{template:m.a,inject:["PostFinanceCheckoutRefundService"],mixins:[_.getByName("notification")],props:{transactionData:{type:Object,required:!0},orderId:{type:String,required:!0}},data(){return{currency:this.transactionData.transactions[0].currency,refundAmount:0,refundableAmount:0,transactionData:{},isLoading:!0}},computed:{dateFilter:()=>k.getByName("date")},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1,this.currency=this.transactionData.transactions[0].currency,this.refundAmount=Number(this.transactionData.transactions[0].amountIncludingTax),this.refundableAmount=Number(this.transactionData.transactions[0].amountIncludingTax)},refund(){this.isLoading=!0,this.PostFinanceCheckoutRefundService.createRefund(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id,this.refundAmount).then((()=>{this.createNotificationSuccess({title:this.$tc("postfinancecheckout-order.refundAction.successTitle"),message:this.$tc("postfinancecheckout-order.refundAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick((()=>{this.$router.replace(`${this.$route.path}?hash=${I.createId()}`)}))})).catch((t=>{try{this.createNotificationError({title:t.response.data.errors[0].title,message:t.response.data.errors[0].detail,autoClose:!1})}catch(e){this.createNotificationError({title:t.title,message:t.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick((()=>{this.$router.replace(`${this.$route.path}?hash=${I.createId()}`)}))}}))}}});var C=n("ygOZ"),w=n.n(C);const{Component:b,Mixin:y,Filter:S,Utils:E}=Shopware;b.register("postfinancecheckout-order-action-void",{template:w.a,inject:["PostFinanceCheckoutTransactionVoidService"],mixins:[y.getByName("notification")],props:{transactionData:{type:Object,required:!0}},data:()=>({isLoading:!0,isVoid:!1}),computed:{dateFilter:()=>S.getByName("date"),lineItemColumns(){return[{property:"uniqueId",label:this.$tc("postfinancecheckout-order.refund.types.uniqueId"),rawData:!1,allowResize:!0,primary:!0,width:"auto"},{property:"name",label:this.$tc("postfinancecheckout-order.refund.types.name"),rawData:!0,allowResize:!0,sortable:!0,width:"auto"},{property:"quantity",label:this.$tc("postfinancecheckout-order.refund.types.quantity"),rawData:!0,allowResize:!0,width:"auto"},{property:"amountIncludingTax",label:this.$tc("postfinancecheckout-order.refund.types.amountIncludingTax"),rawData:!0,allowResize:!0,inlineEdit:"string",width:"auto"},{property:"type",label:this.$tc("postfinancecheckout-order.refund.types.type"),rawData:!0,allowResize:!0,sortable:!0,width:"auto"},{property:"taxAmount",label:this.$tc("postfinancecheckout-order.refund.types.taxAmount"),rawData:!0,allowResize:!0,width:"auto"}]}},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1,this.currency=this.transactionData.transactions[0].currency,this.refundableAmount=this.transactionData.transactions[0].amountIncludingTax,this.refundAmount=this.transactionData.transactions[0].amountIncludingTax},voidPayment(){this.isVoid&&(this.isLoading=!0,this.PostFinanceCheckoutTransactionVoidService.createTransactionVoid(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id).then((()=>{this.createNotificationSuccess({title:this.$tc("postfinancecheckout-order.voidAction.successTitle"),message:this.$tc("postfinancecheckout-order.voidAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick((()=>{this.$router.replace(`${this.$route.path}?hash=${E.createId()}`)}))})).catch((t=>{try{this.createNotificationError({title:t.response.data.errors[0].title,message:t.response.data.errors[0].detail,autoClose:!1})}catch(e){this.createNotificationError({title:t.title,message:t.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick((()=>{this.$router.replace(`${this.$route.path}?hash=${E.createId()}`)}))}})))}}});var v=n("VP8G"),F=n.n(v);n("2zY8");const{Component:N,Mixin:D,Filter:A,Context:O,Utils:T}=Shopware,$=Shopware.Data.Criteria;N.register("postfinancecheckout-order-detail",{template:F.a,inject:["PostFinanceCheckoutTransactionService","repositoryFactory"],mixins:[D.getByName("notification")],data:()=>({transactionData:{transactions:[],refunds:[]},transaction:{},lineItems:[],currency:"",modalType:"",refundAmount:0,refundableAmount:0,isLoading:!0,orderId:""}),metaInfo(){return{title:this.$tc("postfinancecheckout-order.header")}},computed:{dateFilter:()=>A.getByName("date"),relatedResourceColumns(){return[{property:"paymentConnectorConfiguration.name",label:this.$tc("postfinancecheckout-order.transactionHistory.types.payment_method"),rawData:!0},{property:"state",label:this.$tc("postfinancecheckout-order.transactionHistory.types.state"),rawData:!0},{property:"currency",label:this.$tc("postfinancecheckout-order.transactionHistory.types.currency"),rawData:!0},{property:"authorized_amount",label:this.$tc("postfinancecheckout-order.transactionHistory.types.authorized_amount"),rawData:!0},{property:"id",label:this.$tc("postfinancecheckout-order.transactionHistory.types.transaction"),rawData:!0},{property:"customerId",label:this.$tc("postfinancecheckout-order.transactionHistory.types.customer"),rawData:!0}]},lineItemColumns(){return[{property:"uniqueId",label:this.$tc("postfinancecheckout-order.lineItem.types.uniqueId"),rawData:!0,visible:!1,primary:!0},{property:"name",label:this.$tc("postfinancecheckout-order.lineItem.types.name"),rawData:!0},{property:"quantity",label:this.$tc("postfinancecheckout-order.lineItem.types.quantity"),rawData:!0},{property:"amountIncludingTax",label:this.$tc("postfinancecheckout-order.lineItem.types.amountIncludingTax"),rawData:!0},{property:"type",label:this.$tc("postfinancecheckout-order.lineItem.types.type"),rawData:!0},{property:"taxAmount",label:this.$tc("postfinancecheckout-order.lineItem.types.taxAmount"),rawData:!0}]},refundColumns(){return[{property:"id",label:this.$tc("postfinancecheckout-order.refund.types.id"),rawData:!0,visible:!0,primary:!0},{property:"amount",label:this.$tc("postfinancecheckout-order.refund.types.amount"),rawData:!0},{property:"state",label:this.$tc("postfinancecheckout-order.refund.types.state"),rawData:!0},{property:"createdOn",label:this.$tc("postfinancecheckout-order.refund.types.createdOn"),rawData:!0}]}},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},created(){this.createdComponent()},methods:{createdComponent(){this.orderId=this.$route.params.id;const t=this.repositoryFactory.create("order"),e=new $(1,1);e.addAssociation("transactions"),e.getAssociation("transactions").addSorting($.sort("createdAt","DESC")),t.get(this.orderId,O.api,e).then((t=>{this.order=t,this.isLoading=!1;const e=t.transactions[0].customFields.postfinancecheckout_transaction_id;this.PostFinanceCheckoutTransactionService.getTransactionData(t.salesChannelId,e).then((t=>{this.currency=t.transactions[0].currency,t.transactions[0].authorized_amount=T.format.currency(t.transactions[0].authorizationAmount,this.currency),t.transactions[0].lineItems.forEach((t=>{t.amountIncludingTax=T.format.currency(t.amountIncludingTax,this.currency),t.taxAmount=T.format.currency(t.taxAmount,this.currency)})),t.refunds.forEach((t=>{t.amount=T.format.currency(t.amount,this.currency)})),this.lineItems=t.transactions[0].lineItems,this.transactionData=t,this.refundAmount=Number(this.transactionData.transactions[0].amountIncludingTax),this.refundableAmount=Number(this.transactionData.transactions[0].amountIncludingTax),this.transaction=this.transactionData.transactions[0]})).catch((t=>{try{this.createNotificationError({title:this.$tc("postfinancecheckout-order.paymentDetails.error.title"),message:t.message,autoClose:!1})}catch(e){this.createNotificationError({title:this.$tc("postfinancecheckout-order.paymentDetails.error.title"),message:t.message,autoClose:!1})}finally{this.isLoading=!1}}))}))},downloadPackingSlip(){window.open(this.PostFinanceCheckoutTransactionService.getPackingSlip(this.transaction.metaData.salesChannelId,this.transaction.id),"_blank")},downloadInvoice(){window.open(this.PostFinanceCheckoutTransactionService.getInvoiceDocument(this.transaction.metaData.salesChannelId,this.transaction.id),"_blank")},resetDataAttributes(){this.transactionData={transactions:[],refunds:[]},this.lineItems=[],this.isLoading=!0},spawnModal(t){this.modalType=t},closeModal(){this.modalType=""}}});var P=n("/iC3"),x=n("FCMq");const{Module:L}=Shopware;L.register("postfinancecheckout-order",{type:"plugin",name:"PostFinanceCheckout",title:"postfinancecheckout-order.general.title",description:"postfinancecheckout-order.general.descriptionTextModule",version:"1.0.0",targetVersion:"1.0.0",color:"#2b52ff",snippets:{"de-DE":P,"en-GB":x},routeMiddleware(t,e){"sw.order.detail"===e.name&&e.children.push({component:"postfinancecheckout-order-detail",name:"postfinancecheckout.order.detail",isChildren:!0,path:"/sw/order/postfinancecheckout/detail/:id"}),t(e)}});n("aubh");var B=n("Hmsx"),G=n.n(B);const M="PostFinanceCheckoutPayment.config";var V={CONFIG_DOMAIN:M,CONFIG_APPLICATION_KEY:"PostFinanceCheckoutPayment.config.applicationKey",CONFIG_EMAIL_ENABLED:"PostFinanceCheckoutPayment.config.emailEnabled",CONFIG_INTEGRATION:"PostFinanceCheckoutPayment.config.integration",CONFIG_LINE_ITEM_CONSISTENCY_ENABLED:"PostFinanceCheckoutPayment.config.lineItemConsistencyEnabled",CONFIG_SPACE_ID:"PostFinanceCheckoutPayment.config.spaceId",CONFIG_SPACE_VIEW_ID:"PostFinanceCheckoutPayment.config.spaceViewId",CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED:"PostFinanceCheckoutPayment.config.storefrontInvoiceDownloadEnabled",CONFIG_USER_ID:"PostFinanceCheckoutPayment.config.userId",CONFIG_IS_SHOWCASE:"PostFinanceCheckoutPayment.config.isShowcase"};const{Component:R,Mixin:q}=Shopware;R.register("postfinancecheckout-settings",{template:G.a,inject:["PostFinanceCheckoutConfigurationService"],mixins:[q.getByName("notification")],data:()=>({config:{},isLoading:!1,isSaveSuccessful:!1,isShowcase:!1,applicationKeyFilled:!1,applicationKeyErrorState:!1,spaceIdFilled:!1,spaceIdErrorState:!1,userIdFilled:!1,userIdErrorState:!1,isSetDefaultPaymentSuccessful:!1,isSettingDefaultPaymentMethods:!1,configIntegrationDefaultValue:"iframe",configEmailEnabledDefaultValue:!0,configLineItemConsistencyEnabledDefaultValue:!0,configStorefrontInvoiceDownloadEnabledEnabledDefaultValue:!0,...V}),props:{isLoading:{type:Boolean,required:!0}},metaInfo(){return{title:this.$createTitle()}},watch:{config:{handler(){const t=this.$refs.configComponent.allConfigs.null,e=this.$refs.configComponent.selectedSalesChannelId;this.isShowcase=this.config[this.CONFIG_IS_SHOWCASE],null===e?(this.applicationKeyFilled=!!this.config[this.CONFIG_APPLICATION_KEY],this.spaceIdFilled=!!this.config[this.CONFIG_SPACE_ID],this.userIdFilled=!!this.config[this.CONFIG_USER_ID],this.CONFIG_INTEGRATION in this.config||(this.config[this.CONFIG_INTEGRATION]=this.configIntegrationDefaultValue),this.CONFIG_EMAIL_ENABLED in this.config||(this.config[this.CONFIG_EMAIL_ENABLED]=this.configEmailEnabledDefaultValue),this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in this.config||(this.config[this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED]=this.configLineItemConsistencyEnabledDefaultValue),this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in this.config||(this.config[this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED]=this.configStorefrontInvoiceDownloadEnabledEnabledDefaultValue)):(this.applicationKeyFilled=!!this.config[this.CONFIG_APPLICATION_KEY]||!!t[this.CONFIG_APPLICATION_KEY],this.spaceIdFilled=!!this.config[this.CONFIG_SPACE_ID]||!!t[this.CONFIG_SPACE_ID],this.userIdFilled=!!this.config[this.CONFIG_USER_ID]||!!t[this.CONFIG_USER_ID],this.CONFIG_INTEGRATION in this.config&&this.CONFIG_INTEGRATION in t||(this.config[this.CONFIG_INTEGRATION]=this.configIntegrationDefaultValue),this.CONFIG_EMAIL_ENABLED in this.config&&this.CONFIG_EMAIL_ENABLED in t||(this.config[this.CONFIG_EMAIL_ENABLED]=this.configEmailEnabledDefaultValue),this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in this.config&&this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in t||(this.config[this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED]=this.configLineItemConsistencyEnabledDefaultValue),this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in this.config&&this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in t||(this.config[this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED]=this.configStorefrontInvoiceDownloadEnabledEnabledDefaultValue))},deep:!0}},methods:{onSave(){this.spaceIdFilled&&this.userIdFilled&&this.applicationKeyFilled?this.save():this.setErrorStates()},save(){this.isLoading=!0,this.$refs.configComponent.save().then((t=>{t&&(this.config=t),this.registerWebHooks(),this.synchronizePaymentMethodConfiguration(),this.installOrderDeliveryStates()})).catch((()=>{this.isLoading=!1}))},registerWebHooks(){this.PostFinanceCheckoutConfigurationService.registerWebHooks(this.$refs.configComponent.selectedSalesChannelId).then((()=>{this.createNotificationSuccess({title:this.$tc("postfinancecheckout-settings.settingForm.titleSuccess"),message:this.$tc("postfinancecheckout-settings.settingForm.messageWebHookUpdated")})})).catch((()=>{this.createNotificationError({title:this.$tc("postfinancecheckout-settings.settingForm.titleError"),message:this.$tc("postfinancecheckout-settings.settingForm.messageWebHookError")}),this.isLoading=!1}))},synchronizePaymentMethodConfiguration(){this.PostFinanceCheckoutConfigurationService.synchronizePaymentMethodConfiguration(this.$refs.configComponent.selectedSalesChannelId).then((()=>{this.createNotificationSuccess({title:this.$tc("postfinancecheckout-settings.settingForm.titleSuccess"),message:this.$tc("postfinancecheckout-settings.settingForm.messagePaymentMethodConfigurationUpdated")}),this.isLoading=!1})).catch((()=>{this.createNotificationError({title:this.$tc("postfinancecheckout-settings.settingForm.titleError"),message:this.$tc("postfinancecheckout-settings.settingForm.messagePaymentMethodConfigurationError")}),this.isLoading=!1}))},installOrderDeliveryStates(){this.PostFinanceCheckoutConfigurationService.installOrderDeliveryStates().then((()=>{this.createNotificationSuccess({title:this.$tc("postfinancecheckout-settings.settingForm.titleSuccess"),message:this.$tc("postfinancecheckout-settings.settingForm.messageOrderDeliveryStateUpdated")}),this.isLoading=!1})).catch((()=>{this.createNotificationError({title:this.$tc("postfinancecheckout-settings.settingForm.titleError"),message:this.$tc("postfinancecheckout-settings.settingForm.messageOrderDeliveryStateError")}),this.isLoading=!1}))},onSetPaymentMethodDefault(){this.isSettingDefaultPaymentMethods=!0,this.PostFinanceCheckoutConfigurationService.setPostFinanceCheckoutAsSalesChannelPaymentDefault(this.$refs.configComponent.selectedSalesChannelId).then((()=>{this.isSettingDefaultPaymentMethods=!1,this.isSetDefaultPaymentSuccessful=!0}))},setErrorStates(){const t={code:1,detail:this.$tc("postfinancecheckout-settings.messageNotBlank")};this.spaceIdFilled||(this.spaceIdErrorState=t),this.userIdFilled||(this.userIdErrorState=t),this.applicationKeyFilled||(this.applicationKeyErrorState=t)}}});var z=n("heDV"),H=n.n(z);const{Component:K,Mixin:W}=Shopware;K.register("sw-postfinancecheckout-credentials",{template:H.a,name:"PostFinanceCheckoutCredentials",mixins:[W.getByName("notification")],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{required:!0},spaceIdFilled:{type:Boolean,required:!0},spaceIdErrorState:{required:!0},userIdFilled:{type:Boolean,required:!0},userIdErrorState:{required:!0},applicationKeyFilled:{type:Boolean,required:!0},applicationKeyErrorState:{required:!0},isLoading:{type:Boolean,required:!0},isShowcase:{type:Boolean,required:!0}},data:()=>({...V}),computed:{},methods:{checkTextFieldInheritance:t=>"string"!=typeof t||t.length<=0,checkBoolFieldInheritance:t=>"boolean"!=typeof t}});var Y=n("TeG4"),U=n.n(Y);const{Component:j,Mixin:Z}=Shopware;j.register("sw-postfinancecheckout-options",{template:U.a,name:"PostFinanceCheckoutOptions",mixins:[Z.getByName("notification")],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{required:!0},isLoading:{type:Boolean,required:!0}},data:()=>({...V}),computed:{integrationOptions(){return[{id:"iframe",name:this.$tc("postfinancecheckout-settings.settingForm.options.integration.options.iframe")},{id:"payment_page",name:this.$tc("postfinancecheckout-settings.settingForm.options.integration.options.payment_page")}]}},methods:{checkTextFieldInheritance:t=>"string"!=typeof t||t.length<=0,checkBoolFieldInheritance:t=>"boolean"!=typeof t}});var J=n("wwge"),Q=n.n(J);const{Component:X}=Shopware;X.register("sw-postfinancecheckout-settings-icon",{template:Q.a});var tt=n("juBS"),et=n.n(tt);const{Component:nt,Mixin:at}=Shopware;nt.register("sw-postfinancecheckout-storefront-options",{template:et.a,name:"PostFinanceCheckoutStorefrontOptions",mixins:[at.getByName("notification")],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{required:!0},isLoading:{type:Boolean,required:!0}},data:()=>({...V}),computed:{},methods:{checkTextFieldInheritance:t=>"string"!=typeof t||t.length<=0,checkBoolFieldInheritance:t=>"boolean"!=typeof t}});const{Module:it}=Shopware;it.register("postfinancecheckout-settings",{type:"plugin",name:"PostFinanceCheckout",title:"postfinancecheckout-settings.general.descriptionTextModule",description:"postfinancecheckout-settings.general.descriptionTextModule",color:"#28d8ff",icon:"default-action-settings",version:"1.0.0",targetVersion:"1.0.0",routes:{index:{component:"postfinancecheckout-settings",path:"index",meta:{parentPath:"sw.settings.index",privilege:"postfinancecheckout.viewer"}}},settingsItem:{group:"plugins",to:"postfinancecheckout.settings.index",iconComponent:"sw-postfinancecheckout-settings-icon",backgroundEnabled:!0,privilege:"postfinancecheckout.viewer"}});const ot=Shopware.Classes.ApiService;var st=class extends ot{constructor(t,e,n="postfinancecheckout"){super(t,e,n)}registerWebHooks(t=null){const e=this.getBasicHeaders(),n=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/register-web-hooks`;return this.httpClient.post(n,{salesChannelId:t},{headers:e}).then((t=>ot.handleResponse(t)))}setPostFinanceCheckoutAsSalesChannelPaymentDefault(t=null){const e=this.getBasicHeaders(),n=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/set-postfinancecheckout-as-sales-channel-payment-default`;return this.httpClient.post(n,{salesChannelId:t},{headers:e}).then((t=>ot.handleResponse(t)))}synchronizePaymentMethodConfiguration(t=null){const e=this.getBasicHeaders(),n=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/synchronize-payment-method-configuration`;return this.httpClient.post(n,{salesChannelId:t},{headers:e}).then((t=>ot.handleResponse(t)))}installOrderDeliveryStates(){const t=this.getBasicHeaders(),e=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/install-order-delivery-states`;return this.httpClient.post(e,{},{headers:t}).then((t=>ot.handleResponse(t)))}};const ct=Shopware.Classes.ApiService;var rt=class extends ct{constructor(t,e,n="postfinancecheckout"){super(t,e,n)}createRefund(t,e,n){const a=this.getBasicHeaders(),i=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-refund/`;return this.httpClient.post(i,{salesChannelId:t,transactionId:e,refundableAmount:n},{headers:a}).then((t=>ct.handleResponse(t)))}};const lt=Shopware.Classes.ApiService;var dt=class extends lt{constructor(t,e,n="postfinancecheckout"){super(t,e,n)}getTransactionData(t,e){const n=this.getBasicHeaders(),a=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-transaction-data/`;return this.httpClient.post(a,{salesChannelId:t,transactionId:e},{headers:n}).then((t=>lt.handleResponse(t)))}getInvoiceDocument(t,e){return`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-invoice-document/${t}/${e}`}getPackingSlip(t,e){return`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-packing-slip/${t}/${e}`}};const ht=Shopware.Classes.ApiService;var ut=class extends ht{constructor(t,e,n="postfinancecheckout"){super(t,e,n)}createTransactionCompletion(t,e){const n=this.getBasicHeaders(),a=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction-completion/create-transaction-completion/`;return this.httpClient.post(a,{salesChannelId:t,transactionId:e},{headers:n}).then((t=>ht.handleResponse(t)))}};const pt=Shopware.Classes.ApiService;var ft=class extends pt{constructor(t,e,n="postfinancecheckout"){super(t,e,n)}createTransactionVoid(t,e){const n=this.getBasicHeaders(),a=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction-void/create-transaction-void/`;return this.httpClient.post(a,{salesChannelId:t,transactionId:e},{headers:n}).then((t=>pt.handleResponse(t)))}};const{Application:mt}=Shopware;mt.addServiceProvider("PostFinanceCheckoutConfigurationService",(t=>{const e=mt.getContainer("init");return new st(e.httpClient,t.loginService)})),mt.addServiceProvider("PostFinanceCheckoutRefundService",(t=>{const e=mt.getContainer("init");return new rt(e.httpClient,t.loginService)})),mt.addServiceProvider("PostFinanceCheckoutTransactionService",(t=>{const e=mt.getContainer("init");return new dt(e.httpClient,t.loginService)})),mt.addServiceProvider("PostFinanceCheckoutTransactionCompletionService",(t=>{const e=mt.getContainer("init");return new ut(e.httpClient,t.loginService)})),mt.addServiceProvider("PostFinanceCheckoutTransactionVoidService",(t=>{const e=mt.getContainer("init");return new ft(e.httpClient,t.loginService)}))}},[["ypuE","runtime","vendors-node"]]]); \ No newline at end of file diff --git a/src/Resources/snippet/storefront/postfinancecheckout.de-DE.json b/src/Resources/snippet/storefront/postfinancecheckout.de-DE.json index 81b4f1e..8264b8c 100644 --- a/src/Resources/snippet/storefront/postfinancecheckout.de-DE.json +++ b/src/Resources/snippet/storefront/postfinancecheckout.de-DE.json @@ -15,7 +15,7 @@ "payload": { "adjustmentLineItem": "Anpassung Einzelposten", "shipping": { - "lineItem": "Versand-Einzelposten", + "lineItem": "Versand", "name": "Versand" }, "taxes": "Steuern" diff --git a/src/Resources/snippet/storefront/postfinancecheckout.en-GB.json b/src/Resources/snippet/storefront/postfinancecheckout.en-GB.json index 86862d4..453e9b8 100644 --- a/src/Resources/snippet/storefront/postfinancecheckout.en-GB.json +++ b/src/Resources/snippet/storefront/postfinancecheckout.en-GB.json @@ -15,7 +15,7 @@ "payload": { "adjustmentLineItem": "Adjustment Line Item", "shipping": { - "lineItem": "Shipping Line Item", + "lineItem": "Shipping", "name": "Shipping" }, "taxes": "Taxes"