Changeset 3633701
- Timestamp:
- 08/04/2026 04:52:32 AM (3 months ago)
- Location:
- gamerhub-for-woocommerce
- Files:
-
- 10 edited
- 1 copied
-
tags/1.3.1 (copied) (copied from gamerhub-for-woocommerce/trunk )
-
tags/1.3.1/gamerhub-for-woocommerce.php (modified) (2 diffs)
-
tags/1.3.1/includes/class-gamerhub-orders.php (modified) (1 diff)
-
tags/1.3.1/includes/class-gamerhub-settings.php (modified) (2 diffs)
-
tags/1.3.1/includes/class-gamerhub-sync.php (modified) (4 diffs)
-
tags/1.3.1/readme.txt (modified) (3 diffs)
-
trunk/gamerhub-for-woocommerce.php (modified) (2 diffs)
-
trunk/includes/class-gamerhub-orders.php (modified) (1 diff)
-
trunk/includes/class-gamerhub-settings.php (modified) (2 diffs)
-
trunk/includes/class-gamerhub-sync.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gamerhub-for-woocommerce/tags/1.3.1/gamerhub-for-woocommerce.php
r3633305 r3633701 4 4 * Plugin URI: https://portal.gamerhubstore.shop 5 5 * Description: Sell game top-ups & vouchers through GamerHub. Auto-fulfills WooCommerce orders on payment and syncs status back via a signed webhook. 6 * Version: 1.3. 06 * Version: 1.3.1 7 7 * Author: GamerHub 8 8 * License: GPL-2.0-or-later … … 20 20 } 21 21 22 define('GAMERHUB_VERSION', '1.3. 0');22 define('GAMERHUB_VERSION', '1.3.1'); 23 23 define('GAMERHUB_FILE', __FILE__); 24 24 define('GAMERHUB_DIR', plugin_dir_path(__FILE__)); -
gamerhub-for-woocommerce/tags/1.3.1/includes/class-gamerhub-orders.php
r3633305 r3633701 702 702 $subs = json_decode((string) $item->get_meta('_gamerhub_subs') ?: '[]', true); 703 703 if (is_array($subs) && ! empty($subs)) { 704 // A qty>1 line is placed one unit at a time, and place() saves _gamerhub_subs after 705 // EVERY unit so an instant delivery webhook can find the sub it belongs to. That means 706 // this can be asked for a status while placement is still running, with only some of 707 // the units in the list — and aggregating a partial list says "all done" as soon as 708 // those few are done. 709 // 710 // That is not cosmetic. refresh_status() would mark the WooCommerce order Complete and 711 // send the completion email after, say, 3 of 5 units; if unit 4 then FAILED, the order 712 // is already Complete and can never fall through to On Hold. The customer paid for 5, 713 // received 3, and the shop believes it is finished. Seen live on order #3226. 714 // 715 // Counting against the line quantity is stateless and self-correcting — no in-progress 716 // flag to leak if the request dies mid-placement. qty=1 lines are unaffected. 717 $qty = 1; 718 if (is_object($item) && method_exists($item, 'get_quantity')) { 719 $qty = max(1, (int) $item->get_quantity()); 720 } 721 if (count($subs) < $qty) { 722 return 'pending'; // still being placed — not finished, not failed 723 } 724 704 725 return self::agg_status($subs); 705 726 } -
gamerhub-for-woocommerce/tags/1.3.1/includes/class-gamerhub-settings.php
r3633305 r3633701 203 203 'auto_import' => ! empty($_POST['auto_import']) ? '1' : '0', 204 204 'import_images' => ! empty($_POST['import_images']) ? '1' : '0', 205 'needs_shipping' => ! empty($_POST['needs_shipping']) ? '1' : '0', 205 206 // Allow-list, and 'optional' on anything unexpected: a stray value must never make a 206 207 // shop stricter than the owner chose and start refusing add-to-cart. … … 406 407 <?php esc_html_e('Use GamerHub’s artwork for games I add', 'gamerhub-for-woocommerce'); ?> 407 408 </label> 409 <label style="display:block;margin-top:10px;"> 410 <input type="checkbox" name="needs_shipping" value="1" <?php checked(gamerhub_opt('needs_shipping', '0'), '1'); ?> /> 411 <?php esc_html_e('These products need shipping (untick “Virtual”)', 'gamerhub-for-woocommerce'); ?> 412 </label> 413 <?php self::hint( 414 __('Leave this OFF unless you deliberately want to collect a shipping address.', 'gamerhub-for-woocommerce'), 415 __('A top-up is delivered to a game account, so GamerHub marks these products Virtual — WooCommerce then asks for no address and charges no shipping. Turn this on and they become physical goods: WooCommerce will require a shipping method, and a shop that has none configured shows “No shipping options were found” and CANNOT take orders at all. Only turn it on if you have set up shipping zones first. It applies to games you add or sync from then on.', 'gamerhub-for-woocommerce') 416 ); ?> 408 417 <p class="description" style="margin:2px 0 0;max-width:640px;"> 409 418 <?php esc_html_e('The picture is copied into your own Media Library the first time you add a game, so your shop serves it, not us. A game you have already given your own picture is never changed.', 'gamerhub-for-woocommerce'); ?> -
gamerhub-for-woocommerce/tags/1.3.1/includes/class-gamerhub-sync.php
r3633305 r3633701 258 258 $parent->set_status('publish'); 259 259 $parent->set_catalog_visibility('visible'); 260 $parent->set_virtual( true);260 $parent->set_virtual(! self::needs_shipping()); 261 261 $parent->set_downloadable(false); 262 262 $parent->set_attributes([$attr]); … … 343 343 $var->set_attributes(['denomination' => $label]); 344 344 $var->set_status('publish'); 345 $var->set_virtual( true);345 $var->set_virtual(! self::needs_shipping()); 346 346 $var->set_regular_price((string) $retail); 347 347 $var->set_stock_status(($sku['stock_status'] ?? 'in_stock') !== 'out_of_stock' ? 'instock' : 'outofstock'); … … 1022 1022 update_option(self::IMAGE_MAP, $map, false); 1023 1023 return (int) $id; 1024 } 1025 1026 1027 /** 1028 * Should imported products be flagged as needing shipping? 1029 * 1030 * Default NO — a top-up is delivered to a game account, so these are Virtual and WooCommerce 1031 * asks for no address. Turning it on makes them physical goods, and a shop with no shipping 1032 * zone configured then shows "No shipping options were found" and cannot take orders at all. 1033 * That is why it is opt-in rather than a per-product guess. 1034 */ 1035 private static function needs_shipping(): bool 1036 { 1037 return gamerhub_opt('needs_shipping', '0') === '1'; 1024 1038 } 1025 1039 … … 1986 2000 $wc->set_status('publish'); 1987 2001 $wc->set_catalog_visibility('visible'); 1988 $wc->set_virtual( true);2002 $wc->set_virtual(! self::needs_shipping()); 1989 2003 $wc->set_downloadable(false); 1990 2004 $wc->set_sold_individually(true); -
gamerhub-for-woocommerce/tags/1.3.1/readme.txt
r3633305 r3633701 7 7 WC requires at least: 7.1 8 8 WC tested up to: 10.9 9 Stable tag: 1.3. 09 Stable tag: 1.3.1 10 10 License: GPLv2 or later 11 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 104 104 == Changelog == 105 105 106 = 1.3.1 = 107 * Fixed: an order for several units of the same item could be marked Complete - and the completion email sent - while only some of those units had been delivered. If a later unit then failed, the order was already Complete and could never fall through to On Hold, so a part-delivered order looked finished. An order now waits until every unit has reported. 108 * New: "These products need shipping" (GamerHub -> Setup). GamerHub products are Virtual by default, so WooCommerce asks for no address and charges no shipping. Turn this on only if you have set up shipping zones - a shop with none will show "No shipping options were found" and cannot take orders. 109 106 110 = 1.3.0 = 107 111 * **Verify a buyer's game account before they pay.** Games that support it now show a "Verify Account" button under the player fields. It confirms the account exists and shows its name and region, so a mistyped ID is caught before money moves. It never blocks a sale - if the check fails, or is unavailable, the buyer can carry on, and the order records which of the two it was. … … 150 154 == Upgrade Notice == 151 155 156 = 1.3.1 = 157 Fixes a multi-unit order being marked Complete before every unit was delivered, which could hide a failed unit that should have sent the order to On Hold. 158 152 159 = 1.3.0 = 153 160 Adds a pre-purchase account check, gift-card codes shown in the order, and game artwork. Fixes prices written up to ten minutes stale, a manual exchange rate losing its currency pair, and add-to-cart checks being discarded on shops running WooCommerce Product Add-ons. -
gamerhub-for-woocommerce/trunk/gamerhub-for-woocommerce.php
r3633305 r3633701 4 4 * Plugin URI: https://portal.gamerhubstore.shop 5 5 * Description: Sell game top-ups & vouchers through GamerHub. Auto-fulfills WooCommerce orders on payment and syncs status back via a signed webhook. 6 * Version: 1.3. 06 * Version: 1.3.1 7 7 * Author: GamerHub 8 8 * License: GPL-2.0-or-later … … 20 20 } 21 21 22 define('GAMERHUB_VERSION', '1.3. 0');22 define('GAMERHUB_VERSION', '1.3.1'); 23 23 define('GAMERHUB_FILE', __FILE__); 24 24 define('GAMERHUB_DIR', plugin_dir_path(__FILE__)); -
gamerhub-for-woocommerce/trunk/includes/class-gamerhub-orders.php
r3633305 r3633701 702 702 $subs = json_decode((string) $item->get_meta('_gamerhub_subs') ?: '[]', true); 703 703 if (is_array($subs) && ! empty($subs)) { 704 // A qty>1 line is placed one unit at a time, and place() saves _gamerhub_subs after 705 // EVERY unit so an instant delivery webhook can find the sub it belongs to. That means 706 // this can be asked for a status while placement is still running, with only some of 707 // the units in the list — and aggregating a partial list says "all done" as soon as 708 // those few are done. 709 // 710 // That is not cosmetic. refresh_status() would mark the WooCommerce order Complete and 711 // send the completion email after, say, 3 of 5 units; if unit 4 then FAILED, the order 712 // is already Complete and can never fall through to On Hold. The customer paid for 5, 713 // received 3, and the shop believes it is finished. Seen live on order #3226. 714 // 715 // Counting against the line quantity is stateless and self-correcting — no in-progress 716 // flag to leak if the request dies mid-placement. qty=1 lines are unaffected. 717 $qty = 1; 718 if (is_object($item) && method_exists($item, 'get_quantity')) { 719 $qty = max(1, (int) $item->get_quantity()); 720 } 721 if (count($subs) < $qty) { 722 return 'pending'; // still being placed — not finished, not failed 723 } 724 704 725 return self::agg_status($subs); 705 726 } -
gamerhub-for-woocommerce/trunk/includes/class-gamerhub-settings.php
r3633305 r3633701 203 203 'auto_import' => ! empty($_POST['auto_import']) ? '1' : '0', 204 204 'import_images' => ! empty($_POST['import_images']) ? '1' : '0', 205 'needs_shipping' => ! empty($_POST['needs_shipping']) ? '1' : '0', 205 206 // Allow-list, and 'optional' on anything unexpected: a stray value must never make a 206 207 // shop stricter than the owner chose and start refusing add-to-cart. … … 406 407 <?php esc_html_e('Use GamerHub’s artwork for games I add', 'gamerhub-for-woocommerce'); ?> 407 408 </label> 409 <label style="display:block;margin-top:10px;"> 410 <input type="checkbox" name="needs_shipping" value="1" <?php checked(gamerhub_opt('needs_shipping', '0'), '1'); ?> /> 411 <?php esc_html_e('These products need shipping (untick “Virtual”)', 'gamerhub-for-woocommerce'); ?> 412 </label> 413 <?php self::hint( 414 __('Leave this OFF unless you deliberately want to collect a shipping address.', 'gamerhub-for-woocommerce'), 415 __('A top-up is delivered to a game account, so GamerHub marks these products Virtual — WooCommerce then asks for no address and charges no shipping. Turn this on and they become physical goods: WooCommerce will require a shipping method, and a shop that has none configured shows “No shipping options were found” and CANNOT take orders at all. Only turn it on if you have set up shipping zones first. It applies to games you add or sync from then on.', 'gamerhub-for-woocommerce') 416 ); ?> 408 417 <p class="description" style="margin:2px 0 0;max-width:640px;"> 409 418 <?php esc_html_e('The picture is copied into your own Media Library the first time you add a game, so your shop serves it, not us. A game you have already given your own picture is never changed.', 'gamerhub-for-woocommerce'); ?> -
gamerhub-for-woocommerce/trunk/includes/class-gamerhub-sync.php
r3633305 r3633701 258 258 $parent->set_status('publish'); 259 259 $parent->set_catalog_visibility('visible'); 260 $parent->set_virtual( true);260 $parent->set_virtual(! self::needs_shipping()); 261 261 $parent->set_downloadable(false); 262 262 $parent->set_attributes([$attr]); … … 343 343 $var->set_attributes(['denomination' => $label]); 344 344 $var->set_status('publish'); 345 $var->set_virtual( true);345 $var->set_virtual(! self::needs_shipping()); 346 346 $var->set_regular_price((string) $retail); 347 347 $var->set_stock_status(($sku['stock_status'] ?? 'in_stock') !== 'out_of_stock' ? 'instock' : 'outofstock'); … … 1022 1022 update_option(self::IMAGE_MAP, $map, false); 1023 1023 return (int) $id; 1024 } 1025 1026 1027 /** 1028 * Should imported products be flagged as needing shipping? 1029 * 1030 * Default NO — a top-up is delivered to a game account, so these are Virtual and WooCommerce 1031 * asks for no address. Turning it on makes them physical goods, and a shop with no shipping 1032 * zone configured then shows "No shipping options were found" and cannot take orders at all. 1033 * That is why it is opt-in rather than a per-product guess. 1034 */ 1035 private static function needs_shipping(): bool 1036 { 1037 return gamerhub_opt('needs_shipping', '0') === '1'; 1024 1038 } 1025 1039 … … 1986 2000 $wc->set_status('publish'); 1987 2001 $wc->set_catalog_visibility('visible'); 1988 $wc->set_virtual( true);2002 $wc->set_virtual(! self::needs_shipping()); 1989 2003 $wc->set_downloadable(false); 1990 2004 $wc->set_sold_individually(true); -
gamerhub-for-woocommerce/trunk/readme.txt
r3633305 r3633701 7 7 WC requires at least: 7.1 8 8 WC tested up to: 10.9 9 Stable tag: 1.3. 09 Stable tag: 1.3.1 10 10 License: GPLv2 or later 11 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 104 104 == Changelog == 105 105 106 = 1.3.1 = 107 * Fixed: an order for several units of the same item could be marked Complete - and the completion email sent - while only some of those units had been delivered. If a later unit then failed, the order was already Complete and could never fall through to On Hold, so a part-delivered order looked finished. An order now waits until every unit has reported. 108 * New: "These products need shipping" (GamerHub -> Setup). GamerHub products are Virtual by default, so WooCommerce asks for no address and charges no shipping. Turn this on only if you have set up shipping zones - a shop with none will show "No shipping options were found" and cannot take orders. 109 106 110 = 1.3.0 = 107 111 * **Verify a buyer's game account before they pay.** Games that support it now show a "Verify Account" button under the player fields. It confirms the account exists and shows its name and region, so a mistyped ID is caught before money moves. It never blocks a sale - if the check fails, or is unavailable, the buyer can carry on, and the order records which of the two it was. … … 150 154 == Upgrade Notice == 151 155 156 = 1.3.1 = 157 Fixes a multi-unit order being marked Complete before every unit was delivered, which could hide a failed unit that should have sent the order to On Hold. 158 152 159 = 1.3.0 = 153 160 Adds a pre-purchase account check, gift-card codes shown in the order, and game artwork. Fixes prices written up to ten minutes stale, a manual exchange rate losing its currency pair, and add-to-cart checks being discarded on shops running WooCommerce Product Add-ons.
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)