6 Commits

Author SHA1 Message Date
wpdev c2bd02e9ec fix(2meet-data-optimizer-woocommerce-addon): record no negative commission for a fully refunded taxed order
- the amounts follow Marketplace::get_order_profit() (what the vendor is
  paid), which subtracts the full order tax after refunds; a fully refunded
  taxed order came out at subtotal = commission = -tax. The subtotal is now
  floored at 0 (security review M2); partial refunds keep matching what
  Marketplace pays
- Verify: WCOrdersInterceptorTest (full refund with tax), integration 28, unit 11, phpcs
- PR: PR-112 (2.3 acceptance security review)
2026-09-27 17:23:31 +08:00
wpdev 50989396a8 fix(2meet-data-optimizer-woocommerce-addon): recompute commission amounts on every tracked status change and refund
- the commission upsert replaces subtotal, commission, vendor_payout and
  commission_rate on conflict (it kept the first amounts, so a partial refund
  before completion never reached the row)
- woocommerce_order_refunded recomputes a tracked or already recorded order;
  a fully refunded order keeps its row at zero, untracked orders get none
- Verify: WCOrdersInterceptorTest (5 new), integration 27, unit 11, phpcs;
  dev36 flow_wc partial refund -> completed
- PR: PR-092
2026-09-27 16:29:28 +08:00
wpdev c3c4e1de44 refactor(2meet-data-optimizer-woocommerce-addon): drop the product/order hot fields and the user hot group
- Stop registering WC product/order/subscription zone fields and the user hot group; WC reads its meta directly and writes stock by SQL, so a flat copy drifts
- Keep the custom tables registration, the HPOS notice and the commissions
- Verify: composer test / test:integration; dev36 customer save, order stock reduce/restore with no DB errors
- PR: PR-085
2026-09-27 09:48:33 +08:00
wpdev 094248b75d fix(2meet-data-optimizer-woocommerce-addon): read real Marketplace commission keys
Tests / PHP Lint (pull_request) Successful in 11s
Tests / Integration Tests (pull_request) Successful in 59s
Tests / Unit Tests (pull_request) Successful in 59s
- Marketplace writes hp_vendor / hp_commission_rate / hp_commission_fee (no
  underscore); the _hp_* keys never existed, so no commission was recorded
- Compute subtotal, vendor payout and commission the way
  Marketplace::get_order_profit() does, honouring hp_vendor_include_taxes
- Store the vendor's user ID, the product's parent listing, and the platform
  commission percentage (Marketplace stores the vendor share, e.g. 0.9)

Verify: phpunit-integration --filter WCOrdersInterceptorTest (4 tests);
  WC unit 10 OK, integration 22 OK
PR: PR-012
2026-09-25 22:47:35 +08:00
wpdev b9e24814c8 test: 加入 integration 測試套件(連真實 MariaDB)
Tests / PHP Lint (push) Successful in 4s
Tests / Unit Tests (push) Successful in 16s
Tests / Integration Tests (push) Successful in 18s
從 wp-data-optimizer v3.4.6 移植 1 個 integration 測試檔,並新增
tests/integration/bootstrap.php(複用核心的 integration bootstrap,不重複
 與 WP stub)+ phpunit-integration.xml + CI integration job。
2026-07-31 09:56:48 +08:00
wpdev abe738e900 test,ci: 建立 phpunit 基建 + 移植 WC 測試 + CI workflow
Tests / PHP Lint (push) Successful in 5s
Tests / Unit Tests (push) Successful in 17s
- composer.json / phpunit.xml / tests/bootstrap.php(比照 HP AddOn,
  直接 require 核心 plugin 的 unit bootstrap)
- tests/unit/WooCommerceIntegrationTest.php(自 A 移植,10 tests)
- .gitea/workflows/test.yml:lint + unit(unit job 會一併 checkout 核心 plugin,
  因為測試 bootstrap 依賴它)

10 tests / 33 assertions GREEN

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
2026-07-31 09:20:07 +08:00