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

Multiple small fixes for v3.7.7 release #385

Merged
merged 5 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
**Contributors:** juhasiivikko, darrenwestwood, blockonomics, anktd, btcdeveloper
**Tags:** bitcoin, accept bitcoin, bitcoin woocommerce, bitcoin wordpress plugin, bitcoin payments
**Requires at least:** 3.0.1
**Tested up to:** 6.6.2
**Tested up to:** 6.7
**Stable tag:** 3.7.6
**License:** MIT
**License URI:** http://opensource.org/licenses/MIT
Expand Down
28 changes: 17 additions & 11 deletions blockonomics-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ function blockonomics_woocommerce_init()
return;
}


require_once plugin_dir_path(__FILE__) . 'php' . DIRECTORY_SEPARATOR . 'WC_Gateway_Blockonomics.php';
include_once plugin_dir_path(__FILE__) . 'php' . DIRECTORY_SEPARATOR . 'Blockonomics.php';
require_once plugin_dir_path(__FILE__) . 'php' . DIRECTORY_SEPARATOR . 'admin-page.php';
require_once plugin_dir_path(__FILE__) . 'php' . DIRECTORY_SEPARATOR . 'class-blockonomics-setup.php';

add_action('admin_menu', 'add_page');
add_action('init', 'load_plugin_translations');
add_action('woocommerce_order_details_after_order_table', 'nolo_custom_field_display_cust_order_meta', 10, 1);
Expand Down Expand Up @@ -100,7 +100,7 @@ function blockonomics_add_admin_menu() {
'blockonomics_setup_page'
);
}

add_action( 'admin_enqueue_scripts', 'blockonomics_enqueue_custom_admin_style' );
add_action( 'wp_ajax_test_setup', 'blockonomics_test_setup' );

Expand All @@ -120,7 +120,7 @@ function blockonomics_enqueue_custom_admin_style() {
wp_enqueue_style( 'blockonomics-admin-style' );

wp_register_script( 'blockonomics-admin-scripts', plugins_url('js/admin.js', __FILE__), array(), get_plugin_data( __FILE__ )['Version'], array( 'strategy' => 'defer' ) );

wp_localize_script('blockonomics-admin-scripts', 'blockonomics_params', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'apikey' => get_option('blockonomics_api_key')
Expand Down Expand Up @@ -154,7 +154,7 @@ function add_payment_page_shortcode() {
if ($currentFilter == 'wp_head'){
return;
}

$show_order = isset($_GET["show_order"]) ? sanitize_text_field(wp_unslash($_GET['show_order'])) : "";
$crypto = isset($_GET["crypto"]) ? sanitize_key($_GET['crypto']) : "";
$select_crypto = isset($_GET["select_crypto"]) ? sanitize_text_field(wp_unslash($_GET['select_crypto'])) : "";
Expand Down Expand Up @@ -198,7 +198,7 @@ function update_payment_url_on_underpayments($pay_url, $order) {
return esc_url($blockonomics->get_order_checkout_url($order_id));

}

/**
* Add Styles to Blockonomics Admin Page
**/
Expand All @@ -210,7 +210,7 @@ function blockonomics_load_admin_scripts($hook){
/**
* Adding new filter to WooCommerce orders
**/

function filter_orders() {
$screen = get_current_screen();
if ( in_array( $screen->id, array( 'edit-shop_order', 'woocommerce_page_wc-orders' ) )) {
Expand Down Expand Up @@ -241,7 +241,7 @@ function filter_orders_by_address_or_txid( $vars ) {
}
return $vars;
}

/**
* Add this Gateway to WooCommerce
**/
Expand Down Expand Up @@ -428,9 +428,15 @@ function blockonomics_create_table() {
}

function blockonomics_activation_hook() {
if(!is_plugin_active('woocommerce/woocommerce.php'))
{
trigger_error(__( 'Wordpress Bitcoin Payments - Blockonomics requires WooCommerce plugin to be installed and active.', 'blockonomics-bitcoin-payments' ).'<br>', E_USER_ERROR);
if(!is_plugin_active('woocommerce/woocommerce.php')) {
deactivate_plugins(plugin_basename(__FILE__));
$error_message = sprintf(
__('This plugin requires WooCommerce to be installed and activated. Please install and activate WooCommerce first, then activate Blockonomics Bitcoin Payments.', 'blockonomics-bitcoin-payments')
);
wp_die($error_message, 'Plugin Activation Error', array(
'response' => 200,
'back_link' => true,
));
}
}
// Page creation function for the Blockonomics payement following woo-commerce page creation shortcode logic
Expand Down
2 changes: 1 addition & 1 deletion php/Blockonomics.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ public function get_error_context($error_type){
if ($error_type == 'generic') {
// Show Generic Error to Client.
$context['error_title'] = __('Could not generate new address (This may be a temporary error. Please try again)', 'blockonomics-bitcoin-payments');
$context['error_msg'] = __('If this continues, please ask website administrator to do following:<br/><ul><li>Login to admin panel, navigate to WooCommerce > Settings > Payment. Select Manage on "Blockonomics Bitcoin" and click Test Setup to diagnose the exact issue.</li><li>Check blockonomics registered email address for error messages</li>', 'blockonomics-bitcoin-payments');
$context['error_msg'] = __('If this continues, please ask website administrator to do following:<br/><ul><li>Login to WordPress admin panel, navigate to WooCommerce > Settings > Payment. Select Manage on "Blockonomics Bitcoin" and click Test Setup to diagnose the exact issue.</li><li>Check blockonomics registered email address for error messages</li></ul>', 'blockonomics-bitcoin-payments');
} else if($error_type == 'underpaid') {
$context['error_title'] = '';
$context['error_msg'] = __('Paid order BTC amount is less than expected. Contact merchant', 'blockonomics-bitcoin-payments');
Expand Down
23 changes: 23 additions & 0 deletions templates/blockonomics_nojs_checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,29 @@
<span class="blockonomics-icon-cart"></span>
<?php echo $order['expected_fiat'] ?> <?php echo $order['currency'] ?>
</div>
<?php
if (isset($paid_fiat)) {
?>
<tr>
<th>
<div class="bnomics-header-row">
<span class="bnomics-order-id"><?php _e('Paid Amount:', 'blockonomics-bitcoin-payments'); ?></span>
<div>
<?php echo $paid_fiat ?> <?php echo $order['currency'] ?>
</div>
</div>

<div class="bnomics-header-row">
<span class="bnomics-order-id"><?php _e('Remaining Amount:', 'blockonomics-bitcoin-payments'); ?></span>
<div>
<?php echo $order['expected_fiat'] ?> <?php echo $order['currency'] ?>
</div>
</div>
</th>
</tr>
<?php
}
?>
</th>
</tr>
</table>
Expand Down
Loading