@fantastic.dev/better-stripe 0.33.0 → 0.35.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/CHANGELOG.md +42 -0
- package/README.md +30 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +522 -2
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +261 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +522 -2
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +261 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/refundCommandEvidence.d.ts +14 -0
- package/dist/client/connect/refundCommandEvidence.d.ts.map +1 -0
- package/dist/client/connect/refundCommandEvidence.js +20 -0
- package/dist/client/connect/refundCommandEvidence.js.map +1 -0
- package/dist/client/connect/refundCommandNormalization.d.ts +11 -0
- package/dist/client/connect/refundCommandNormalization.d.ts.map +1 -0
- package/dist/client/connect/refundCommandNormalization.js +12 -0
- package/dist/client/connect/refundCommandNormalization.js.map +1 -0
- package/dist/client/core/accountClosures.d.ts +15 -0
- package/dist/client/core/accountClosures.d.ts.map +1 -0
- package/dist/client/core/accountClosures.js +10 -0
- package/dist/client/core/accountClosures.js.map +1 -0
- package/dist/client/core/accounts.d.ts.map +1 -1
- package/dist/client/core/accounts.js +15 -23
- package/dist/client/core/accounts.js.map +1 -1
- package/dist/client/core/personalAccountMapping.d.ts +8 -0
- package/dist/client/core/personalAccountMapping.d.ts.map +1 -0
- package/dist/client/core/personalAccountMapping.js +11 -0
- package/dist/client/core/personalAccountMapping.js.map +1 -0
- package/dist/client/financialObservations.d.ts +42 -0
- package/dist/client/financialObservations.d.ts.map +1 -0
- package/dist/client/financialObservations.js +58 -0
- package/dist/client/financialObservations.js.map +1 -0
- package/dist/client/financialOwnership.d.ts +52 -0
- package/dist/client/financialOwnership.d.ts.map +1 -0
- package/dist/client/financialOwnership.js +72 -0
- package/dist/client/financialOwnership.js.map +1 -0
- package/dist/client/index.d.ts +57 -4
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +15 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/observationPagination.d.ts +10 -0
- package/dist/client/observationPagination.d.ts.map +1 -0
- package/dist/client/observationPagination.js +12 -0
- package/dist/client/observationPagination.js.map +1 -0
- package/dist/client/publicTypes.d.ts +10 -0
- package/dist/client/publicTypes.d.ts.map +1 -0
- package/dist/client/publicTypes.js +2 -0
- package/dist/client/publicTypes.js.map +1 -0
- package/dist/client/readContracts.d.ts +29 -0
- package/dist/client/readContracts.d.ts.map +1 -1
- package/dist/client/readContracts.js +10 -0
- package/dist/client/readContracts.js.map +1 -1
- package/dist/client/transferObservations.d.ts +59 -0
- package/dist/client/transferObservations.d.ts.map +1 -0
- package/dist/client/transferObservations.js +82 -0
- package/dist/client/transferObservations.js.map +1 -0
- package/dist/component/_generated/component.d.ts +594 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/accountClosure/helpers.d.ts +18 -0
- package/dist/component/accountClosure/helpers.d.ts.map +1 -0
- package/dist/component/accountClosure/helpers.js +18 -0
- package/dist/component/accountClosure/helpers.js.map +1 -0
- package/dist/component/accountClosure/mutations.d.ts +20 -0
- package/dist/component/accountClosure/mutations.d.ts.map +1 -0
- package/dist/component/accountClosure/mutations.js +55 -0
- package/dist/component/accountClosure/mutations.js.map +1 -0
- package/dist/component/accountClosure/queries.d.ts +34 -0
- package/dist/component/accountClosure/queries.d.ts.map +1 -0
- package/dist/component/accountClosure/queries.js +36 -0
- package/dist/component/accountClosure/queries.js.map +1 -0
- package/dist/component/accountClosure/schema.d.ts +46 -0
- package/dist/component/accountClosure/schema.d.ts.map +1 -0
- package/dist/component/accountClosure/schema.js +20 -0
- package/dist/component/accountClosure/schema.js.map +1 -0
- package/dist/component/affiliateRecovery/mutations.d.ts.map +1 -1
- package/dist/component/affiliateRecovery/mutations.js +4 -1
- package/dist/component/affiliateRecovery/mutations.js.map +1 -1
- package/dist/component/connect/mutations.d.ts.map +1 -1
- package/dist/component/connect/mutations.js +18 -2
- package/dist/component/connect/mutations.js.map +1 -1
- package/dist/component/connect/queries.d.ts +8 -0
- package/dist/component/connect/queries.d.ts.map +1 -1
- package/dist/component/connect/reversalClaims.d.ts.map +1 -1
- package/dist/component/connect/reversalClaims.js +7 -1
- package/dist/component/connect/reversalClaims.js.map +1 -1
- package/dist/component/connect/reversalReceipts.d.ts.map +1 -1
- package/dist/component/connect/reversalReceipts.js +2 -0
- package/dist/component/connect/reversalReceipts.js.map +1 -1
- package/dist/component/connect/schema.d.ts +11 -1
- package/dist/component/connect/schema.d.ts.map +1 -1
- package/dist/component/connect/schema.js +9 -1
- package/dist/component/connect/schema.js.map +1 -1
- package/dist/component/connect/validators.d.ts +9 -1
- package/dist/component/connect/validators.d.ts.map +1 -1
- package/dist/component/connect/validators.js +2 -0
- package/dist/component/connect/validators.js.map +1 -1
- package/dist/component/core/mutations.d.ts.map +1 -1
- package/dist/component/core/mutations.js +5 -0
- package/dist/component/core/mutations.js.map +1 -1
- package/dist/component/core/personalAccountMapping.d.ts +95 -0
- package/dist/component/core/personalAccountMapping.d.ts.map +1 -0
- package/dist/component/core/personalAccountMapping.js +54 -0
- package/dist/component/core/personalAccountMapping.js.map +1 -0
- package/dist/component/core/queries.d.ts +27 -0
- package/dist/component/core/queries.d.ts.map +1 -1
- package/dist/component/core/queries.js +7 -0
- package/dist/component/core/queries.js.map +1 -1
- package/dist/component/earnings/triggers.d.ts +468 -2
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/earnings/triggers.js +7 -1
- package/dist/component/earnings/triggers.js.map +1 -1
- package/dist/component/financialObservations/continuation.d.ts +7 -0
- package/dist/component/financialObservations/continuation.d.ts.map +1 -0
- package/dist/component/financialObservations/continuation.js +131 -0
- package/dist/component/financialObservations/continuation.js.map +1 -0
- package/dist/component/financialObservations/generations.d.ts +6 -0
- package/dist/component/financialObservations/generations.d.ts.map +1 -0
- package/dist/component/financialObservations/generations.js +46 -0
- package/dist/component/financialObservations/generations.js.map +1 -0
- package/dist/component/financialObservations/mutations.d.ts +62 -0
- package/dist/component/financialObservations/mutations.d.ts.map +1 -0
- package/dist/component/financialObservations/mutations.js +69 -0
- package/dist/component/financialObservations/mutations.js.map +1 -0
- package/dist/component/financialObservations/queries.d.ts +307 -0
- package/dist/component/financialObservations/queries.d.ts.map +1 -0
- package/dist/component/financialObservations/queries.js +219 -0
- package/dist/component/financialObservations/queries.js.map +1 -0
- package/dist/component/financialObservations/schema.d.ts +182 -0
- package/dist/component/financialObservations/schema.d.ts.map +1 -0
- package/dist/component/financialObservations/schema.js +53 -0
- package/dist/component/financialObservations/schema.js.map +1 -0
- package/dist/component/financialObservations/settlement.d.ts +7 -0
- package/dist/component/financialObservations/settlement.d.ts.map +1 -0
- package/dist/component/financialObservations/settlement.js +118 -0
- package/dist/component/financialObservations/settlement.js.map +1 -0
- package/dist/component/financialObservations/settlementHelpers.d.ts +46 -0
- package/dist/component/financialObservations/settlementHelpers.d.ts.map +1 -0
- package/dist/component/financialObservations/settlementHelpers.js +70 -0
- package/dist/component/financialObservations/settlementHelpers.js.map +1 -0
- package/dist/component/financialObservations/transferBatches.d.ts +12 -0
- package/dist/component/financialObservations/transferBatches.d.ts.map +1 -0
- package/dist/component/financialObservations/transferBatches.js +76 -0
- package/dist/component/financialObservations/transferBatches.js.map +1 -0
- package/dist/component/financialObservations/transferContinuation.d.ts +5 -0
- package/dist/component/financialObservations/transferContinuation.d.ts.map +1 -0
- package/dist/component/financialObservations/transferContinuation.js +35 -0
- package/dist/component/financialObservations/transferContinuation.js.map +1 -0
- package/dist/component/financialObservations/transferContinuationState.d.ts +8 -0
- package/dist/component/financialObservations/transferContinuationState.d.ts.map +1 -0
- package/dist/component/financialObservations/transferContinuationState.js +69 -0
- package/dist/component/financialObservations/transferContinuationState.js.map +1 -0
- package/dist/component/financialObservations/transferContinuationSteps.d.ts +5 -0
- package/dist/component/financialObservations/transferContinuationSteps.d.ts.map +1 -0
- package/dist/component/financialObservations/transferContinuationSteps.js +174 -0
- package/dist/component/financialObservations/transferContinuationSteps.js.map +1 -0
- package/dist/component/financialObservations/transferHelpers.d.ts +18 -0
- package/dist/component/financialObservations/transferHelpers.d.ts.map +1 -0
- package/dist/component/financialObservations/transferHelpers.js +37 -0
- package/dist/component/financialObservations/transferHelpers.js.map +1 -0
- package/dist/component/financialObservations/transferReferenceSchema.d.ts +56 -0
- package/dist/component/financialObservations/transferReferenceSchema.d.ts.map +1 -0
- package/dist/component/financialObservations/transferReferenceSchema.js +21 -0
- package/dist/component/financialObservations/transferReferenceSchema.js.map +1 -0
- package/dist/component/financialObservations/transferSchema.d.ts +237 -0
- package/dist/component/financialObservations/transferSchema.d.ts.map +1 -0
- package/dist/component/financialObservations/transferSchema.js +65 -0
- package/dist/component/financialObservations/transferSchema.js.map +1 -0
- package/dist/component/financialObservations/transfers.d.ts +7 -0
- package/dist/component/financialObservations/transfers.d.ts.map +1 -0
- package/dist/component/financialObservations/transfers.js +79 -0
- package/dist/component/financialObservations/transfers.js.map +1 -0
- package/dist/component/financialOwnership/helpers.d.ts +37 -0
- package/dist/component/financialOwnership/helpers.d.ts.map +1 -0
- package/dist/component/financialOwnership/helpers.js +76 -0
- package/dist/component/financialOwnership/helpers.js.map +1 -0
- package/dist/component/financialOwnership/mutations.d.ts +28 -0
- package/dist/component/financialOwnership/mutations.d.ts.map +1 -0
- package/dist/component/financialOwnership/mutations.js +74 -0
- package/dist/component/financialOwnership/mutations.js.map +1 -0
- package/dist/component/financialOwnership/queries.d.ts +57 -0
- package/dist/component/financialOwnership/queries.d.ts.map +1 -0
- package/dist/component/financialOwnership/queries.js +50 -0
- package/dist/component/financialOwnership/queries.js.map +1 -0
- package/dist/component/financialOwnership/schema.d.ts +140 -0
- package/dist/component/financialOwnership/schema.d.ts.map +1 -0
- package/dist/component/financialOwnership/schema.js +35 -0
- package/dist/component/financialOwnership/schema.js.map +1 -0
- package/dist/component/payoutRelease/queries.d.ts +2 -2
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/refundHistory/commandBinding.d.ts +17 -0
- package/dist/component/refundHistory/commandBinding.d.ts.map +1 -0
- package/dist/component/refundHistory/commandBinding.js +41 -0
- package/dist/component/refundHistory/commandBinding.js.map +1 -0
- package/dist/component/refundHistory/commandEvidence.d.ts +50 -0
- package/dist/component/refundHistory/commandEvidence.d.ts.map +1 -0
- package/dist/component/refundHistory/commandEvidence.js +54 -0
- package/dist/component/refundHistory/commandEvidence.js.map +1 -0
- package/dist/component/refundHistory/commandEvidenceValidator.d.ts +89 -0
- package/dist/component/refundHistory/commandEvidenceValidator.d.ts.map +1 -0
- package/dist/component/refundHistory/commandEvidenceValidator.js +8 -0
- package/dist/component/refundHistory/commandEvidenceValidator.js.map +1 -0
- package/dist/component/refundHistory/commandFields.d.ts +8 -0
- package/dist/component/refundHistory/commandFields.d.ts.map +1 -0
- package/dist/component/refundHistory/commandFields.js +9 -0
- package/dist/component/refundHistory/commandFields.js.map +1 -0
- package/dist/component/refundHistory/mutations.d.ts +8 -0
- package/dist/component/refundHistory/mutations.d.ts.map +1 -0
- package/dist/component/refundHistory/mutations.js +25 -0
- package/dist/component/refundHistory/mutations.js.map +1 -0
- package/dist/component/refundHistory/queries.d.ts +51 -0
- package/dist/component/refundHistory/queries.d.ts.map +1 -1
- package/dist/component/refundHistory/queries.js +14 -0
- package/dist/component/refundHistory/queries.js.map +1 -1
- package/dist/component/schema.d.ts +261 -1
- package/dist/component/schema.js +14 -0
- package/dist/component/schema.js.map +1 -1
- package/dist/component/settlement/mutations.d.ts.map +1 -1
- package/dist/component/settlement/mutations.js +5 -1
- package/dist/component/settlement/mutations.js.map +1 -1
- package/dist/shared/refundCommandScope.d.ts +10 -0
- package/dist/shared/refundCommandScope.d.ts.map +1 -0
- package/dist/shared/refundCommandScope.js +9 -0
- package/dist/shared/refundCommandScope.js.map +1 -0
- package/docs/financial-observations.md +159 -0
- package/docs/financial-ownership.md +54 -0
- package/docs/personal-account-mapping.md +54 -0
- package/docs/refund-command-evidence.md +49 -0
- package/package.json +6 -2
- package/src/client/connect/refundCommandEvidence.ts +41 -0
- package/src/client/connect/refundCommandNormalization.ts +28 -0
- package/src/client/core/account-close-orchestration.test.ts +131 -0
- package/src/client/core/account-closure.test.ts +317 -0
- package/src/client/core/accountClosures.ts +37 -0
- package/src/client/core/accounts.test.ts +0 -111
- package/src/client/core/accounts.ts +24 -29
- package/src/client/core/personal-account-mapping.test.ts +71 -0
- package/src/client/core/personalAccountMapping.ts +23 -0
- package/src/client/financialObservations.test.ts +109 -0
- package/src/client/financialObservations.ts +106 -0
- package/src/client/financialOwnership.test.ts +80 -0
- package/src/client/financialOwnership.ts +116 -0
- package/src/client/index.ts +38 -35
- package/src/client/observationPagination.ts +11 -0
- package/src/client/publicTypes.ts +72 -0
- package/src/client/readContracts.ts +21 -0
- package/src/client/refund-command-evidence.test.ts +68 -0
- package/src/client/refund-command-normalization.test.ts +61 -0
- package/src/client/transferContinuation.test.ts +94 -0
- package/src/client/transferObservations.test.ts +98 -0
- package/src/client/transferObservations.ts +180 -0
- package/src/component/_generated/api.ts +52 -0
- package/src/component/_generated/component.ts +716 -0
- package/src/component/accountClosure/helpers.ts +21 -0
- package/src/component/accountClosure/mutations.ts +56 -0
- package/src/component/accountClosure/queries.ts +43 -0
- package/src/component/accountClosure/schema.ts +20 -0
- package/src/component/affiliateRecovery/mutations.ts +10 -1
- package/src/component/connect/mutations.ts +29 -2
- package/src/component/connect/reversalClaims.ts +19 -1
- package/src/component/connect/reversalReceipts.ts +2 -0
- package/src/component/connect/schema.ts +9 -1
- package/src/component/connect/validators.ts +2 -0
- package/src/component/core/mutations.ts +3 -0
- package/src/component/core/personal-account-mapping.test.ts +173 -0
- package/src/component/core/personalAccountMapping.ts +81 -0
- package/src/component/core/queries.ts +11 -0
- package/src/component/core/reset.test.ts +8 -1
- package/src/component/earnings/earnings-totals.test.ts +14 -10
- package/src/component/earnings/triggers.ts +9 -1
- package/src/component/financialObservations/continuation.test.ts +445 -0
- package/src/component/financialObservations/continuation.ts +159 -0
- package/src/component/financialObservations/generations.ts +53 -0
- package/src/component/financialObservations/mutations.ts +75 -0
- package/src/component/financialObservations/observation-boundaries.test.ts +466 -0
- package/src/component/financialObservations/queries.ts +246 -0
- package/src/component/financialObservations/schema.ts +68 -0
- package/src/component/financialObservations/settlement-observations.test.ts +86 -0
- package/src/component/financialObservations/settlement.ts +142 -0
- package/src/component/financialObservations/settlementHelpers.ts +92 -0
- package/src/component/financialObservations/transfer-batches.test.ts +61 -0
- package/src/component/financialObservations/transfer-boundaries.test.ts +116 -0
- package/src/component/financialObservations/transfer-continuation-guards.test.ts +428 -0
- package/src/component/financialObservations/transfer-continuation.test.ts +154 -0
- package/src/component/financialObservations/transfer-observations.test.ts +212 -0
- package/src/component/financialObservations/transfer-overflow.test.ts +181 -0
- package/src/component/financialObservations/transfer-writers.test.ts +162 -0
- package/src/component/financialObservations/transferBatches.ts +96 -0
- package/src/component/financialObservations/transferContinuation.ts +53 -0
- package/src/component/financialObservations/transferContinuationState.ts +85 -0
- package/src/component/financialObservations/transferContinuationSteps.ts +232 -0
- package/src/component/financialObservations/transferHelpers.ts +38 -0
- package/src/component/financialObservations/transferReferenceSchema.ts +20 -0
- package/src/component/financialObservations/transferSchema.ts +74 -0
- package/src/component/financialObservations/transfers.ts +99 -0
- package/src/component/financialOwnership/financial-ownership.test.ts +102 -0
- package/src/component/financialOwnership/helpers.ts +98 -0
- package/src/component/financialOwnership/mutations.ts +83 -0
- package/src/component/financialOwnership/ownership-boundaries.test.ts +308 -0
- package/src/component/financialOwnership/queries.ts +65 -0
- package/src/component/financialOwnership/schema.ts +35 -0
- package/src/component/refundHistory/command-evidence.test.ts +288 -0
- package/src/component/refundHistory/command-normalization-resource.test.ts +77 -0
- package/src/component/refundHistory/command-normalization.test.ts +229 -0
- package/src/component/refundHistory/command-provenance.test.ts +59 -0
- package/src/component/refundHistory/commandBinding.ts +54 -0
- package/src/component/refundHistory/commandEvidence.ts +71 -0
- package/src/component/refundHistory/commandEvidenceValidator.ts +18 -0
- package/src/component/refundHistory/commandFields.ts +9 -0
- package/src/component/refundHistory/mutations.ts +33 -0
- package/src/component/refundHistory/queries.ts +15 -0
- package/src/component/schema.ts +24 -0
- package/src/component/settlement/mutations.ts +5 -1
- package/src/shared/refundCommandScope.ts +19 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { QueryCtx } from "../_generated/server.js";
|
|
2
|
+
import { type RefundCommandScope } from "../../shared/refundCommandScope.js";
|
|
3
|
+
/** Bounded global normalization and exact-key proof, never a provider history or retry claim. */
|
|
4
|
+
export declare function readRefundCommandEvidence(ctx: QueryCtx, scope: RefundCommandScope): Promise<{
|
|
5
|
+
status: "unavailable";
|
|
6
|
+
reason: "normalization_incomplete";
|
|
7
|
+
refund?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
status: "unavailable";
|
|
10
|
+
reason: "ambiguous";
|
|
11
|
+
refund?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
status: "unavailable";
|
|
14
|
+
reason: "missing";
|
|
15
|
+
refund?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
status: "unavailable";
|
|
18
|
+
reason: "correlation_conflict";
|
|
19
|
+
refund?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
status: "unavailable";
|
|
22
|
+
reason: "scope_mismatch";
|
|
23
|
+
refund?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
status: "unavailable";
|
|
26
|
+
reason: "invalid_receipt";
|
|
27
|
+
refund?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
reason?: undefined;
|
|
30
|
+
status: "observed";
|
|
31
|
+
refund: {
|
|
32
|
+
_creationTime: number;
|
|
33
|
+
_id: import("convex/values").GenericId<"refunds">;
|
|
34
|
+
accountId?: string | undefined;
|
|
35
|
+
amount: number;
|
|
36
|
+
currency: string;
|
|
37
|
+
failureReason?: string | undefined;
|
|
38
|
+
metadata?: any;
|
|
39
|
+
reason?: "duplicate" | "expired_uncaptured_charge" | "fraudulent" | "requested_by_customer" | undefined;
|
|
40
|
+
refundCommandConflict?: boolean | undefined;
|
|
41
|
+
refundCommandKey?: string | undefined;
|
|
42
|
+
refundCommandNormalizationVersion?: 1 | undefined;
|
|
43
|
+
refundCommandObservedAt?: number | undefined;
|
|
44
|
+
status: "canceled" | "failed" | "pending" | "requires_action" | "succeeded";
|
|
45
|
+
stripeChargeId?: string | undefined;
|
|
46
|
+
stripePaymentIntentId?: string | undefined;
|
|
47
|
+
stripeRefundId: string;
|
|
48
|
+
};
|
|
49
|
+
}>;
|
|
50
|
+
//# sourceMappingURL=commandEvidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandEvidence.d.ts","sourceRoot":"","sources":["../../../src/component/refundHistory/commandEvidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,oCAAoC,CAAC;AAE5C,iGAAiG;AACjG,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,kBAAkB;YAWb,aAAa;YACb,0BAA0B;;;YASnB,aAAa;YAAmB,WAAW;;;YAG3C,aAAa;YAAmB,SAAS;;;YAGhD,aAAa;YACb,sBAAsB;;;YAStB,aAAa;YACb,gBAAgB;;;YAWhB,aAAa;YACb,iBAAiB;;;;YAUZ,UAAU;;;;;;;;;;;;;;;;;;;GAC5B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { assertRefundCommandScope, } from "../../shared/refundCommandScope.js";
|
|
2
|
+
/** Bounded global normalization and exact-key proof, never a provider history or retry claim. */
|
|
3
|
+
export async function readRefundCommandEvidence(ctx, scope) {
|
|
4
|
+
assertRefundCommandScope(scope);
|
|
5
|
+
const legacy = await ctx.db
|
|
6
|
+
.query("refunds")
|
|
7
|
+
.withIndex("by_refund_command_normalization_version", (q) => q.eq("refundCommandNormalizationVersion", undefined))
|
|
8
|
+
.take(1);
|
|
9
|
+
if (legacy.length)
|
|
10
|
+
return {
|
|
11
|
+
status: "unavailable",
|
|
12
|
+
reason: "normalization_incomplete",
|
|
13
|
+
};
|
|
14
|
+
const rows = await ctx.db
|
|
15
|
+
.query("refunds")
|
|
16
|
+
.withIndex("by_refund_command_key", (q) => q.eq("refundCommandKey", scope.commandKey))
|
|
17
|
+
.take(2);
|
|
18
|
+
if (rows.length > 1)
|
|
19
|
+
return { status: "unavailable", reason: "ambiguous" };
|
|
20
|
+
const row = rows[0];
|
|
21
|
+
if (!row)
|
|
22
|
+
return { status: "unavailable", reason: "missing" };
|
|
23
|
+
if (row.refundCommandConflict)
|
|
24
|
+
return {
|
|
25
|
+
status: "unavailable",
|
|
26
|
+
reason: "correlation_conflict",
|
|
27
|
+
};
|
|
28
|
+
if (row.accountId !== scope.accountId ||
|
|
29
|
+
row.stripePaymentIntentId !== scope.stripePaymentIntentId ||
|
|
30
|
+
row.stripeChargeId !== scope.stripeChargeId ||
|
|
31
|
+
row.currency !== scope.currency)
|
|
32
|
+
return {
|
|
33
|
+
status: "unavailable",
|
|
34
|
+
reason: "scope_mismatch",
|
|
35
|
+
};
|
|
36
|
+
if (!/^re_[A-Za-z0-9_]{1,252}$/.test(row.stripeRefundId) ||
|
|
37
|
+
!Number.isSafeInteger(row.amount) ||
|
|
38
|
+
row.amount <= 0 ||
|
|
39
|
+
!Number.isSafeInteger(row.refundCommandObservedAt) ||
|
|
40
|
+
(row.refundCommandObservedAt ?? -1) < 0 ||
|
|
41
|
+
(row.refundCommandObservedAt ?? Infinity) > Date.now())
|
|
42
|
+
return {
|
|
43
|
+
status: "unavailable",
|
|
44
|
+
reason: "invalid_receipt",
|
|
45
|
+
};
|
|
46
|
+
const identity = await ctx.db
|
|
47
|
+
.query("refunds")
|
|
48
|
+
.withIndex("by_stripe_refund_id", (q) => q.eq("stripeRefundId", row.stripeRefundId))
|
|
49
|
+
.take(2);
|
|
50
|
+
if (identity.length !== 1 || identity[0]?._id !== row._id)
|
|
51
|
+
return { status: "unavailable", reason: "ambiguous" };
|
|
52
|
+
return { status: "observed", refund: row };
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=commandEvidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandEvidence.js","sourceRoot":"","sources":["../../../src/component/refundHistory/commandEvidence.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,GAEzB,MAAM,oCAAoC,CAAC;AAE5C,iGAAiG;AACjG,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,GAAa,EACb,KAAyB;IAEzB,wBAAwB,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE;SACxB,KAAK,CAAC,SAAS,CAAC;SAChB,SAAS,CAAC,yCAAyC,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1D,CAAC,CAAC,EAAE,CAAC,mCAAmC,EAAE,SAAS,CAAC,CACrD;SACA,IAAI,CAAC,CAAC,CAAC,CAAC;IACX,IAAI,MAAM,CAAC,MAAM;QACf,OAAO;YACL,MAAM,EAAE,aAAsB;YAC9B,MAAM,EAAE,0BAAmC;SAC5C,CAAC;IACJ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,EAAE;SACtB,KAAK,CAAC,SAAS,CAAC;SAChB,SAAS,CAAC,uBAAuB,EAAE,CAAC,CAAC,EAAE,EAAE,CACxC,CAAC,CAAC,EAAE,CAAC,kBAAkB,EAAE,KAAK,CAAC,UAAU,CAAC,CAC3C;SACA,IAAI,CAAC,CAAC,CAAC,CAAC;IACX,IAAI,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,EAAE,CACtC,CAAC,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,CAAC,cAAc,CAAC,CAC3C;SACA,IAAI,CAAC,CAAC,CAAC,CAAC;IACX,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG;QACvD,OAAO,EAAE,MAAM,EAAE,aAAsB,EAAE,MAAM,EAAE,WAAoB,EAAE,CAAC;IAC1E,OAAO,EAAE,MAAM,EAAE,UAAmB,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/** Observation and coverage only; no state here means provider absence or retry authority. */
|
|
2
|
+
export declare const refundCommandEvidenceValidator: import("convex/values").VUnion<{
|
|
3
|
+
refund: {
|
|
4
|
+
_creationTime: number;
|
|
5
|
+
_id: import("convex/values").GenericId<"refunds">;
|
|
6
|
+
accountId?: string | undefined;
|
|
7
|
+
amount: number;
|
|
8
|
+
currency: string;
|
|
9
|
+
failureReason?: string | undefined;
|
|
10
|
+
metadata?: any;
|
|
11
|
+
reason?: "duplicate" | "expired_uncaptured_charge" | "fraudulent" | "requested_by_customer" | undefined;
|
|
12
|
+
refundCommandConflict?: boolean | undefined;
|
|
13
|
+
refundCommandKey?: string | undefined;
|
|
14
|
+
refundCommandNormalizationVersion?: 1 | undefined;
|
|
15
|
+
refundCommandObservedAt?: number | undefined;
|
|
16
|
+
status: "canceled" | "failed" | "pending" | "requires_action" | "succeeded";
|
|
17
|
+
stripeChargeId?: string | undefined;
|
|
18
|
+
stripePaymentIntentId?: string | undefined;
|
|
19
|
+
stripeRefundId: string;
|
|
20
|
+
};
|
|
21
|
+
status: "observed";
|
|
22
|
+
} | {
|
|
23
|
+
reason: "ambiguous" | "correlation_conflict" | "invalid_receipt" | "missing" | "normalization_incomplete" | "scope_mismatch";
|
|
24
|
+
status: "unavailable";
|
|
25
|
+
}, [import("convex/values").VObject<{
|
|
26
|
+
refund: {
|
|
27
|
+
_creationTime: number;
|
|
28
|
+
_id: import("convex/values").GenericId<"refunds">;
|
|
29
|
+
accountId?: string | undefined;
|
|
30
|
+
amount: number;
|
|
31
|
+
currency: string;
|
|
32
|
+
failureReason?: string | undefined;
|
|
33
|
+
metadata?: any;
|
|
34
|
+
reason?: "duplicate" | "expired_uncaptured_charge" | "fraudulent" | "requested_by_customer" | undefined;
|
|
35
|
+
refundCommandConflict?: boolean | undefined;
|
|
36
|
+
refundCommandKey?: string | undefined;
|
|
37
|
+
refundCommandNormalizationVersion?: 1 | undefined;
|
|
38
|
+
refundCommandObservedAt?: number | undefined;
|
|
39
|
+
status: "canceled" | "failed" | "pending" | "requires_action" | "succeeded";
|
|
40
|
+
stripeChargeId?: string | undefined;
|
|
41
|
+
stripePaymentIntentId?: string | undefined;
|
|
42
|
+
stripeRefundId: string;
|
|
43
|
+
};
|
|
44
|
+
status: "observed";
|
|
45
|
+
}, {
|
|
46
|
+
status: import("convex/values").VLiteral<"observed", "required">;
|
|
47
|
+
refund: import("convex/values").VObject<{
|
|
48
|
+
_creationTime: number;
|
|
49
|
+
_id: import("convex/values").GenericId<"refunds">;
|
|
50
|
+
accountId?: string | undefined;
|
|
51
|
+
amount: number;
|
|
52
|
+
currency: string;
|
|
53
|
+
failureReason?: string | undefined;
|
|
54
|
+
metadata?: any;
|
|
55
|
+
reason?: "duplicate" | "expired_uncaptured_charge" | "fraudulent" | "requested_by_customer" | undefined;
|
|
56
|
+
refundCommandConflict?: boolean | undefined;
|
|
57
|
+
refundCommandKey?: string | undefined;
|
|
58
|
+
refundCommandNormalizationVersion?: 1 | undefined;
|
|
59
|
+
refundCommandObservedAt?: number | undefined;
|
|
60
|
+
status: "canceled" | "failed" | "pending" | "requires_action" | "succeeded";
|
|
61
|
+
stripeChargeId?: string | undefined;
|
|
62
|
+
stripePaymentIntentId?: string | undefined;
|
|
63
|
+
stripeRefundId: string;
|
|
64
|
+
}, {
|
|
65
|
+
refundCommandNormalizationVersion: import("convex/values").VLiteral<1 | undefined, "optional">;
|
|
66
|
+
refundCommandKey: import("convex/values").VString<string | undefined, "optional">;
|
|
67
|
+
refundCommandConflict: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
68
|
+
refundCommandObservedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
69
|
+
stripeRefundId: import("convex/values").VString<string, "required">;
|
|
70
|
+
stripePaymentIntentId: import("convex/values").VString<string | undefined, "optional">;
|
|
71
|
+
stripeChargeId: import("convex/values").VString<string | undefined, "optional">;
|
|
72
|
+
accountId: import("convex/values").VString<string | undefined, "optional">;
|
|
73
|
+
amount: import("convex/values").VFloat64<number, "required">;
|
|
74
|
+
currency: import("convex/values").VString<string, "required">;
|
|
75
|
+
status: import("convex/values").VUnion<"canceled" | "failed" | "pending" | "requires_action" | "succeeded", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"requires_action", "required">, import("convex/values").VLiteral<"succeeded", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"canceled", "required">], "required", never>;
|
|
76
|
+
reason: import("convex/values").VUnion<"duplicate" | "expired_uncaptured_charge" | "fraudulent" | "requested_by_customer" | undefined, [import("convex/values").VLiteral<"duplicate", "required">, import("convex/values").VLiteral<"fraudulent", "required">, import("convex/values").VLiteral<"requested_by_customer", "required">, import("convex/values").VLiteral<"expired_uncaptured_charge", "required">], "optional", never>;
|
|
77
|
+
failureReason: import("convex/values").VString<string | undefined, "optional">;
|
|
78
|
+
metadata: import("convex/values").VAny<any, "optional", string>;
|
|
79
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"refunds">, "required">;
|
|
80
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
81
|
+
}, "required", "_creationTime" | "_id" | "accountId" | "amount" | "currency" | "failureReason" | "metadata" | "reason" | "refundCommandConflict" | "refundCommandKey" | "refundCommandNormalizationVersion" | "refundCommandObservedAt" | "status" | "stripeChargeId" | "stripePaymentIntentId" | "stripeRefundId" | `metadata.${string}`>;
|
|
82
|
+
}, "required", "refund" | "refund._creationTime" | "refund._id" | "refund.accountId" | "refund.amount" | "refund.currency" | "refund.failureReason" | "refund.metadata" | "refund.reason" | "refund.refundCommandConflict" | "refund.refundCommandKey" | "refund.refundCommandNormalizationVersion" | "refund.refundCommandObservedAt" | "refund.status" | "refund.stripeChargeId" | "refund.stripePaymentIntentId" | "refund.stripeRefundId" | "status" | `refund.metadata.${string}`>, import("convex/values").VObject<{
|
|
83
|
+
reason: "ambiguous" | "correlation_conflict" | "invalid_receipt" | "missing" | "normalization_incomplete" | "scope_mismatch";
|
|
84
|
+
status: "unavailable";
|
|
85
|
+
}, {
|
|
86
|
+
status: import("convex/values").VLiteral<"unavailable", "required">;
|
|
87
|
+
reason: import("convex/values").VUnion<"ambiguous" | "correlation_conflict" | "invalid_receipt" | "missing" | "normalization_incomplete" | "scope_mismatch", [import("convex/values").VLiteral<"missing", "required">, import("convex/values").VLiteral<"normalization_incomplete", "required">, import("convex/values").VLiteral<"ambiguous", "required">, import("convex/values").VLiteral<"correlation_conflict", "required">, import("convex/values").VLiteral<"scope_mismatch", "required">, import("convex/values").VLiteral<"invalid_receipt", "required">], "required", never>;
|
|
88
|
+
}, "required", "reason" | "status">], "required", "reason" | "refund" | "refund._creationTime" | "refund._id" | "refund.accountId" | "refund.amount" | "refund.currency" | "refund.failureReason" | "refund.metadata" | "refund.reason" | "refund.refundCommandConflict" | "refund.refundCommandKey" | "refund.refundCommandNormalizationVersion" | "refund.refundCommandObservedAt" | "refund.status" | "refund.stripeChargeId" | "refund.stripePaymentIntentId" | "refund.stripeRefundId" | "status" | `refund.metadata.${string}`>;
|
|
89
|
+
//# sourceMappingURL=commandEvidenceValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandEvidenceValidator.d.ts","sourceRoot":"","sources":["../../../src/component/refundHistory/commandEvidenceValidator.ts"],"names":[],"mappings":"AAGA,8FAA8F;AAC9F,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qgBAa1C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { refundDocValidator } from "../connect/validators.js";
|
|
3
|
+
/** Observation and coverage only; no state here means provider absence or retry authority. */
|
|
4
|
+
export const refundCommandEvidenceValidator = v.union(v.object({ status: v.literal("observed"), refund: refundDocValidator }), v.object({
|
|
5
|
+
status: v.literal("unavailable"),
|
|
6
|
+
reason: v.union(v.literal("missing"), v.literal("normalization_incomplete"), v.literal("ambiguous"), v.literal("correlation_conflict"), v.literal("scope_mismatch"), v.literal("invalid_receipt")),
|
|
7
|
+
}));
|
|
8
|
+
//# sourceMappingURL=commandEvidenceValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandEvidenceValidator.js","sourceRoot":"","sources":["../../../src/component/refundHistory/commandEvidenceValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,8FAA8F;AAC9F,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CACnD,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,EACvE,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC,KAAK,CACb,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EACpB,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,EACrC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EACtB,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,EACjC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAC3B,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAC7B;CACF,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Correlation projection only; raw provider refund fields remain authoritative. */
|
|
2
|
+
export declare const refundCommandFields: {
|
|
3
|
+
refundCommandNormalizationVersion: import("convex/values").VLiteral<1 | undefined, "optional">;
|
|
4
|
+
refundCommandKey: import("convex/values").VString<string | undefined, "optional">;
|
|
5
|
+
refundCommandConflict: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
6
|
+
refundCommandObservedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=commandFields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandFields.d.ts","sourceRoot":"","sources":["../../../src/component/refundHistory/commandFields.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,eAAO,MAAM,mBAAmB;IAC9B,iCAAiC;IACjC,gBAAgB;IAChB,qBAAqB;IACrB,uBAAuB;CACxB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
/** Correlation projection only; raw provider refund fields remain authoritative. */
|
|
3
|
+
export const refundCommandFields = {
|
|
4
|
+
refundCommandNormalizationVersion: v.optional(v.literal(1)),
|
|
5
|
+
refundCommandKey: v.optional(v.string()),
|
|
6
|
+
refundCommandConflict: v.optional(v.boolean()),
|
|
7
|
+
refundCommandObservedAt: v.optional(v.number()),
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=commandFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandFields.js","sourceRoot":"","sources":["../../../src/component/refundHistory/commandFields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,oFAAoF;AACpF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,iCAAiC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3D,gBAAgB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACxC,qBAAqB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAC9C,uBAAuB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAChD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Trusted-host projection backfill; completion covers current component rows, never provider history. */
|
|
2
|
+
export declare const normalizeRefundCommandBindings: import("convex/server").RegisteredMutation<"public", {
|
|
3
|
+
limit: number;
|
|
4
|
+
}, Promise<{
|
|
5
|
+
normalized: number;
|
|
6
|
+
hasMore: boolean;
|
|
7
|
+
}>>;
|
|
8
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/refundHistory/mutations.ts"],"names":[],"mappings":"AAIA,0GAA0G;AAC1G,eAAO,MAAM,8BAA8B;;;;;GA2BzC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { mutation } from "../_generated/server.js";
|
|
3
|
+
import { refundCommandBinding } from "./commandBinding.js";
|
|
4
|
+
/** Trusted-host projection backfill; completion covers current component rows, never provider history. */
|
|
5
|
+
export const normalizeRefundCommandBindings = mutation({
|
|
6
|
+
args: { limit: v.number() },
|
|
7
|
+
returns: v.object({ normalized: v.number(), hasMore: v.boolean() }),
|
|
8
|
+
handler: async (ctx, { limit }) => {
|
|
9
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 100)
|
|
10
|
+
throw new Error("Normalization limit must be an integer from 1 to 100");
|
|
11
|
+
const rows = await ctx.db
|
|
12
|
+
.query("refunds")
|
|
13
|
+
.withIndex("by_refund_command_normalization_version", (q) => q.eq("refundCommandNormalizationVersion", undefined))
|
|
14
|
+
.take(limit);
|
|
15
|
+
const now = Date.now();
|
|
16
|
+
for (const row of rows)
|
|
17
|
+
await ctx.db.patch("refunds", row._id, refundCommandBinding(row, {}, now));
|
|
18
|
+
const pending = await ctx.db
|
|
19
|
+
.query("refunds")
|
|
20
|
+
.withIndex("by_refund_command_normalization_version", (q) => q.eq("refundCommandNormalizationVersion", undefined))
|
|
21
|
+
.take(1);
|
|
22
|
+
return { normalized: rows.length, hasMore: pending.length > 0 };
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=mutations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/component/refundHistory/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,0GAA0G;AAC1G,MAAM,CAAC,MAAM,8BAA8B,GAAG,QAAQ,CAAC;IACrD,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;IACnE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAChC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG;YACtD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,EAAE;aACtB,KAAK,CAAC,SAAS,CAAC;aAChB,SAAS,CAAC,yCAAyC,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1D,CAAC,CAAC,EAAE,CAAC,mCAAmC,EAAE,SAAS,CAAC,CACrD;aACA,IAAI,CAAC,KAAK,CAAC,CAAC;QACf,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,MAAM,GAAG,IAAI,IAAI;YACpB,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAChB,SAAS,EACT,GAAG,CAAC,GAAG,EACP,oBAAoB,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,CACnC,CAAC;QACJ,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,EAAE;aACzB,KAAK,CAAC,SAAS,CAAC;aAChB,SAAS,CAAC,yCAAyC,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1D,CAAC,CAAC,EAAE,CAAC,mCAAmC,EAAE,SAAS,CAAC,CACrD;aACA,IAAI,CAAC,CAAC,CAAC,CAAC;QACX,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IAClE,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -20,9 +20,60 @@ export declare const paginateRefunds: import("convex/server").RegisteredQuery<"p
|
|
|
20
20
|
failureReason?: string | undefined;
|
|
21
21
|
metadata?: any;
|
|
22
22
|
reason?: "duplicate" | "expired_uncaptured_charge" | "fraudulent" | "requested_by_customer" | undefined;
|
|
23
|
+
refundCommandConflict?: boolean | undefined;
|
|
24
|
+
refundCommandKey?: string | undefined;
|
|
25
|
+
refundCommandNormalizationVersion?: 1 | undefined;
|
|
26
|
+
refundCommandObservedAt?: number | undefined;
|
|
23
27
|
status: "canceled" | "failed" | "pending" | "requires_action" | "succeeded";
|
|
24
28
|
stripeChargeId?: string | undefined;
|
|
25
29
|
stripePaymentIntentId?: string | undefined;
|
|
26
30
|
stripeRefundId: string;
|
|
27
31
|
}>>>;
|
|
32
|
+
/** Exact command evidence is read-only and never authorizes a provider retry. */
|
|
33
|
+
export declare const getRefundCommandEvidence: import("convex/server").RegisteredQuery<"public", import("../../shared/refundCommandScope.js").RefundCommandScope, Promise<{
|
|
34
|
+
status: "unavailable";
|
|
35
|
+
reason: "normalization_incomplete";
|
|
36
|
+
refund?: undefined;
|
|
37
|
+
} | {
|
|
38
|
+
status: "unavailable";
|
|
39
|
+
reason: "ambiguous";
|
|
40
|
+
refund?: undefined;
|
|
41
|
+
} | {
|
|
42
|
+
status: "unavailable";
|
|
43
|
+
reason: "missing";
|
|
44
|
+
refund?: undefined;
|
|
45
|
+
} | {
|
|
46
|
+
status: "unavailable";
|
|
47
|
+
reason: "correlation_conflict";
|
|
48
|
+
refund?: undefined;
|
|
49
|
+
} | {
|
|
50
|
+
status: "unavailable";
|
|
51
|
+
reason: "scope_mismatch";
|
|
52
|
+
refund?: undefined;
|
|
53
|
+
} | {
|
|
54
|
+
status: "unavailable";
|
|
55
|
+
reason: "invalid_receipt";
|
|
56
|
+
refund?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
reason?: undefined;
|
|
59
|
+
status: "observed";
|
|
60
|
+
refund: {
|
|
61
|
+
_creationTime: number;
|
|
62
|
+
_id: import("convex/values").GenericId<"refunds">;
|
|
63
|
+
accountId?: string | undefined;
|
|
64
|
+
amount: number;
|
|
65
|
+
currency: string;
|
|
66
|
+
failureReason?: string | undefined;
|
|
67
|
+
metadata?: any;
|
|
68
|
+
reason?: "duplicate" | "expired_uncaptured_charge" | "fraudulent" | "requested_by_customer" | undefined;
|
|
69
|
+
refundCommandConflict?: boolean | undefined;
|
|
70
|
+
refundCommandKey?: string | undefined;
|
|
71
|
+
refundCommandNormalizationVersion?: 1 | undefined;
|
|
72
|
+
refundCommandObservedAt?: number | undefined;
|
|
73
|
+
status: "canceled" | "failed" | "pending" | "requires_action" | "succeeded";
|
|
74
|
+
stripeChargeId?: string | undefined;
|
|
75
|
+
stripePaymentIntentId?: string | undefined;
|
|
76
|
+
stripeRefundId: string;
|
|
77
|
+
};
|
|
78
|
+
}>>;
|
|
28
79
|
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/refundHistory/queries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/refundHistory/queries.ts"],"names":[],"mappings":"AAiBA,wFAAwF;AACxF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0B1B,CAAC;AA0DH,iFAAiF;AACjF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUnC,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { refundCommandEvidenceValidator } from "./commandEvidenceValidator.js";
|
|
2
|
+
import { readRefundCommandEvidence } from "./commandEvidence.js";
|
|
1
3
|
import { paginationOptsValidator, paginationResultValidator, } from "convex/server";
|
|
2
4
|
import { v } from "convex/values";
|
|
3
5
|
import { paginator } from "convex-helpers/server/pagination";
|
|
@@ -56,4 +58,16 @@ function scopedRefunds(ctx, args) {
|
|
|
56
58
|
return refunds.withIndex("by_status", (q) => q.eq("status", status));
|
|
57
59
|
return refunds;
|
|
58
60
|
}
|
|
61
|
+
/** Exact command evidence is read-only and never authorizes a provider retry. */
|
|
62
|
+
export const getRefundCommandEvidence = query({
|
|
63
|
+
args: {
|
|
64
|
+
commandKey: v.string(),
|
|
65
|
+
accountId: v.string(),
|
|
66
|
+
stripePaymentIntentId: v.string(),
|
|
67
|
+
stripeChargeId: v.string(),
|
|
68
|
+
currency: v.string(),
|
|
69
|
+
},
|
|
70
|
+
returns: refundCommandEvidenceValidator,
|
|
71
|
+
handler: readRefundCommandEvidence,
|
|
72
|
+
});
|
|
59
73
|
//# sourceMappingURL=queries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/component/refundHistory/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAiB,MAAM,yBAAyB,CAAC;AAC/D,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GAEtB,MAAM,0BAA0B,CAAC;AAElC,wFAAwF;AACxF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;IACnC,IAAI,EAAE;QACJ,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QACjC,qBAAqB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7C,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QACzC,cAAc,EAAE,uBAAuB;KACxC;IACD,OAAO,EAAE,yBAAyB,CAAC,kBAAkB,CAAC;IACtD,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QAChC,IACE,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,QAAQ,CAAC;YAC9C,cAAc,CAAC,QAAQ,GAAG,CAAC;YAC3B,cAAc,CAAC,QAAQ,GAAG,GAAG;YAE7B,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAA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