@mohasinac/appkit 4.41.16 → 4.42.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/client/features/maintenance/views/MaintenanceDashboardView.js +1 -1
- package/dist/_internal/server/features/checkout/actions.d.ts +16 -14
- package/dist/_internal/server/features/checkout/actions.js +145 -97
- package/dist/_internal/server/features/checkout/bundle-expansion.d.ts +1 -1
- package/dist/_internal/server/features/checkout/index.d.ts +1 -1
- package/dist/_internal/server/features/checkout/index.js +1 -1
- package/dist/_internal/server/features/checkout/locked-lines.js +1 -1
- package/dist/_internal/server/features/checkout/source-context.js +2 -2
- package/dist/_internal/server/features/maintenance/analyze.js +1 -1
- package/dist/_internal/server/features/refunds/actions.d.ts +4 -4
- package/dist/_internal/server/features/refunds/actions.js +9 -8
- package/dist/_internal/server/functions/scheduled.d.ts +1 -2
- package/dist/_internal/server/functions/scheduled.js +1 -9
- package/dist/_internal/server/jobs/core/index.d.ts +0 -1
- package/dist/_internal/server/jobs/core/index.js +0 -1
- package/dist/_internal/server/jobs/handlers/index.d.ts +0 -1
- package/dist/_internal/server/jobs/handlers/index.js +0 -1
- package/dist/_internal/shared/actions/action-registry.js +2 -2
- package/dist/_internal/shared/checkout/order-math.d.ts +1 -1
- package/dist/_internal/shared/checkout/order-math.js +1 -1
- package/dist/_internal/shared/checkout/rules/prize-draw.rule.js +2 -2
- package/dist/_internal/shared/features/blog/schema.d.ts +4 -4
- package/dist/_internal/shared/features/cart/schema.d.ts +6 -6
- package/dist/_internal/shared/features/orders/refund-copy.d.ts +1 -1
- package/dist/_internal/shared/features/orders/refund-copy.js +1 -1
- package/dist/_internal/shared/features/orders/schema.d.ts +5 -5
- package/dist/_internal/shared/features/orders/schema.js +1 -1
- package/dist/_internal/shared/features/products/schema.d.ts +2 -2
- package/dist/_internal/shared/features/promotions/schema.d.ts +4 -4
- package/dist/_internal/shared/features/reviews/schema.d.ts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/configs/next.js +2 -2
- package/dist/constants/field-names.d.ts +1 -1
- package/dist/constants/field-names.js +1 -1
- package/dist/contracts/index.d.ts +0 -2
- package/dist/contracts/index.js +0 -1
- package/dist/contracts/payment.d.ts +13 -2
- package/dist/contracts/payment.js +2 -2
- package/dist/core/integration-keys.d.ts +7 -3
- package/dist/core/integration-keys.js +13 -7
- package/dist/core/money.d.ts +11 -0
- package/dist/core/money.js +15 -0
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/errors/messages.d.ts +1 -0
- package/dist/errors/messages.js +1 -0
- package/dist/errors/{razorpay-unreachable.d.ts → payment-provider-unreachable.d.ts} +1 -1
- package/dist/errors/{razorpay-unreachable.js → payment-provider-unreachable.js} +1 -1
- package/dist/features/addresses/schemas/address-form.d.ts +20 -20
- package/dist/features/addresses/schemas/index.d.ts +2 -2
- package/dist/features/admin/components/AdminSiteSettingsView.js +32 -16
- package/dist/features/admin/constants/site-settings-tabs.d.ts +1 -1
- package/dist/features/admin/schemas/admin-ops-forms.d.ts +10 -10
- package/dist/features/admin/schemas/admin-user-form.d.ts +2 -2
- package/dist/features/admin/schemas/firestore.d.ts +17 -8
- package/dist/features/admin/schemas/firestore.js +1 -1
- package/dist/features/admin/schemas/nav-item-form.d.ts +2 -2
- package/dist/features/auctions/schemas/index.d.ts +2 -2
- package/dist/features/auth/schemas/index.d.ts +2 -2
- package/dist/features/before-after/schemas/index.d.ts +2 -2
- package/dist/features/blog/actions/blog-actions.d.ts +4 -4
- package/dist/features/blog/schemas/blog-form.d.ts +2 -2
- package/dist/features/blog/schemas/index.d.ts +4 -4
- package/dist/features/cart/schemas/index.d.ts +3 -3
- package/dist/features/catalogue/schemas/validation.d.ts +4 -4
- package/dist/features/categories/schemas/index.d.ts +2 -2
- package/dist/features/checkout/index.d.ts +0 -4
- package/dist/features/checkout/index.js +0 -3
- package/dist/features/checkout/types/index.d.ts +0 -25
- package/dist/features/checkout/types/index.js +1 -2
- package/dist/features/collections/schemas/index.d.ts +2 -2
- package/dist/features/consultation/schemas/index.d.ts +4 -4
- package/dist/features/corporate/schemas/index.d.ts +2 -2
- package/dist/features/events/schemas/index.d.ts +4 -4
- package/dist/features/grouped/schemas/index.d.ts +2 -2
- package/dist/features/homepage/schemas/index.d.ts +2 -2
- package/dist/features/lottery/schemas/zod.d.ts +4 -4
- package/dist/features/loyalty/schemas/index.d.ts +6 -6
- package/dist/features/orders/components/OrderPaymentSummary.d.ts +1 -1
- package/dist/features/orders/components/OrderPaymentSummary.js +5 -5
- package/dist/features/orders/components/RefundHistoryTable.js +1 -1
- package/dist/features/orders/repository/orders.repository.d.ts +10 -1
- package/dist/features/orders/repository/orders.repository.js +17 -1
- package/dist/features/orders/schemas/firestore.d.ts +11 -12
- package/dist/features/orders/schemas/firestore.js +0 -1
- package/dist/features/orders/schemas/index.d.ts +48 -48
- package/dist/features/orders/schemas/index.js +1 -1
- package/dist/features/orders/types/index.d.ts +1 -3
- package/dist/features/orders/types/index.js +1 -2
- package/dist/features/payments/manifest.js +1 -1
- package/dist/features/payments/repository/payout.repository.d.ts +1 -4
- package/dist/features/payments/repository/payout.repository.js +0 -29
- package/dist/features/payments/schemas/firestore.d.ts +8 -15
- package/dist/features/payments/schemas/firestore.js +7 -5
- package/dist/features/payments/schemas/index.d.ts +52 -125
- package/dist/features/payments/schemas/index.js +0 -58
- package/dist/features/payments/types/index.d.ts +2 -4
- package/dist/features/payments/types/index.js +1 -2
- package/dist/features/products/schemas/index.d.ts +14 -14
- package/dist/features/products/schemas/product-features.validators.d.ts +10 -10
- package/dist/features/promotions/schemas/index.d.ts +20 -20
- package/dist/features/reviews/schemas/index.d.ts +8 -8
- package/dist/features/scams/schemas/index.d.ts +10 -10
- package/dist/features/search/action-index/settings-entries.js +4 -4
- package/dist/features/seller/schemas/index.d.ts +12 -12
- package/dist/features/seller/schemas/order-forms.d.ts +4 -4
- package/dist/features/shipments/schemas/validation.d.ts +28 -28
- package/dist/features/store-extensions/schemas/payout-method-form.d.ts +50 -50
- package/dist/features/store-extensions/schemas/report-create-form.d.ts +2 -2
- package/dist/features/store-extensions/schemas/shipping-config-form.d.ts +10 -10
- package/dist/features/support/schemas/index.d.ts +14 -14
- package/dist/features/tester/actions/checklist-item-actions.d.ts +4 -4
- package/dist/features/tester/schemas/checklist-item-form.d.ts +2 -2
- package/dist/features/tester/seed-data/_money-flows.js +145 -0
- package/dist/features/tester/seed-data/authored/account-auth__signup-login.js +21 -2
- package/dist/features/tester/seed-data/authored/admin__site-system.js +38 -0
- package/dist/features/tester/seed-data/authored/buying__buying-checkout.js +10 -10
- package/dist/features/tester/seed-data/authored/buying__offers.js +11 -10
- package/dist/features/tester/seed-data/authored/cta-layout__checkout-bottom-bar.js +1 -1
- package/dist/features/tester/seed-data/tester-checklist-seed-data.js +24 -12
- package/dist/features/wishlist/schemas/index.d.ts +2 -2
- package/dist/index.d.ts +6 -28
- package/dist/index.js +8 -51
- package/dist/jobs.d.ts +1 -1
- package/dist/jobs.js +1 -1
- package/dist/providers/payment-phonepe/index.d.ts +117 -0
- package/dist/providers/payment-phonepe/index.js +221 -0
- package/dist/providers.d.ts +3 -2
- package/dist/providers.js +3 -2
- package/dist/schemas/registry.d.ts +163 -2623
- package/dist/schemas/registry.js +1 -6
- package/dist/seed/faq-seed-data.js +5 -5
- package/dist/seed/payouts-seed-data.js +3 -3
- package/dist/seed/site-settings-seed-data.js +7 -4
- package/dist/server-entry.d.ts +1 -2
- package/dist/server-entry.js +1 -3
- package/dist/server.d.ts +3 -9
- package/dist/server.js +5 -23
- package/dist/validation/schemas.d.ts +2 -2
- package/package.json +5 -4
- package/dist/_internal/server/features/payments/actions.d.ts +0 -30
- package/dist/_internal/server/features/payments/actions.js +0 -45
- package/dist/_internal/server/features/payments/data.d.ts +0 -13
- package/dist/_internal/server/features/payments/data.js +0 -20
- package/dist/_internal/server/features/payments/index.d.ts +0 -3
- package/dist/_internal/server/features/payments/index.js +0 -3
- package/dist/_internal/server/jobs/core/payoutBatch.d.ts +0 -2
- package/dist/_internal/server/jobs/core/payoutBatch.js +0 -120
- package/dist/_internal/server/jobs/handlers/payoutBatch.d.ts +0 -2
- package/dist/_internal/server/jobs/handlers/payoutBatch.js +0 -2
- package/dist/_internal/shared/features/payments/config.d.ts +0 -3
- package/dist/_internal/shared/features/payments/config.js +0 -3
- package/dist/contracts/client-payment-gateway.d.ts +0 -64
- package/dist/contracts/client-payment-gateway.js +0 -25
- package/dist/features/checkout/hooks/useCheckout.d.ts +0 -9
- package/dist/features/checkout/hooks/useCheckout.js +0 -24
- package/dist/features/checkout/hooks/useCheckoutApi.d.ts +0 -72
- package/dist/features/checkout/hooks/useCheckoutApi.js +0 -47
- package/dist/features/checkout/hooks/usePaymentCheckout.d.ts +0 -77
- package/dist/features/checkout/hooks/usePaymentCheckout.js +0 -192
- package/dist/providers/payment-razorpay/index.d.ts +0 -115
- package/dist/providers/payment-razorpay/index.js +0 -208
- package/dist/schemas/webhooks/razorpay.d.ts +0 -2634
- package/dist/schemas/webhooks/razorpay.js +0 -104
|
@@ -66,8 +66,8 @@ export declare const submitLotteryPullSchema: z.ZodEffects<z.ZodObject<{
|
|
|
66
66
|
purchasedItemNumber: z.ZodNumber;
|
|
67
67
|
userPhone: z.ZodString;
|
|
68
68
|
}, "strip", z.ZodTypeAny, {
|
|
69
|
-
transactionId: string;
|
|
70
69
|
userId: string;
|
|
70
|
+
transactionId: string;
|
|
71
71
|
userPhone: string;
|
|
72
72
|
sourceType: "event" | "product";
|
|
73
73
|
paymentTime: string;
|
|
@@ -77,8 +77,8 @@ export declare const submitLotteryPullSchema: z.ZodEffects<z.ZodObject<{
|
|
|
77
77
|
eventId?: string | undefined;
|
|
78
78
|
userDisplayName?: string | undefined;
|
|
79
79
|
}, {
|
|
80
|
-
transactionId: string;
|
|
81
80
|
userId: string;
|
|
81
|
+
transactionId: string;
|
|
82
82
|
userPhone: string;
|
|
83
83
|
sourceType: "event" | "product";
|
|
84
84
|
paymentTime: string;
|
|
@@ -88,8 +88,8 @@ export declare const submitLotteryPullSchema: z.ZodEffects<z.ZodObject<{
|
|
|
88
88
|
eventId?: string | undefined;
|
|
89
89
|
userDisplayName?: string | undefined;
|
|
90
90
|
}>, {
|
|
91
|
-
transactionId: string;
|
|
92
91
|
userId: string;
|
|
92
|
+
transactionId: string;
|
|
93
93
|
userPhone: string;
|
|
94
94
|
sourceType: "event" | "product";
|
|
95
95
|
paymentTime: string;
|
|
@@ -99,8 +99,8 @@ export declare const submitLotteryPullSchema: z.ZodEffects<z.ZodObject<{
|
|
|
99
99
|
eventId?: string | undefined;
|
|
100
100
|
userDisplayName?: string | undefined;
|
|
101
101
|
}, {
|
|
102
|
-
transactionId: string;
|
|
103
102
|
userId: string;
|
|
103
|
+
transactionId: string;
|
|
104
104
|
userPhone: string;
|
|
105
105
|
sourceType: "event" | "product";
|
|
106
106
|
paymentTime: string;
|
|
@@ -11,13 +11,13 @@ export declare const coinHistoryEntrySchema: z.ZodObject<{
|
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
12
|
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
13
13
|
delta: number;
|
|
14
|
-
orderId?: string | undefined;
|
|
15
14
|
timestamp?: string | undefined;
|
|
15
|
+
orderId?: string | undefined;
|
|
16
16
|
}, {
|
|
17
17
|
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
18
18
|
delta: number;
|
|
19
|
-
orderId?: string | undefined;
|
|
20
19
|
timestamp?: string | undefined;
|
|
20
|
+
orderId?: string | undefined;
|
|
21
21
|
}>;
|
|
22
22
|
/**
|
|
23
23
|
* Base Zod schema for a loyalty balance record.
|
|
@@ -40,13 +40,13 @@ export declare const loyaltyBalanceSchema: z.ZodObject<{
|
|
|
40
40
|
}, "strip", z.ZodTypeAny, {
|
|
41
41
|
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
42
42
|
delta: number;
|
|
43
|
-
orderId?: string | undefined;
|
|
44
43
|
timestamp?: string | undefined;
|
|
44
|
+
orderId?: string | undefined;
|
|
45
45
|
}, {
|
|
46
46
|
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
47
47
|
delta: number;
|
|
48
|
-
orderId?: string | undefined;
|
|
49
48
|
timestamp?: string | undefined;
|
|
49
|
+
orderId?: string | undefined;
|
|
50
50
|
}>, "many">>;
|
|
51
51
|
}, "strip", z.ZodTypeAny, {
|
|
52
52
|
uid: string;
|
|
@@ -54,8 +54,8 @@ export declare const loyaltyBalanceSchema: z.ZodObject<{
|
|
|
54
54
|
coinHistory?: {
|
|
55
55
|
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
56
56
|
delta: number;
|
|
57
|
-
orderId?: string | undefined;
|
|
58
57
|
timestamp?: string | undefined;
|
|
58
|
+
orderId?: string | undefined;
|
|
59
59
|
}[] | undefined;
|
|
60
60
|
}, {
|
|
61
61
|
uid: string;
|
|
@@ -63,8 +63,8 @@ export declare const loyaltyBalanceSchema: z.ZodObject<{
|
|
|
63
63
|
coinHistory?: {
|
|
64
64
|
reason: "redemption" | "order_reward" | "referral" | "review_reward" | "manual_credit" | "manual_debit" | "expiry";
|
|
65
65
|
delta: number;
|
|
66
|
-
orderId?: string | undefined;
|
|
67
66
|
timestamp?: string | undefined;
|
|
67
|
+
orderId?: string | undefined;
|
|
68
68
|
}[] | undefined;
|
|
69
69
|
}>;
|
|
70
70
|
export declare const loyaltyConfigSchema: z.ZodObject<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OrderPaymentSummary — the single place both admin and seller order-detail
|
|
3
3
|
* views render payment info from, regardless of how the buyer paid (manual
|
|
4
|
-
* cash/UPI proof,
|
|
4
|
+
* cash/UPI proof, PhonePe, or COD). Reads `order.paymentRecord` when present;
|
|
5
5
|
* falls back to an adapter over the pre-existing legacy fields
|
|
6
6
|
* (`paymentMethod`/`paymentId`/`paymentProofUrl`/`paymentTransactionId`) for
|
|
7
7
|
* orders placed before Feature C shipped, so old orders keep rendering
|
|
@@ -4,14 +4,14 @@ import { Badge, Div, Heading, Row, Stack, Text } from "../../../ui";
|
|
|
4
4
|
import { formatCurrency } from "../../../utils/number.formatter";
|
|
5
5
|
const METHOD_LABEL = {
|
|
6
6
|
manual: "Manual (Cash / UPI)",
|
|
7
|
-
|
|
7
|
+
phonepe: "PhonePe",
|
|
8
8
|
cod: "Cash on Delivery",
|
|
9
9
|
};
|
|
10
10
|
function legacyFallback(order) {
|
|
11
11
|
if (!order.paymentMethod)
|
|
12
12
|
return null;
|
|
13
|
-
const method = order.paymentMethod === "
|
|
14
|
-
? "
|
|
13
|
+
const method = order.paymentMethod === "online"
|
|
14
|
+
? "phonepe"
|
|
15
15
|
: order.paymentMethod === "cod"
|
|
16
16
|
? "cod"
|
|
17
17
|
: "manual";
|
|
@@ -20,7 +20,7 @@ function legacyFallback(order) {
|
|
|
20
20
|
transactionId: order.paymentTransactionId ?? order.paymentId,
|
|
21
21
|
proofUrl: order.paymentProofUrl,
|
|
22
22
|
amount: order.totalPrice,
|
|
23
|
-
verificationMethod: method === "
|
|
23
|
+
verificationMethod: method === "phonepe" ? "order_status" : method === "cod" ? "cod_collection" : "manual_review",
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
export function OrderPaymentSummary({ order, className = "" }) {
|
|
@@ -28,5 +28,5 @@ export function OrderPaymentSummary({ order, className = "" }) {
|
|
|
28
28
|
if (!record) {
|
|
29
29
|
return (_jsx(Div, { className: className, rounded: "xl", padding: "md", surface: "muted", border: "default", children: _jsx(Text, { size: "sm", color: "muted", children: "No payment information recorded yet." }) }));
|
|
30
30
|
}
|
|
31
|
-
return (_jsxs(Div, { className: className, rounded: "xl", padding: "md", surface: "muted", border: "default", children: [_jsxs(Row, { justify: "between", align: "center", className: "mb-2", children: [_jsx(Heading, { level: 3, size: "sm", weight: "semibold", color: "muted", children: "Payment" }), _jsx(Badge, { variant: order.paymentStatus === "paid" ? "success" : "default", children: order.paymentStatus ?? "pending" })] }), _jsxs(Stack, { gap: "xs", children: [_jsxs(Row, { justify: "between", children: [_jsx(Text, { size: "sm", color: "muted", children: "Method" }), _jsx(Text, { size: "sm", weight: "medium", children: METHOD_LABEL[record.method] })] }), _jsxs(Row, { justify: "between", children: [_jsx(Text, { size: "sm", color: "muted", children: "Amount" }), _jsx(Text, { size: "sm", weight: "medium", children: formatCurrency(record.amount, order.currency ?? "INR") })] }), record.transactionId && (_jsxs(Row, { justify: "between", children: [_jsx(Text, { size: "sm", color: "muted", children: "Reference" }), _jsx(Text, { size: "sm", weight: "medium", children: record.transactionId })] })), record.paidAt && (_jsxs(Row, { justify: "between", children: [_jsx(Text, { size: "sm", color: "muted", children: "Paid at" }), _jsx(Text, { size: "sm", children: new Date(record.paidAt).toLocaleString() })] })), record.verifiedBy && (_jsxs(Row, { justify: "between", children: [_jsx(Text, { size: "sm", color: "muted", children: "Verified by" }), _jsx(Text, { size: "sm", children: record.verifiedBy })] })), record.gatewayRef?.
|
|
31
|
+
return (_jsxs(Div, { className: className, rounded: "xl", padding: "md", surface: "muted", border: "default", children: [_jsxs(Row, { justify: "between", align: "center", className: "mb-2", children: [_jsx(Heading, { level: 3, size: "sm", weight: "semibold", color: "muted", children: "Payment" }), _jsx(Badge, { variant: order.paymentStatus === "paid" ? "success" : "default", children: order.paymentStatus ?? "pending" })] }), _jsxs(Stack, { gap: "xs", children: [_jsxs(Row, { justify: "between", children: [_jsx(Text, { size: "sm", color: "muted", children: "Method" }), _jsx(Text, { size: "sm", weight: "medium", children: METHOD_LABEL[record.method] })] }), _jsxs(Row, { justify: "between", children: [_jsx(Text, { size: "sm", color: "muted", children: "Amount" }), _jsx(Text, { size: "sm", weight: "medium", children: formatCurrency(record.amount, order.currency ?? "INR") })] }), record.transactionId && (_jsxs(Row, { justify: "between", children: [_jsx(Text, { size: "sm", color: "muted", children: "Reference" }), _jsx(Text, { size: "sm", weight: "medium", children: record.transactionId })] })), record.paidAt && (_jsxs(Row, { justify: "between", children: [_jsx(Text, { size: "sm", color: "muted", children: "Paid at" }), _jsx(Text, { size: "sm", children: new Date(record.paidAt).toLocaleString() })] })), record.verifiedBy && (_jsxs(Row, { justify: "between", children: [_jsx(Text, { size: "sm", color: "muted", children: "Verified by" }), _jsx(Text, { size: "sm", children: record.verifiedBy })] })), record.gatewayRef?.phonepeOrderId && (_jsxs(Row, { justify: "between", children: [_jsx(Text, { size: "sm", color: "muted", children: "Gateway order ID" }), _jsx(Text, { size: "sm", children: record.gatewayRef.phonepeOrderId })] }))] })] }));
|
|
32
32
|
}
|
|
@@ -10,7 +10,7 @@ function formatDate(d) {
|
|
|
10
10
|
return dt.toLocaleDateString("en-IN", { day: "numeric", month: "short", year: "numeric" });
|
|
11
11
|
}
|
|
12
12
|
function RefundRow({ event, currency }) {
|
|
13
|
-
return (_jsxs(Row, { border: "subtle", justify: "between", align: "start", gap: "sm", className: "border-b last:border-0", padding: "y-sm", children: [_jsxs(Stack, { gap: "xs", className: "flex-1", children: [_jsxs(Row, { gap: "sm", align: "center", children: [_jsx(Badge, { variant: event.type === "full" ? "danger" : "warning", children: event.type === "full" ? REFUND_COPY.history.badgeFull : REFUND_COPY.history.badgePartial }), _jsx(Text, { size: "xs", color: "muted", children: formatDate(event.refundedAt) })] }), _jsx(Text, { size: "sm", children: event.reason }), event.manualTransactionId && (_jsxs(Text, { size: "xs", color: "muted", children: [REFUND_COPY.history.labelTxn, " ", event.manualTransactionId] })), event.
|
|
13
|
+
return (_jsxs(Row, { border: "subtle", justify: "between", align: "start", gap: "sm", className: "border-b last:border-0", padding: "y-sm", children: [_jsxs(Stack, { gap: "xs", className: "flex-1", children: [_jsxs(Row, { gap: "sm", align: "center", children: [_jsx(Badge, { variant: event.type === "full" ? "danger" : "warning", children: event.type === "full" ? REFUND_COPY.history.badgeFull : REFUND_COPY.history.badgePartial }), _jsx(Text, { size: "xs", color: "muted", children: formatDate(event.refundedAt) })] }), _jsx(Text, { size: "sm", children: event.reason }), event.manualTransactionId && (_jsxs(Text, { size: "xs", color: "muted", children: [REFUND_COPY.history.labelTxn, " ", event.manualTransactionId] })), event.phonepeRefundId && (_jsxs(Text, { size: "xs", color: "muted", children: [REFUND_COPY.history.labelPhonePe, " ", event.phonepeRefundId] }))] }), _jsx(Text, { size: "sm", weight: "semibold", className: "shrink-0", children: formatCurrency(event.amount, currency) })] }));
|
|
14
14
|
}
|
|
15
15
|
/** Warning triangle icon — inline SVG kept here since it's a single-use decorative element. */
|
|
16
16
|
function WarningIcon() {
|
|
@@ -66,7 +66,7 @@ declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
|
66
66
|
markPacked(orderId: string): Promise<OrderDocument>;
|
|
67
67
|
/**
|
|
68
68
|
* Payment Detail Parity (Feature C) — the COD counterpart to the manual
|
|
69
|
-
* proof-upload /
|
|
69
|
+
* proof-upload / PhonePe-webhook write paths. Seller or admin confirms
|
|
70
70
|
* the cash was physically collected; there is no external gateway to
|
|
71
71
|
* verify against, so `verifiedBy` is the acting user's uid and
|
|
72
72
|
* `verificationMethod` is always "cod_collection".
|
|
@@ -299,6 +299,15 @@ declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
|
299
299
|
postRefundEvent(orderId: string, event: OrderRefundEvent, becomeRefunded?: boolean, ctx?: OrderWriteContext): Promise<OrderDocument>;
|
|
300
300
|
/** Fetch all orders sharing a paymentBatchId (for sibling-orders display). */
|
|
301
301
|
findByPaymentBatchId(batchId: string): Promise<OrderDocument[]>;
|
|
302
|
+
/**
|
|
303
|
+
* Fetch every order recorded against a single gateway payment id (e.g. a
|
|
304
|
+
* PhonePe `merchantOrderId`, which one checkout can split into several
|
|
305
|
+
* per-seller orders). Used by the checkout idempotency guard — the buyer's
|
|
306
|
+
* `/verify` call and the async webhook can both race to place orders for
|
|
307
|
+
* the same payment, and whichever loses the claim needs to know what the
|
|
308
|
+
* winner already created.
|
|
309
|
+
*/
|
|
310
|
+
findByPaymentId(paymentId: string): Promise<OrderDocument[]>;
|
|
302
311
|
/**
|
|
303
312
|
* Cloud Functions: find pending orders created before a timeout threshold.
|
|
304
313
|
* Used by the payment-timeout cleanup job to cancel stale unconfirmed orders.
|
|
@@ -139,7 +139,7 @@ class OrderRepository extends BaseRepository {
|
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* Payment Detail Parity (Feature C) — the COD counterpart to the manual
|
|
142
|
-
* proof-upload /
|
|
142
|
+
* proof-upload / PhonePe-webhook write paths. Seller or admin confirms
|
|
143
143
|
* the cash was physically collected; there is no external gateway to
|
|
144
144
|
* verify against, so `verifiedBy` is the acting user's uid and
|
|
145
145
|
* `verificationMethod` is always "cod_collection".
|
|
@@ -400,6 +400,22 @@ class OrderRepository extends BaseRepository {
|
|
|
400
400
|
.get();
|
|
401
401
|
return snap.docs.map((d) => this.decryptOrder({ id: d.id, ...d.data() }));
|
|
402
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* Fetch every order recorded against a single gateway payment id (e.g. a
|
|
405
|
+
* PhonePe `merchantOrderId`, which one checkout can split into several
|
|
406
|
+
* per-seller orders). Used by the checkout idempotency guard — the buyer's
|
|
407
|
+
* `/verify` call and the async webhook can both race to place orders for
|
|
408
|
+
* the same payment, and whichever loses the claim needs to know what the
|
|
409
|
+
* winner already created.
|
|
410
|
+
*/
|
|
411
|
+
async findByPaymentId(paymentId) {
|
|
412
|
+
const snap = await this.db
|
|
413
|
+
.collection(this.collection)
|
|
414
|
+
.where(ORDER_FIELDS.PAYMENT_ID, "==", paymentId)
|
|
415
|
+
.limit(20)
|
|
416
|
+
.get();
|
|
417
|
+
return snap.docs.map((d) => this.decryptOrder({ id: d.id, ...d.data() }));
|
|
418
|
+
}
|
|
403
419
|
/**
|
|
404
420
|
* Cloud Functions: find pending orders created before a timeout threshold.
|
|
405
421
|
* Used by the payment-timeout cleanup job to cancel stale unconfirmed orders.
|
|
@@ -130,7 +130,6 @@ export declare const PaymentMethodValues: {
|
|
|
130
130
|
readonly CASH: "cash";
|
|
131
131
|
readonly ONLINE: "online";
|
|
132
132
|
readonly UPI_MANUAL: "upi_manual";
|
|
133
|
-
readonly RAZORPAY: "razorpay";
|
|
134
133
|
readonly ADMIN_BYPASS: "admin_bypass";
|
|
135
134
|
readonly EMI: "emi";
|
|
136
135
|
};
|
|
@@ -245,8 +244,8 @@ export interface OrderRefundEvent {
|
|
|
245
244
|
reasonCode?: ReturnReason;
|
|
246
245
|
refundedAt: Date;
|
|
247
246
|
refundedBy: string;
|
|
248
|
-
/** Set when
|
|
249
|
-
|
|
247
|
+
/** Set when PhonePe processed the refund. */
|
|
248
|
+
phonepeRefundId?: string;
|
|
250
249
|
/** Set when refund was processed manually (offline). */
|
|
251
250
|
manualTransactionId?: string;
|
|
252
251
|
/** Proof document URL (via /api/media signed-URL flow). */
|
|
@@ -545,24 +544,24 @@ export interface OrderDocument extends BaseDocument {
|
|
|
545
544
|
/** Set true only when an automatic partial refund (for dropped Razorpay items) failed and needs manual follow-up. */
|
|
546
545
|
refundPending?: boolean;
|
|
547
546
|
}
|
|
548
|
-
export type OrderPaymentRecordMethod = "manual" | "
|
|
549
|
-
export type OrderPaymentVerificationMethod = "manual_review" | "webhook" | "cod_collection";
|
|
547
|
+
export type OrderPaymentRecordMethod = "manual" | "phonepe" | "cod";
|
|
548
|
+
export type OrderPaymentVerificationMethod = "manual_review" | "webhook" | "cod_collection" | "order_status";
|
|
550
549
|
export interface OrderPaymentRecord {
|
|
551
550
|
method: OrderPaymentRecordMethod;
|
|
552
|
-
/** UTR (manual) |
|
|
551
|
+
/** UTR (manual) | PhonePe transactionId (phonepe) | collector note/ref (COD). */
|
|
553
552
|
transactionId?: string;
|
|
554
|
-
/** Manual proof upload | COD collection receipt photo (optional) | n/a for
|
|
553
|
+
/** Manual proof upload | COD collection receipt photo (optional) | n/a for phonepe. */
|
|
555
554
|
proofUrl?: string;
|
|
556
555
|
amount: number;
|
|
557
556
|
paidAt?: Date;
|
|
558
|
-
/** Admin/seller uid (manual/COD) | "
|
|
557
|
+
/** Admin/seller uid (manual/COD) | "phonepe-order-status" or "phonepe-webhook" (phonepe, automatic). */
|
|
559
558
|
verifiedBy?: string;
|
|
560
559
|
verificationMethod: OrderPaymentVerificationMethod;
|
|
561
|
-
/**
|
|
560
|
+
/** PhonePe audit trail only. */
|
|
562
561
|
gatewayRef?: {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
562
|
+
merchantOrderId?: string;
|
|
563
|
+
phonepeOrderId?: string;
|
|
564
|
+
transactionId?: string;
|
|
566
565
|
};
|
|
567
566
|
}
|
|
568
567
|
export declare const ORDER_COLLECTION: "orders";
|