docs: sync from backend cbc32dc — template delivery rails
This commit is contained in:
@@ -5,7 +5,7 @@ tags: [api, marketplace, reference]
|
||||
|
||||
# Marketplace API
|
||||
|
||||
> **Last updated:** 2026-05-29 — aligned with code (see [Doc vs Code Audit Report](../09%20-%20Audits/Doc%20vs%20Code%20Audit%20Report%20-%202026-05-29.md))
|
||||
> **Last updated:** 2026-05-31 — request-template delivery mode and payment rail validation updated.
|
||||
|
||||
All marketplace endpoints live under `/api/marketplace/*`. The router is composed of several files mounted from `app.ts`:
|
||||
|
||||
@@ -345,13 +345,23 @@ A [[RequestTemplate]] is a re-usable "shop product" a seller can publish. Buyers
|
||||
quantity?: number; // 1-10000
|
||||
budget?: { min?: number; max?: number; currency: "USD" | "EUR" | "IRR" | "USDT" | "USDC" };
|
||||
urgency?: "low" | "medium" | "high" | "urgent";
|
||||
deliveryInfo?: { deliveryType: "physical" | "online"; email?: string };
|
||||
deliveryInfo?: {
|
||||
deliveryType: "physical" | "online"; // seller-selected; buyer cannot override at checkout
|
||||
notes?: string;
|
||||
email?: string; // optional legacy field; empty string is accepted
|
||||
};
|
||||
paymentConfig?: {
|
||||
useShopDefault: boolean; // false = template override, true = shop defaults
|
||||
allowedChains: number[]; // at least one positive chain id when paymentConfig is sent
|
||||
allowedTokens: string[]; // at least one non-empty token symbol when paymentConfig is sent
|
||||
};
|
||||
maxUsage?: number | null; // 0/null = unlimited
|
||||
expiresAt?: string | null; // ISO date
|
||||
images?: string[]; // URLs from [[File API]]
|
||||
}
|
||||
```
|
||||
**Response 201:** `{ data: { template } }` with a generated `shareableLink`.
|
||||
**Validation:** If `paymentConfig` is present, both `allowedChains` and `allowedTokens` must be non-empty. The UI now defaults new templates to explicit template rails, so a seller must choose at least one chain and one token before publishing.
|
||||
|
||||
### GET /api/marketplace/request-templates
|
||||
|
||||
@@ -399,7 +409,7 @@ A [[RequestTemplate]] is a re-usable "shop product" a seller can publish. Buyers
|
||||
|
||||
### POST /api/marketplace/request-templates/batch-convert
|
||||
|
||||
**Description:** Convert several templates at once (cart checkout).
|
||||
**Description:** Convert several templates at once (cart checkout). The seller's template delivery mode is preserved; buyer-supplied checkout details are only overlaid where that mode requires them.
|
||||
**Auth required:** Bearer JWT (buyer)
|
||||
**Request body:**
|
||||
```ts
|
||||
@@ -410,8 +420,25 @@ A [[RequestTemplate]] is a re-usable "shop product" a seller can publish. Buyers
|
||||
sellerId: string; // MongoId
|
||||
}>;
|
||||
status?: "pending" | "pending_payment" | "active";
|
||||
paymentConfirmed?: boolean;
|
||||
paymentData?: Record<string, unknown>;
|
||||
deliveryInfo?: {
|
||||
email?: string; // copied to generated online requests
|
||||
billing?: {
|
||||
name?: string;
|
||||
phoneNumber?: string;
|
||||
address?: string;
|
||||
city?: string;
|
||||
state?: string;
|
||||
country?: string;
|
||||
zipCode?: string;
|
||||
addressType?: string;
|
||||
fullAddress?: string; // copied to generated physical requests
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
**Delivery mapping:** `online` templates use `deliveryInfo.email`; `physical` templates use `deliveryInfo.billing` to fill `deliveryInfo.address` and `deliveryInfo.deliveryAddress` on the generated [[PurchaseRequest]].
|
||||
|
||||
### POST /api/marketplace/request-templates/complete-payment
|
||||
|
||||
|
||||
Reference in New Issue
Block a user