Skip to content

Commit

Permalink
fix: remove subscritpion on googlepay and fix order repository
Browse files Browse the repository at this point in the history
fix: remove subscritpion on googlepay and fix order repository
  • Loading branch information
fabiano-mallmann authored Sep 26, 2024
2 parents 78b5b84 + df473ea commit fd6e2ca
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/Block/Checkout/Payment/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Woocommerce\Pagarme\Block\Checkout\Payment;

use Woocommerce\Pagarme\Block\Checkout\Gateway;
use Woocommerce\Pagarme\Model\Subscription;

defined( 'ABSPATH' ) || exit;

Expand All @@ -33,4 +34,9 @@ public function getQtyCards()
{
return 1;
}

public function hasSubscriptionProductInCart()
{
return Subscription::hasSubscriptionProductInCart();
}
}
18 changes: 7 additions & 11 deletions templates/checkout/payment/credit-card.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,13 @@ wp_localize_script(
]
);

if($this->getConfig()->getEnableGooglepay() == "yes"):
?>


<div id="pagarme-googlepay"></div>
<div class="pagarme_creditcard_divider">
<p>
<?=__("Or pay with card", 'woo-pagarme-payments')?>
</p>
</div>

if ( $this->getConfig()->getEnableGooglepay() == "yes" && !$this->hasSubscriptionProductInCart() ) : ?>
<div id="pagarme-googlepay"></div>
<div class="pagarme_creditcard_divider">
<p>
<?=__("Or pay with card", 'woo-pagarme-payments')?>
</p>
</div>
<?php
endif; // Enable or disable googlepay
$this->createBlock(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit fd6e2ca

Please sign in to comment.