@mohasinac/appkit 3.2.19 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/server/features/checkout/actions.d.ts +2 -0
- package/dist/_internal/server/features/checkout/actions.js +239 -190
- package/dist/_internal/server/functions/scheduled.d.ts +2 -1
- package/dist/_internal/server/functions/scheduled.js +9 -1
- package/dist/_internal/server/jobs/core/autoPayoutEligibility.js +8 -11
- package/dist/_internal/server/jobs/core/emiInstallmentReminder.d.ts +8 -0
- package/dist/_internal/server/jobs/core/emiInstallmentReminder.js +78 -0
- package/dist/_internal/server/jobs/core/weeklyPayoutEligibility.d.ts +2 -2
- package/dist/_internal/server/jobs/core/weeklyPayoutEligibility.js +15 -10
- package/dist/_internal/server/jobs/handlers/emiInstallmentReminder.d.ts +2 -0
- package/dist/_internal/server/jobs/handlers/emiInstallmentReminder.js +2 -0
- package/dist/_internal/server/jobs/handlers/index.d.ts +1 -0
- package/dist/_internal/server/jobs/handlers/index.js +2 -0
- package/dist/_internal/server/providers/index.d.ts +4 -4
- package/dist/_internal/server/providers/index.js +4 -4
- package/dist/_internal/server/providers/payment/razorpay-mock.d.ts +3 -2
- package/dist/_internal/server/providers/payment/razorpay-mock.js +3 -1
- package/dist/_internal/server/providers/resolve.d.ts +10 -13
- package/dist/_internal/server/providers/resolve.js +9 -15
- package/dist/_internal/shared/actions/action-registry.js +28 -0
- package/dist/_internal/shared/checkout/rules/_defaults.js +1 -0
- package/dist/_internal/shared/checkout/rules/_registry.js +4 -0
- package/dist/_internal/shared/checkout/rules/art.rule.d.ts +9 -0
- package/dist/_internal/shared/checkout/rules/art.rule.js +5 -0
- package/dist/_internal/shared/checkout/rules/auction.rule.js +1 -0
- package/dist/_internal/shared/checkout/rules/classified.rule.js +1 -0
- package/dist/_internal/shared/checkout/rules/index.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/index.js +2 -0
- package/dist/_internal/shared/checkout/rules/stickers.rule.d.ts +9 -0
- package/dist/_internal/shared/checkout/rules/stickers.rule.js +5 -0
- package/dist/_internal/shared/checkout/rules/types.d.ts +6 -0
- package/dist/_internal/shared/features/checkout/config.d.ts +16 -1
- package/dist/_internal/shared/features/checkout/config.js +16 -1
- package/dist/_internal/shared/features/emi/schedule.d.ts +63 -0
- package/dist/_internal/shared/features/emi/schedule.js +62 -0
- package/dist/_internal/shared/fees/calculator.d.ts +53 -0
- package/dist/_internal/shared/fees/calculator.js +40 -0
- package/dist/_internal/shared/listing-types/_registry.d.ts +22 -66
- package/dist/_internal/shared/listing-types/_registry.js +19 -2
- package/dist/_internal/shared/listing-types/art/config.d.ts +15 -0
- package/dist/_internal/shared/listing-types/art/config.js +14 -0
- package/dist/_internal/shared/listing-types/art/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/art/ctas.js +3 -0
- package/dist/_internal/shared/listing-types/art/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/art/og.js +1 -0
- package/dist/_internal/shared/listing-types/art/schema.d.ts +2 -0
- package/dist/_internal/shared/listing-types/art/schema.js +3 -0
- package/dist/_internal/shared/listing-types/art/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/art/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/auction/config.d.ts +8 -0
- package/dist/_internal/shared/listing-types/auction/config.js +6 -0
- package/dist/_internal/shared/listing-types/capabilities.js +17 -0
- package/dist/_internal/shared/listing-types/classified/config.d.ts +8 -0
- package/dist/_internal/shared/listing-types/classified/config.js +6 -0
- package/dist/_internal/shared/listing-types/digital-code/config.d.ts +8 -0
- package/dist/_internal/shared/listing-types/digital-code/config.js +6 -0
- package/dist/_internal/shared/listing-types/live/config.d.ts +8 -0
- package/dist/_internal/shared/listing-types/live/config.js +6 -0
- package/dist/_internal/shared/listing-types/pre-order/config.d.ts +8 -0
- package/dist/_internal/shared/listing-types/pre-order/config.js +6 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.d.ts +8 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.js +6 -0
- package/dist/_internal/shared/listing-types/standard/config.d.ts +8 -0
- package/dist/_internal/shared/listing-types/standard/config.js +6 -0
- package/dist/_internal/shared/listing-types/stickers/config.d.ts +15 -0
- package/dist/_internal/shared/listing-types/stickers/config.js +14 -0
- package/dist/_internal/shared/listing-types/stickers/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/stickers/ctas.js +3 -0
- package/dist/_internal/shared/listing-types/stickers/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/stickers/og.js +1 -0
- package/dist/_internal/shared/listing-types/stickers/schema.d.ts +2 -0
- package/dist/_internal/shared/listing-types/stickers/schema.js +3 -0
- package/dist/_internal/shared/listing-types/stickers/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/stickers/seed-factory.js +1 -0
- package/dist/client.d.ts +7 -2
- package/dist/client.js +4 -2
- package/dist/constants/field-names.d.ts +2 -6
- package/dist/constants/field-names.js +2 -6
- package/dist/contracts/index.d.ts +4 -2
- package/dist/contracts/index.js +6 -0
- package/dist/contracts/payment.d.ts +14 -9
- package/dist/contracts/payment.js +11 -1
- package/dist/contracts/shipping.d.ts +14 -9
- package/dist/contracts/shipping.js +11 -1
- package/dist/features/about/components/PublicProfileView.js +3 -6
- package/dist/features/account/components/UserOffersPanel.js +0 -1
- package/dist/features/admin/components/AdminAddressBookView.d.ts +11 -0
- package/dist/features/admin/components/AdminAddressBookView.js +30 -0
- package/dist/features/admin/components/AdminArtView.d.ts +3 -0
- package/dist/features/admin/components/AdminArtView.js +45 -0
- package/dist/features/admin/components/AdminCarouselEditorView.js +2 -3
- package/dist/features/admin/components/AdminFulfillmentView.js +0 -1
- package/dist/features/admin/components/AdminSiteConfigGuideView.js +1 -1
- package/dist/features/admin/components/AdminSiteSettingsView.js +14 -9
- package/dist/features/admin/components/AdminStickersView.d.ts +3 -0
- package/dist/features/admin/components/AdminStickersView.js +45 -0
- package/dist/features/admin/components/index.d.ts +6 -0
- package/dist/features/admin/components/index.js +4 -0
- package/dist/features/admin/hooks/useChat.js +0 -1
- package/dist/features/admin/schemas/firestore.d.ts +19 -11
- package/dist/features/admin/schemas/firestore.js +12 -2
- package/dist/features/auctions/components/MarketplaceAuctionCard.d.ts +3 -2
- package/dist/features/auth/hooks/useAuth.js +35 -10
- package/dist/features/auth/schemas/firestore.d.ts +2 -6
- package/dist/features/cart/schemas/firestore.d.ts +3 -2
- package/dist/features/consultation/schemas/index.d.ts +2 -2
- package/dist/features/history/hooks/useHistory.js +0 -1
- package/dist/features/loyalty/schemas/index.d.ts +6 -6
- package/dist/features/messages/hooks/useConversation.js +0 -1
- package/dist/features/messages/hooks/useConversations.js +0 -1
- package/dist/features/orders/repository/orders.repository.d.ts +20 -2
- package/dist/features/orders/repository/orders.repository.js +34 -5
- package/dist/features/orders/schemas/firestore.d.ts +33 -7
- package/dist/features/orders/schemas/firestore.js +1 -1
- package/dist/features/orders/schemas/index.d.ts +176 -31
- package/dist/features/orders/schemas/index.js +20 -6
- package/dist/features/orders/types/index.d.ts +3 -3
- package/dist/features/payments/repository/payout.repository.js +2 -2
- package/dist/features/payments/schemas/firestore.d.ts +3 -3
- package/dist/features/payments/schemas/firestore.js +2 -2
- package/dist/features/payments/schemas/index.d.ts +5 -5
- package/dist/features/payments/schemas/index.js +2 -2
- package/dist/features/products/api/[id]/route.js +4 -1
- package/dist/features/products/api/route.js +4 -1
- package/dist/features/products/components/CompareOverlay.js +7 -9
- package/dist/features/products/components/ProductDetailPageView.d.ts +3 -1
- package/dist/features/products/components/ProductDetailPageView.js +2 -2
- package/dist/features/products/components/ProductForm.js +18 -7
- package/dist/features/products/components/ProductGrid.js +7 -12
- package/dist/features/products/components/ShowGroupSection.js +3 -5
- package/dist/features/products/components/SublistingCarouselSection.js +3 -6
- package/dist/features/products/constants/listing-tabs.d.ts +32 -0
- package/dist/features/products/constants/listing-tabs.js +8 -0
- package/dist/features/products/index.d.ts +1 -1
- package/dist/features/products/index.js +3 -1
- package/dist/features/products/schemas/firestore.d.ts +20 -1
- package/dist/features/products/schemas/firestore.js +2 -0
- package/dist/features/products/schemas/index.d.ts +48 -0
- package/dist/features/products/schemas/index.js +9 -0
- package/dist/features/products/schemas/product-features.d.ts +1 -1
- package/dist/features/products/types/index.d.ts +5 -3
- package/dist/features/products/utils/listing-type.d.ts +6 -0
- package/dist/features/products/utils/listing-type.js +3 -0
- package/dist/features/reviews/api/[id]/route.js +5 -4
- package/dist/features/seller/actions/seller-actions.d.ts +29 -14
- package/dist/features/seller/actions/seller-actions.js +101 -27
- package/dist/features/seller/components/FulfillmentView.js +0 -1
- package/dist/features/seller/components/SellerAddressesView.js +0 -1
- package/dist/features/seller/components/SellerArtView.d.ts +7 -0
- package/dist/features/seller/components/SellerArtView.js +114 -0
- package/dist/features/seller/components/SellerOffersPanel.js +0 -1
- package/dist/features/seller/components/SellerOrdersView.js +38 -1
- package/dist/features/seller/components/SellerProductShell.d.ts +5 -1
- package/dist/features/seller/components/SellerProductShell.js +69 -59
- package/dist/features/seller/components/SellerReviewsView.js +0 -1
- package/dist/features/seller/components/SellerShippingView.js +6 -25
- package/dist/features/seller/components/SellerStickersView.d.ts +7 -0
- package/dist/features/seller/components/SellerStickersView.js +114 -0
- package/dist/features/seller/components/index.d.ts +4 -0
- package/dist/features/seller/components/index.js +2 -0
- package/dist/features/seller/messages/en.json +1 -1
- package/dist/features/seller/schemas/index.d.ts +7 -7
- package/dist/features/seller/schemas/index.js +1 -1
- package/dist/features/seller/types/index.d.ts +1 -1
- package/dist/features/stores/components/StoreDetailLayoutView.js +18 -2
- package/dist/features/stores/schemas/firestore.d.ts +7 -1
- package/dist/features/stores/schemas/index.d.ts +19 -16
- package/dist/features/stores/schemas/index.js +1 -1
- package/dist/index.d.ts +21 -36
- package/dist/index.js +27 -39
- package/dist/next/routing/route-map.d.ts +22 -0
- package/dist/next/routing/route-map.js +10 -0
- package/dist/providers/payment-manual/index.d.ts +40 -0
- package/dist/providers/payment-manual/index.js +91 -0
- package/dist/providers/payment-razorpay/index.d.ts +4 -2
- package/dist/providers/payment-razorpay/index.js +4 -1
- package/dist/providers/shipping-manual/index.d.ts +22 -0
- package/dist/providers/shipping-manual/index.js +47 -0
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +5 -3
- package/dist/schemas/registry.d.ts +129 -70
- package/dist/schemas/registry.js +0 -4
- package/dist/security/pii-encrypt.js +0 -7
- package/dist/security/pii-redact.js +0 -1
- package/dist/seed/conversations-seed-data.js +2 -2
- package/dist/seed/faq-seed-data.js +7 -7
- package/dist/seed/grouped-listings-seed-data.d.ts +2 -0
- package/dist/seed/index.d.ts +2 -0
- package/dist/seed/index.js +2 -0
- package/dist/seed/manifest.js +20 -16
- package/dist/seed/payouts-seed-data.js +5 -5
- package/dist/seed/products-art-seed-data.d.ts +11 -0
- package/dist/seed/products-art-seed-data.js +125 -0
- package/dist/seed/products-preorders-seed-data.d.ts +2 -0
- package/dist/seed/products-stickers-seed-data.d.ts +11 -0
- package/dist/seed/products-stickers-seed-data.js +125 -0
- package/dist/seed/site-settings-seed-data.js +13 -4
- package/dist/seed/stores-seed-data.js +11 -11
- package/dist/server.d.ts +7 -15
- package/dist/server.js +17 -42
- package/dist/ui/rich-text/RichText.js +1 -1
- package/package.json +1 -1
|
@@ -9,12 +9,12 @@ export declare const coinHistoryEntrySchema: z.ZodObject<{
|
|
|
9
9
|
orderId: z.ZodOptional<z.ZodString>;
|
|
10
10
|
timestamp: z.ZodOptional<z.ZodString>;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
reason: "
|
|
12
|
+
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
13
13
|
delta: number;
|
|
14
14
|
orderId?: string | undefined;
|
|
15
15
|
timestamp?: string | undefined;
|
|
16
16
|
}, {
|
|
17
|
-
reason: "
|
|
17
|
+
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
18
18
|
delta: number;
|
|
19
19
|
orderId?: string | undefined;
|
|
20
20
|
timestamp?: string | undefined;
|
|
@@ -38,12 +38,12 @@ export declare const loyaltyBalanceSchema: z.ZodObject<{
|
|
|
38
38
|
orderId: z.ZodOptional<z.ZodString>;
|
|
39
39
|
timestamp: z.ZodOptional<z.ZodString>;
|
|
40
40
|
}, "strip", z.ZodTypeAny, {
|
|
41
|
-
reason: "
|
|
41
|
+
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
42
42
|
delta: number;
|
|
43
43
|
orderId?: string | undefined;
|
|
44
44
|
timestamp?: string | undefined;
|
|
45
45
|
}, {
|
|
46
|
-
reason: "
|
|
46
|
+
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
47
47
|
delta: number;
|
|
48
48
|
orderId?: string | undefined;
|
|
49
49
|
timestamp?: string | undefined;
|
|
@@ -52,7 +52,7 @@ export declare const loyaltyBalanceSchema: z.ZodObject<{
|
|
|
52
52
|
uid: string;
|
|
53
53
|
hcCoins: number;
|
|
54
54
|
coinHistory?: {
|
|
55
|
-
reason: "
|
|
55
|
+
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
56
56
|
delta: number;
|
|
57
57
|
orderId?: string | undefined;
|
|
58
58
|
timestamp?: string | undefined;
|
|
@@ -61,7 +61,7 @@ export declare const loyaltyBalanceSchema: z.ZodObject<{
|
|
|
61
61
|
uid: string;
|
|
62
62
|
hcCoins?: number | undefined;
|
|
63
63
|
coinHistory?: {
|
|
64
|
-
reason: "
|
|
64
|
+
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
65
65
|
delta: number;
|
|
66
66
|
orderId?: string | undefined;
|
|
67
67
|
timestamp?: string | undefined;
|
|
@@ -43,7 +43,6 @@ export function useConversation(conversationId) {
|
|
|
43
43
|
const [error, setError] = useState(null);
|
|
44
44
|
const [isConnected, setIsConnected] = useState(false);
|
|
45
45
|
const refetch = useCallback(async () => {
|
|
46
|
-
// toast-intentionally-silent: background conversation refetch — error stored in state, UI shows inline error
|
|
47
46
|
if (!conversationId) {
|
|
48
47
|
setConversation(null);
|
|
49
48
|
return;
|
|
@@ -19,7 +19,6 @@ export function useConversations(userId) {
|
|
|
19
19
|
const [isLoading, setIsLoading] = useState(false);
|
|
20
20
|
const [error, setError] = useState(null);
|
|
21
21
|
const refetch = useCallback(async () => {
|
|
22
|
-
// toast-intentionally-silent: background conversations list refetch — error stored in state
|
|
23
22
|
if (!userId) {
|
|
24
23
|
setConversations([]);
|
|
25
24
|
return;
|
|
@@ -181,9 +181,14 @@ declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
|
181
181
|
data: OrderDocument;
|
|
182
182
|
}>>;
|
|
183
183
|
/**
|
|
184
|
-
* Cloud Functions: find
|
|
184
|
+
* Cloud Functions: find delivered orders eligible for the weekly payout sweep.
|
|
185
|
+
*
|
|
186
|
+
* EMI orders that still have unpaid installments are excluded — the seller
|
|
187
|
+
* is only eligible once the buyer has fully paid off the order, not merely
|
|
188
|
+
* once it's delivered (a seller-enabled `allowShipBeforeEmiComplete` item
|
|
189
|
+
* can be delivered long before EMI collection finishes).
|
|
185
190
|
*/
|
|
186
|
-
|
|
191
|
+
getEligibleForPayoutSweep(): Promise<Array<{
|
|
187
192
|
id: string;
|
|
188
193
|
ref: DocumentReference;
|
|
189
194
|
data: OrderDocument;
|
|
@@ -192,12 +197,25 @@ declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
|
192
197
|
* Cloud Functions: find auto-payout eligible delivered orders older than windowDays business days.
|
|
193
198
|
* @param windowDays - number of business days since delivery
|
|
194
199
|
* @param cutoff - pre-computed business-day cutoff date (computed by caller)
|
|
200
|
+
*
|
|
201
|
+
* See {@link getEligibleForPayoutSweep} for the EMI-incomplete exclusion rationale.
|
|
195
202
|
*/
|
|
196
203
|
getEligibleAutomatic(cutoff: Date): Promise<Array<{
|
|
197
204
|
id: string;
|
|
198
205
|
ref: DocumentReference;
|
|
199
206
|
data: OrderDocument;
|
|
200
207
|
}>>;
|
|
208
|
+
/**
|
|
209
|
+
* Cloud Functions: EMI reminder sweep — orders on an active (not yet fully
|
|
210
|
+
* paid) EMI plan. Per-installment due-date filtering happens in the job
|
|
211
|
+
* itself since `emiInstallments` is an array field Firestore can't range-
|
|
212
|
+
* query on.
|
|
213
|
+
*/
|
|
214
|
+
getActiveEmiOrders(): Promise<Array<{
|
|
215
|
+
id: string;
|
|
216
|
+
ref: DocumentReference;
|
|
217
|
+
data: OrderDocument;
|
|
218
|
+
}>>;
|
|
201
219
|
/**
|
|
202
220
|
* Cloud Functions: stage a payout-requested update into a caller-owned WriteBatch.
|
|
203
221
|
*/
|
|
@@ -268,26 +268,34 @@ class OrderRepository extends BaseRepository {
|
|
|
268
268
|
}));
|
|
269
269
|
}
|
|
270
270
|
/**
|
|
271
|
-
* Cloud Functions: find
|
|
271
|
+
* Cloud Functions: find delivered orders eligible for the weekly payout sweep.
|
|
272
|
+
*
|
|
273
|
+
* EMI orders that still have unpaid installments are excluded — the seller
|
|
274
|
+
* is only eligible once the buyer has fully paid off the order, not merely
|
|
275
|
+
* once it's delivered (a seller-enabled `allowShipBeforeEmiComplete` item
|
|
276
|
+
* can be delivered long before EMI collection finishes).
|
|
272
277
|
*/
|
|
273
|
-
async
|
|
278
|
+
async getEligibleForPayoutSweep() {
|
|
274
279
|
const snap = await this.db
|
|
275
280
|
.collection(this.collection)
|
|
276
281
|
.where(ORDER_FIELDS.PAYOUT_STATUS, "==", "eligible")
|
|
277
|
-
.where(ORDER_FIELDS.SHIPPING_METHOD, "==", "shiprocket")
|
|
278
282
|
.where(ORDER_FIELDS.STATUS, "==", OrderStatusValues.DELIVERED)
|
|
279
283
|
.limit(500)
|
|
280
284
|
.get();
|
|
281
|
-
return snap.docs
|
|
285
|
+
return snap.docs
|
|
286
|
+
.map((d) => ({
|
|
282
287
|
id: d.id,
|
|
283
288
|
ref: d.ref,
|
|
284
289
|
data: this.decryptOrder({ id: d.id, ...d.data() }),
|
|
285
|
-
}))
|
|
290
|
+
}))
|
|
291
|
+
.filter((o) => !o.data.emiEnabled || o.data.emiComplete);
|
|
286
292
|
}
|
|
287
293
|
/**
|
|
288
294
|
* Cloud Functions: find auto-payout eligible delivered orders older than windowDays business days.
|
|
289
295
|
* @param windowDays - number of business days since delivery
|
|
290
296
|
* @param cutoff - pre-computed business-day cutoff date (computed by caller)
|
|
297
|
+
*
|
|
298
|
+
* See {@link getEligibleForPayoutSweep} for the EMI-incomplete exclusion rationale.
|
|
291
299
|
*/
|
|
292
300
|
async getEligibleAutomatic(cutoff) {
|
|
293
301
|
const snap = await this.db
|
|
@@ -297,6 +305,27 @@ class OrderRepository extends BaseRepository {
|
|
|
297
305
|
.where(ORDER_FIELDS.UPDATED_AT, "<=", cutoff)
|
|
298
306
|
.limit(500)
|
|
299
307
|
.get();
|
|
308
|
+
return snap.docs
|
|
309
|
+
.map((d) => ({
|
|
310
|
+
id: d.id,
|
|
311
|
+
ref: d.ref,
|
|
312
|
+
data: this.decryptOrder({ id: d.id, ...d.data() }),
|
|
313
|
+
}))
|
|
314
|
+
.filter((o) => !o.data.emiEnabled || o.data.emiComplete);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Cloud Functions: EMI reminder sweep — orders on an active (not yet fully
|
|
318
|
+
* paid) EMI plan. Per-installment due-date filtering happens in the job
|
|
319
|
+
* itself since `emiInstallments` is an array field Firestore can't range-
|
|
320
|
+
* query on.
|
|
321
|
+
*/
|
|
322
|
+
async getActiveEmiOrders() {
|
|
323
|
+
const snap = await this.db
|
|
324
|
+
.collection(this.collection)
|
|
325
|
+
.where("emiEnabled", "==", true)
|
|
326
|
+
.where("emiComplete", "==", false)
|
|
327
|
+
.limit(500)
|
|
328
|
+
.get();
|
|
300
329
|
return snap.docs.map((d) => ({
|
|
301
330
|
id: d.id,
|
|
302
331
|
ref: d.ref,
|
|
@@ -5,14 +5,14 @@ import type { OrderStatus, PaymentStatus } from "../types";
|
|
|
5
5
|
import type { OrderType } from "../utils/order-splitter";
|
|
6
6
|
import type { BaseDocument } from "../../../_internal/shared/types/base-document";
|
|
7
7
|
import type { ListingType } from "../../products/types";
|
|
8
|
-
|
|
8
|
+
/** Manual shipping is the only supported method — sellers enter carrier + tracking directly, no carrier API integration. */
|
|
9
|
+
export type ShippingMethod = "custom";
|
|
9
10
|
export type RefundType = "full" | "partial";
|
|
10
11
|
export type OrderPayoutStatus = "eligible" | "requested" | "paid";
|
|
11
12
|
export type RefundStatus = "pending" | "processing" | "completed" | "rejected";
|
|
12
13
|
/** Runtime-accessible shipping method values â€" use instead of bare string literals. */
|
|
13
14
|
export declare const ShippingMethodValues: {
|
|
14
15
|
readonly CUSTOM: "custom";
|
|
15
|
-
readonly SHIPROCKET: "shiprocket";
|
|
16
16
|
};
|
|
17
17
|
/** Runtime-accessible order status values â€" use instead of bare string literals. */
|
|
18
18
|
export declare const OrderStatusValues: {
|
|
@@ -43,7 +43,24 @@ export declare const PaymentMethodValues: {
|
|
|
43
43
|
readonly UPI_MANUAL: "upi_manual";
|
|
44
44
|
readonly RAZORPAY: "razorpay";
|
|
45
45
|
readonly ADMIN_BYPASS: "admin_bypass";
|
|
46
|
+
readonly EMI: "emi";
|
|
46
47
|
};
|
|
48
|
+
export type EmiInstallmentStatus = "pending" | "paid" | "overdue";
|
|
49
|
+
export interface EmiInstallment {
|
|
50
|
+
/** 1-based installment number. */
|
|
51
|
+
index: number;
|
|
52
|
+
dueDate: Date;
|
|
53
|
+
/** Installment amount in paise (principal share + surcharge share for this installment). */
|
|
54
|
+
amount: number;
|
|
55
|
+
status: EmiInstallmentStatus;
|
|
56
|
+
paidAt?: Date;
|
|
57
|
+
/** Buyer-uploaded UTR/reference number for this installment's manual payment. */
|
|
58
|
+
transactionId?: string;
|
|
59
|
+
/** Signed-URL media slug for the buyer's payment proof for this installment. */
|
|
60
|
+
proofUrl?: string;
|
|
61
|
+
/** Set once the reminder sweep has notified the buyer for this installment, so it isn't re-sent on every sweep run. */
|
|
62
|
+
reminderSentAt?: Date;
|
|
63
|
+
}
|
|
47
64
|
/** Runtime-accessible refund status values â€" use instead of bare string literals. */
|
|
48
65
|
export declare const RefundStatusValues: {
|
|
49
66
|
readonly PENDING: "pending";
|
|
@@ -141,15 +158,24 @@ export interface OrderDocument extends BaseDocument {
|
|
|
141
158
|
platformFee?: number;
|
|
142
159
|
depositAmount?: number;
|
|
143
160
|
codRemainingAmount?: number;
|
|
161
|
+
/** COD handling fee charged to the buyer: max(codHandlingFeeMinInPaise, subtotal × codHandlingFeePercent / 100). Only set when paymentMethod === "cod". */
|
|
162
|
+
codHandlingFee?: number;
|
|
163
|
+
emiEnabled?: boolean;
|
|
164
|
+
/** Number of monthly installments the buyer chose (2–6). */
|
|
165
|
+
emiTenureMonths?: number;
|
|
166
|
+
/** Down payment collected at checkout, in paise (emiTokenPercent × seller subtotal). */
|
|
167
|
+
emiTokenAmount?: number;
|
|
168
|
+
/** Extra cost of choosing EMI over full payment, in paise — split between platform and seller. */
|
|
169
|
+
emiSurchargeAmount?: number;
|
|
170
|
+
emiInstallments?: EmiInstallment[];
|
|
171
|
+
/** Sum of unpaid installment amounts, in paise. 0 once all installments are paid. */
|
|
172
|
+
emiRemainingBalance?: number;
|
|
173
|
+
/** True once every installment's status is "paid". Gates shipment unless the product's `allowShipBeforeEmiComplete` flag is set. */
|
|
174
|
+
emiComplete?: boolean;
|
|
144
175
|
shippingFee?: number;
|
|
145
176
|
shippingMethod?: ShippingMethod;
|
|
146
177
|
shippingCarrier?: string;
|
|
147
178
|
trackingUrl?: string;
|
|
148
|
-
shiprocketOrderId?: number;
|
|
149
|
-
shiprocketShipmentId?: number;
|
|
150
|
-
shiprocketAWB?: string;
|
|
151
|
-
shiprocketStatus?: string;
|
|
152
|
-
shiprocketUpdatedAt?: Date;
|
|
153
179
|
payoutStatus?: OrderPayoutStatus;
|
|
154
180
|
payoutId?: string;
|
|
155
181
|
offerId?: string;
|
|
@@ -5,7 +5,6 @@ import { generateOrderId } from "../../../utils/id-generators";
|
|
|
5
5
|
/** Runtime-accessible shipping method values â€" use instead of bare string literals. */
|
|
6
6
|
export const ShippingMethodValues = {
|
|
7
7
|
CUSTOM: "custom",
|
|
8
|
-
SHIPROCKET: "shiprocket",
|
|
9
8
|
};
|
|
10
9
|
/** Runtime-accessible order status values â€" use instead of bare string literals. */
|
|
11
10
|
export const OrderStatusValues = {
|
|
@@ -36,6 +35,7 @@ export const PaymentMethodValues = {
|
|
|
36
35
|
UPI_MANUAL: "upi_manual",
|
|
37
36
|
RAZORPAY: "razorpay",
|
|
38
37
|
ADMIN_BYPASS: "admin_bypass",
|
|
38
|
+
EMI: "emi",
|
|
39
39
|
};
|
|
40
40
|
/** Runtime-accessible refund status values â€" use instead of bare string literals. */
|
|
41
41
|
export const RefundStatusValues = {
|
|
@@ -2,10 +2,69 @@ export * from "./firestore";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export declare const orderListingTypeSchema: z.ZodEnum<["standard", "auction", "pre-order", "prize-draw", "classified", "digital-code", "live"]>;
|
|
4
4
|
export declare const orderPaymentStatusSchema: z.ZodEnum<["pending", "processing", "paid", "failed", "refunded", "partial_refund"]>;
|
|
5
|
-
export declare const orderShippingMethodSchema: z.ZodEnum<["custom"
|
|
5
|
+
export declare const orderShippingMethodSchema: z.ZodEnum<["custom"]>;
|
|
6
6
|
export declare const orderRefundStatusSchema: z.ZodEnum<["pending", "processing", "completed", "rejected"]>;
|
|
7
7
|
export declare const orderPayoutStatusSchema: z.ZodEnum<["eligible", "requested", "paid"]>;
|
|
8
8
|
export declare const orderRefundTypeSchema: z.ZodEnum<["full", "partial"]>;
|
|
9
|
+
export declare const emiInstallmentStatusSchema: z.ZodEnum<["pending", "paid", "overdue"]>;
|
|
10
|
+
export declare const emiInstallmentSchema: z.ZodObject<{
|
|
11
|
+
index: z.ZodNumber;
|
|
12
|
+
dueDate: z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodObject<{
|
|
13
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
14
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
15
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
16
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
17
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
18
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
19
|
+
amount: z.ZodNumber;
|
|
20
|
+
status: z.ZodEnum<["pending", "paid", "overdue"]>;
|
|
21
|
+
paidAt: z.ZodOptional<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodObject<{
|
|
22
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
23
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
24
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
25
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
26
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
27
|
+
}, z.ZodTypeAny, "passthrough">>]>>;
|
|
28
|
+
transactionId: z.ZodOptional<z.ZodString>;
|
|
29
|
+
proofUrl: z.ZodOptional<z.ZodString>;
|
|
30
|
+
reminderSentAt: z.ZodOptional<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodObject<{
|
|
31
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
32
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
33
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
34
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
35
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
36
|
+
}, z.ZodTypeAny, "passthrough">>]>>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
status: "pending" | "paid" | "overdue";
|
|
39
|
+
amount: number;
|
|
40
|
+
index: number;
|
|
41
|
+
dueDate: string | Date | z.objectOutputType<{
|
|
42
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
43
|
+
}, z.ZodTypeAny, "passthrough">;
|
|
44
|
+
transactionId?: string | undefined;
|
|
45
|
+
paidAt?: string | Date | z.objectOutputType<{
|
|
46
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
47
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
48
|
+
proofUrl?: string | undefined;
|
|
49
|
+
reminderSentAt?: string | Date | z.objectOutputType<{
|
|
50
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
51
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
status: "pending" | "paid" | "overdue";
|
|
54
|
+
amount: number;
|
|
55
|
+
index: number;
|
|
56
|
+
dueDate: string | Date | z.objectInputType<{
|
|
57
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
58
|
+
}, z.ZodTypeAny, "passthrough">;
|
|
59
|
+
transactionId?: string | undefined;
|
|
60
|
+
paidAt?: string | Date | z.objectInputType<{
|
|
61
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
62
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
63
|
+
proofUrl?: string | undefined;
|
|
64
|
+
reminderSentAt?: string | Date | z.objectInputType<{
|
|
65
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
66
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
67
|
+
}>;
|
|
9
68
|
export declare const orderDocumentItemSchema: z.ZodObject<{
|
|
10
69
|
productId: z.ZodString;
|
|
11
70
|
productTitle: z.ZodString;
|
|
@@ -276,21 +335,75 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
276
335
|
platformFee: z.ZodOptional<z.ZodNumber>;
|
|
277
336
|
depositAmount: z.ZodOptional<z.ZodNumber>;
|
|
278
337
|
codRemainingAmount: z.ZodOptional<z.ZodNumber>;
|
|
338
|
+
codHandlingFee: z.ZodOptional<z.ZodNumber>;
|
|
339
|
+
emiEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
340
|
+
emiTenureMonths: z.ZodOptional<z.ZodNumber>;
|
|
341
|
+
emiTokenAmount: z.ZodOptional<z.ZodNumber>;
|
|
342
|
+
emiSurchargeAmount: z.ZodOptional<z.ZodNumber>;
|
|
343
|
+
emiInstallments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
344
|
+
index: z.ZodNumber;
|
|
345
|
+
dueDate: z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodObject<{
|
|
346
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
347
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
348
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
349
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
350
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
351
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
352
|
+
amount: z.ZodNumber;
|
|
353
|
+
status: z.ZodEnum<["pending", "paid", "overdue"]>;
|
|
354
|
+
paidAt: z.ZodOptional<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodObject<{
|
|
355
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
356
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
357
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
358
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
359
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
360
|
+
}, z.ZodTypeAny, "passthrough">>]>>;
|
|
361
|
+
transactionId: z.ZodOptional<z.ZodString>;
|
|
362
|
+
proofUrl: z.ZodOptional<z.ZodString>;
|
|
363
|
+
reminderSentAt: z.ZodOptional<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodObject<{
|
|
364
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
365
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
366
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
367
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
368
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
369
|
+
}, z.ZodTypeAny, "passthrough">>]>>;
|
|
370
|
+
}, "strip", z.ZodTypeAny, {
|
|
371
|
+
status: "pending" | "paid" | "overdue";
|
|
372
|
+
amount: number;
|
|
373
|
+
index: number;
|
|
374
|
+
dueDate: string | Date | z.objectOutputType<{
|
|
375
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
376
|
+
}, z.ZodTypeAny, "passthrough">;
|
|
377
|
+
transactionId?: string | undefined;
|
|
378
|
+
paidAt?: string | Date | z.objectOutputType<{
|
|
379
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
380
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
381
|
+
proofUrl?: string | undefined;
|
|
382
|
+
reminderSentAt?: string | Date | z.objectOutputType<{
|
|
383
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
384
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
385
|
+
}, {
|
|
386
|
+
status: "pending" | "paid" | "overdue";
|
|
387
|
+
amount: number;
|
|
388
|
+
index: number;
|
|
389
|
+
dueDate: string | Date | z.objectInputType<{
|
|
390
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
391
|
+
}, z.ZodTypeAny, "passthrough">;
|
|
392
|
+
transactionId?: string | undefined;
|
|
393
|
+
paidAt?: string | Date | z.objectInputType<{
|
|
394
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
395
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
396
|
+
proofUrl?: string | undefined;
|
|
397
|
+
reminderSentAt?: string | Date | z.objectInputType<{
|
|
398
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
399
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
400
|
+
}>, "many">>;
|
|
401
|
+
emiRemainingBalance: z.ZodOptional<z.ZodNumber>;
|
|
402
|
+
emiComplete: z.ZodOptional<z.ZodBoolean>;
|
|
279
403
|
shippingFee: z.ZodOptional<z.ZodNumber>;
|
|
280
|
-
shippingMethod: z.ZodOptional<z.ZodEnum<["custom"
|
|
404
|
+
shippingMethod: z.ZodOptional<z.ZodEnum<["custom"]>>;
|
|
281
405
|
shippingCarrier: z.ZodOptional<z.ZodString>;
|
|
282
406
|
trackingUrl: z.ZodOptional<z.ZodString>;
|
|
283
|
-
shiprocketOrderId: z.ZodOptional<z.ZodNumber>;
|
|
284
|
-
shiprocketShipmentId: z.ZodOptional<z.ZodNumber>;
|
|
285
|
-
shiprocketAWB: z.ZodOptional<z.ZodString>;
|
|
286
|
-
shiprocketStatus: z.ZodOptional<z.ZodString>;
|
|
287
|
-
shiprocketUpdatedAt: z.ZodOptional<z.ZodUnion<[z.ZodDate, z.ZodString, z.ZodObject<{
|
|
288
|
-
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
289
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
290
|
-
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
291
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
292
|
-
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
293
|
-
}, z.ZodTypeAny, "passthrough">>]>>;
|
|
294
407
|
payoutStatus: z.ZodOptional<z.ZodEnum<["eligible", "requested", "paid"]>>;
|
|
295
408
|
payoutId: z.ZodOptional<z.ZodString>;
|
|
296
409
|
offerId: z.ZodOptional<z.ZodString>;
|
|
@@ -452,7 +565,7 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
452
565
|
}[] | undefined;
|
|
453
566
|
payoutStatus?: "paid" | "eligible" | "requested" | undefined;
|
|
454
567
|
couponCode?: string | undefined;
|
|
455
|
-
shippingMethod?: "custom" |
|
|
568
|
+
shippingMethod?: "custom" | undefined;
|
|
456
569
|
orderType?: string | undefined;
|
|
457
570
|
imageUrls?: string[] | undefined;
|
|
458
571
|
paymentId?: string | undefined;
|
|
@@ -469,7 +582,7 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
469
582
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
470
583
|
cancellationReason?: string | undefined;
|
|
471
584
|
refundAmount?: number | undefined;
|
|
472
|
-
refundStatus?: "pending" | "processing" | "
|
|
585
|
+
refundStatus?: "pending" | "processing" | "rejected" | "completed" | undefined;
|
|
473
586
|
refundFeeDeducted?: number | undefined;
|
|
474
587
|
refundNetAmount?: number | undefined;
|
|
475
588
|
refundNote?: string | undefined;
|
|
@@ -484,16 +597,32 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
484
597
|
}[] | undefined;
|
|
485
598
|
depositAmount?: number | undefined;
|
|
486
599
|
codRemainingAmount?: number | undefined;
|
|
600
|
+
codHandlingFee?: number | undefined;
|
|
601
|
+
emiEnabled?: boolean | undefined;
|
|
602
|
+
emiTenureMonths?: number | undefined;
|
|
603
|
+
emiTokenAmount?: number | undefined;
|
|
604
|
+
emiSurchargeAmount?: number | undefined;
|
|
605
|
+
emiInstallments?: {
|
|
606
|
+
status: "pending" | "paid" | "overdue";
|
|
607
|
+
amount: number;
|
|
608
|
+
index: number;
|
|
609
|
+
dueDate: string | Date | z.objectOutputType<{
|
|
610
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
611
|
+
}, z.ZodTypeAny, "passthrough">;
|
|
612
|
+
transactionId?: string | undefined;
|
|
613
|
+
paidAt?: string | Date | z.objectOutputType<{
|
|
614
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
615
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
616
|
+
proofUrl?: string | undefined;
|
|
617
|
+
reminderSentAt?: string | Date | z.objectOutputType<{
|
|
618
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
619
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
620
|
+
}[] | undefined;
|
|
621
|
+
emiRemainingBalance?: number | undefined;
|
|
622
|
+
emiComplete?: boolean | undefined;
|
|
487
623
|
shippingFee?: number | undefined;
|
|
488
624
|
shippingCarrier?: string | undefined;
|
|
489
625
|
trackingUrl?: string | undefined;
|
|
490
|
-
shiprocketOrderId?: number | undefined;
|
|
491
|
-
shiprocketShipmentId?: number | undefined;
|
|
492
|
-
shiprocketAWB?: string | undefined;
|
|
493
|
-
shiprocketStatus?: string | undefined;
|
|
494
|
-
shiprocketUpdatedAt?: string | Date | z.objectOutputType<{
|
|
495
|
-
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
496
|
-
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
497
626
|
payoutId?: string | undefined;
|
|
498
627
|
offerId?: string | undefined;
|
|
499
628
|
prizeWon?: {
|
|
@@ -581,7 +710,7 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
581
710
|
}[] | undefined;
|
|
582
711
|
payoutStatus?: "paid" | "eligible" | "requested" | undefined;
|
|
583
712
|
couponCode?: string | undefined;
|
|
584
|
-
shippingMethod?: "custom" |
|
|
713
|
+
shippingMethod?: "custom" | undefined;
|
|
585
714
|
orderType?: string | undefined;
|
|
586
715
|
imageUrls?: string[] | undefined;
|
|
587
716
|
paymentId?: string | undefined;
|
|
@@ -598,7 +727,7 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
598
727
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
599
728
|
cancellationReason?: string | undefined;
|
|
600
729
|
refundAmount?: number | undefined;
|
|
601
|
-
refundStatus?: "pending" | "processing" | "
|
|
730
|
+
refundStatus?: "pending" | "processing" | "rejected" | "completed" | undefined;
|
|
602
731
|
refundFeeDeducted?: number | undefined;
|
|
603
732
|
refundNetAmount?: number | undefined;
|
|
604
733
|
refundNote?: string | undefined;
|
|
@@ -613,16 +742,32 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
613
742
|
}[] | undefined;
|
|
614
743
|
depositAmount?: number | undefined;
|
|
615
744
|
codRemainingAmount?: number | undefined;
|
|
745
|
+
codHandlingFee?: number | undefined;
|
|
746
|
+
emiEnabled?: boolean | undefined;
|
|
747
|
+
emiTenureMonths?: number | undefined;
|
|
748
|
+
emiTokenAmount?: number | undefined;
|
|
749
|
+
emiSurchargeAmount?: number | undefined;
|
|
750
|
+
emiInstallments?: {
|
|
751
|
+
status: "pending" | "paid" | "overdue";
|
|
752
|
+
amount: number;
|
|
753
|
+
index: number;
|
|
754
|
+
dueDate: string | Date | z.objectInputType<{
|
|
755
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
756
|
+
}, z.ZodTypeAny, "passthrough">;
|
|
757
|
+
transactionId?: string | undefined;
|
|
758
|
+
paidAt?: string | Date | z.objectInputType<{
|
|
759
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
760
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
761
|
+
proofUrl?: string | undefined;
|
|
762
|
+
reminderSentAt?: string | Date | z.objectInputType<{
|
|
763
|
+
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
764
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
765
|
+
}[] | undefined;
|
|
766
|
+
emiRemainingBalance?: number | undefined;
|
|
767
|
+
emiComplete?: boolean | undefined;
|
|
616
768
|
shippingFee?: number | undefined;
|
|
617
769
|
shippingCarrier?: string | undefined;
|
|
618
770
|
trackingUrl?: string | undefined;
|
|
619
|
-
shiprocketOrderId?: number | undefined;
|
|
620
|
-
shiprocketShipmentId?: number | undefined;
|
|
621
|
-
shiprocketAWB?: string | undefined;
|
|
622
|
-
shiprocketStatus?: string | undefined;
|
|
623
|
-
shiprocketUpdatedAt?: string | Date | z.objectInputType<{
|
|
624
|
-
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
625
|
-
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
626
771
|
payoutId?: string | undefined;
|
|
627
772
|
offerId?: string | undefined;
|
|
628
773
|
prizeWon?: {
|
|
@@ -21,10 +21,21 @@ export const orderPaymentStatusSchema = z.enum([
|
|
|
21
21
|
"refunded",
|
|
22
22
|
"partial_refund",
|
|
23
23
|
]);
|
|
24
|
-
export const orderShippingMethodSchema = z.enum(["custom"
|
|
24
|
+
export const orderShippingMethodSchema = z.enum(["custom"]);
|
|
25
25
|
export const orderRefundStatusSchema = z.enum(["pending", "processing", "completed", "rejected"]);
|
|
26
26
|
export const orderPayoutStatusSchema = z.enum(["eligible", "requested", "paid"]);
|
|
27
27
|
export const orderRefundTypeSchema = z.enum(["full", "partial"]);
|
|
28
|
+
export const emiInstallmentStatusSchema = z.enum(["pending", "paid", "overdue"]);
|
|
29
|
+
export const emiInstallmentSchema = z.object({
|
|
30
|
+
index: z.number().int().positive(),
|
|
31
|
+
dueDate: firestoreDateSchema,
|
|
32
|
+
amount: paiseSchema,
|
|
33
|
+
status: emiInstallmentStatusSchema,
|
|
34
|
+
paidAt: firestoreDateSchema.optional(),
|
|
35
|
+
transactionId: z.string().optional(),
|
|
36
|
+
proofUrl: z.string().optional(),
|
|
37
|
+
reminderSentAt: firestoreDateSchema.optional(),
|
|
38
|
+
});
|
|
28
39
|
export const orderDocumentItemSchema = z.object({
|
|
29
40
|
productId: z.string(),
|
|
30
41
|
productTitle: z.string(),
|
|
@@ -118,15 +129,18 @@ export const orderFirestoreSchema = z.object({
|
|
|
118
129
|
platformFee: paiseSchema.optional(),
|
|
119
130
|
depositAmount: paiseSchema.optional(),
|
|
120
131
|
codRemainingAmount: paiseSchema.optional(),
|
|
132
|
+
codHandlingFee: paiseSchema.optional(),
|
|
133
|
+
emiEnabled: z.boolean().optional(),
|
|
134
|
+
emiTenureMonths: z.number().int().min(2).max(6).optional(),
|
|
135
|
+
emiTokenAmount: paiseSchema.optional(),
|
|
136
|
+
emiSurchargeAmount: paiseSchema.optional(),
|
|
137
|
+
emiInstallments: z.array(emiInstallmentSchema).optional(),
|
|
138
|
+
emiRemainingBalance: paiseSchema.optional(),
|
|
139
|
+
emiComplete: z.boolean().optional(),
|
|
121
140
|
shippingFee: paiseSchema.optional(),
|
|
122
141
|
shippingMethod: orderShippingMethodSchema.optional(),
|
|
123
142
|
shippingCarrier: z.string().optional(),
|
|
124
143
|
trackingUrl: z.string().optional(),
|
|
125
|
-
shiprocketOrderId: z.number().int().optional(),
|
|
126
|
-
shiprocketShipmentId: z.number().int().optional(),
|
|
127
|
-
shiprocketAWB: z.string().optional(),
|
|
128
|
-
shiprocketStatus: z.string().optional(),
|
|
129
|
-
shiprocketUpdatedAt: firestoreDateSchema.optional(),
|
|
130
144
|
payoutStatus: orderPayoutStatusSchema.optional(),
|
|
131
145
|
payoutId: z.string().optional(),
|
|
132
146
|
offerId: z.string().optional(),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PaymentGateway, PaymentGatewayValues } from "../../payments/schemas";
|
|
2
2
|
export { type PaymentGateway, PaymentGatewayValues };
|
|
3
|
+
import type { ListingType } from "../../products/types/index";
|
|
3
4
|
export type PaymentStatus = "pending" | "processing" | "paid" | "failed" | "refunded" | "partial_refund";
|
|
4
5
|
export interface UserAddress {
|
|
5
6
|
id: string;
|
|
@@ -23,9 +24,8 @@ export interface OrderItem {
|
|
|
23
24
|
currency?: string;
|
|
24
25
|
storeId?: string;
|
|
25
26
|
attributes?: Record<string, string>;
|
|
26
|
-
/** Listing kind at the time of order — needed for prize-draw UI hints (SB8-F).
|
|
27
|
-
|
|
28
|
-
listingType?: "standard" | "auction" | "pre-order" | "prize-draw" | "classified" | "digital-code" | "live";
|
|
27
|
+
/** Listing kind at the time of order — needed for prize-draw UI hints (SB8-F). */
|
|
28
|
+
listingType?: ListingType;
|
|
29
29
|
/**
|
|
30
30
|
* Per-item prize-draw reveal status (SB8-F). Populated by the checkout
|
|
31
31
|
* actions when listingType === "prize-draw". Used to render the
|
|
@@ -126,7 +126,7 @@ export class PayoutRepository extends BaseRepository {
|
|
|
126
126
|
return this.update(payoutId, {
|
|
127
127
|
status,
|
|
128
128
|
...extra,
|
|
129
|
-
...(status === PAYOUT_FIELDS.STATUS_VALUES.
|
|
129
|
+
...(status === PAYOUT_FIELDS.STATUS_VALUES.PAID ||
|
|
130
130
|
status === PAYOUT_FIELDS.STATUS_VALUES.FAILED
|
|
131
131
|
? { processedAt: new Date() }
|
|
132
132
|
: {}),
|
|
@@ -163,7 +163,7 @@ export class PayoutRepository extends BaseRepository {
|
|
|
163
163
|
const snapshot = await this.db
|
|
164
164
|
.collection(this.collection)
|
|
165
165
|
.where(PAYOUT_FIELDS.STORE_ID, "==", storeId)
|
|
166
|
-
.where(PAYOUT_FIELDS.STATUS, "in", ["pending", "processing", "
|
|
166
|
+
.where(PAYOUT_FIELDS.STATUS, "in", ["pending", "processing", "paid"])
|
|
167
167
|
.get();
|
|
168
168
|
const ids = new Set();
|
|
169
169
|
snapshot.docs.forEach((doc) => {
|
|
@@ -9,7 +9,7 @@ export interface PayoutBankAccount {
|
|
|
9
9
|
ifscCode: string;
|
|
10
10
|
bankName: string;
|
|
11
11
|
}
|
|
12
|
-
export type PayoutStatus = "pending" | "processing" | "
|
|
12
|
+
export type PayoutStatus = "pending" | "processing" | "paid" | "failed";
|
|
13
13
|
/**
|
|
14
14
|
* A single refund deduction applied against a payout before dispatch.
|
|
15
15
|
*
|
|
@@ -29,7 +29,7 @@ export interface PayoutRefundDeduction {
|
|
|
29
29
|
export declare const PayoutStatusValues: {
|
|
30
30
|
readonly PENDING: "pending";
|
|
31
31
|
readonly PROCESSING: "processing";
|
|
32
|
-
readonly
|
|
32
|
+
readonly PAID: "paid";
|
|
33
33
|
readonly FAILED: "failed";
|
|
34
34
|
};
|
|
35
35
|
export type PayoutPaymentMethod = "bank_transfer" | "upi";
|
|
@@ -82,7 +82,7 @@ export declare const PAYOUT_FIELDS: {
|
|
|
82
82
|
readonly STATUS_VALUES: {
|
|
83
83
|
readonly PENDING: PayoutStatus;
|
|
84
84
|
readonly PROCESSING: PayoutStatus;
|
|
85
|
-
readonly
|
|
85
|
+
readonly PAID: PayoutStatus;
|
|
86
86
|
readonly FAILED: PayoutStatus;
|
|
87
87
|
};
|
|
88
88
|
};
|