Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove subscritpion on googlepay and fix order repository #490

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading