Skip to content

Commit

Permalink
Merge pull request #1 from MugglePay/bug/fix-callback
Browse files Browse the repository at this point in the history
Fix Order Callback
  • Loading branch information
shawnmuggle authored Oct 29, 2024
2 parents 9acfa6b + cddc43b commit da1ebe7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
12 changes: 9 additions & 3 deletions class/class-mpwp-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,15 @@ public function __construct()

self::$log_enabled = $this->debug;

// Setup callback URL
$this->callback_url = WC()->api_request_url($this->id);

add_action('woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ));
add_action('woocommerce_api_wc_gateway_mpwp', array( $this, 'check_response' ));
// add_action('woocommerce_api_wc_gateway_mpwp', array( $this, 'check_response' ));
add_filter('woocommerce_order_data_store_cpt_get_orders_query', array( $this, 'custom_query_var' ), 10, 2);
add_action('woocommerce_api_' . $this->id, array($this, 'check_response'));


// add_action('woocommerce_cancelled_order', array( $this, 'cancel_order' ), 10 ,1);
// add_action( 'woocommerce_order_status_processing', array( $this, 'capture_payment' ) );
// add_action( 'woocommerce_order_status_completed', array( $this, 'capture_payment' ) );
Expand Down Expand Up @@ -442,7 +448,7 @@ public function get_payment_url($order, $pay_currency)
// Translators: %s is the order ID.
'title' => sprintf(__('Payment order #%s', 'mugglepay'), $order->get_id()),
'description' => $description,
'callback_url' => WC()->api_request_url('MPWP_WC_Gateway'),
'callback_url' => $this->callback_url,
'cancel_url' => esc_url_raw($order->get_cancel_order_url_raw()),
'success_url' => esc_url_raw($this->get_return_url($order)),
'mobile' => wp_is_mobile(),
Expand Down Expand Up @@ -690,4 +696,4 @@ public function custom_query_var($query, $query_vars)

return $query;
}
}
}
10 changes: 5 additions & 5 deletions muggle-pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Plugin Name: MugglePay
Plugin URI: https://mugglepay.com/
Description: MugglePay is a one-stop payment solution for merchants with an online payment need.
Version: 1.0.2
Version: 1.0.4
Author: Shawn
Author URI: https://x.com/shawnmuggle
Text Domain: mugglepay
Expand Down Expand Up @@ -123,12 +123,12 @@ function mpwp_order_meta_general($order)
<h3><?php esc_html_e('MugglePay Payment Voucher', 'mugglepay'); ?>
</h3>
<div class="">
<p>
<?php
<p>
<?php
// Translators: %s is the transaction ID.
printf( esc_html__( 'Transaction ID: %s', 'mugglepay' ), esc_html( $order->get_transaction_id() ) );
?>
</p>
</p>
</div>

<?php
Expand Down Expand Up @@ -192,4 +192,4 @@ function mpwp_admin_load_scripts() {
wp_register_script( 'wpmp-admin-script', MPWP_PLUGIN_URL.'/assets/js/wpmp-admin.js', array(), 1, true );
wp_enqueue_script( 'wpmp-admin-script' );

}
}
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: mugglepay woocommerce alipay wechat btc digital payment
Requires at least: 5.3
Tested up to: 6.5.5
Requires PHP: 7.0
Stable tag: 1.0.2
Stable tag: 1.0.4
License: GPLv3+
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -76,6 +76,12 @@ Clicking the Manage button on the right hand side will take you into the setting

== Changelog ==

=== 1.0.4 ===
* Code Improvements

=== 1.0.3 ===
* Code Improvements

=== 1.0.2 ===
* Code Improvements

Expand Down

0 comments on commit da1ebe7

Please sign in to comment.