From 69cfc7c89820a4c971212d523214a9ee0e6143c6 Mon Sep 17 00:00:00 2001 From: Fabiano Mallmann <25328512+fabiano-mallmann@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:18:57 -0300 Subject: [PATCH 1/2] fix: remove subscritpion on googlepay and fix order repository --- src/Block/Checkout/Payment/CreditCard.php | 6 ++++++ templates/checkout/payment/credit-card.phtml | 4 +--- .../src/Kernel/Repositories/OrderRepository.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Block/Checkout/Payment/CreditCard.php b/src/Block/Checkout/Payment/CreditCard.php index 9c68892e..26f84473 100644 --- a/src/Block/Checkout/Payment/CreditCard.php +++ b/src/Block/Checkout/Payment/CreditCard.php @@ -12,6 +12,7 @@ namespace Woocommerce\Pagarme\Block\Checkout\Payment; use Woocommerce\Pagarme\Block\Checkout\Gateway; +use Woocommerce\Pagarme\Model\Subscription; defined( 'ABSPATH' ) || exit; @@ -33,4 +34,9 @@ public function getQtyCards() { return 1; } + + public function hasSubscriptionProductInCart() + { + return Subscription::hasSubscriptionProductInCart(); + } } diff --git a/templates/checkout/payment/credit-card.phtml b/templates/checkout/payment/credit-card.phtml index c0b8633f..8e087494 100644 --- a/templates/checkout/payment/credit-card.phtml +++ b/templates/checkout/payment/credit-card.phtml @@ -28,10 +28,8 @@ wp_localize_script( ] ); -if($this->getConfig()->getEnableGooglepay() == "yes"): +if ( $this->getConfig()->getEnableGooglepay() == "yes" && !$this->hasSubscriptionProductInCart() ) : ?> - -
diff --git a/vendor/pagarme/ecommerce-module-core/src/Kernel/Repositories/OrderRepository.php b/vendor/pagarme/ecommerce-module-core/src/Kernel/Repositories/OrderRepository.php index e05165d1..267dc8ad 100644 --- a/vendor/pagarme/ecommerce-module-core/src/Kernel/Repositories/OrderRepository.php +++ b/vendor/pagarme/ecommerce-module-core/src/Kernel/Repositories/OrderRepository.php @@ -119,7 +119,7 @@ public function findByPlatformId($platformID) $orderTable = $this->db->getTable(AbstractDatabaseDecorator::TABLE_ORDER); $platformID = filter_var($platformID, FILTER_SANITIZE_SPECIAL_CHARS); $query = "SELECT * FROM `$orderTable` "; - $query .= "WHERE code = '{$platformID}';"; + $query .= "WHERE code = '{$platformID}' ORDER BY id DESC;"; $result = $this->db->fetch($query); From df473ea9d204c7678c0b9c6c49ec5d9ce4ac4dd1 Mon Sep 17 00:00:00 2001 From: Fabiano Mallmann <25328512+fabiano-mallmann@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:27:00 -0300 Subject: [PATCH 2/2] fix: smell --- templates/checkout/payment/credit-card.phtml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/templates/checkout/payment/credit-card.phtml b/templates/checkout/payment/credit-card.phtml index 8e087494..805793c8 100644 --- a/templates/checkout/payment/credit-card.phtml +++ b/templates/checkout/payment/credit-card.phtml @@ -28,15 +28,13 @@ wp_localize_script( ] ); -if ( $this->getConfig()->getEnableGooglepay() == "yes" && !$this->hasSubscriptionProductInCart() ) : -?> -
-- =__("Or pay with card", 'woo-pagarme-payments')?> -
-+ =__("Or pay with card", 'woo-pagarme-payments')?> +
+