laravel-shop/database/migrations
Fabian @ Blax Software c170595ac8 feat(ledger): VAT per ledger row from Stripe's own data
stripe_transactions gets a nullable `tax` column: the VAT inside the
row's amount, in signed cents like amount, NULL = unknown.

- Charges/payments: the charge's invoice tax (tax, else total_tax_amounts
  / total_taxes) pro-rated by captured amount over invoice total, so a
  partly credit-paid invoice counts only the cash part; without an invoice,
  the Checkout Session of the payment intent (total_details.amount_tax).
- refund, payment_refund, payment_failure_refund, refund_failure carry the
  same share of the charge's VAT as their amount, signed like it.
- Fees, payouts, transfers, disputes and PayPal rows stay NULL.
- syncLedgerForCharge expands charge.invoice (falls back without it on API
  versions that lack Charge.invoice). A charge and its refunds share one
  lookup; refunds reuse the charge's ledger row; a re-import keeps a known
  value without a Stripe call. Stripe holding no VAT data is marked
  meta.tax_source=none and not asked again. A failed lookup leaves NULL and
  never breaks the import.
- shop:import-stripe-ledger --backfill-tax [--dry-run] [--since] [--recheck]
  and Shop::backfillLedgerTax() fill missing VAT read-only, idempotently.
- ledgerTotals, revenueLedgerByDay, ledgerTotalsByAccount and
  customerLedgerTotals gain a `tax` key (SUM(COALESCE(tax,0))); existing
  keys unchanged. Before the migration runs, rows save without tax and
  tax reads 0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-02 12:10:11 +01:00
..
2025_01_01_000001_create_blax_shop_tables.php fix: product_action_runs.action_id must be uuidMorphs (ProductAction is HasUuids) 2026-06-10 11:33:09 +02:00
2025_01_01_000002_create_product_price_tiers_table.php I loanable product type, tiered pricing, lifecycle events, host helpers 2026-05-15 10:27:59 +02:00
2025_01_01_000003_add_stripe_to_users_table.php I loanable product type, tiered pricing, lifecycle events, host helpers 2026-05-15 10:27:59 +02:00
2025_01_01_000004_create_blax_shop_subscriptions.php feat(subscriptions): Cashier-backed subscription lifecycle with product link + events 2026-06-02 11:40:15 +02:00
2026_01_01_000000_drop_stock_quantity_from_products.php BF edgecases, R structure, A tests 2026-05-18 13:05:38 +02:00
2026_01_01_000001_drop_in_stock_and_stock_status_from_products.php BF edgecases, R structure, A tests 2026-05-18 13:05:38 +02:00
2026_01_01_000002_add_max_per_cart_and_max_per_user_to_products.php IAM "max usage" feature 2026-05-19 14:01:52 +02:00
2026_01_01_000003_create_license_seats_table.php feat(seats): assignable license seats — buy N, assign/reassign/reclaim per user 2026-07-29 10:07:58 +02:00
2026_01_01_000004_add_cost_amount_to_product_prices.php feat(cost): per-price cost basis (COGS) + net-MRR margin 2026-08-28 15:12:42 +02:00
2026_01_01_000005_add_license_fee_to_product_prices.php feat(cost): royalty / minimum-licence-fee margin (Aircademy-style) 2026-08-28 16:03:04 +02:00
2026_09_03_000001_create_stripe_transactions_table.php feat(ledger): user-independent Stripe BalanceTransaction ledger + daily net stats 2026-09-03 10:01:07 +02:00
2026_10_07_000001_add_provider_and_account_to_stripe_transactions_table.php feat(ledger): mirror PayPal accounts into the money ledger 2026-10-07 10:46:46 +02:00
2026_11_02_000001_add_tax_to_stripe_transactions_table.php feat(ledger): VAT per ledger row from Stripe's own data 2026-11-02 12:10:11 +01:00