Skip to content

Commit

Permalink
Update version 1.0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
atmoner committed Jan 26, 2023
1 parent c952728 commit d317320
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 18 deletions.
6 changes: 5 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Donate link: https://commerce.bitcanna.io
Tags: payments, cryptocurrency, blockchain
Requires at least: 3.0.1
Tested up to: 6.1.1
Stable tag: 1.0.16
Stable tag: 1.0.17
Requires PHP: 7.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -37,6 +37,10 @@ For our FAQ we'd like to refer you to our [documentation website](https://docs.b
5. After just a couple seconds, the payment will be performed and you can view your transaction.

== Changelog ==
= 1.0.17 =
* Fix keplr bug
* Change status order

= 1.0.16 =
* Fix call api-store only on checkout page
* Fix mobile view on checkout
Expand Down
2 changes: 1 addition & 1 deletion api-cosmos.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
$order = new WC_Order($orderId);
if (!empty($order)) {
$note = 'Tx of order: '.esc_attr( $orderTx );
$order->update_status( 'completed' );
$order->update_status( 'processing' ); // completed
$order->add_order_note( $note , true );
// TODO add link to explorer
// wc_update_order_item_meta($orderId, '_cosmos_tx', esc_attr());
Expand Down
4 changes: 2 additions & 2 deletions cosmos-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin Name: Cosmos Pay
* Plugin URI: https://twitter.com/bitcannaglobal
* Description: Easily accept cryptocurrency payments on your WordPress site. Enable multiple currencies from the interconnected Cosmos ecosystem.
* Version: 1.0.16
* Version: 1.0.17
* Author: BitCanna
* Author URI: https://commerce.bitcanna.io
* License: GPL-2.0+
Expand All @@ -35,7 +35,7 @@
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define( 'COSMOS_WOOCOMMERCE_VERSION', '1.0.16' );
define( 'COSMOS_WOOCOMMERCE_VERSION', '1.0.17' );



Expand Down
32 changes: 20 additions & 12 deletions public/class-cosmos-woocommerce-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ public function enqueue_scripts() {
if ( is_checkout() ) {
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/bundle.js', array( 'jquery' ), $this->version, 'all' );
wp_enqueue_script( $this->plugin_name . '_mainscript', plugin_dir_url( __FILE__ ) . 'js/mainscript.js', array( 'jquery' ), $this->version, true );
}
}

}
/**
* Start cosmos pay form
Expand All @@ -109,13 +110,20 @@ public function enqueue_scripts() {
public function cosmos_pay_form( $order_id ) {
global $woocommerce;



$order = wc_get_order( $order_id );
$userWp = wp_get_current_user( );
$userWoo = $order->user_id;
$orderData = $order->get_data( );
$order_status = $order->get_status( );

$getMemo = wc_get_order_item_meta( $order_id , '_cosmos_memo', true );


if ($order_status !== 'cancelled') {
$order->update_status( 'pending', __( 'Awaiting Cosmos payment', 'wc-gateway-offline' ) );
}

if ( empty( $getMemo ) ) {
// Mark as pending (we're awaiting the payment)
// $order->update_status( 'pending', __( 'Awaiting Cosmos payment', 'wc-gateway-offline' ) );
Expand All @@ -140,19 +148,19 @@ public function cosmos_pay_form( $order_id ) {
} else {

$selected_payment_method_id = $woocommerce->session->get( 'chosen_payment_method' );
$selected_payment_method = $woocommerce->payment_gateways->payment_gateways()[ $selected_payment_method_id ];
$order_status = $order->get_status( );
$selected_payment_method = $woocommerce->payment_gateways->payment_gateways()[ $selected_payment_method_id ];
$configMake = get_option("cosmos_pay_config_approved");

if ($configMake === 'false' || $configMake === false || empty($selected_payment_method->settings['option_name'])) {
include plugin_dir_path(__FILE__) . "partials/cosmos-payment-config-tpl.php";
} else {
if ( $order_status !== 'cancelled' ) {
include plugin_dir_path(__FILE__) . "partials/cosmos-payment-tpl.php";
} else
include plugin_dir_path(__FILE__) . "partials/cosmos-payment-cancel-tpl.php";
if ($woocommerce->payment_gateways->payment_gateways()[ 'woo-cosmos' ]->enabled === 'yes') {
if ($configMake === 'false' || $configMake === false || empty($selected_payment_method->settings['option_name'])) {
include plugin_dir_path(__FILE__) . "partials/cosmos-payment-config-tpl.php";
} else {
if ( $order_status !== 'cancelled' ) {
include plugin_dir_path(__FILE__) . "partials/cosmos-payment-tpl.php";
} else
include plugin_dir_path(__FILE__) . "partials/cosmos-payment-cancel-tpl.php";
}
}

}
}
/**
Expand Down
5 changes: 3 additions & 2 deletions public/js/mainscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function startChecking( order_id, mainDomain, finalApiUrl, memo, isBlocked, isLo
})
} else {
$('#mainTransaction').show();
console.log(setDefault)
// https://store-wp.walaxy.io/index.php?name=api-cosmos
// $.post( mainDomain+"/api-cosmos/", { switch: setDefault, order_id: order_id, nonce: nonceSelectChain }, async function( result ) {
$.post( finalApiUrl, { switch: setDefault, order_id: order_id, nonce: nonceSelectChain }, async function( result ) {
Expand All @@ -49,11 +48,13 @@ function startChecking( order_id, mainDomain, finalApiUrl, memo, isBlocked, isLo
});

let finalMethod = ''
if(isMobile) {
if(isMobile === true) {
finalMethod = 'another'
} else
finalMethod = 'keplr'

console.log(isMobile)
console.log(finalMethod)
$.post( finalApiUrl, { switchMethod: finalMethod, order_id: order_id, nonce: nonceSwitchMethod }, function( result ) {
});
}
Expand Down

0 comments on commit d317320

Please sign in to comment.