Skip to content

Commit

Permalink
Merge pull request #9 from sargatxet/hotfix-total-calculation
Browse files Browse the repository at this point in the history
[FIX] total calculation
  • Loading branch information
Traka-Dev authored Jan 20, 2023
2 parents d7095db + 9671043 commit 293f070
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions paymentGateway/cardano/class-sargapay-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ private function getCurrency()
$result->currency = get_woocommerce_currency();
$result->symbol = get_woocommerce_currency_symbol();
} else {
$currency = $this->currency;
switch ($currency) {
$result->currency = $this->currency;
switch ($result->currency) {
case "ADA":
$result->symbol = "";
break;
Expand All @@ -304,7 +304,7 @@ public function payment_fields()
$request = wp_remote_retrieve_body(wp_remote_get('https://api.coingecko.com/api/v3/simple/price?ids=cardano&vs_currencies=' . $currency));
$data = json_decode($request, true);
}
if ($currency === "ADA" || count($data) == 1) {
if ($currency === "ADA" || count($data['cardano']) == 1) {
if ($this->testmode) {
?>
<h3 style='text-align:center; background:red; color:white; font-weight:bold;'>
Expand Down Expand Up @@ -443,7 +443,7 @@ public function process_payment($order_id)
WC()->cart->empty_cart();
return array(
'result' => 'failure',
'redirect' => WC()->cart->get_checkout_url()
'redirect' => wc_get_checkout_url()
);
}

Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://sargatxet.cloud/
Tags: paymentGateway, Crypto, Cardano
Requires at least: 4.7
Tested up to: 6.1
Stable tag: 2.1.0
Stable tag: 2.1.1
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -68,6 +68,9 @@ Finally we have to activate the plugin and verify the network that we are going

== Changelog ==

= 2.1.1 =
* Fixed issue where the total value displayed as 0 when the default currency was set to ADA

= 2.1 =
* Add Cardano Currency to WooCommerce
* Fix markup error
Expand Down
4 changes: 2 additions & 2 deletions sargapay.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin Name: Sargapay
* Plugin URI: https://sargatxet.cloud/sargapay-cardano/
* Description: WordPress payment gateway for crypto.
* Version: 2.1.0
* Version: 2.1.1
* Author: Sargatxet
* Author URI: https://sargatxet.cloud/
* License: GPLv2 or later
Expand Down Expand Up @@ -58,7 +58,7 @@

define('SARGAPAY_PATH', plugin_dir_path(__FILE__));
define('SARGAPAY_URL', plugin_dir_url(__FILE__));
define('SARGAPAY_VERSION', '2.1.0');
define('SARGAPAY_VERSION', '2.1.1');

add_filter('cron_schedules', 'sargapay_cron_hook');
add_action('sargapay_cron_hook', 'sargapay_check_confirmations_cardano');
Expand Down

0 comments on commit 293f070

Please sign in to comment.