Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Added the seller ledger screens to the operator dashboard
Damian Legawiecdd3c3206c6bb
diff --git a/packages/dashboard-starter/src/routeTree.gen.ts b/packages/dashboard-starter/src/routeTree.gen.tsindex 0cfcf180ca..2a665e773c 100644--- a/packages/dashboard-starter/src/routeTree.gen.ts+++ b/packages/dashboard-starter/src/routeTree.gen.ts@@ -53,6 +53,7 @@ import { Route as SettingsCommissionRatesRouteImport } from './../../dashboard/simport { Route as SettingsChannelsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/channels'import { Route as SettingsApiKeysRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/api-keys'import { Route as SettingsAllowedOriginsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins'+import { Route as SellersTransfersRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/sellers/transfers'import { Route as SellersSellerIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId'import { Route as PromotionsNewRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/promotions/new'import { Route as PromotionsGiftCardsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards'@@ -72,12 +73,14 @@ import { Route as BrandsDotbrandIdRouteImport } from './../../dashboard-plugin-eimport { Route as SettingsWebhooksIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/webhooks/index'import { Route as SettingsImportsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/imports/index'import { Route as SettingsDeliveryProfilesIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/index'+import { Route as SellersPayoutsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/sellers/payouts/index'import { Route as ProductsPriceListsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/price-lists/index'import { Route as ProductsCollectionsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/collections/index'import { Route as ProductsCategoriesIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/categories/index'import { Route as ProductsCatalogsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/catalogs/index'import { Route as OrdersOrderIdIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/orders/$orderId/index'import { Route as SettingsWebhooksWebhookEndpointIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'+import { Route as SellersPayoutsPayoutIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/sellers/payouts/$payoutId'import { Route as ProductsPriceListsNewRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/price-lists/new'import { Route as ProductsCollectionsNewRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/collections/new'import { Route as ProductsCollectionsCollectionIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/collections/$collectionId'@@ -312,6 +315,11 @@ const SettingsAllowedOriginsRoute = SettingsAllowedOriginsRouteImport.update({path: '/allowed-origins',getParentRoute: () => SettingsRoute,} as any)+const SellersTransfersRoute = SellersTransfersRouteImport.update({+ id: '/sellers/transfers',+ path: '/sellers/transfers',+ getParentRoute: () => authenticatedStoreIdRoute,+} as any)const SellersSellerIdRoute = SellersSellerIdRouteImport.update({id: '/sellers/$sellerId',path: '/sellers/$sellerId',@@ -408,6 +416,11 @@ const SettingsDeliveryProfilesIndexRoute =path: '/delivery-profiles/',getParentRoute: () => SettingsRoute,} as any)+const SellersPayoutsIndexRoute = SellersPayoutsIndexRouteImport.update({+ id: '/sellers/payouts/',+ path: '/sellers/payouts/',+ getParentRoute: () => authenticatedStoreIdRoute,+} as any)const ProductsPriceListsIndexRoute = ProductsPriceListsIndexRouteImport.update({id: '/products/price-lists/',path: '/products/price-lists/',@@ -440,6 +453,11 @@ const SettingsWebhooksWebhookEndpointIdRoute =path: '/webhooks/$webhookEndpointId',getParentRoute: () => SettingsRoute,} as any)+const SellersPayoutsPayoutIdRoute = SellersPayoutsPayoutIdRouteImport.update({+ id: '/sellers/payouts/$payoutId',+ path: '/sellers/payouts/$payoutId',+ getParentRoute: () => authenticatedStoreIdRoute,+} as any)const ProductsPriceListsNewRoute = ProductsPriceListsNewRouteImport.update({id: '/products/price-lists/new',path: '/products/price-lists/new',@@ -534,6 +552,7 @@ export interface FileRoutesByFullPath {'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute'/$storeId/promotions/new': typeof PromotionsNewRoute'/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute+ '/$storeId/sellers/transfers': typeof SellersTransfersRoute'/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute'/$storeId/settings/api-keys': typeof SettingsApiKeysRoute'/$storeId/settings/channels': typeof SettingsChannelsRoute@@ -570,12 +589,14 @@ export interface FileRoutesByFullPath {'/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute'/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute'/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute+ '/$storeId/sellers/payouts/$payoutId': typeof SellersPayoutsPayoutIdRoute'/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute'/$storeId/orders/$orderId/': typeof OrdersOrderIdIndexRoute'/$storeId/products/catalogs/': typeof ProductsCatalogsIndexRoute'/$storeId/products/categories/': typeof ProductsCategoriesIndexRoute'/$storeId/products/collections/': typeof ProductsCollectionsIndexRoute'/$storeId/products/price-lists/': typeof ProductsPriceListsIndexRoute+ '/$storeId/sellers/payouts/': typeof SellersPayoutsIndexRoute'/$storeId/settings/delivery-profiles/': typeof SettingsDeliveryProfilesIndexRoute'/$storeId/settings/imports/': typeof SettingsImportsIndexRoute'/$storeId/settings/webhooks/': typeof SettingsWebhooksIndexRoute@@ -613,6 +634,7 @@ export interface FileRoutesByTo {'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute'/$storeId/promotions/new': typeof PromotionsNewRoute'/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute+ '/$storeId/sellers/transfers': typeof SellersTransfersRoute'/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute'/$storeId/settings/api-keys': typeof SettingsApiKeysRoute'/$storeId/settings/channels': typeof SettingsChannelsRoute@@ -649,12 +671,14 @@ export interface FileRoutesByTo {'/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute'/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute'/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute+ '/$storeId/sellers/payouts/$payoutId': typeof SellersPayoutsPayoutIdRoute'/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute'/$storeId/orders/$orderId': typeof OrdersOrderIdIndexRoute'/$storeId/products/catalogs': typeof ProductsCatalogsIndexRoute'/$storeId/products/categories': typeof ProductsCategoriesIndexRoute'/$storeId/products/collections': typeof ProductsCollectionsIndexRoute'/$storeId/products/price-lists': typeof ProductsPriceListsIndexRoute+ '/$storeId/sellers/payouts': typeof SellersPayoutsIndexRoute'/$storeId/settings/delivery-profiles': typeof SettingsDeliveryProfilesIndexRoute'/$storeId/settings/imports': typeof SettingsImportsIndexRoute'/$storeId/settings/webhooks': typeof SettingsWebhooksIndexRoute@@ -696,6 +720,7 @@ export interface FileRoutesById {'/_authenticated/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute'/_authenticated/$storeId/promotions/new': typeof PromotionsNewRoute'/_authenticated/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute+ '/_authenticated/$storeId/sellers/transfers': typeof SellersTransfersRoute'/_authenticated/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute'/_authenticated/$storeId/settings/api-keys': typeof SettingsApiKeysRoute'/_authenticated/$storeId/settings/channels': typeof SettingsChannelsRoute@@ -732,12 +757,14 @@ export interface FileRoutesById {'/_authenticated/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute'/_authenticated/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute'/_authenticated/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute+ '/_authenticated/$storeId/sellers/payouts/$payoutId': typeof SellersPayoutsPayoutIdRoute'/_authenticated/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute'/_authenticated/$storeId/orders/$orderId/': typeof OrdersOrderIdIndexRoute'/_authenticated/$storeId/products/catalogs/': typeof ProductsCatalogsIndexRoute'/_authenticated/$storeId/products/categories/': typeof ProductsCategoriesIndexRoute'/_authenticated/$storeId/products/collections/': typeof ProductsCollectionsIndexRoute'/_authenticated/$storeId/products/price-lists/': typeof ProductsPriceListsIndexRoute+ '/_authenticated/$storeId/sellers/payouts/': typeof SellersPayoutsIndexRoute'/_authenticated/$storeId/settings/delivery-profiles/': typeof SettingsDeliveryProfilesIndexRoute'/_authenticated/$storeId/settings/imports/': typeof SettingsImportsIndexRoute'/_authenticated/$storeId/settings/webhooks/': typeof SettingsWebhooksIndexRoute@@ -779,6 +806,7 @@ export interface FileRouteTypes {| '/$storeId/promotions/gift-cards'| '/$storeId/promotions/new'| '/$storeId/sellers/$sellerId'+ | '/$storeId/sellers/transfers'| '/$storeId/settings/allowed-origins'| '/$storeId/settings/api-keys'| '/$storeId/settings/channels'@@ -815,12 +843,14 @@ export interface FileRouteTypes {| '/$storeId/products/collections/$collectionId'| '/$storeId/products/collections/new'| '/$storeId/products/price-lists/new'+ | '/$storeId/sellers/payouts/$payoutId'| '/$storeId/settings/webhooks/$webhookEndpointId'| '/$storeId/orders/$orderId/'| '/$storeId/products/catalogs/'| '/$storeId/products/categories/'| '/$storeId/products/collections/'| '/$storeId/products/price-lists/'+ | '/$storeId/sellers/payouts/'| '/$storeId/settings/delivery-profiles/'| '/$storeId/settings/imports/'| '/$storeId/settings/webhooks/'@@ -858,6 +888,7 @@ export interface FileRouteTypes {| '/$storeId/promotions/gift-cards'| '/$storeId/promotions/new'| '/$storeId/sellers/$sellerId'+ | '/$storeId/sellers/transfers'| '/$storeId/settings/allowed-origins'| '/$storeId/settings/api-keys'| '/$storeId/settings/channels'@@ -894,12 +925,14 @@ export interface FileRouteTypes {| '/$storeId/products/collections/$collectionId'| '/$storeId/products/collections/new'| '/$storeId/products/price-lists/new'+ | '/$storeId/sellers/payouts/$payoutId'| '/$storeId/settings/webhooks/$webhookEndpointId'| '/$storeId/orders/$orderId'| '/$storeId/products/catalogs'| '/$storeId/products/categories'| '/$storeId/products/collections'| '/$storeId/products/price-lists'+ | '/$storeId/sellers/payouts'| '/$storeId/settings/delivery-profiles'| '/$storeId/settings/imports'| '/$storeId/settings/webhooks'@@ -940,6 +973,7 @@ export interface FileRouteTypes {| '/_authenticated/$storeId/promotions/gift-cards'| '/_authenticated/$storeId/promotions/new'| '/_authenticated/$storeId/sellers/$sellerId'+ | '/_authenticated/$storeId/sellers/transfers'| '/_authenticated/$storeId/settings/allowed-origins'| '/_authenticated/$storeId/settings/api-keys'| '/_authenticated/$storeId/settings/channels'@@ -976,12 +1010,14 @@ export interface FileRouteTypes {| '/_authenticated/$storeId/products/collections/$collectionId'| '/_authenticated/$storeId/products/collections/new'| '/_authenticated/$storeId/products/price-lists/new'+ | '/_authenticated/$storeId/sellers/payouts/$payoutId'| '/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'| '/_authenticated/$storeId/orders/$orderId/'| '/_authenticated/$storeId/products/catalogs/'| '/_authenticated/$storeId/products/categories/'| '/_authenticated/$storeId/products/collections/'| '/_authenticated/$storeId/products/price-lists/'+ | '/_authenticated/$storeId/sellers/payouts/'| '/_authenticated/$storeId/settings/delivery-profiles/'| '/_authenticated/$storeId/settings/imports/'| '/_authenticated/$storeId/settings/webhooks/'@@ -1310,6 +1346,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof SettingsAllowedOriginsRouteImportparentRoute: typeof SettingsRoute}+ '/_authenticated/$storeId/sellers/transfers': {+ id: '/_authenticated/$storeId/sellers/transfers'+ path: '/sellers/transfers'+ fullPath: '/$storeId/sellers/transfers'+ preLoaderRoute: typeof SellersTransfersRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }'/_authenticated/$storeId/sellers/$sellerId': {id: '/_authenticated/$storeId/sellers/$sellerId'path: '/sellers/$sellerId'@@ -1443,6 +1486,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof SettingsDeliveryProfilesIndexRouteImportparentRoute: typeof SettingsRoute}+ '/_authenticated/$storeId/sellers/payouts/': {+ id: '/_authenticated/$storeId/sellers/payouts/'+ path: '/sellers/payouts'+ fullPath: '/$storeId/sellers/payouts/'+ preLoaderRoute: typeof SellersPayoutsIndexRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }'/_authenticated/$storeId/products/price-lists/': {id: '/_authenticated/$storeId/products/price-lists/'path: '/products/price-lists'@@ -1485,6 +1535,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof SettingsWebhooksWebhookEndpointIdRouteImportparentRoute: typeof SettingsRoute}+ '/_authenticated/$storeId/sellers/payouts/$payoutId': {+ id: '/_authenticated/$storeId/sellers/payouts/$payoutId'+ path: '/sellers/payouts/$payoutId'+ fullPath: '/$storeId/sellers/payouts/$payoutId'+ preLoaderRoute: typeof SellersPayoutsPayoutIdRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }'/_authenticated/$storeId/products/price-lists/new': {id: '/_authenticated/$storeId/products/price-lists/new'path: '/products/price-lists/new'@@ -1661,6 +1718,7 @@ interface authenticatedStoreIdRouteChildren {PromotionsGiftCardsRoute: typeof PromotionsGiftCardsRoutePromotionsNewRoute: typeof PromotionsNewRouteSellersSellerIdRoute: typeof SellersSellerIdRoute+ SellersTransfersRoute: typeof SellersTransfersRouteBrandsDotindexRoute: typeof BrandsDotindexRouteCompaniesIndexRoute: typeof CompaniesIndexRouteCustomersIndexRoute: typeof CustomersIndexRoute@@ -1675,11 +1733,13 @@ interface authenticatedStoreIdRouteChildren {ProductsCollectionsCollectionIdRoute: typeof ProductsCollectionsCollectionIdRouteProductsCollectionsNewRoute: typeof ProductsCollectionsNewRouteProductsPriceListsNewRoute: typeof ProductsPriceListsNewRoute+ SellersPayoutsPayoutIdRoute: typeof SellersPayoutsPayoutIdRouteOrdersOrderIdIndexRoute: typeof OrdersOrderIdIndexRouteProductsCatalogsIndexRoute: typeof ProductsCatalogsIndexRouteProductsCategoriesIndexRoute: typeof ProductsCategoriesIndexRouteProductsCollectionsIndexRoute: typeof ProductsCollectionsIndexRouteProductsPriceListsIndexRoute: typeof ProductsPriceListsIndexRoute+ SellersPayoutsIndexRoute: typeof SellersPayoutsIndexRouteProductsPriceListsPriceListIdIndexRoute: typeof ProductsPriceListsPriceListIdIndexRoute}@@ -1707,6 +1767,7 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {PromotionsGiftCardsRoute: PromotionsGiftCardsRoute,PromotionsNewRoute: PromotionsNewRoute,SellersSellerIdRoute: SellersSellerIdRoute,+ SellersTransfersRoute: SellersTransfersRoute,BrandsDotindexRoute: BrandsDotindexRoute,CompaniesIndexRoute: CompaniesIndexRoute,CustomersIndexRoute: CustomersIndexRoute,@@ -1721,11 +1782,13 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {ProductsCollectionsCollectionIdRoute: ProductsCollectionsCollectionIdRoute,ProductsCollectionsNewRoute: ProductsCollectionsNewRoute,ProductsPriceListsNewRoute: ProductsPriceListsNewRoute,+ SellersPayoutsPayoutIdRoute: SellersPayoutsPayoutIdRoute,OrdersOrderIdIndexRoute: OrdersOrderIdIndexRoute,ProductsCatalogsIndexRoute: ProductsCatalogsIndexRoute,ProductsCategoriesIndexRoute: ProductsCategoriesIndexRoute,ProductsCollectionsIndexRoute: ProductsCollectionsIndexRoute,ProductsPriceListsIndexRoute: ProductsPriceListsIndexRoute,+ SellersPayoutsIndexRoute: SellersPayoutsIndexRoute,ProductsPriceListsPriceListIdIndexRoute:ProductsPriceListsPriceListIdIndexRoute,}diff --git a/packages/dashboard/e2e/global-setup.ts b/packages/dashboard/e2e/global-setup.tsindex cb426176c0..0f58bd944e 100644--- a/packages/dashboard/e2e/global-setup.ts+++ b/packages/dashboard/e2e/global-setup.ts@@ -20,6 +20,9 @@ import {FIXTURE_BULK_PRODUCT_L,FIXTURE_BULK_PRODUCT_M,FIXTURE_BULK_PRODUCT_N,+ FIXTURE_LEDGER_OWED_AMOUNT,+ FIXTURE_LEDGER_PAYOUT_AMOUNT,+ FIXTURE_LEDGER_SELLER,FIXTURE_PROMO_CUSTOMER_EMAIL,FIXTURE_PROMO_CUSTOMER_FIRST_NAME,FIXTURE_PROMO_CUSTOMER_FULL_NAME,@@ -110,6 +113,15 @@ const BOOTSTRAP_RUBY = [// market would otherwise surface later as opaque multi-currency failures.`germany = Spree::Country.find_by_iso!('DE')`,`s.markets.find_or_create_by!(name: 'Europe') { |m| m.currency = 'EUR'; m.default_locale = 'de'; m.countries = [germany] } unless s.markets.exists?(currency: 'EUR')`,+ // A seller with one settled earning and one payout still owed, so the+ // marketplace ledger screens have rows to read and a settlement to mark+ // paid. Written directly: both are produced by fulfilment and the payout+ // sweep, neither of which an E2E run can reach.+ `ledger_seller = s.sellers.where(name: '${FIXTURE_LEDGER_SELLER}').first_or_create! { |v| v.status = 'approved' }`,+ `ledger_payout = ledger_seller.seller_payouts.where(amount: ${FIXTURE_LEDGER_PAYOUT_AMOUNT}).first_or_create!(store: s, currency: s.default_currency, provider: Spree::PayoutProvider::System.provider_key, status: 'pending')`,+ `ledger_seller.seller_payouts.where(amount: ${FIXTURE_LEDGER_OWED_AMOUNT}).first_or_create!(store: s, currency: s.default_currency, provider: Spree::PayoutProvider::System.provider_key, status: 'pending')`,+ `ledger_order = s.orders.where(seller: ledger_seller).first || Spree::Order.create!(store: s, seller: ledger_seller, currency: s.default_currency, email: '[email protected]', status: 'placed', completed_at: Time.current)`,+ `ledger_seller.seller_transfers.first_or_create!(store: s, order: ledger_order, payout: ledger_payout, amount: ${FIXTURE_LEDGER_PAYOUT_AMOUNT}, currency: s.default_currency, kind: 'earning', provider: Spree::PayoutProvider::System.provider_key, status: 'completed')`,'port = ENV.fetch("PORT", 3010)','puts JSON.generate(api_url: "http://localhost:#{port}", admin_email: admin.email, admin_password: "spree123", store_id: s.prefixed_id, store_name: s.name)',].join('; ')diff --git a/packages/dashboard/e2e/helpers.ts b/packages/dashboard/e2e/helpers.tsindex 65e3026aaa..25d5a35b73 100644--- a/packages/dashboard/e2e/helpers.ts+++ b/packages/dashboard/e2e/helpers.ts@@ -146,6 +146,20 @@ export const FIXTURE_BULK_CATEGORY_PERMALINK = 'e2e-bulk-category'// channels bulk-action and filter specs.export const FIXTURE_BULK_CHANNEL_CODE = 'e2e-bulk'export const FIXTURE_BULK_CHANNEL_NAME = 'E2E Bulk Channel'+/**+ * A seller with one settled sale and one payout still owed, so the ledger+ * screens have rows without a spec having to place and fulfil an order first.+ */+export const FIXTURE_LEDGER_SELLER = 'E2E Ledger Seller'+/** The settled payout the read-only specs assert against. */+export const FIXTURE_LEDGER_PAYOUT_AMOUNT = '120.0'+/**+ * A second payout, owed, for the mark-as-paid spec to consume. Separate from+ * the one above so completing it cannot change what another spec reads —+ * the suite is serial, and CI splits it across shards.+ */+export const FIXTURE_LEDGER_OWED_AMOUNT = '75.0'+export const FIXTURE_PROMO_CUSTOMER_EMAIL = '[email protected]'export const FIXTURE_PROMO_CUSTOMER_FIRST_NAME = 'Promo'export const FIXTURE_PROMO_CUSTOMER_FULL_NAME = 'Promo Customer'diff --git a/packages/dashboard/e2e/seller-ledger.spec.ts b/packages/dashboard/e2e/seller-ledger.spec.tsnew file mode 100644index 0000000000..2e6d7e12d3--- /dev/null+++ b/packages/dashboard/e2e/seller-ledger.spec.ts@@ -0,0 +1,88 @@+import { expect, test } from '@playwright/test'+import {+ FIXTURE_LEDGER_OWED_AMOUNT,+ FIXTURE_LEDGER_PAYOUT_AMOUNT,+ FIXTURE_LEDGER_SELLER,+ login,+} from './helpers'++const TRANSFERS_PATH = (storeId: string) => `/${storeId}/sellers/transfers`+const PAYOUTS_PATH = (storeId: string) => `/${storeId}/sellers/payouts`++test.describe('seller ledger', () => {+ test('lists what a seller earned', async ({ page }) => {+ const creds = await login(page)+ await page.goto(TRANSFERS_PATH(creds.store_id))++ await expect(page.getByRole('link', { name: FIXTURE_LEDGER_SELLER })).toBeVisible({+ timeout: 15_000,+ })+ await expect(page.getByText('$120.00').first()).toBeVisible()+ })++ // A seller checking a figure wants the sale behind it, so the order cell is+ // a link rather than text. The same column exists on both panels.+ test('links an earning to the order that produced it', async ({ page }) => {+ const creds = await login(page)+ await page.goto(TRANSFERS_PATH(creds.store_id))++ const orderLink = page+ .getByRole('row')+ .filter({ hasText: FIXTURE_LEDGER_SELLER })+ .getByRole('link', { name: /^R\d+$/ })+ .first()+ await expect(orderLink).toBeVisible({ timeout: 15_000 })++ await orderLink.click()++ await expect(page).toHaveURL(/\/orders\/or_/, { timeout: 15_000 })+ })++ // The queue an operator works on payout day: the built-in provider records+ // what to send and waits to be told the bank transfer went out.+ test('marks a payout as paid, with the reference it went out under', async ({ page }) => {+ const creds = await login(page)+ await page.goto(PAYOUTS_PATH(creds.store_id))++ // Its own payout, so completing it cannot change what another spec reads.+ const owed = page+ .getByRole('row')+ .filter({ hasText: `$${Number(FIXTURE_LEDGER_OWED_AMOUNT).toFixed(2)}` })+ await expect(owed).toBeVisible({ timeout: 15_000 })++ const reference = `BACS-${Date.now()}`+ await owed.getByRole('button', { name: /actions/i }).click()+ await page.getByRole('menuitem', { name: /mark as paid/i }).click()++ await expect(page.getByRole('heading', { name: /mark this payout as paid/i })).toBeVisible()+ await page.getByLabel(/reference/i).fill(reference)+ await page+ .getByRole('dialog')+ .getByRole('button', { name: /mark as paid/i })+ .click()++ await expect(page.getByText(reference)).toBeVisible({ timeout: 15_000 })+ await expect(owed.getByText(/completed/i)).toBeVisible({ timeout: 15_000 })+ })++ // The itemisation is what makes a settlement auditable — a figure on a bank+ // statement has to trace back to the sales behind it.+ test('a payout itemises the earnings it covers', async ({ page }) => {+ const creds = await login(page)+ await page.goto(PAYOUTS_PATH(creds.store_id))++ // The settled payout, picked by its amount: the seller has more than one+ // row here, so the seller name alone names both.+ const row = page+ .getByRole('row')+ .filter({ hasText: `$${Number(FIXTURE_LEDGER_PAYOUT_AMOUNT).toFixed(2)}` })+ await expect(row).toBeVisible({ timeout: 15_000 })++ // The date cell is the payout's own link; the seller cell goes to the+ // seller. Both live on the row, so this picks the one under test.+ await row.locator('[data-payout-id]').first().click()++ await expect(page.getByText(/covers 1 earning/i)).toBeVisible({ timeout: 15_000 })+ await expect(page.getByRole('heading', { name: '$120.00' })).toBeVisible()+ })+})diff --git a/packages/dashboard/src/components/spree/orders/order-payments-card.tsx b/packages/dashboard/src/components/spree/orders/order-payments-card.tsxindex 989f4d9558..d74062d4c1 100644--- a/packages/dashboard/src/components/spree/orders/order-payments-card.tsx+++ b/packages/dashboard/src/components/spree/orders/order-payments-card.tsx@@ -31,6 +31,7 @@ import {SelectItem,SelectTrigger,SelectValue,+ Skeleton,StatusBadge,Switch,Table,@@ -52,6 +53,7 @@ import i18n from 'i18next'import { type FormEvent, useEffect, useState } from 'react'import { useTranslation } from 'react-i18next'import { useOrderMutation } from '../../../hooks/use-order'+import { useOrderGroup } from '../../../hooks/use-seller-ledger'export function PaymentsCard({ order }: { order: Order }) {const { t } = useTranslation()@@ -59,7 +61,18 @@ export function PaymentsCard({ order }: { order: Order }) {const confirm = useConfirm()const [addOpen, setAddOpen] = useState(false)- const payments = order.payments ?? []+ // An order from a split checkout has no payments of its own: the customer+ // paid once, against the group. Reading `order.payments` there would render+ // "no payments" on an order that was paid in full.+ const { data: group, isPending: groupPending } = useOrderGroup(order.order_group_id)+ const grouped = !!order.order_group_id+ const payments = (grouped ? group?.payments : order.payments) ?? []+ // On a grouped order the payments arrive with the group, so until they do+ // there is nothing to say — rendering the empty state here would show "no+ // payments" on an order that was paid in full, which is the misreading this+ // whole branch exists to prevent.+ const awaitingGroup = grouped && groupPending+ const splits = order.payment_splits ?? []const captureMutation = useOrderMutation(orderId, (paymentId: string) =>adminClient.orders.payments.capture(orderId, paymentId, {}),@@ -78,101 +91,129 @@ export function PaymentsCard({ order }: { order: Order }) {</CardTitle><CardAction className="flex items-center gap-2">{order.payment_status && <StatusBadge status={order.payment_status} />}- <Button size="sm" variant="outline" onClick={() => setAddOpen(true)}>- <PlusIcon data-icon="inline-start" />- {t('admin.actions.add')}- </Button>+ {/* Adding, capturing and voting a grouped payment acts on every+ order in the checkout, not just this one — so this order's page+ reads that money rather than moving it. */}+ {!grouped && (+ <Button size="sm" variant="outline" onClick={() => setAddOpen(true)}>+ <PlusIcon data-icon="inline-start" />+ {t('admin.actions.add')}+ </Button>+ )}</CardAction></CardHeader>- {payments.length === 0 ? (+ {awaitingGroup ? (+ <CardContent>+ <Skeleton className="h-24 w-full" />+ </CardContent>+ ) : payments.length === 0 ? (<CardContent><p className="text-center text-muted-foreground py-8">{t('admin.pages.orders.detail.empty_payments')}</p></CardContent>) : (- <Table>- <TableHeader>- <TableRow>- <TableHead>{t('admin.orders.detail.payments_table.number')}</TableHead>- <TableHead>{t('admin.orders.detail.payments_table.method')}</TableHead>- <TableHead>{t('admin.orders.detail.payments_table.state')}</TableHead>- <TableHead className="text-right">{t('admin.fields.amount.label')}</TableHead>- <TableHead className="w-10" />- </TableRow>- </TableHeader>- <TableBody>- {payments.map((payment) => (- <TableRow key={payment.id}>- <TableCell className="font-medium">{payment.number}</TableCell>- <TableCell className="text-muted-foreground">- {payment.payment_method?.name ?? '—'}- </TableCell>- <TableCell>- <StatusBadge status={payment.status} />- </TableCell>- <TableCell className="text-right font-medium whitespace-nowrap tabular-nums">- {payment.display_amount}- </TableCell>- <TableCell>- {(payment.status === 'checkout' ||- payment.status === 'pending' ||- payment.status === 'completed') && (- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button variant="ghost" size="icon-xs">- <EllipsisVerticalIcon className="size-4" />- <span className="sr-only">{t('admin.actions.actions_menu')}</span>- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- {(payment.status === 'checkout' || payment.status === 'pending') && (- <DropdownMenuItem- onClick={async () => {- if (- await confirm({- message: t('admin.orders.detail.confirm.capture_message'),- variant: 'default',- confirmLabel: t('admin.pages.orders.detail.actions.capture'),- })- ) {- captureMutation.mutate(payment.id)- }- }}- >- <CreditCardIcon className="size-4" />- {t('admin.pages.orders.detail.actions.capture')}- </DropdownMenuItem>- )}- {(payment.status === 'checkout' ||- payment.status === 'pending' ||- payment.status === 'completed') && (- <DropdownMenuItem- variant="destructive"- onClick={async () => {- if (- await confirm({- message: t('admin.orders.detail.confirm.void_message'),- variant: 'destructive',- confirmLabel: t('admin.pages.orders.detail.actions.void'),- })- ) {- voidMutation.mutate(payment.id)- }- }}- >- <XCircleIcon className="size-4" />- {t('admin.pages.orders.detail.actions.void')}- </DropdownMenuItem>- )}- </DropdownMenuContent>- </DropdownMenu>- )}- </TableCell>+ <>+ {grouped && (+ <p className="px-6 pb-2 text-sm text-muted-foreground">+ {t('admin.orders.detail.payments_table.shared_help')}+ </p>+ )}+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead>{t('admin.orders.detail.payments_table.number')}</TableHead>+ <TableHead>{t('admin.orders.detail.payments_table.method')}</TableHead>+ <TableHead>{t('admin.orders.detail.payments_table.state')}</TableHead>+ <TableHead className="text-right">{t('admin.fields.amount.label')}</TableHead>+ {grouped && (+ <TableHead className="text-right">+ {t('admin.orders.detail.payments_table.this_order')}+ </TableHead>+ )}+ <TableHead className="w-10" /></TableRow>- ))}- </TableBody>- </Table>+ </TableHeader>+ <TableBody>+ {payments.map((payment) => (+ <TableRow key={payment.id}>+ <TableCell className="font-medium">{payment.number}</TableCell>+ <TableCell className="text-muted-foreground">+ {payment.payment_method?.name ?? '—'}+ </TableCell>+ <TableCell>+ <StatusBadge status={payment.status} />+ </TableCell>+ <TableCell className="text-right font-medium whitespace-nowrap tabular-nums">+ {payment.display_amount}+ </TableCell>+ {grouped && (+ <TableCell className="text-right whitespace-nowrap tabular-nums">+ {splits.find((split) => split.payment_id === payment.id)+ ?.display_captured_amount ?? '—'}+ </TableCell>+ )}+ <TableCell>+ {!grouped &&+ (payment.status === 'checkout' ||+ payment.status === 'pending' ||+ payment.status === 'completed') && (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button variant="ghost" size="icon-xs">+ <EllipsisVerticalIcon className="size-4" />+ <span className="sr-only">{t('admin.actions.actions_menu')}</span>+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ {(payment.status === 'checkout' || payment.status === 'pending') && (+ <DropdownMenuItem+ onClick={async () => {+ if (+ await confirm({+ message: t('admin.orders.detail.confirm.capture_message'),+ variant: 'default',+ confirmLabel: t('admin.pages.orders.detail.actions.capture'),+ })+ ) {+ captureMutation.mutate(payment.id)+ }+ }}+ >+ <CreditCardIcon className="size-4" />+ {t('admin.pages.orders.detail.actions.capture')}+ </DropdownMenuItem>+ )}+ {(payment.status === 'checkout' ||+ payment.status === 'pending' ||+ payment.status === 'completed') && (+ <DropdownMenuItem+ variant="destructive"+ onClick={async () => {+ if (+ await confirm({+ message: t('admin.orders.detail.confirm.void_message'),+ variant: 'destructive',+ confirmLabel: t('admin.pages.orders.detail.actions.void'),+ })+ ) {+ voidMutation.mutate(payment.id)+ }+ }}+ >+ <XCircleIcon className="size-4" />+ {t('admin.pages.orders.detail.actions.void')}+ </DropdownMenuItem>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ )}+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </>)}<AddPaymentDialog order={order} open={addOpen} onOpenChange={setAddOpen} /></Card>diff --git a/packages/dashboard/src/components/spree/orders/order-seller-transfers-card.tsx b/packages/dashboard/src/components/spree/orders/order-seller-transfers-card.tsxnew file mode 100644index 0000000000..868f8656f5--- /dev/null+++ b/packages/dashboard/src/components/spree/orders/order-seller-transfers-card.tsx@@ -0,0 +1,86 @@+import type { Order } from '@spree/admin-sdk'+import {+ Card,+ CardHeader,+ CardTitle,+ StatusBadge,+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from '@spree/dashboard-ui'+import { BanknoteIcon } from '@spree/dashboard-ui/icons'+import { Link } from '@tanstack/react-router'+import { useTranslation } from 'react-i18next'+import { useSellerTransfers } from '../../../hooks/use-seller-ledger'++/**+ * What this order earned its seller, and what a refund has taken back.+ *+ * Renders nothing on an order with no ledger rows — a first-party order has+ * none by definition, and a seller's order has none until it is fulfilled.+ */+export function SellerTransfersCard({ order }: { order: Order }) {+ const { t } = useTranslation()+ const { data } = useSellerTransfers({ order_id_eq: order.id })++ const transfers = data?.data ?? []+ if (transfers.length === 0) return null++ return (+ <Card>+ <CardHeader>+ <CardTitle>+ <BanknoteIcon className="size-4" />+ {t('admin.payouts.order_card.title')}+ </CardTitle>+ </CardHeader>++ <Table>+ <TableHeader>+ <TableRow>+ <TableHead>{t('admin.payouts.columns.kind')}</TableHead>+ <TableHead>{t('admin.fields.status.label')}</TableHead>+ <TableHead>{t('admin.nav.seller_payouts')}</TableHead>+ <TableHead className="text-right">{t('admin.fields.amount.label')}</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {transfers.map((transfer) => (+ <TableRow key={transfer.id}>+ <TableCell>+ {t(`admin.payouts.kinds.${transfer.kind}`, { defaultValue: transfer.kind })}+ </TableCell>+ <TableCell>+ <StatusBadge+ status={transfer.status}+ label={t(`admin.payouts.statuses.${transfer.status}`, {+ defaultValue: transfer.status,+ })}+ />+ </TableCell>+ <TableCell>+ {transfer.payout_id ? (+ <Link+ to={'/$storeId/sellers/payouts/$payoutId' as string}+ params={{ payoutId: transfer.payout_id }}+ className="no-underline"+ >+ {t('admin.payouts.order_card.view_payout')}+ </Link>+ ) : (+ <span className="text-muted-foreground">+ {t('admin.payouts.order_card.not_settled')}+ </span>+ )}+ </TableCell>+ <TableCell className="text-right tabular-nums">{transfer.display_amount}</TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </Card>+ )+}diff --git a/packages/dashboard/src/components/spree/sellers/payout-complete-dialog.tsx b/packages/dashboard/src/components/spree/sellers/payout-complete-dialog.tsxnew file mode 100644index 0000000000..077f440afd--- /dev/null+++ b/packages/dashboard/src/components/spree/sellers/payout-complete-dialog.tsx@@ -0,0 +1,89 @@+import type { SellerPayout } from '@spree/admin-sdk'+import {+ Button,+ Dialog,+ DialogBody,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ Field,+ FieldDescription,+ FieldLabel,+ Input,+} from '@spree/dashboard-ui'+import { type FormEvent, useState } from 'react'+import { useTranslation } from 'react-i18next'+import { useCompletePayout } from '../../../hooks/use-seller-ledger'++/**+ * The operator saying a settlement reached the seller's bank.+ *+ * What the built-in payout provider waits for: it records what to send and is+ * then told it went. The reference is what makes the claim checkable against+ * a bank statement later, so it is asked for here rather than assumed — and+ * asking is itself the confirmation, which is why there is no second dialog+ * on top of this one.+ */+export function PayoutCompleteDialog({+ payout,+ open,+ onOpenChange,+}: {+ payout: SellerPayout+ open: boolean+ onOpenChange: (open: boolean) => void+}) {+ const { t } = useTranslation()+ const [reference, setReference] = useState(payout.reference ?? '')+ const complete = useCompletePayout(payout.id)++ async function handleSubmit(event: FormEvent) {+ event.preventDefault()+ await complete.mutateAsync({ reference: reference.trim() || undefined })+ onOpenChange(false)+ }++ return (+ <Dialog open={open} onOpenChange={onOpenChange}>+ <DialogContent>+ <form onSubmit={handleSubmit}>+ <DialogHeader>+ <DialogTitle>{t('admin.payouts.complete.title')}</DialogTitle>+ <DialogDescription>+ {t('admin.payouts.complete.description', {+ amount: payout.display_amount,+ seller: payout.seller_name ?? '',+ })}+ </DialogDescription>+ </DialogHeader>++ <DialogBody>+ <Field>+ <FieldLabel htmlFor="payout-reference">+ {t('admin.payouts.columns.reference')}+ </FieldLabel>+ <Input+ id="payout-reference"+ value={reference}+ onChange={(event) => setReference(event.target.value)}+ placeholder={t('admin.payouts.complete.reference_placeholder')}+ />+ <FieldDescription>{t('admin.payouts.complete.reference_help')}</FieldDescription>+ </Field>+ </DialogBody>++ <DialogFooter>+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>+ {t('admin.actions.cancel')}+ </Button>+ <Button type="submit" disabled={complete.isPending}>+ {t('admin.payouts.complete.action')}+ </Button>+ </DialogFooter>+ </form>+ </DialogContent>+ </Dialog>+ )+}diff --git a/packages/dashboard/src/components/spree/sellers/seller-balance-card.tsx b/packages/dashboard/src/components/spree/sellers/seller-balance-card.tsxnew file mode 100644index 0000000000..f50f4a8e6a--- /dev/null+++ b/packages/dashboard/src/components/spree/sellers/seller-balance-card.tsx@@ -0,0 +1,71 @@+import type { Seller } from '@spree/admin-sdk'+import { Card, CardContent, CardHeader, CardTitle, Separator } from '@spree/dashboard-ui'+import { Link } from '@tanstack/react-router'+import { useTranslation } from 'react-i18next'+import { useSellerBalances } from '../../../hooks/use-seller-ledger'+import { ReadRow } from './seller-read-row'++/**+ * What this seller has earned and what they are still owed, per currency.+ *+ * Nothing is ever converted between currencies, so a seller trading in two+ * has two positions rather than one total. Renders nothing until their first+ * fulfilled sale — an empty card on every new seller would only be noise.+ */+export function SellerBalanceCard({ seller }: { seller: Seller }) {+ const { t } = useTranslation()+ const { data } = useSellerBalances(seller.id)++ const balances = data?.data ?? []+ if (balances.length === 0) return null++ return (+ <Card>+ <CardHeader>+ <CardTitle>{t('admin.payouts.balance.title')}</CardTitle>+ </CardHeader>+ <CardContent className="flex flex-col gap-4">+ {balances.map((balance, index) => (+ <div key={balance.currency} className="flex flex-col gap-3">+ {index > 0 && <Separator />}+ <ReadRow label={t('admin.payouts.balance.owed', { currency: balance.currency })}>+ <span className="font-medium">{balance.display_balance}</span>+ </ReadRow>+ <ReadRow label={t('admin.payouts.balance.earned')}>{balance.display_earned}</ReadRow>+ <ReadRow label={t('admin.payouts.balance.paid')}>{balance.display_paid}</ReadRow>+ <ReadRow label={t('admin.payouts.balance.pending')}>{balance.display_pending}</ReadRow>+ </div>+ ))}++ <div className="flex gap-4 border-t pt-3 text-sm">+ <Link+ to={'/$storeId/sellers/transfers' as string}+ search={sellerFilter(seller.id, 'seller-transfers')}+ >+ {t('admin.nav.seller_transfers')}+ </Link>+ <Link+ to={'/$storeId/sellers/payouts' as string}+ search={sellerFilter(seller.id, 'seller-payouts')}+ >+ {t('admin.nav.seller_payouts')}+ </Link>+ </div>+ </CardContent>+ </Card>+ )+}++/**+ * Search params opening a ledger list filtered to one seller.+ *+ * JSON-encoded because that is how the resource table reads filters back off+ * the URL — the same shape `orderGroupSearch` builds for the orders list.+ */+function sellerFilter(sellerId: string, table: string): { filters: string } {+ return {+ filters: JSON.stringify([+ { id: `${table}-seller-${sellerId}`, field: 'seller_name', operator: 'eq', value: sellerId },+ ]),+ }+}diff --git a/packages/dashboard/src/hooks/use-order.ts b/packages/dashboard/src/hooks/use-order.tsindex f6f5a02dd9..71f7a82016 100644--- a/packages/dashboard/src/hooks/use-order.ts+++ b/packages/dashboard/src/hooks/use-order.ts@@ -16,6 +16,9 @@ export function useOrder(orderId: string) {'fulfillments.delivery_rates.delivery_method','payments','payments.payment_method',+ // An order from a split checkout has no payments of its own; what+ // it has is a share of each payment made against its group.+ 'payment_splits','billing_address','shipping_address','customer',diff --git a/packages/dashboard/src/hooks/use-seller-ledger.ts b/packages/dashboard/src/hooks/use-seller-ledger.tsnew file mode 100644index 0000000000..96995b29d2--- /dev/null+++ b/packages/dashboard/src/hooks/use-seller-ledger.ts@@ -0,0 +1,80 @@+import { adminClient, useResourceKey, useResourceMutation } from '@spree/dashboard-core'+import { useQuery } from '@tanstack/react-query'+import i18n from 'i18next'++/** Where one seller stands with the marketplace, one row per currency. */+export function useSellerBalances(sellerId: string | undefined) {+ return useQuery({+ queryKey: useResourceKey('sellers', sellerId ?? 'noop', 'balances'),+ queryFn: () => adminClient.sellers.balances(sellerId as string),+ enabled: !!sellerId,+ })+}++export function usePayout(payoutId: string) {+ return useQuery({+ queryKey: useResourceKey('seller-payouts', payoutId),+ queryFn: () => adminClient.sellerPayouts.get(payoutId),+ enabled: !!payoutId,+ })+}++/**+ * The earnings one settlement covers, or the ones one order produced.+ *+ * Read through the transfers list rather than off the payout: a settlement+ * carries only the count, and a monthly one can hold hundreds of rows that+ * only this page wants.+ *+ * Paged rather than capped. The server clamps `limit` at 100, so a sweep+ * covering more than that would otherwise render a page and call it the+ * whole settlement — on the screen whose purpose is tracing a bank figure+ * back to the sales behind it.+ */+export function useSellerTransfers(+ filter: { payout_id_eq?: string; order_id_eq?: string },+ page = 1,+) {+ const key = filter.payout_id_eq ?? filter.order_id_eq ?? 'all'++ return useQuery({+ queryKey: useResourceKey('seller-transfers', key, String(page)),+ queryFn: () => adminClient.sellerTransfers.list({ ...filter, limit: 100, page }),+ enabled: !!(filter.payout_id_eq || filter.order_id_eq),+ placeholderData: (previous) => previous,+ })+}++/**+ * The operator saying a bank transfer went out.+ *+ * What the built-in payout provider waits for: it records what to send and is+ * then told it went, with the reference it went out under.+ */+export function useCompletePayout(payoutId: string) {+ return useResourceMutation({+ mutationFn: (params: { reference?: string }) =>+ adminClient.sellerPayouts.complete(payoutId, params),+ invalidate: [['seller-payouts'], ['seller-payouts', payoutId], ['sellers']],+ successMessage: i18n.t('admin.payouts.marked_paid'),+ })+}++/**+ * The payments a split checkout was paid with.+ *+ * Narrowed with `fields`, not just `expand`: the group serializer renders the+ * orders it holds through the full admin order serializer, so a five-seller+ * basket would otherwise pull five complete sibling orders — items, addresses+ * and fulfillments included — to read one payments array.+ */+export function useOrderGroup(orderGroupId: string | null | undefined) {+ return useQuery({+ queryKey: useResourceKey('order-groups', orderGroupId ?? 'noop', 'payments'),+ queryFn: () =>+ adminClient.orderGroups.get(orderGroupId as string, {+ fields: ['payments', 'number'],+ }),+ enabled: !!orderGroupId,+ })+}diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.jsonindex c280528213..5ab064c728 100644--- a/packages/dashboard/src/locales/ar.json+++ b/packages/dashboard/src/locales/ar.json@@ -2585,6 +2585,8 @@"promotions": "العروض الترويجية","reports": "التقارير","returns": "المرتجعات",+ "seller_payouts": "المدفوعات",+ "seller_transfers": "التحويلات","sellers": "البائعون","settings": "الإعدادات","transfers": "التحويلات",@@ -2727,6 +2729,7 @@"complete_message": "هل تريد إكمال مسودة الطلب هذه الآن؟","remove_gift_card_message": "هل تريد إزالة بطاقة الهدايا هذه من الطلب؟","remove_item_message": "هل تريد إزالة هذا العنصر من الطلب؟",+ "remove_store_credit_message": "هل تريد إزالة رصيد المتجر من الطلب؟","ship_message": "شحن هذا الوفاء؟","void_message": "Void هذه الدفعة؟"},@@ -2834,12 +2837,16 @@"upload_label_title": "رفع ملصق"},"gift_card_section": {+ "applied_suffix": "مُطبَّق",+ "apply_balance": "قم بتطبيق الرصيد المتاح لـ العميل","apply_dialog_description": "أدخل رمز بطاقة الهدايا لتطبيقه على هذا الطلب.","apply_dialog_title": "Apply Gift Card","code_placeholder": "GIFT-XXXX-YYYY","gift_card_label": "بطاقة هدية","none_applied": "لم يتم تطبيق أي شيء",- "title": "الخصومات وبطاقة الهدايا"+ "requires_customer": "يتطلب العميل",+ "store_credit_label": "Store credit",+ "title": "الخصومات والرصيد"},"load_failed_message": "لم نتمكن من تحميل الطلب {{orderId}}.","messages": {@@ -2869,7 +2876,9 @@"payments_table": {"method": "طريقة","number": "رقم",- "state": "ولاية"+ "state": "ولاية",+ "this_order": "هذا الطلب",+ "shared_help": "دُفعت مرة واحدة لسلة تضم عدة بائعين. هذا الطلب له حصة منها."},"purchase_order": {"document": "مستند أمر الشراء",@@ -5266,6 +5275,63 @@"owner": {"marketplace": "السوق"}+ },+ "payouts": {+ "transfers_description": "ما حققته كل طلبية تم تسليمها للبائع، بعد خصم عمولتك.",+ "transfers_empty": "لا توجد أرباح للبائعين بعد.",+ "payouts_description": "المدفوعات إلى بائعيك — ما هو مستحق وما تم إرساله.",+ "payouts_empty": "لا توجد مدفوعات بعد.",+ "load_error": "تعذر تحميل هذه الدفعة",+ "marked_paid": "تم وضع علامة مدفوعة على الدفعة",+ "columns": {+ "date": "التاريخ",+ "order": "الطلب",+ "kind": "النوع",+ "reference": "المرجع",+ "provider": "المزود",+ "earnings": "الأرباح"+ },+ "kinds": {+ "earning": "بيع",+ "refund_reversal": "استرداد"+ },+ "statuses": {+ "pending": "قيد الانتظار",+ "processing": "قيد المعالجة",+ "completed": "مكتملة",+ "failed": "فشلت",+ "unresolved": "بحاجة إلى مراجعة"+ },+ "balance": {+ "title": "الرصيد",+ "owed": "المستحق ({{currency}})",+ "earned": "المكتسب",+ "paid": "المدفوع",+ "pending": "في الطريق"+ },+ "complete": {+ "title": "وضع علامة مدفوعة على هذه الدفعة",+ "description": "يسجّل أن {{amount}} وصل إلى {{seller}}. هذا لا ينقل أي أموال.",+ "reference_placeholder": "مثال: BACS-9912",+ "reference_help": "المرجع البنكي لهذا التحويل، ليمكن تتبعه لاحقًا.",+ "action": "وضع علامة مدفوعة"+ },+ "detail": {+ "covers_one": "يغطي ربحًا واحدًا",+ "covers_two": "يغطي ربحين",+ "covers_few": "يغطي {{count}} أرباح",+ "covers_many": "يغطي {{count}} ربحًا",+ "covers_other": "يغطي {{count}} ربح",+ "covers_empty": "هذه الدفعة لا تغطي أي أرباح.",+ "settlement": "الدفعة",+ "period": "الفترة"+ },+ "order_card": {+ "title": "أرباح البائع",+ "view_payout": "عرض الدفعة",+ "not_settled": "لم يتم الدفع بعد"+ },+ "search_placeholder": "البحث بالمرجع"}}}diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.jsonindex 058a0ad948..bd4b1492f7 100644--- a/packages/dashboard/src/locales/de.json+++ b/packages/dashboard/src/locales/de.json@@ -2567,6 +2567,8 @@"promotions": "Aktionen","reports": "Berichte","returns": "Retouren",+ "seller_payouts": "Auszahlungen",+ "seller_transfers": "Überweisungen","sellers": "Verkäufer","settings": "Einstellungen","transfers": "Umlagerungen",@@ -2709,6 +2711,7 @@"complete_message": "Diesen Auftragsentwurf jetzt abschließen?","remove_gift_card_message": "Diese Geschenkkarte aus dem Auftrag entfernen?","remove_item_message": "Diesen Artikel aus dem Auftrag entfernen?",+ "remove_store_credit_message": "Guthaben aus dem Auftrag entfernen?","ship_message": "Diese Lieferung versenden?","void_message": "Diese Zahlung stornieren?"},@@ -2817,12 +2820,16 @@"upload_label_title": "Etikett hochladen"},"gift_card_section": {+ "applied_suffix": "angewendet",+ "apply_balance": "Verfügbares Guthaben des Kunden anwenden","apply_dialog_description": "Geben Sie einen Geschenkkartencode ein, der auf diesen Auftrag angewendet werden soll.","apply_dialog_title": "Geschenkkarte anwenden","code_placeholder": "GIFT-XXXX-YYYY","gift_card_label": "Geschenkkarte","none_applied": "Keine angewendet",- "title": "Rabatte & Geschenkkarte"+ "requires_customer": "Erfordert einen Kunden",+ "store_credit_label": "Guthaben",+ "title": "Rabatte & Guthaben"},"load_failed_message": "Auftrag {{orderId}} konnte nicht geladen werden.","messages": {@@ -2852,7 +2859,9 @@"payments_table": {"method": "Methode","number": "Nummer",- "state": "Status"+ "state": "Status",+ "this_order": "Diese Bestellung",+ "shared_help": "Einmal bezahlt für einen Warenkorb mehrerer Verkäufer. Diese Bestellung hat einen Anteil daran."},"purchase_order": {"document": "Bestelldokument",@@ -5244,6 +5253,60 @@"owner": {"marketplace": "Marktplatz"}+ },+ "payouts": {+ "transfers_description": "Was jede ausgelieferte Bestellung dem Verkäufer eingebracht hat, abzüglich Ihrer Provision.",+ "transfers_empty": "Noch keine Verkäufereinnahmen.",+ "payouts_description": "Auszahlungen an Ihre Verkäufer – was offen ist und was gesendet wurde.",+ "payouts_empty": "Noch keine Auszahlungen.",+ "load_error": "Diese Auszahlung konnte nicht geladen werden",+ "marked_paid": "Auszahlung als bezahlt markiert",+ "columns": {+ "date": "Datum",+ "order": "Bestellung",+ "kind": "Art",+ "reference": "Referenz",+ "provider": "Anbieter",+ "earnings": "Einnahmen"+ },+ "kinds": {+ "earning": "Verkauf",+ "refund_reversal": "Rückerstattung"+ },+ "statuses": {+ "pending": "Ausstehend",+ "processing": "In Bearbeitung",+ "completed": "Abgeschlossen",+ "failed": "Fehlgeschlagen",+ "unresolved": "Prüfung nötig"+ },+ "balance": {+ "title": "Saldo",+ "owed": "Offen ({{currency}})",+ "earned": "Verdient",+ "paid": "Ausgezahlt",+ "pending": "Unterwegs"+ },+ "complete": {+ "title": "Auszahlung als bezahlt markieren",+ "description": "Hält fest, dass {{amount}} bei {{seller}} angekommen ist. Es wird kein Geld bewegt.",+ "reference_placeholder": "z. B. BACS-9912",+ "reference_help": "Die Bankreferenz dieser Überweisung, damit sie später nachvollziehbar ist.",+ "action": "Als bezahlt markieren"+ },+ "detail": {+ "covers_one": "Umfasst {{count}} Einnahme",+ "covers_other": "Umfasst {{count}} Einnahmen",+ "covers_empty": "Diese Auszahlung umfasst keine Einnahmen.",+ "settlement": "Auszahlung",+ "period": "Zeitraum"+ },+ "order_card": {+ "title": "Verkäufereinnahmen",+ "view_payout": "Auszahlung ansehen",+ "not_settled": "Noch nicht ausgezahlt"+ },+ "search_placeholder": "Nach Referenz suchen"}}}diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.jsonindex 40137d5e2d..1ef99cd9a7 100644--- a/packages/dashboard/src/locales/en.json+++ b/packages/dashboard/src/locales/en.json@@ -2567,6 +2567,8 @@"promotions": "Promotions","reports": "Reports","returns": "Returns",+ "seller_payouts": "Payouts",+ "seller_transfers": "Transfers","sellers": "Sellers","settings": "Settings","transfers": "Transfers",@@ -2709,6 +2711,7 @@"complete_message": "Complete this draft order now?","remove_gift_card_message": "Remove this gift card from the order?","remove_item_message": "Remove this item from the order?",+ "remove_store_credit_message": "Remove store credit from the order?","ship_message": "Ship this fulfillment?","void_message": "Void this payment?"},@@ -2817,12 +2820,16 @@"upload_label_title": "Upload label"},"gift_card_section": {+ "applied_suffix": "applied",+ "apply_balance": "Apply customer's available balance","apply_dialog_description": "Enter a gift card code to apply to this order.","apply_dialog_title": "Apply Gift Card","code_placeholder": "GIFT-XXXX-YYYY","gift_card_label": "Gift card","none_applied": "None applied",- "title": "Discounts & Gift card"+ "requires_customer": "Requires a customer",+ "store_credit_label": "Store credit",+ "title": "Discounts & Credit"},"load_failed_message": "We couldn't load order {{orderId}}.","messages": {@@ -2852,7 +2859,9 @@"payments_table": {"method": "Method","number": "Number",- "state": "State"+ "state": "State",+ "this_order": "This order",+ "shared_help": "Paid once for a basket spanning several sellers. This order has a share of it."},"purchase_order": {"document": "Purchase order document",@@ -5244,6 +5253,60 @@"owner": {"marketplace": "Marketplace"}+ },+ "payouts": {+ "transfers_description": "What each fulfilled order earned its seller, less your commission.",+ "transfers_empty": "No seller earnings yet.",+ "payouts_description": "Settlements to your sellers — what is owed, and what has been sent.",+ "payouts_empty": "No payouts yet.",+ "load_error": "Could not load this payout",+ "marked_paid": "Payout marked as paid",+ "columns": {+ "date": "Date",+ "order": "Order",+ "kind": "Type",+ "reference": "Reference",+ "provider": "Provider",+ "earnings": "Earnings"+ },+ "kinds": {+ "earning": "Sale",+ "refund_reversal": "Refund"+ },+ "statuses": {+ "pending": "Pending",+ "processing": "Processing",+ "completed": "Completed",+ "failed": "Failed",+ "unresolved": "Needs checking"+ },+ "balance": {+ "title": "Balance",+ "owed": "Owed ({{currency}})",+ "earned": "Earned",+ "paid": "Paid out",+ "pending": "On its way"+ },+ "complete": {+ "title": "Mark this payout as paid",+ "description": "Records that {{amount}} reached {{seller}}. This does not move any money.",+ "reference_placeholder": "e.g. BACS-9912",+ "reference_help": "The bank reference this went out under, so it can be traced later.",+ "action": "Mark as paid"+ },+ "detail": {+ "covers_one": "Covers {{count}} earning",+ "covers_other": "Covers {{count}} earnings",+ "covers_empty": "This payout covers no earnings.",+ "settlement": "Payout",+ "period": "Period"+ },+ "order_card": {+ "title": "Seller earnings",+ "view_payout": "View payout",+ "not_settled": "Not paid out yet"+ },+ "search_placeholder": "Search by reference"}}}diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.jsonindex 61309d213a..2e64e4b0f8 100644--- a/packages/dashboard/src/locales/fr.json+++ b/packages/dashboard/src/locales/fr.json@@ -2567,6 +2567,8 @@"promotions": "Promotions","reports": "Rapports","returns": "Retours",+ "seller_payouts": "Versements",+ "seller_transfers": "Transferts","sellers": "Vendeurs","settings": "Paramètres","transfers": "Transferts",@@ -2709,6 +2711,7 @@"complete_message": "Finaliser cette commande brouillon maintenant ?","remove_gift_card_message": "Retirer cette carte cadeau de la commande ?","remove_item_message": "Retirer cet article de la commande ?",+ "remove_store_credit_message": "Retirer l'avoir de la commande ?","ship_message": "Expédier cet envoi ?","void_message": "Annuler ce paiement ?"},@@ -2817,12 +2820,16 @@"upload_label_title": "Téléverser une étiquette"},"gift_card_section": {+ "applied_suffix": "appliqué",+ "apply_balance": "Appliquer le solde disponible du client","apply_dialog_description": "Saisissez un code de carte cadeau à appliquer à cette commande.","apply_dialog_title": "Appliquer une carte cadeau","code_placeholder": "GIFT-XXXX-YYYY","gift_card_label": "Carte cadeau","none_applied": "Aucun appliqué",- "title": "Remises et carte cadeau"+ "requires_customer": "Nécessite un client",+ "store_credit_label": "Avoir",+ "title": "Remises et avoirs"},"load_failed_message": "Impossible de charger la commande {{orderId}}.","messages": {@@ -2852,7 +2859,9 @@"payments_table": {"method": "Méthode","number": "Numéro",- "state": "État"+ "state": "État",+ "this_order": "Cette commande",+ "shared_help": "Payé en une fois pour un panier réparti entre plusieurs vendeurs. Cette commande en détient une part."},"purchase_order": {"document": "Document de bon de commande",@@ -5244,6 +5253,60 @@"owner": {"marketplace": "Place de marché"}+ },+ "payouts": {+ "transfers_description": "Ce que chaque commande expédiée a rapporté au vendeur, déduction faite de votre commission.",+ "transfers_empty": "Aucun gain de vendeur pour le moment.",+ "payouts_description": "Versements à vos vendeurs — ce qui est dû et ce qui a été envoyé.",+ "payouts_empty": "Aucun versement pour le moment.",+ "load_error": "Impossible de charger ce versement",+ "marked_paid": "Versement marqué comme payé",+ "columns": {+ "date": "Date",+ "order": "Commande",+ "kind": "Type",+ "reference": "Référence",+ "provider": "Fournisseur",+ "earnings": "Gains"+ },+ "kinds": {+ "earning": "Vente",+ "refund_reversal": "Remboursement"+ },+ "statuses": {+ "pending": "En attente",+ "processing": "En cours",+ "completed": "Terminé",+ "failed": "Échoué",+ "unresolved": "À vérifier"+ },+ "balance": {+ "title": "Solde",+ "owed": "Dû ({{currency}})",+ "earned": "Gagné",+ "paid": "Versé",+ "pending": "En route"+ },+ "complete": {+ "title": "Marquer ce versement comme payé",+ "description": "Enregistre que {{amount}} est parvenu à {{seller}}. Aucun mouvement d'argent n'est effectué.",+ "reference_placeholder": "ex. BACS-9912",+ "reference_help": "La référence bancaire du virement, pour pouvoir le retrouver plus tard.",+ "action": "Marquer comme payé"+ },+ "detail": {+ "covers_one": "Couvre {{count}} gain",+ "covers_other": "Couvre {{count}} gains",+ "covers_empty": "Ce versement ne couvre aucun gain.",+ "settlement": "Versement",+ "period": "Période"+ },+ "order_card": {+ "title": "Gains du vendeur",+ "view_payout": "Voir le versement",+ "not_settled": "Pas encore versé"+ },+ "search_placeholder": "Rechercher par référence"}}}diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.jsonindex 596eccc7f0..1030da9a86 100644--- a/packages/dashboard/src/locales/pl.json+++ b/packages/dashboard/src/locales/pl.json@@ -2589,6 +2589,8 @@"promotions": "Promocje","reports": "Raporty","returns": "Zwroty",+ "seller_payouts": "Wypłaty",+ "seller_transfers": "Transfery","sellers": "Sprzedawcy","settings": "Ustawienia","transfers": "Transfery",@@ -2733,6 +2735,7 @@"complete_message": "Sfinalizować teraz to zamówienie robocze?","remove_gift_card_message": "Usunąć tę kartę podarunkową z zamówienia?","remove_item_message": "Usunąć tę pozycję z zamówienia?",+ "remove_store_credit_message": "Usunąć kredyt sklepowy z zamówienia?","ship_message": "Wysłać tę realizację?","void_message": "Unieważnić tę płatność?"},@@ -2843,12 +2846,16 @@"upload_label_title": "Wgraj etykietę"},"gift_card_section": {+ "applied_suffix": "zastosowano",+ "apply_balance": "Zastosuj dostępne saldo klienta","apply_dialog_description": "Wprowadź kod karty podarunkowej, aby zastosować ją do tego zamówienia.","apply_dialog_title": "Zastosuj kartę podarunkową","code_placeholder": "GIFT-XXXX-YYYY","gift_card_label": "Karta podarunkowa","none_applied": "Brak zastosowanych",- "title": "Rabaty i karta podarunkowa"+ "requires_customer": "Wymaga klienta",+ "store_credit_label": "Kredyt sklepowy",+ "title": "Rabaty i środki"},"load_failed_message": "Nie udało się załadować zamówienia {{orderId}}.","messages": {@@ -2878,7 +2885,9 @@"payments_table": {"method": "Metoda","number": "Numer",- "state": "Stan"+ "state": "Stan",+ "this_order": "To zamówienie",+ "shared_help": "Zapłacone raz za koszyk obejmujący kilku sprzedawców. To zamówienie ma w nim udział."},"purchase_order": {"document": "Dokument zamówienia zakupu",@@ -5302,6 +5311,62 @@"owner": {"marketplace": "Marketplace"}+ },+ "payouts": {+ "transfers_description": "Ile każde zrealizowane zamówienie zarobiło sprzedawcy, po odjęciu Twojej prowizji.",+ "transfers_empty": "Brak zarobków sprzedawców.",+ "payouts_description": "Wypłaty dla sprzedawców — co jest należne i co zostało wysłane.",+ "payouts_empty": "Brak wypłat.",+ "load_error": "Nie udało się wczytać tej wypłaty",+ "marked_paid": "Wypłata oznaczona jako zapłacona",+ "columns": {+ "date": "Data",+ "order": "Zamówienie",+ "kind": "Typ",+ "reference": "Numer referencyjny",+ "provider": "Dostawca",+ "earnings": "Zarobki"+ },+ "kinds": {+ "earning": "Sprzedaż",+ "refund_reversal": "Zwrot"+ },+ "statuses": {+ "pending": "Oczekuje",+ "processing": "W trakcie",+ "completed": "Zakończona",+ "failed": "Nieudana",+ "unresolved": "Do sprawdzenia"+ },+ "balance": {+ "title": "Saldo",+ "owed": "Do zapłaty ({{currency}})",+ "earned": "Zarobione",+ "paid": "Wypłacone",+ "pending": "W drodze"+ },+ "complete": {+ "title": "Oznacz wypłatę jako zapłaconą",+ "description": "Zapisuje, że {{amount}} dotarło do {{seller}}. Nie przenosi to żadnych pieniędzy.",+ "reference_placeholder": "np. BACS-9912",+ "reference_help": "Numer referencyjny przelewu, aby można go było później odnaleźć.",+ "action": "Oznacz jako zapłacone"+ },+ "detail": {+ "covers_one": "Obejmuje {{count}} zarobek",+ "covers_few": "Obejmuje {{count}} zarobki",+ "covers_many": "Obejmuje {{count}} zarobków",+ "covers_other": "Obejmuje {{count}} zarobków",+ "covers_empty": "Ta wypłata nie obejmuje żadnych zarobków.",+ "settlement": "Wypłata",+ "period": "Okres"+ },+ "order_card": {+ "title": "Zarobki sprzedawcy",+ "view_payout": "Zobacz wypłatę",+ "not_settled": "Jeszcze nie wypłacone"+ },+ "search_placeholder": "Szukaj po numerze referencyjnym"}}}diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.jsonindex 3502f17842..9d30d9f84e 100644--- a/packages/dashboard/src/locales/zh-CN.json+++ b/packages/dashboard/src/locales/zh-CN.json@@ -2560,6 +2560,8 @@"promotions": "促销","reports": "报表","returns": "退货",+ "seller_payouts": "打款",+ "seller_transfers": "收入","sellers": "卖家","settings": "设置","transfers": "调拨",@@ -2702,6 +2704,7 @@"complete_message": "现在完成此草稿订单吗?","remove_gift_card_message": "从订单中移除此礼品卡吗?","remove_item_message": "从订单中移除此商品吗?",+ "remove_store_credit_message": "从订单中移除商店积分吗?","ship_message": "发货此履约单吗?","void_message": "作废此付款吗?"},@@ -2809,12 +2812,16 @@"upload_label_title": "上传面单"},"gift_card_section": {+ "applied_suffix": "已应用",+ "apply_balance": "应用客户的可用余额","apply_dialog_description": "输入要应用到此订单的礼品卡代码。","apply_dialog_title": "应用礼品卡","code_placeholder": "GIFT-XXXX-YYYY","gift_card_label": "礼品卡","none_applied": "未应用",- "title": "折扣与礼品卡"+ "requires_customer": "需要客户",+ "store_credit_label": "店铺积分",+ "title": "折扣与余额"},"load_failed_message": "无法加载订单 {{orderId}}。","messages": {@@ -2844,7 +2851,9 @@"payments_table": {"method": "方式","number": "编号",- "state": "州/省"+ "state": "州/省",+ "this_order": "本订单",+ "shared_help": "该购物车横跨多个卖家,只支付了一次。本订单占其中一部分。"},"purchase_order": {"document": "采购订单文件",@@ -5235,6 +5244,59 @@"owner": {"marketplace": "市场平台"}+ },+ "payouts": {+ "transfers_description": "每笔已发货订单为卖家带来的收入,已扣除您的佣金。",+ "transfers_empty": "暂无卖家收入。",+ "payouts_description": "向卖家的打款——待付金额与已发出金额。",+ "payouts_empty": "暂无打款记录。",+ "load_error": "无法加载此打款记录",+ "marked_paid": "打款已标记为已支付",+ "columns": {+ "date": "日期",+ "order": "订单",+ "kind": "类型",+ "reference": "参考号",+ "provider": "服务商",+ "earnings": "收入"+ },+ "kinds": {+ "earning": "销售",+ "refund_reversal": "退款"+ },+ "statuses": {+ "pending": "待处理",+ "processing": "处理中",+ "completed": "已完成",+ "failed": "失败",+ "unresolved": "需核查"+ },+ "balance": {+ "title": "余额",+ "owed": "应付({{currency}})",+ "earned": "已赚取",+ "paid": "已打款",+ "pending": "在途"+ },+ "complete": {+ "title": "将此打款标记为已支付",+ "description": "记录 {{amount}} 已到账 {{seller}}。此操作不会转移任何资金。",+ "reference_placeholder": "例如 BACS-9912",+ "reference_help": "这笔转账的银行参考号,便于日后追溯。",+ "action": "标记为已支付"+ },+ "detail": {+ "covers_other": "包含 {{count}} 笔收入",+ "covers_empty": "此打款不包含任何收入。",+ "settlement": "打款",+ "period": "周期"+ },+ "order_card": {+ "title": "卖家收入",+ "view_payout": "查看打款",+ "not_settled": "尚未打款"+ },+ "search_placeholder": "按参考号搜索"}}}diff --git a/packages/dashboard/src/nav/default.ts b/packages/dashboard/src/nav/default.tsindex 5aa2c0f104..12346838de 100644--- a/packages/dashboard/src/nav/default.ts+++ b/packages/dashboard/src/nav/default.ts@@ -191,6 +191,25 @@ nav.add({icon: StoreIcon,subject: Subject.Seller,position: 450,+ children: [+ // The fund ledger. Under Sellers because that is what it is about, the+ // way returns sit under Orders — and gated on the ledger subjects, so a+ // staff member who manages sellers without seeing the money gets neither.+ {+ key: 'sellers.transfers',+ labelKey: 'admin.nav.seller_transfers',+ path: '/sellers/transfers',+ subject: Subject.SellerTransfer,+ position: 100,+ },+ {+ key: 'sellers.payouts',+ labelKey: 'admin.nav.seller_payouts',+ path: '/sellers/payouts',+ subject: Subject.SellerPayout,+ position: 200,+ },+ ],})nav.add({diff --git a/packages/dashboard/src/routeTree.gen.ts b/packages/dashboard/src/routeTree.gen.tsindex 57f38aff6d..958926d5dd 100644--- a/packages/dashboard/src/routeTree.gen.ts+++ b/packages/dashboard/src/routeTree.gen.ts@@ -52,6 +52,7 @@ import { Route as SettingsCommissionRatesRouteImport } from './routes/_authenticimport { Route as SettingsChannelsRouteImport } from './routes/_authenticated/$storeId/settings/channels'import { Route as SettingsApiKeysRouteImport } from './routes/_authenticated/$storeId/settings/api-keys'import { Route as SettingsAllowedOriginsRouteImport } from './routes/_authenticated/$storeId/settings/allowed-origins'+import { Route as SellersTransfersRouteImport } from './routes/_authenticated/$storeId/sellers/transfers'import { Route as SellersSellerIdRouteImport } from './routes/_authenticated/$storeId/sellers/$sellerId'import { Route as PromotionsNewRouteImport } from './routes/_authenticated/$storeId/promotions/new'import { Route as PromotionsGiftCardsRouteImport } from './routes/_authenticated/$storeId/promotions/gift-cards'@@ -70,12 +71,14 @@ import { Route as CompaniesCompanyIdRouteImport } from './routes/_authenticated/import { Route as SettingsWebhooksIndexRouteImport } from './routes/_authenticated/$storeId/settings/webhooks/index'import { Route as SettingsImportsIndexRouteImport } from './routes/_authenticated/$storeId/settings/imports/index'import { Route as SettingsDeliveryProfilesIndexRouteImport } from './routes/_authenticated/$storeId/settings/delivery-profiles/index'+import { Route as SellersPayoutsIndexRouteImport } from './routes/_authenticated/$storeId/sellers/payouts/index'import { Route as ProductsPriceListsIndexRouteImport } from './routes/_authenticated/$storeId/products/price-lists/index'import { Route as ProductsCollectionsIndexRouteImport } from './routes/_authenticated/$storeId/products/collections/index'import { Route as ProductsCategoriesIndexRouteImport } from './routes/_authenticated/$storeId/products/categories/index'import { Route as ProductsCatalogsIndexRouteImport } from './routes/_authenticated/$storeId/products/catalogs/index'import { Route as OrdersOrderIdIndexRouteImport } from './routes/_authenticated/$storeId/orders/$orderId/index'import { Route as SettingsWebhooksWebhookEndpointIdRouteImport } from './routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'+import { Route as SellersPayoutsPayoutIdRouteImport } from './routes/_authenticated/$storeId/sellers/payouts/$payoutId'import { Route as ProductsPriceListsNewRouteImport } from './routes/_authenticated/$storeId/products/price-lists/new'import { Route as ProductsCollectionsNewRouteImport } from './routes/_authenticated/$storeId/products/collections/new'import { Route as ProductsCollectionsCollectionIdRouteImport } from './routes/_authenticated/$storeId/products/collections/$collectionId'@@ -305,6 +308,11 @@ const SettingsAllowedOriginsRoute = SettingsAllowedOriginsRouteImport.update({path: '/allowed-origins',getParentRoute: () => SettingsRoute,} as any)+const SellersTransfersRoute = SellersTransfersRouteImport.update({+ id: '/sellers/transfers',+ path: '/sellers/transfers',+ getParentRoute: () => authenticatedStoreIdRoute,+} as any)const SellersSellerIdRoute = SellersSellerIdRouteImport.update({id: '/sellers/$sellerId',path: '/sellers/$sellerId',@@ -396,6 +404,11 @@ const SettingsDeliveryProfilesIndexRoute =path: '/delivery-profiles/',getParentRoute: () => SettingsRoute,} as any)+const SellersPayoutsIndexRoute = SellersPayoutsIndexRouteImport.update({+ id: '/sellers/payouts/',+ path: '/sellers/payouts/',+ getParentRoute: () => authenticatedStoreIdRoute,+} as any)const ProductsPriceListsIndexRoute = ProductsPriceListsIndexRouteImport.update({id: '/products/price-lists/',path: '/products/price-lists/',@@ -428,6 +441,11 @@ const SettingsWebhooksWebhookEndpointIdRoute =path: '/webhooks/$webhookEndpointId',getParentRoute: () => SettingsRoute,} as any)+const SellersPayoutsPayoutIdRoute = SellersPayoutsPayoutIdRouteImport.update({+ id: '/sellers/payouts/$payoutId',+ path: '/sellers/payouts/$payoutId',+ getParentRoute: () => authenticatedStoreIdRoute,+} as any)const ProductsPriceListsNewRoute = ProductsPriceListsNewRouteImport.update({id: '/products/price-lists/new',path: '/products/price-lists/new',@@ -521,6 +539,7 @@ export interface FileRoutesByFullPath {'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute'/$storeId/promotions/new': typeof PromotionsNewRoute'/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute+ '/$storeId/sellers/transfers': typeof SellersTransfersRoute'/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute'/$storeId/settings/api-keys': typeof SettingsApiKeysRoute'/$storeId/settings/channels': typeof SettingsChannelsRoute@@ -556,12 +575,14 @@ export interface FileRoutesByFullPath {'/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute'/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute'/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute+ '/$storeId/sellers/payouts/$payoutId': typeof SellersPayoutsPayoutIdRoute'/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute'/$storeId/orders/$orderId/': typeof OrdersOrderIdIndexRoute'/$storeId/products/catalogs/': typeof ProductsCatalogsIndexRoute'/$storeId/products/categories/': typeof ProductsCategoriesIndexRoute'/$storeId/products/collections/': typeof ProductsCollectionsIndexRoute'/$storeId/products/price-lists/': typeof ProductsPriceListsIndexRoute+ '/$storeId/sellers/payouts/': typeof SellersPayoutsIndexRoute'/$storeId/settings/delivery-profiles/': typeof SettingsDeliveryProfilesIndexRoute'/$storeId/settings/imports/': typeof SettingsImportsIndexRoute'/$storeId/settings/webhooks/': typeof SettingsWebhooksIndexRoute@@ -598,6 +619,7 @@ export interface FileRoutesByTo {'/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute'/$storeId/promotions/new': typeof PromotionsNewRoute'/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute+ '/$storeId/sellers/transfers': typeof SellersTransfersRoute'/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute'/$storeId/settings/api-keys': typeof SettingsApiKeysRoute'/$storeId/settings/channels': typeof SettingsChannelsRoute@@ -633,12 +655,14 @@ export interface FileRoutesByTo {'/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute'/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute'/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute+ '/$storeId/sellers/payouts/$payoutId': typeof SellersPayoutsPayoutIdRoute'/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute'/$storeId/orders/$orderId': typeof OrdersOrderIdIndexRoute'/$storeId/products/catalogs': typeof ProductsCatalogsIndexRoute'/$storeId/products/categories': typeof ProductsCategoriesIndexRoute'/$storeId/products/collections': typeof ProductsCollectionsIndexRoute'/$storeId/products/price-lists': typeof ProductsPriceListsIndexRoute+ '/$storeId/sellers/payouts': typeof SellersPayoutsIndexRoute'/$storeId/settings/delivery-profiles': typeof SettingsDeliveryProfilesIndexRoute'/$storeId/settings/imports': typeof SettingsImportsIndexRoute'/$storeId/settings/webhooks': typeof SettingsWebhooksIndexRoute@@ -679,6 +703,7 @@ export interface FileRoutesById {'/_authenticated/$storeId/promotions/gift-cards': typeof PromotionsGiftCardsRoute'/_authenticated/$storeId/promotions/new': typeof PromotionsNewRoute'/_authenticated/$storeId/sellers/$sellerId': typeof SellersSellerIdRoute+ '/_authenticated/$storeId/sellers/transfers': typeof SellersTransfersRoute'/_authenticated/$storeId/settings/allowed-origins': typeof SettingsAllowedOriginsRoute'/_authenticated/$storeId/settings/api-keys': typeof SettingsApiKeysRoute'/_authenticated/$storeId/settings/channels': typeof SettingsChannelsRoute@@ -714,12 +739,14 @@ export interface FileRoutesById {'/_authenticated/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute'/_authenticated/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute'/_authenticated/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute+ '/_authenticated/$storeId/sellers/payouts/$payoutId': typeof SellersPayoutsPayoutIdRoute'/_authenticated/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute'/_authenticated/$storeId/orders/$orderId/': typeof OrdersOrderIdIndexRoute'/_authenticated/$storeId/products/catalogs/': typeof ProductsCatalogsIndexRoute'/_authenticated/$storeId/products/categories/': typeof ProductsCategoriesIndexRoute'/_authenticated/$storeId/products/collections/': typeof ProductsCollectionsIndexRoute'/_authenticated/$storeId/products/price-lists/': typeof ProductsPriceListsIndexRoute+ '/_authenticated/$storeId/sellers/payouts/': typeof SellersPayoutsIndexRoute'/_authenticated/$storeId/settings/delivery-profiles/': typeof SettingsDeliveryProfilesIndexRoute'/_authenticated/$storeId/settings/imports/': typeof SettingsImportsIndexRoute'/_authenticated/$storeId/settings/webhooks/': typeof SettingsWebhooksIndexRoute@@ -760,6 +787,7 @@ export interface FileRouteTypes {| '/$storeId/promotions/gift-cards'| '/$storeId/promotions/new'| '/$storeId/sellers/$sellerId'+ | '/$storeId/sellers/transfers'| '/$storeId/settings/allowed-origins'| '/$storeId/settings/api-keys'| '/$storeId/settings/channels'@@ -795,12 +823,14 @@ export interface FileRouteTypes {| '/$storeId/products/collections/$collectionId'| '/$storeId/products/collections/new'| '/$storeId/products/price-lists/new'+ | '/$storeId/sellers/payouts/$payoutId'| '/$storeId/settings/webhooks/$webhookEndpointId'| '/$storeId/orders/$orderId/'| '/$storeId/products/catalogs/'| '/$storeId/products/categories/'| '/$storeId/products/collections/'| '/$storeId/products/price-lists/'+ | '/$storeId/sellers/payouts/'| '/$storeId/settings/delivery-profiles/'| '/$storeId/settings/imports/'| '/$storeId/settings/webhooks/'@@ -837,6 +867,7 @@ export interface FileRouteTypes {| '/$storeId/promotions/gift-cards'| '/$storeId/promotions/new'| '/$storeId/sellers/$sellerId'+ | '/$storeId/sellers/transfers'| '/$storeId/settings/allowed-origins'| '/$storeId/settings/api-keys'| '/$storeId/settings/channels'@@ -872,12 +903,14 @@ export interface FileRouteTypes {| '/$storeId/products/collections/$collectionId'| '/$storeId/products/collections/new'| '/$storeId/products/price-lists/new'+ | '/$storeId/sellers/payouts/$payoutId'| '/$storeId/settings/webhooks/$webhookEndpointId'| '/$storeId/orders/$orderId'| '/$storeId/products/catalogs'| '/$storeId/products/categories'| '/$storeId/products/collections'| '/$storeId/products/price-lists'+ | '/$storeId/sellers/payouts'| '/$storeId/settings/delivery-profiles'| '/$storeId/settings/imports'| '/$storeId/settings/webhooks'@@ -917,6 +950,7 @@ export interface FileRouteTypes {| '/_authenticated/$storeId/promotions/gift-cards'| '/_authenticated/$storeId/promotions/new'| '/_authenticated/$storeId/sellers/$sellerId'+ | '/_authenticated/$storeId/sellers/transfers'| '/_authenticated/$storeId/settings/allowed-origins'| '/_authenticated/$storeId/settings/api-keys'| '/_authenticated/$storeId/settings/channels'@@ -952,12 +986,14 @@ export interface FileRouteTypes {| '/_authenticated/$storeId/products/collections/$collectionId'| '/_authenticated/$storeId/products/collections/new'| '/_authenticated/$storeId/products/price-lists/new'+ | '/_authenticated/$storeId/sellers/payouts/$payoutId'| '/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'| '/_authenticated/$storeId/orders/$orderId/'| '/_authenticated/$storeId/products/catalogs/'| '/_authenticated/$storeId/products/categories/'| '/_authenticated/$storeId/products/collections/'| '/_authenticated/$storeId/products/price-lists/'+ | '/_authenticated/$storeId/sellers/payouts/'| '/_authenticated/$storeId/settings/delivery-profiles/'| '/_authenticated/$storeId/settings/imports/'| '/_authenticated/$storeId/settings/webhooks/'@@ -1279,6 +1315,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof SettingsAllowedOriginsRouteImportparentRoute: typeof SettingsRoute}+ '/_authenticated/$storeId/sellers/transfers': {+ id: '/_authenticated/$storeId/sellers/transfers'+ path: '/sellers/transfers'+ fullPath: '/$storeId/sellers/transfers'+ preLoaderRoute: typeof SellersTransfersRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }'/_authenticated/$storeId/sellers/$sellerId': {id: '/_authenticated/$storeId/sellers/$sellerId'path: '/sellers/$sellerId'@@ -1405,6 +1448,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof SettingsDeliveryProfilesIndexRouteImportparentRoute: typeof SettingsRoute}+ '/_authenticated/$storeId/sellers/payouts/': {+ id: '/_authenticated/$storeId/sellers/payouts/'+ path: '/sellers/payouts'+ fullPath: '/$storeId/sellers/payouts/'+ preLoaderRoute: typeof SellersPayoutsIndexRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }'/_authenticated/$storeId/products/price-lists/': {id: '/_authenticated/$storeId/products/price-lists/'path: '/products/price-lists'@@ -1447,6 +1497,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof SettingsWebhooksWebhookEndpointIdRouteImportparentRoute: typeof SettingsRoute}+ '/_authenticated/$storeId/sellers/payouts/$payoutId': {+ id: '/_authenticated/$storeId/sellers/payouts/$payoutId'+ path: '/sellers/payouts/$payoutId'+ fullPath: '/$storeId/sellers/payouts/$payoutId'+ preLoaderRoute: typeof SellersPayoutsPayoutIdRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }'/_authenticated/$storeId/products/price-lists/new': {id: '/_authenticated/$storeId/products/price-lists/new'path: '/products/price-lists/new'@@ -1622,6 +1679,7 @@ interface authenticatedStoreIdRouteChildren {PromotionsGiftCardsRoute: typeof PromotionsGiftCardsRoutePromotionsNewRoute: typeof PromotionsNewRouteSellersSellerIdRoute: typeof SellersSellerIdRoute+ SellersTransfersRoute: typeof SellersTransfersRouteCompaniesIndexRoute: typeof CompaniesIndexRouteCustomersIndexRoute: typeof CustomersIndexRouteOrdersIndexRoute: typeof OrdersIndexRoute@@ -1635,11 +1693,13 @@ interface authenticatedStoreIdRouteChildren {ProductsCollectionsCollectionIdRoute: typeof ProductsCollectionsCollectionIdRouteProductsCollectionsNewRoute: typeof ProductsCollectionsNewRouteProductsPriceListsNewRoute: typeof ProductsPriceListsNewRoute+ SellersPayoutsPayoutIdRoute: typeof SellersPayoutsPayoutIdRouteOrdersOrderIdIndexRoute: typeof OrdersOrderIdIndexRouteProductsCatalogsIndexRoute: typeof ProductsCatalogsIndexRouteProductsCategoriesIndexRoute: typeof ProductsCategoriesIndexRouteProductsCollectionsIndexRoute: typeof ProductsCollectionsIndexRouteProductsPriceListsIndexRoute: typeof ProductsPriceListsIndexRoute+ SellersPayoutsIndexRoute: typeof SellersPayoutsIndexRouteProductsPriceListsPriceListIdIndexRoute: typeof ProductsPriceListsPriceListIdIndexRoute}@@ -1666,6 +1726,7 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {PromotionsGiftCardsRoute: PromotionsGiftCardsRoute,PromotionsNewRoute: PromotionsNewRoute,SellersSellerIdRoute: SellersSellerIdRoute,+ SellersTransfersRoute: SellersTransfersRoute,CompaniesIndexRoute: CompaniesIndexRoute,CustomersIndexRoute: CustomersIndexRoute,OrdersIndexRoute: OrdersIndexRoute,@@ -1679,11 +1740,13 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {ProductsCollectionsCollectionIdRoute: ProductsCollectionsCollectionIdRoute,ProductsCollectionsNewRoute: ProductsCollectionsNewRoute,ProductsPriceListsNewRoute: ProductsPriceListsNewRoute,+ SellersPayoutsPayoutIdRoute: SellersPayoutsPayoutIdRoute,OrdersOrderIdIndexRoute: OrdersOrderIdIndexRoute,ProductsCatalogsIndexRoute: ProductsCatalogsIndexRoute,ProductsCategoriesIndexRoute: ProductsCategoriesIndexRoute,ProductsCollectionsIndexRoute: ProductsCollectionsIndexRoute,ProductsPriceListsIndexRoute: ProductsPriceListsIndexRoute,+ SellersPayoutsIndexRoute: SellersPayoutsIndexRoute,ProductsPriceListsPriceListIdIndexRoute:ProductsPriceListsPriceListIdIndexRoute,}diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/index.tsxindex 763cf17a92..831fd2e093 100644--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/index.tsx+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/index.tsx@@ -31,6 +31,7 @@ import {} from '../../../../../components/spree/orders/order-notes-cards'import { PaymentsCard } from '../../../../../components/spree/orders/order-payments-card'import { OrderPurchaseOrderCard } from '../../../../../components/spree/orders/order-purchase-order-card'+import { SellerTransfersCard } from '../../../../../components/spree/orders/order-seller-transfers-card'import { OrderSkeleton } from '../../../../../components/spree/orders/order-skeleton'import { OrderSummaryCard } from '../../../../../components/spree/orders/order-summary-card'import { useOrder } from '../../../../../hooks/use-order'@@ -78,6 +79,7 @@ function OrderDetailPage() {<OrderDiscountsCard order={order} /><FeesCard order={order} /><CommissionLinesCard order={order} />+ <SellerTransfersCard order={order} /><OrderSummaryCard order={order} /><EditableApiCustomFieldsProviderownerType="Spree::Order"diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsxindex 929ef22294..b9f24b409a 100644--- a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx@@ -16,6 +16,7 @@ import { useTranslation } from 'react-i18next'import { ResourceDetailSkeleton } from '../../../../components/spree/route-pending'import { SellerAddressCard } from '../../../../components/spree/sellers/seller-address-card'import { SellerAtAGlanceCard } from '../../../../components/spree/sellers/seller-at-a-glance-card'+import { SellerBalanceCard } from '../../../../components/spree/sellers/seller-balance-card'import { SellerBrandCard } from '../../../../components/spree/sellers/seller-brand-card'import { SellerContactCard } from '../../../../components/spree/sellers/seller-contact-card'import { SellerEditProfileSheet } from '../../../../components/spree/sellers/seller-edit-profile-sheet'@@ -275,6 +276,7 @@ function SellerBody({ seller }: { seller: Seller }) {<><SellerStatusCard seller={seller} /><SellerAtAGlanceCard seller={seller} />+ <SellerBalanceCard seller={seller} /><SellerContactCardseller={seller}canEdit={canEdit}diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/$payoutId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/$payoutId.tsxnew file mode 100644index 0000000000..b7f9cb6344--- /dev/null+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/$payoutId.tsx@@ -0,0 +1,188 @@+import { adminClient, PageHeader, Subject, usePermissions } from '@spree/dashboard-core'+import {+ Button,+ Card,+ CardHeader,+ CardTitle,+ ErrorState,+ Pagination,+ ResourceLayout,+ StatusBadge,+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from '@spree/dashboard-ui'+import { HandCoinsIcon } from '@spree/dashboard-ui/icons'+import { createFileRoute, Link } from '@tanstack/react-router'+import i18n from 'i18next'+import { useState } from 'react'+import { useTranslation } from 'react-i18next'+import { ResourceDetailSkeleton } from '../../../../../components/spree/route-pending'+import { PayoutCompleteDialog } from '../../../../../components/spree/sellers/payout-complete-dialog'+import { ReadRow } from '../../../../../components/spree/sellers/seller-read-row'+import { usePayout, useSellerTransfers } from '../../../../../hooks/use-seller-ledger'++const OWED = ['pending', 'processing', 'unresolved']++export const Route = createFileRoute('/_authenticated/$storeId/sellers/payouts/$payoutId')({+ component: PayoutDetailPage,+})++/**+ * One settlement, and the earnings it covers.+ *+ * The itemisation is what makes a payout auditable: it names exactly which+ * orders were settled, so a figure on a bank statement can be traced back to+ * the sales behind it.+ */+function PayoutDetailPage() {+ const { t } = useTranslation()+ const { payoutId } = Route.useParams()+ const { permissions } = usePermissions()+ const [completing, setCompleting] = useState(false)+ const [page, setPage] = useState(1)++ const { data: payout, isLoading, error, refetch } = usePayout(payoutId)+ const { data: transfers } = useSellerTransfers({ payout_id_eq: payoutId }, page)++ if (isLoading) return <ResourceDetailSkeleton />+ if (error || !payout) {+ return (+ <ErrorState+ title={t('admin.payouts.load_error')}+ error={error as Error | undefined}+ onRetry={() => refetch()}+ />+ )+ }++ const rows = transfers?.data ?? []+ const canComplete =+ permissions.can('update', Subject.SellerPayout) && OWED.includes(payout.status)++ return (+ <>+ <ResourceLayout+ header={+ <PageHeader+ title={payout.display_amount}+ subtitle={payout.seller_name ?? undefined}+ backTo="sellers/payouts"+ badges={+ <StatusBadge+ status={payout.status}+ label={t(`admin.payouts.statuses.${payout.status}`, {+ defaultValue: payout.status,+ })}+ />+ }+ actions={+ canComplete ? (+ <Button onClick={() => setCompleting(true)}>+ {t('admin.payouts.complete.action')}+ </Button>+ ) : null+ }+ resource={{ id: payout.id }}+ jsonPreview={{+ title: `Payout ${payout.id}`,+ fetch: () => adminClient.sellerPayouts.get(payout.id),+ endpoint: `/api/v3/admin/seller_payouts/${payout.id}`,+ }}+ />+ }+ main={+ <Card>+ <CardHeader>+ <CardTitle>+ <HandCoinsIcon className="size-4" />+ {/* The settlement's own count, not the rows this page+ happened to load — the list is paged. */}+ {t('admin.payouts.detail.covers', { count: payout.transfers_count })}+ </CardTitle>+ </CardHeader>++ {rows.length === 0 ? (+ <p className="px-6 pb-6 text-sm text-muted-foreground">+ {t('admin.payouts.detail.covers_empty')}+ </p>+ ) : (+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead>{t('admin.payouts.columns.date')}</TableHead>+ <TableHead>{t('admin.payouts.columns.order')}</TableHead>+ <TableHead>{t('admin.payouts.columns.kind')}</TableHead>+ <TableHead className="text-right">{t('admin.fields.amount.label')}</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {rows.map((transfer) => (+ <TableRow key={transfer.id}>+ <TableCell>{formatDate(transfer.created_at)}</TableCell>+ <TableCell>+ {transfer.order_id ? (+ <Link+ to={'/$storeId/orders/$orderId' as string}+ params={{ orderId: transfer.order_id }}+ className="no-underline"+ >+ {transfer.order_number ?? transfer.order_id}+ </Link>+ ) : (+ '—'+ )}+ </TableCell>+ <TableCell className="text-muted-foreground">+ {t(`admin.payouts.kinds.${transfer.kind}`, {+ defaultValue: transfer.kind,+ })}+ </TableCell>+ <TableCell className="text-right tabular-nums">+ {transfer.display_amount}+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ )}+ {transfers?.meta && transfers.meta.pages > 1 && (+ <Pagination meta={transfers.meta} onPageChange={setPage} />+ )}+ </Card>+ }+ sidebar={+ <Card>+ <CardHeader>+ <CardTitle>{t('admin.payouts.detail.settlement')}</CardTitle>+ </CardHeader>+ <div className="flex flex-col gap-3 px-6 pb-6">+ <ReadRow label={t('admin.fields.amount.label')}>{payout.display_amount}</ReadRow>+ <ReadRow label={t('admin.payouts.columns.reference')}>{payout.reference}</ReadRow>+ <ReadRow label={t('admin.payouts.columns.provider')}>{payout.provider}</ReadRow>+ <ReadRow label={t('admin.payouts.detail.period')}>+ {payout.period_start && payout.period_end+ ? `${formatDate(payout.period_start)} – ${formatDate(payout.period_end)}`+ : null}+ </ReadRow>+ </div>+ </Card>+ }+ />++ {completing && <PayoutCompleteDialog payout={payout} open onOpenChange={setCompleting} />}+ </>+ )+}++function formatDate(iso: string | null | undefined) {+ if (!iso) return '—'+ return new Date(iso).toLocaleDateString(i18n.language, {+ month: 'short',+ day: 'numeric',+ year: 'numeric',+ })+}diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/index.tsxnew file mode 100644index 0000000000..23eef6460a--- /dev/null+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/index.tsx@@ -0,0 +1,79 @@+import type { SellerPayout } from '@spree/admin-sdk'+import {+ adminClient,+ ResourceTable,+ resourceSearchSchema,+ Subject,+ usePermissions,+} from '@spree/dashboard-core'+import { RowActions, useRowClickBridge } from '@spree/dashboard-ui'+import { CheckCircleIcon } from '@spree/dashboard-ui/icons'+import { createFileRoute, useNavigate } from '@tanstack/react-router'+import { useState } from 'react'+import { useTranslation } from 'react-i18next'+import { PayoutCompleteDialog } from '../../../../../components/spree/sellers/payout-complete-dialog'+import '../../../../../tables/seller-ledger'++// A settlement the sweep has written but nobody has confirmed. The workflow+// accepts exactly these, so offering the action on anything else would+// promise a move the server refuses.+const OWED = ['pending', 'processing', 'unresolved']++export const Route = createFileRoute('/_authenticated/$storeId/sellers/payouts/')({+ validateSearch: resourceSearchSchema,+ component: SellerPayoutsPage,+})++/**+ * What the marketplace owes its sellers, and what it has sent.+ *+ * The queue an operator works through on payout day: the built-in provider+ * records a settlement and waits to be told the bank transfer went out.+ */+function SellerPayoutsPage() {+ const { t } = useTranslation()+ const searchParams = Route.useSearch()+ const { storeId } = Route.useParams()+ const navigate = useNavigate()+ const { permissions } = usePermissions()+ const [completing, setCompleting] = useState<SellerPayout | null>(null)++ const canComplete = permissions.can('update', Subject.SellerPayout)++ useRowClickBridge('data-payout-id', (payoutId: string) =>+ navigate({ to: '/$storeId/sellers/payouts/$payoutId', params: { storeId, payoutId } }),+ )++ return (+ <>+ <ResourceTable<SellerPayout>+ tableKey="seller-payouts"+ queryKey="seller-payouts"+ queryFn={(params) => adminClient.sellerPayouts.list(params)}+ searchParams={searchParams}+ title={t('admin.nav.seller_payouts')}+ rowActions={(payout) => (+ <RowActions+ actions={[+ {+ key: 'complete',+ label: t('admin.payouts.complete.action'),+ icon: <CheckCircleIcon className="size-4" />,+ visible: canComplete && OWED.includes(payout.status),+ onSelect: () => setCompleting(payout),+ },+ ]}+ />+ )}+ />++ {completing && (+ <PayoutCompleteDialog+ payout={completing}+ open+ onOpenChange={(open) => !open && setCompleting(null)}+ />+ )}+ </>+ )+}diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/transfers.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/transfers.tsxnew file mode 100644index 0000000000..f3cdea1e8e--- /dev/null+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/transfers.tsx@@ -0,0 +1,31 @@+import { adminClient, ResourceTable, resourceSearchSchema } from '@spree/dashboard-core'+import { createFileRoute } from '@tanstack/react-router'+import { useTranslation } from 'react-i18next'+import '../../../../tables/seller-ledger'++export const Route = createFileRoute('/_authenticated/$storeId/sellers/transfers')({+ validateSearch: resourceSearchSchema,+ component: SellerTransfersPage,+})++/**+ * What the marketplace's sellers have earned, order by order.+ *+ * Read-only, like the returns and exchanges lists: an earning is written when+ * an order is fulfilled and corrected by a reversal when it is refunded, so+ * there is nothing here to act on — what an operator acts on is the payout.+ */+function SellerTransfersPage() {+ const { t } = useTranslation()+ const searchParams = Route.useSearch()++ return (+ <ResourceTable+ tableKey="seller-transfers"+ queryKey="seller-transfers"+ queryFn={(params) => adminClient.sellerTransfers.list(params)}+ searchParams={searchParams}+ title={t('admin.nav.seller_transfers')}+ />+ )+}diff --git a/packages/dashboard/src/tables/seller-ledger.tsx b/packages/dashboard/src/tables/seller-ledger.tsxnew file mode 100644index 0000000000..a9bdcc8ede--- /dev/null+++ b/packages/dashboard/src/tables/seller-ledger.tsx@@ -0,0 +1,216 @@+import type { SellerPayout, SellerTransfer } from '@spree/admin-sdk'+import { defineTable } from '@spree/dashboard-core'+import { ResourceNameCell, StatusBadge } from '@spree/dashboard-ui'+import { BanknoteIcon, HandCoinsIcon } from '@spree/dashboard-ui/icons'+import { Link } from '@tanstack/react-router'+import i18n from 'i18next'+import { sellerAutocompleteProps } from '../hooks/use-sellers'++const LEDGER_STATUSES = ['pending', 'processing', 'completed', 'failed', 'unresolved'] as const+const TRANSFER_KINDS = ['earning', 'refund_reversal'] as const++function statusOptions() {+ return LEDGER_STATUSES.map((status) => ({+ value: status,+ label: i18n.t(`admin.payouts.statuses.${status}`),+ }))+}++defineTable<SellerTransfer>('seller-transfers', {+ title: i18n.t('admin.nav.seller_transfers'),+ description: i18n.t('admin.payouts.transfers_description'),+ // The provider's own id for the movement. Without a searchParam the toolbar+ // would send `name_cont`, which neither ledger model whitelists — and+ // Ransack ignores an unknown condition, so the box would silently return+ // the unfiltered list.+ searchParam: 'reference_cont',+ searchPlaceholder: i18n.t('admin.payouts.search_placeholder'),+ defaultSort: { field: 'created_at', direction: 'desc' },+ emptyIcon: <BanknoteIcon className="size-8 text-muted-foreground" />,+ emptyMessage: i18n.t('admin.payouts.transfers_empty'),+ columns: [+ {+ key: 'created_at',+ label: i18n.t('admin.payouts.columns.date'),+ sortable: true,+ filterable: true,+ filterType: 'date',+ quickFilter: true,+ default: true,+ render: (transfer) => new Date(transfer.created_at).toLocaleDateString(i18n.language),+ },+ {+ key: 'seller_name',+ label: i18n.t('admin.nav.sellers'),+ filterable: true,+ filterType: 'resource',+ filterResource: sellerAutocompleteProps('seller-transfers-table-seller-filter'),+ ransackAttribute: 'seller_id',+ quickFilter: true,+ default: true,+ render: (transfer) =>+ transfer.seller_id ? (+ <Link+ to={'/$storeId/sellers/$sellerId' as string}+ params={{ sellerId: transfer.seller_id }}+ className="no-underline"+ >+ {transfer.seller_name ?? transfer.seller_id}+ </Link>+ ) : (+ '—'+ ),+ },+ {+ key: 'order_number',+ label: i18n.t('admin.payouts.columns.order'),+ default: true,+ render: (transfer) =>+ transfer.order_id ? (+ <Link+ to={'/$storeId/orders/$orderId' as string}+ params={{ orderId: transfer.order_id }}+ className="no-underline"+ >+ {transfer.order_number ?? transfer.order_id}+ </Link>+ ) : (+ '—'+ ),+ },+ {+ key: 'kind',+ label: i18n.t('admin.payouts.columns.kind'),+ filterable: true,+ filterType: 'enum',+ filterOptions: TRANSFER_KINDS.map((kind) => ({+ value: kind,+ label: i18n.t(`admin.payouts.kinds.${kind}`),+ })),+ quickFilter: true,+ default: true,+ render: (transfer) =>+ i18n.t(`admin.payouts.kinds.${transfer.kind}`, { defaultValue: transfer.kind }),+ },+ {+ key: 'status',+ label: i18n.t('admin.fields.status.label'),+ sortable: true,+ filterable: true,+ filterType: 'enum',+ filterOptions: statusOptions(),+ quickFilter: true,+ default: true,+ render: (transfer) => (+ <StatusBadge+ status={transfer.status}+ label={i18n.t(`admin.payouts.statuses.${transfer.status}`, {+ defaultValue: transfer.status,+ })}+ />+ ),+ },+ {+ key: 'provider',+ label: i18n.t('admin.payouts.columns.provider'),+ sortable: true,+ filterable: true,+ render: (transfer) => transfer.provider,+ },+ {+ key: 'amount',+ label: i18n.t('admin.fields.amount.label'),+ sortable: true,+ default: true,+ className: 'text-right tabular-nums',+ render: (transfer) => transfer.display_amount,+ },+ ],+})++defineTable<SellerPayout>('seller-payouts', {+ title: i18n.t('admin.nav.seller_payouts'),+ description: i18n.t('admin.payouts.payouts_description'),+ searchParam: 'reference_cont',+ searchPlaceholder: i18n.t('admin.payouts.search_placeholder'),+ defaultSort: { field: 'created_at', direction: 'desc' },+ emptyIcon: <HandCoinsIcon className="size-8 text-muted-foreground" />,+ emptyMessage: i18n.t('admin.payouts.payouts_empty'),+ columns: [+ {+ key: 'created_at',+ label: i18n.t('admin.payouts.columns.date'),+ sortable: true,+ filterable: true,+ filterType: 'date',+ quickFilter: true,+ default: true,+ render: (payout) => (+ <ResourceNameCell+ id={payout.id}+ dataAttr="data-payout-id"+ name={new Date(payout.created_at).toLocaleDateString(i18n.language)}+ />+ ),+ },+ {+ key: 'seller_name',+ label: i18n.t('admin.nav.sellers'),+ filterable: true,+ filterType: 'resource',+ filterResource: sellerAutocompleteProps('seller-payouts-table-seller-filter'),+ ransackAttribute: 'seller_id',+ quickFilter: true,+ default: true,+ render: (payout) =>+ payout.seller_id ? (+ <Link+ to={'/$storeId/sellers/$sellerId' as string}+ params={{ sellerId: payout.seller_id }}+ className="no-underline"+ >+ {payout.seller_name ?? payout.seller_id}+ </Link>+ ) : (+ '—'+ ),+ },+ {+ key: 'status',+ label: i18n.t('admin.fields.status.label'),+ sortable: true,+ filterable: true,+ filterType: 'enum',+ filterOptions: statusOptions(),+ quickFilter: true,+ default: true,+ render: (payout) => (+ <StatusBadge+ status={payout.status}+ label={i18n.t(`admin.payouts.statuses.${payout.status}`, { defaultValue: payout.status })}+ />+ ),+ },+ {+ key: 'transfers_count',+ label: i18n.t('admin.payouts.columns.earnings'),+ default: true,+ render: (payout) => payout.transfers_count,+ },+ {+ key: 'reference',+ label: i18n.t('admin.payouts.columns.reference'),+ filterable: true,+ default: true,+ render: (payout) => payout.reference ?? '—',+ },+ {+ key: 'amount',+ label: i18n.t('admin.fields.amount.label'),+ sortable: true,+ default: true,+ className: 'text-right tabular-nums',+ render: (payout) => payout.display_amount,+ },+ ],+})