* feat(shopify): port the order sync from the transactions feed to webshop_orders Shopify orders now land as rich rows on the Orders page (platform 'shopify'), the same surface WooCommerce uses, instead of opaque bank-feed rows on the 1584 cash account: - order-sync.ts writes through the shared upsertWebshopOrders service; the 1584/ensureManualCashAccount wiring is gone (prod has zero Shopify feed rows). Cursor/overlap/dedup, revoked classification and the frozen external_id formats are unchanged. - vat_breakdown is reconstructed from the order-level taxLines (net = tax/rate, remainder as a 0%-bucket, refuse on unusable data); refund VAT is prorated from the parent order's mix. The line-item snapshot is stored only when it reconstructs the charged total to the ore, else the invoice conversion falls back to one aggregate line. - GraphQL query gains createdAt, taxesIncluded, taxLines, lineItems and shippingLines (all non-PII; page size 100 -> 25 for query cost). - Nav gate counts active shopify_connections; the Orders empty-state CTA goes to the platform-neutral /import hub; panel/manifest copy now points at the Orders page (sv + en). - Paid-only qualification and the 90-day backfill stay; the bookkeeping-lock row filter is dropped (lock is enforced at booking, parity with WooCommerce). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(shopify): carry the prorated parent tax on refunds when per-rate bucketing is refused A refund whose parent vat_breakdown was refused (unreported rates) stored total_tax 0 and prefilled a 0%-refund with no moms reversal. The parent's total tax is now prorated into the refund row, so the booking dialog's ratio-inference fallback presents an editable bucket with the reversal instead (CodeRabbit + Swedish review + skeptic finding). Adds the mixed-rate line and truncated shipping-page tests CodeRabbit asked for. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
33 lines
1021 B
TypeScript
33 lines
1021 B
TypeScript
import type { Extension } from '@/lib/extensions/types'
|
|
import { shopifyApiRoutes } from './api-routes'
|
|
|
|
/**
|
|
* Shopify extension
|
|
*
|
|
* Connects a company's Shopify store via a merchant-created Dev Dashboard
|
|
* custom app (client credentials grant; the revealable shpat_ token flow was
|
|
* discontinued 2026-01-01) and upserts the store's paid orders and refunds
|
|
* into webshop_orders (the Orders page), with per-rate VAT and a line-item
|
|
* snapshot as booking underlag. Feed-only (same doctrine as the WooCommerce
|
|
* sync): nothing is auto-booked, and Shopify Payments payout/fee
|
|
* reconciliation is out of scope for now (phase 2).
|
|
*
|
|
* Required environment variables:
|
|
* - SHOPIFY_CREDENTIALS_ENCRYPTION_KEY (at-rest key for client id/secret)
|
|
*/
|
|
export const shopifyExtension: Extension = {
|
|
id: 'shopify',
|
|
name: 'Shopify',
|
|
version: '1.0.0',
|
|
sector: 'general',
|
|
|
|
settingsPanel: {
|
|
label: 'Shopify',
|
|
path: '/import?mode=shopify',
|
|
},
|
|
|
|
apiRoutes: shopifyApiRoutes,
|
|
}
|
|
|
|
export default shopifyExtension
|