Compare commits
5 Commits
22afabc649
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ad3f604321 | |||
| 5d13f70f16 | |||
| 4d3d1774b6 | |||
| d9d3556579 | |||
| c2bd02e9ec |
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: 2meet Data Optimizer — Woocommerce AddOn
|
||||
* Plugin URI: https://2meet.io/2meet-data-optimizer/woocommerce
|
||||
* Description: WooCommerce 整合:20 表 schema 註冊 + commission tracking (wp_wpdo_wc_commissions) + product/order zone + HPOS notice
|
||||
* Version: 0.3.0
|
||||
* Version: 0.3.1
|
||||
* Requires at least: 6.0
|
||||
* Tested up to: 6.9.4
|
||||
* Requires PHP: 8.1
|
||||
@@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define( 'TMDO_WOOCOMMERCE_VERSION', '0.3.0' );
|
||||
define( 'TMDO_WOOCOMMERCE_VERSION', '0.3.1' );
|
||||
define( 'TMDO_WOOCOMMERCE_PATH', plugin_dir_path( __FILE__ ) );
|
||||
define( 'TMDO_WOOCOMMERCE_URL', plugin_dir_url( __FILE__ ) );
|
||||
define( 'TMDO_WOOCOMMERCE_FILE', __FILE__ );
|
||||
|
||||
@@ -11,6 +11,13 @@ Versioning follows [Semantic Versioning](https://semver.org/).
|
||||
|
||||
---
|
||||
|
||||
## [0.3.1] — 2026-10-02 — 重新打包
|
||||
|
||||
### Changed
|
||||
- 重新打包(無功能變更):與 WP-MVB v8 樞紐站(dev39)一同驗收後發版;程式碼與前一版相同。
|
||||
|
||||
---
|
||||
|
||||
## [0.3.0] — 2026-09-27
|
||||
|
||||
Released with 2meet-data-optimizer 1.3.0 (hardening 2.3).
|
||||
@@ -26,6 +33,10 @@ Released with 2meet-data-optimizer 1.3.0 (hardening 2.3).
|
||||
status `refunded`; untracked orders get none). Repeated events still leave
|
||||
one row per order and vendor. dev36: partial refund then completion records
|
||||
the refunded amount. (PR-092)
|
||||
- Amounts follow Marketplace::get_order_profit() (what the vendor is paid,
|
||||
which subtracts the full tax after refunds); the subtotal is floored at 0,
|
||||
so a fully refunded taxed order no longer records a negative commission.
|
||||
(PR-112)
|
||||
|
||||
### Upgrading
|
||||
|
||||
|
||||
@@ -149,6 +149,10 @@ class TMDO_WC_Orders_Interceptor extends TMDO_Interceptor_Base {
|
||||
if ( ! get_option( 'hp_vendor_include_taxes' ) ) {
|
||||
$subtotal -= (float) $order->get_total_tax();
|
||||
}
|
||||
// Marketplace subtracts the full tax even after a refund; a fully
|
||||
// refunded taxed order would otherwise record a negative amount.
|
||||
$subtotal = max( 0.0, $subtotal );
|
||||
|
||||
$vendor_payout = max( 0.0, $subtotal * $vendor_share - $fee );
|
||||
$commission = $subtotal - $vendor_payout;
|
||||
$commission_rate = round( ( 1 - $vendor_share ) * 100, 2 ); // Platform percentage, as set in Marketplace.
|
||||
|
||||
@@ -204,6 +204,23 @@ class WCOrdersInterceptorTest extends TestCase {
|
||||
$this->assertEqualsWithDelta( 0.0, (float) $row['vendor_payout'], 0.0001 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Amounts follow Marketplace::get_order_profit() (what the vendor is paid,
|
||||
* which subtracts the full tax after refunds), but a fully refunded taxed
|
||||
* order must not record a negative subtotal or commission.
|
||||
*/
|
||||
public function test_a_fully_refunded_taxed_order_records_no_negative_amounts(): void {
|
||||
$this->place_order( $this->marketplace_meta(), 110.0, 10.0 );
|
||||
$this->refund( 110.0, 'refunded' );
|
||||
|
||||
( new TMDO_WC_Orders_Interceptor() )->action_order_refunded( self::ORDER_ID, 1 );
|
||||
|
||||
$row = $this->commission_row();
|
||||
$this->assertEqualsWithDelta( 0.0, (float) $row['subtotal'], 0.0001 );
|
||||
$this->assertEqualsWithDelta( 0.0, (float) $row['commission'], 0.0001 );
|
||||
$this->assertEqualsWithDelta( 0.0, (float) $row['vendor_payout'], 0.0001 );
|
||||
}
|
||||
|
||||
public function test_a_refund_of_an_untracked_order_records_nothing(): void {
|
||||
$this->refund( 50.0, 'pending' );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user