diff --git a/src/Resources/config/services/subscriber.xml b/src/Resources/config/services/subscriber.xml index 269ffb04c..00bddce59 100644 --- a/src/Resources/config/services/subscriber.xml +++ b/src/Resources/config/services/subscriber.xml @@ -72,6 +72,11 @@ + + + + + @@ -96,7 +101,5 @@ - - diff --git a/src/Resources/snippet/de_DE/mollie-payments.de-DE.json b/src/Resources/snippet/de_DE/mollie-payments.de-DE.json index 0308db603..04e905ed7 100644 --- a/src/Resources/snippet/de_DE/mollie-payments.de-DE.json +++ b/src/Resources/snippet/de_DE/mollie-payments.de-DE.json @@ -119,8 +119,12 @@ "information": "Abonnementprodukt" } }, + "order": { + "refundedLabel": "Rückerstattet:", + "refundPendingLabel": "Rückerstattung ausstehend:" + }, "testMode": { "label": "Testmodus" } } -} \ No newline at end of file +} diff --git a/src/Resources/snippet/en_GB/mollie-payments.en-GB.json b/src/Resources/snippet/en_GB/mollie-payments.en-GB.json index 904429df5..bffabeecd 100644 --- a/src/Resources/snippet/en_GB/mollie-payments.en-GB.json +++ b/src/Resources/snippet/en_GB/mollie-payments.en-GB.json @@ -119,8 +119,12 @@ "information": "Subscription product" } }, + "order": { + "refundedLabel": "Refunded:", + "refundPendingLabel": "Refund pending:" + }, "testMode": { "label": "Test mode" } } -} \ No newline at end of file +} diff --git a/src/Resources/snippet/nl_NL/mollie-payments.nl-NL.json b/src/Resources/snippet/nl_NL/mollie-payments.nl-NL.json index 95761601f..26ded5056 100644 --- a/src/Resources/snippet/nl_NL/mollie-payments.nl-NL.json +++ b/src/Resources/snippet/nl_NL/mollie-payments.nl-NL.json @@ -119,8 +119,12 @@ "information": "Abonnement product" } }, + "order": { + "refundedLabel": "Terugbetaling:", + "refundPendingLabel": "Terugbetaling in afwachting:" + }, "testMode": { "label": "testmodus" } } -} \ No newline at end of file +} diff --git a/src/Resources/views/storefront/page/account/order-history/order-detail.html.twig b/src/Resources/views/storefront/page/account/order-history/order-detail.html.twig new file mode 100644 index 000000000..ac46d0b38 --- /dev/null +++ b/src/Resources/views/storefront/page/account/order-history/order-detail.html.twig @@ -0,0 +1,39 @@ +{% sw_extends '@Storefront/storefront/page/account/order-history/order-detail.html.twig' %} +{% block page_account_order_item_detail_amount_value %} + {{ parent() }} + {% set totals = order.extensions.mollie_refunds.totals %} + + {% block page_account_order_item_detail_amount_mollie_refund_pending_label %} + {% if totals.pendingRefunds != 0 %} +
+ {{ "molliePayments.order.refundPendingLabel"|trans|sw_sanitize }} +
+ {% endif %} + {% endblock %} + + {% block page_account_order_item_detail_amount_mollie_refund_pending_value %} + {% if totals.pendingRefunds != 0 %} +
+ {{ totals.pendingRefunds|currency(order.currency.isoCode) }} +
+ {% endif %} + {% endblock %} + + {% block page_account_order_item_detail_amount_mollie_refunded_label %} + {% if totals.refunded != 0 %} +
+ {{ "molliePayments.order.refundedLabel"|trans|sw_sanitize }} +
+ {% endif %} + {% endblock %} + + {% block page_account_order_item_detail_amount_mollie_refunded_value %} + {% if totals.refunded != 0 %} +
+ {{ totals.refunded|currency(order.currency.isoCode) }} +
+ {% endif %} + {% endblock %} + + +{% endblock %} diff --git a/src/Subscriber/AccountOrderPageLoadedSubscriber.php b/src/Subscriber/AccountOrderPageLoadedSubscriber.php new file mode 100644 index 000000000..9de87c7e0 --- /dev/null +++ b/src/Subscriber/AccountOrderPageLoadedSubscriber.php @@ -0,0 +1,51 @@ +refundManager = $refundManager; + } + + /** + * @return array + */ + public static function getSubscribedEvents(): array + { + return [ + AccountOrderPageLoadedEvent::class => 'onAccountOrderPageLoaded' + ]; + } + + /** + * @param AccountOrderPageLoadedEvent $event + * @return void + */ + public function onAccountOrderPageLoaded(AccountOrderPageLoadedEvent $event) + { + # Add the refunds for the order history details page + $orders = $event->getPage()->getOrders(); + /** @var OrderEntity $order */ + foreach ($orders as $order) { + $data = $this->refundManager->getData($order,$event->getContext()); + $order->addArrayExtension("mollie_refunds",$data->toArray()); + } + + } +}