From e67a2f6303435378a98b1f84e254be2c92cfc29d Mon Sep 17 00:00:00 2001
From: criskell <96352451+criskell@users.noreply.github.com>
Date: Tue, 5 Nov 2024 15:35:22 -0300
Subject: [PATCH] fix(checkout): allow multiple address (#738)
* fix(checkout): allow multiple address
* fix(pix): hide qrcode when order has not been created
* feat(success): show pix on multishipping success page
---
Pix/Block/Multishipping/Checkout/Success.php | 86 +++++++++++++++++++
Pix/etc/payment.xml | 2 +-
.../layout/multishipping_checkout_success.xml | 11 +++
Pix/view/frontend/templates/info/pix.phtml | 10 ++-
.../multishipping/checkout/success.phtml | 24 ++++++
5 files changed, 129 insertions(+), 4 deletions(-)
create mode 100644 Pix/Block/Multishipping/Checkout/Success.php
create mode 100644 Pix/view/frontend/layout/multishipping_checkout_success.xml
create mode 100644 Pix/view/frontend/templates/multishipping/checkout/success.phtml
diff --git a/Pix/Block/Multishipping/Checkout/Success.php b/Pix/Block/Multishipping/Checkout/Success.php
new file mode 100644
index 00000000..8cb9ffdc
--- /dev/null
+++ b/Pix/Block/Multishipping/Checkout/Success.php
@@ -0,0 +1,86 @@
+checkoutSession = $checkoutSession;
+ $this->customerSession = $customerSession;
+ $this->_helperData = $helper;
+ $this->_orderFactory = $orderFactory;
+ }
+
+ public function getQrCodes()
+ {
+ $orderIds = $this->_session->getOrderIds();
+
+ if (! $orderIds || ! is_array($orderIds)) {
+ return [];
+ }
+
+ $qrCodes = [];
+
+ foreach ($orderIds as $orderId) {
+ $order = $this->_orderFactory->create()
+ ->loadByIncrementId($orderId);
+
+ if (! $order->getId()) {
+ continue;
+ }
+
+ $correlationID = $order->getOpenpixCorrelationid();
+
+ if (empty($correlationID)) {
+ continue;
+ }
+
+ $qrCodes[] = [
+ 'paymentLinkUrl' => $order->getOpenpixPaymentlinkurl(),
+ 'brCodeImage' => $order->getOpenpixQrcodeimage(),
+ 'brCode' => $order->getOpenpixBrcode(),
+ 'correlationID' => $correlationID,
+ ];
+ }
+
+ return $qrCodes;
+ }
+
+ public function getAppID(): string
+ {
+ $appID = $this->_helperData->getAppID();
+
+ if (isset($appID)) {
+ return $appID;
+ }
+
+ return '';
+ }
+
+ public function getPluginSrc(): string
+ {
+ return $this->_helperData->getOpenPixPluginUrlScript();
+ }
+
+ public function getCustomerId()
+ {
+ return $this->customerSession->getCustomer()->getId();
+ }
+}
diff --git a/Pix/etc/payment.xml b/Pix/etc/payment.xml
index 73b43895..0fddd1d8 100644
--- a/Pix/etc/payment.xml
+++ b/Pix/etc/payment.xml
@@ -2,7 +2,7 @@