Changeset 3379052
- Timestamp:
- 10/15/2025 05:28:06 PM (6 months ago)
- Location:
- startbutton-for-woocommerce
- Files:
-
- 30 added
- 5 edited
-
tags/1.1.7 (added)
-
tags/1.1.7/assets (added)
-
tags/1.1.7/assets/._.DS_Store (added)
-
tags/1.1.7/assets/css (added)
-
tags/1.1.7/assets/css/currency-switcher.css (added)
-
tags/1.1.7/assets/images (added)
-
tags/1.1.7/assets/images/logo.png (added)
-
tags/1.1.7/assets/images/screenshot-1.png (added)
-
tags/1.1.7/assets/images/screenshot-2.png (added)
-
tags/1.1.7/assets/images/screenshot-3.png (added)
-
tags/1.1.7/assets/js (added)
-
tags/1.1.7/assets/js/admin.js (added)
-
tags/1.1.7/assets/js/blocks (added)
-
tags/1.1.7/assets/js/blocks/frontend (added)
-
tags/1.1.7/assets/js/blocks/frontend/blocks.asset.php (added)
-
tags/1.1.7/assets/js/blocks/frontend/blocks.js (added)
-
tags/1.1.7/assets/js/currency-switcher.js (added)
-
tags/1.1.7/assets/js/sb-web-sdk.min.js (added)
-
tags/1.1.7/assets/js/sb-web-sdk.min_.js (added)
-
tags/1.1.7/assets/js/sb-web-sdk.min__.js (added)
-
tags/1.1.7/assets/js/sb-web-sdk.minz.js (added)
-
tags/1.1.7/assets/js/startbutton.js (added)
-
tags/1.1.7/changelog.txt (added)
-
tags/1.1.7/includes (added)
-
tags/1.1.7/includes/class-wc-gateway-startbutton-blocks-support.php (added)
-
tags/1.1.7/includes/class-wc-gateway-startbutton.php (added)
-
tags/1.1.7/readme.txt (added)
-
tags/1.1.7/templates (added)
-
tags/1.1.7/templates/currency-switcher.php (added)
-
tags/1.1.7/woo-startbutton.php (added)
-
trunk/assets/js/startbutton.js (modified) (3 diffs)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/includes/class-wc-gateway-startbutton.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/woo-startbutton.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
startbutton-for-woocommerce/trunk/assets/js/startbutton.js
r3378480 r3379052 13 13 // const isDevelopment = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'; 14 14 console.log('url', location.origin + '/wc-api/WC_Startbutton_Webhook'); 15 console.log('wc_startbutton_params.env', wc_startbutton_params.env); 15 16 // Configuration for development environment 16 17 const config = { … … 42 43 success: (res) => { 43 44 console.log('success'); 44 $form = $( '#order_review' );45 $form.append( '<input type="hidden" name="order_id" value="' + wc_startbutton_params.order_id + '"/>' );46 $form.append( '<input type="hidden" name="startbutton_tx_ref" value="' + res.reference + '"/>' );47 $form.append( '<input type="hidden" name="startbutton_tx_id" value="' + res.transaction + '"/>' );48 $form.append( '<input type="hidden" name="startbutton_nonce" value="' + wc_startbutton_params.nonce + '"/>' );49 45 50 $form.submit(); 46 // Store payment data for redirect in finally() 47 window.startbuttonPaymentData = { 48 order_id: wc_startbutton_params.order_id, 49 tx_ref: res.reference, 50 tx_id: res.transaction, 51 nonce: wc_startbutton_params.nonce 52 }; 53 51 54 console.log('res', res); 52 55 resolve(res); … … 67 70 $('#startbutton-payment-button').removeClass('disabled'); 68 71 $('#startbutton-cancel-payment-button').removeClass('disabled'); 72 73 // Handle redirect in finally() - this will execute regardless of success/error 74 if (window.startbuttonPaymentData) { 75 const { order_id, tx_ref, tx_id, nonce } = window.startbuttonPaymentData; 76 console.log('resolved...', {order_id, tx_ref, tx_id, nonce}); 77 // Try form submission first 78 // try { 79 // $form = $( '#order_review' ); 80 // $form.append( '<input type="hidden" name="order_id" value="' + order_id + '"/>' ); 81 // $form.append( '<input type="hidden" name="startbutton_tx_ref" value="' + tx_ref + '"/>' ); 82 // $form.append( '<input type="hidden" name="startbutton_tx_id" value="' + tx_id + '"/>' ); 83 // $form.append( '<input type="hidden" name="startbutton_nonce" value="' + nonce + '"/>' ); 84 85 // $form.submit(); 86 // console.log('Form submitted successfully'); 87 // } catch (formError) { 88 // console.log('Form submission failed, attempting direct redirect:', formError); 89 // Fallback to direct URL redirect 90 const redirectUrl = wc_startbutton_params.api_url + '?' + new URLSearchParams({ 91 order_id: order_id, 92 startbutton_tx_ref: tx_ref, 93 startbutton_tx_id: tx_id, 94 startbutton_nonce: nonce 95 }).toString(); 96 97 console.log('Redirecting to:', redirectUrl); 98 window.location.href = redirectUrl; 99 // } 100 101 // Clear the stored data 102 delete window.startbuttonPaymentData; 103 } 69 104 }); 70 105 } -
startbutton-for-woocommerce/trunk/changelog.txt
r3378843 r3379052 24 24 2025-10-14 - version 1.1.6 25 25 * Bug fixes 26 27 2025-10-14 - version 1.1.7 28 * Bug fixes -
startbutton-for-woocommerce/trunk/includes/class-wc-gateway-startbutton.php
r3378480 r3379052 550 550 } 551 551 $startbutton_params['shipping_address'] = $shipping_address; 552 $startbutton_params['api_url'] = WC()->api_request_url( 'WC_Gateway_Startbutton' ); 552 553 553 554 wp_localize_script( 'wc_startbutton', 'wc_startbutton_params', $startbutton_params ); … … 784 785 error_log('=== STARTBUTTON TRANSACTION UPDATE STARTED ==='); 785 786 786 // Update request parameters 787 $order_id = isset( $_POST['order_id'] ) ? absint( $_POST['order_id'] ) : 0;788 $tx_ref = isset( $_POST['startbutton_tx_ref'] ) ? sanitize_text_field( wp_unslash($_POST['startbutton_tx_ref'] )) : '';789 $tx_id = isset( $_POST['startbutton_tx_id'] ) ? sanitize_text_field( wp_unslash($_POST['startbutton_tx_id'] )) : '';790 $nonce = isset( $_POST['startbutton_nonce'] ) ? sanitize_text_field( wp_unslash($_POST['startbutton_nonce'] )) : '';787 // Update request parameters - support both POST and GET requests 788 $order_id = isset( $_POST['order_id'] ) ? absint( $_POST['order_id'] ) : (isset( $_GET['order_id'] ) ? absint( $_GET['order_id'] ) : 0); 789 $tx_ref = isset( $_POST['startbutton_tx_ref'] ) ? sanitize_text_field( wp_unslash($_POST['startbutton_tx_ref'] )) : (isset( $_GET['startbutton_tx_ref'] ) ? sanitize_text_field( wp_unslash($_GET['startbutton_tx_ref'] )) : ''); 790 $tx_id = isset( $_POST['startbutton_tx_id'] ) ? sanitize_text_field( wp_unslash($_POST['startbutton_tx_id'] )) : (isset( $_GET['startbutton_tx_id'] ) ? sanitize_text_field( wp_unslash($_GET['startbutton_tx_id'] )) : ''); 791 $nonce = isset( $_POST['startbutton_nonce'] ) ? sanitize_text_field( wp_unslash($_POST['startbutton_nonce'] )) : (isset( $_GET['startbutton_nonce'] ) ? sanitize_text_field( wp_unslash($_GET['startbutton_nonce'] )) : ''); 791 792 792 793 error_log('Order ID: ' . $order_id); 793 794 error_log('Transaction Ref: ' . $tx_ref); 794 795 error_log('Transaction ID: ' . $tx_id); 796 error_log('Request method: ' . $_SERVER['REQUEST_METHOD']); 795 797 796 798 if ( ! $order_id || empty( $tx_ref ) || empty ( $tx_id ) || empty( $nonce )) { -
startbutton-for-woocommerce/trunk/readme.txt
r3378843 r3379052 4 4 Requires at least: 6.2 5 5 Tested up to: 6.7 6 Stable tag: 1.1. 66 Stable tag: 1.1.7 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 123 123 * Bug fixes 124 124 125 = 1.1.7 - October 14, 2025 = 126 * Bug fixes 127 125 128 == Screenshots == 126 129 -
startbutton-for-woocommerce/trunk/woo-startbutton.php
r3378843 r3379052 4 4 * Plugin URI: https://startbutton.africa 5 5 * Description: Startbutton payment gateway for WooCommerce. 6 * Version: 1.1. 66 * Version: 1.1.7 7 7 * Author: Sommysab 8 8 * License: GPL-2.0+ … … 29 29 'prod' => 'https://api.startbutton.tech', 30 30 ]); 31 define( 'STARTBUTTON_WC_VERSION', '1.1. 6' );31 define( 'STARTBUTTON_WC_VERSION', '1.1.7' ); 32 32 33 33 /**
Note: See TracChangeset
for help on using the changeset viewer.