@fantastic.dev/better-stripe 0.41.0 → 0.43.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 +25 -0
- package/README.md +1 -1
- package/dist/client/balanceFundingWorkflow/client.d.ts +172 -0
- package/dist/client/balanceFundingWorkflow/client.d.ts.map +1 -0
- package/dist/client/balanceFundingWorkflow/client.js +289 -0
- package/dist/client/balanceFundingWorkflow/client.js.map +1 -0
- package/dist/client/billing/balanceFunding.d.ts +5 -0
- package/dist/client/billing/balanceFunding.d.ts.map +1 -1
- package/dist/client/billing/balanceFunding.js +30 -0
- package/dist/client/billing/balanceFunding.js.map +1 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +1388 -2
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +710 -17
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +1420 -34
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +694 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/costRecovery-invoices.d.ts +3 -2
- package/dist/client/costRecovery-invoices.d.ts.map +1 -1
- package/dist/client/costRecovery-invoices.js +10 -5
- package/dist/client/costRecovery-invoices.js.map +1 -1
- package/dist/client/costRecovery.d.ts +4 -2
- package/dist/client/costRecovery.d.ts.map +1 -1
- package/dist/client/costRecovery.js +2 -2
- package/dist/client/costRecovery.js.map +1 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/processingCostReconciliation/client.d.ts +14 -0
- package/dist/client/processingCostReconciliation/client.d.ts.map +1 -0
- package/dist/client/processingCostReconciliation/client.js +35 -0
- package/dist/client/processingCostReconciliation/client.js.map +1 -0
- package/dist/client/processingCostReconciliation/contracts.d.ts +172 -0
- package/dist/client/processingCostReconciliation/contracts.d.ts.map +1 -0
- package/dist/client/processingCostReconciliation/contracts.js +55 -0
- package/dist/client/processingCostReconciliation/contracts.js.map +1 -0
- package/dist/client/processingCostReconciliation/invoiceFunding.d.ts +15 -0
- package/dist/client/processingCostReconciliation/invoiceFunding.d.ts.map +1 -0
- package/dist/client/processingCostReconciliation/invoiceFunding.js +195 -0
- package/dist/client/processingCostReconciliation/invoiceFunding.js.map +1 -0
- package/dist/client/processingCostReconciliation/provider.d.ts +9 -0
- package/dist/client/processingCostReconciliation/provider.d.ts.map +1 -0
- package/dist/client/processingCostReconciliation/provider.js +148 -0
- package/dist/client/processingCostReconciliation/provider.js.map +1 -0
- package/dist/client/settlement/processingCostHistory.d.ts +12 -0
- package/dist/client/settlement/processingCostHistory.d.ts.map +1 -0
- package/dist/client/settlement/processingCostHistory.js +20 -0
- package/dist/client/settlement/processingCostHistory.js.map +1 -0
- package/dist/client/settlement/processingCosts.d.ts +3 -0
- package/dist/client/settlement/processingCosts.d.ts.map +1 -1
- package/dist/client/settlement/processingCosts.js +27 -7
- package/dist/client/settlement/processingCosts.js.map +1 -1
- package/dist/component/_generated/api.d.ts +36 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +988 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/balanceFunding/helpers.d.ts +42 -0
- package/dist/component/balanceFunding/helpers.d.ts.map +1 -1
- package/dist/component/balanceFunding/internal/actions.d.ts +39 -0
- package/dist/component/balanceFunding/internal/actions.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/actions.js +80 -0
- package/dist/component/balanceFunding/internal/actions.js.map +1 -0
- package/dist/component/balanceFunding/internal/mutations.d.ts +55 -0
- package/dist/component/balanceFunding/internal/mutations.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/mutations.js +54 -0
- package/dist/component/balanceFunding/internal/mutations.js.map +1 -0
- package/dist/component/balanceFunding/internal/queries.d.ts +116 -0
- package/dist/component/balanceFunding/internal/queries.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/queries.js +35 -0
- package/dist/component/balanceFunding/internal/queries.js.map +1 -0
- package/dist/component/balanceFunding/internal/workflow.d.ts +10 -0
- package/dist/component/balanceFunding/internal/workflow.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/workflow.js +31 -0
- package/dist/component/balanceFunding/internal/workflow.js.map +1 -0
- package/dist/component/balanceFunding/lifecycleHandlers.d.ts +126 -0
- package/dist/component/balanceFunding/lifecycleHandlers.d.ts.map +1 -1
- package/dist/component/balanceFunding/mutations.d.ts +419 -16
- package/dist/component/balanceFunding/mutations.d.ts.map +1 -1
- package/dist/component/balanceFunding/mutations.js +24 -0
- package/dist/component/balanceFunding/mutations.js.map +1 -1
- package/dist/component/balanceFunding/preparationHandlers.d.ts +42 -0
- package/dist/component/balanceFunding/preparationHandlers.d.ts.map +1 -1
- package/dist/component/balanceFunding/queries.d.ts +78 -0
- package/dist/component/balanceFunding/queries.d.ts.map +1 -1
- package/dist/component/balanceFunding/queries.js +35 -0
- package/dist/component/balanceFunding/queries.js.map +1 -1
- package/dist/component/balanceFunding/receipt.d.ts +5 -0
- package/dist/component/balanceFunding/receipt.d.ts.map +1 -0
- package/dist/component/balanceFunding/receipt.js +37 -0
- package/dist/component/balanceFunding/receipt.js.map +1 -0
- package/dist/component/balanceFunding/schema.d.ts +506 -2
- package/dist/component/balanceFunding/schema.d.ts.map +1 -1
- package/dist/component/balanceFunding/schema.js +2 -0
- package/dist/component/balanceFunding/schema.js.map +1 -1
- package/dist/component/balanceFunding/stateHandlers.d.ts +42 -0
- package/dist/component/balanceFunding/stateHandlers.d.ts.map +1 -1
- package/dist/component/balanceFunding/workflowControl.d.ts +19 -0
- package/dist/component/balanceFunding/workflowControl.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowControl.js +149 -0
- package/dist/component/balanceFunding/workflowControl.js.map +1 -0
- package/dist/component/balanceFunding/workflowSchema.d.ts +356 -0
- package/dist/component/balanceFunding/workflowSchema.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowSchema.js +48 -0
- package/dist/component/balanceFunding/workflowSchema.js.map +1 -0
- package/dist/component/balanceFunding/workflowState.d.ts +157 -0
- package/dist/component/balanceFunding/workflowState.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowState.js +194 -0
- package/dist/component/balanceFunding/workflowState.js.map +1 -0
- package/dist/component/balanceFunding/workflowValidators.d.ts +306 -0
- package/dist/component/balanceFunding/workflowValidators.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowValidators.js +27 -0
- package/dist/component/balanceFunding/workflowValidators.js.map +1 -0
- package/dist/component/earnings/triggers.d.ts +388 -2
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/payoutRelease/queries.d.ts +2 -2
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/processingCostReconciliation/adoption.d.ts +29 -0
- package/dist/component/processingCostReconciliation/adoption.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/adoption.js +58 -0
- package/dist/component/processingCostReconciliation/adoption.js.map +1 -0
- package/dist/component/processingCostReconciliation/bridge.d.ts +45 -0
- package/dist/component/processingCostReconciliation/bridge.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/bridge.js +41 -0
- package/dist/component/processingCostReconciliation/bridge.js.map +1 -0
- package/dist/component/processingCostReconciliation/helpers.d.ts +327 -0
- package/dist/component/processingCostReconciliation/helpers.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/helpers.js +39 -0
- package/dist/component/processingCostReconciliation/helpers.js.map +1 -0
- package/dist/component/processingCostReconciliation/mutations.d.ts +303 -0
- package/dist/component/processingCostReconciliation/mutations.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/mutations.js +121 -0
- package/dist/component/processingCostReconciliation/mutations.js.map +1 -0
- package/dist/component/processingCostReconciliation/queries.d.ts +422 -0
- package/dist/component/processingCostReconciliation/queries.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/queries.js +19 -0
- package/dist/component/processingCostReconciliation/queries.js.map +1 -0
- package/dist/component/processingCostReconciliation/rollback.d.ts +21 -0
- package/dist/component/processingCostReconciliation/rollback.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/rollback.js +54 -0
- package/dist/component/processingCostReconciliation/rollback.js.map +1 -0
- package/dist/component/processingCostReconciliation/schema.d.ts +2460 -0
- package/dist/component/processingCostReconciliation/schema.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/schema.js +137 -0
- package/dist/component/processingCostReconciliation/schema.js.map +1 -0
- package/dist/component/processingCostReconciliation/steps.d.ts +306 -0
- package/dist/component/processingCostReconciliation/steps.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/steps.js +149 -0
- package/dist/component/processingCostReconciliation/steps.js.map +1 -0
- package/dist/component/processingCostReconciliation/validation.d.ts +13 -0
- package/dist/component/processingCostReconciliation/validation.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/validation.js +61 -0
- package/dist/component/processingCostReconciliation/validation.js.map +1 -0
- package/dist/component/processingCostReconciliation/workflow.d.ts +105 -0
- package/dist/component/processingCostReconciliation/workflow.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/workflow.js +33 -0
- package/dist/component/processingCostReconciliation/workflow.js.map +1 -0
- package/dist/component/schema.d.ts +694 -1
- package/dist/component/schema.js +2 -0
- package/dist/component/schema.js.map +1 -1
- package/package.json +1 -1
- package/src/client/balanceFundingWorkflow/capture.test.ts +144 -0
- package/src/client/balanceFundingWorkflow/client.ts +419 -0
- package/src/client/billing/balanceFunding.ts +50 -0
- package/src/client/costRecovery-invoices.ts +19 -4
- package/src/client/costRecovery.ts +4 -2
- package/src/client/index.ts +15 -0
- package/src/client/processingCostReconciliation/client.ts +75 -0
- package/src/client/processingCostReconciliation/contracts.ts +176 -0
- package/src/client/processingCostReconciliation/invoiceFunding.ts +270 -0
- package/src/client/processingCostReconciliation/invoiceProvider.test.ts +353 -0
- package/src/client/processingCostReconciliation/provider.test.ts +324 -0
- package/src/client/processingCostReconciliation/provider.ts +178 -0
- package/src/client/settlement/processingCostHistory.ts +31 -0
- package/src/client/settlement/processingCosts.ts +50 -15
- package/src/component/_generated/api.ts +36 -0
- package/src/component/_generated/component.ts +1094 -0
- package/src/component/balanceFunding/internal/actions.ts +107 -0
- package/src/component/balanceFunding/internal/mutations.ts +66 -0
- package/src/component/balanceFunding/internal/queries.ts +34 -0
- package/src/component/balanceFunding/internal/workflow.ts +49 -0
- package/src/component/balanceFunding/mutations.ts +34 -0
- package/src/component/balanceFunding/queries.ts +38 -0
- package/src/component/balanceFunding/receipt.ts +48 -0
- package/src/component/balanceFunding/schema.ts +2 -0
- package/src/component/balanceFunding/scopeLookup.test.ts +94 -0
- package/src/component/balanceFunding/workflow.fixtures.ts +366 -0
- package/src/component/balanceFunding/workflow.test.ts +552 -0
- package/src/component/balanceFunding/workflowControl.ts +198 -0
- package/src/component/balanceFunding/workflowSchema.ts +78 -0
- package/src/component/balanceFunding/workflowState.ts +285 -0
- package/src/component/balanceFunding/workflowValidators.ts +40 -0
- package/src/component/processingCostReconciliation/adoption.test.ts +206 -0
- package/src/component/processingCostReconciliation/adoption.ts +77 -0
- package/src/component/processingCostReconciliation/bridge.ts +50 -0
- package/src/component/processingCostReconciliation/helpers.ts +55 -0
- package/src/component/processingCostReconciliation/invoice.test.ts +152 -0
- package/src/component/processingCostReconciliation/mutations.ts +148 -0
- package/src/component/processingCostReconciliation/queries.ts +18 -0
- package/src/component/processingCostReconciliation/rollback.ts +72 -0
- package/src/component/processingCostReconciliation/schema.ts +191 -0
- package/src/component/processingCostReconciliation/state.test.ts +407 -0
- package/src/component/processingCostReconciliation/steps.ts +168 -0
- package/src/component/processingCostReconciliation/validation.ts +79 -0
- package/src/component/processingCostReconciliation/workflow.test.ts +329 -0
- package/src/component/processingCostReconciliation/workflow.ts +50 -0
- package/src/component/schema.ts +2 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { anyApi } from "convex/server";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
import { internalAction } from "../_generated/server.js";
|
|
4
|
+
import { refFields, observation, failure } from "./schema.js";
|
|
5
|
+
import { providerReceiptSchema } from "../../client/processingCostReconciliation/contracts.js";
|
|
6
|
+
import { same } from "../recoveryWorkflow/helpers.js";
|
|
7
|
+
const outcome = v.union(v.object({ status: v.literal("ready"), value: observation }), failure);
|
|
8
|
+
const unknown = {
|
|
9
|
+
status: "unknown",
|
|
10
|
+
reason: "provider_outcome_unknown",
|
|
11
|
+
retryable: false,
|
|
12
|
+
};
|
|
13
|
+
export const invoke = internalAction({
|
|
14
|
+
args: refFields,
|
|
15
|
+
returns: outcome,
|
|
16
|
+
handler: async (ctx, args) => {
|
|
17
|
+
try {
|
|
18
|
+
const op = await ctx.runQuery(anyApi.processingCostReconciliation.queries.saved, args);
|
|
19
|
+
if (op.result)
|
|
20
|
+
return { status: "ready", value: op.result.observation };
|
|
21
|
+
if (op.failure && ["conflict", "rejected"].includes(op.failure.status))
|
|
22
|
+
return op.failure;
|
|
23
|
+
await ctx.runMutation(anyApi.processingCostReconciliation.steps.begin, args);
|
|
24
|
+
const request = {
|
|
25
|
+
...args,
|
|
26
|
+
providerApiVersion: op.providerApiVersion,
|
|
27
|
+
definitionVersion: op.definitionVersion,
|
|
28
|
+
};
|
|
29
|
+
const raw = await ctx.runAction(op.provider, request);
|
|
30
|
+
const parsed = providerReceiptSchema.safeParse(raw);
|
|
31
|
+
if (!parsed.success)
|
|
32
|
+
return unknown;
|
|
33
|
+
const { outcome, ...echo } = parsed.data;
|
|
34
|
+
return same(request, echo) ? outcome : unknown;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return unknown;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../../src/component/processingCostReconciliation/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAuB,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CACrB,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAC5D,OAAO,CACR,CAAC;AACF,MAAM,OAAO,GAAG;IACd,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,0BAA0B;IAClC,SAAS,EAAE,KAAK;CACR,CAAC;AACX,MAAM,CAAC,MAAM,MAAM,GAAG,cAAc,CAAC;IACnC,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAkC,EAAE;QAC3D,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,QAAQ,CAC3B,MAAM,CAAC,4BAA4B,CAAC,OAAO,CAAC,KAAK,EACjD,IAAI,CACL,CAAC;YACF,IAAI,EAAE,CAAC,MAAM;gBAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YACxE,IAAI,EAAE,CAAC,OAAO,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;gBACpE,OAAO,EAAE,CAAC,OAAO,CAAC;YACpB,MAAM,GAAG,CAAC,WAAW,CACnB,MAAM,CAAC,4BAA4B,CAAC,KAAK,CAAC,KAAK,EAC/C,IAAI,CACL,CAAC;YACF,MAAM,OAAO,GAAG;gBACd,GAAG,IAAI;gBACP,kBAAkB,EAAE,EAAE,CAAC,kBAAkB;gBACzC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB;aACxC,CAAC;YACF,MAAM,GAAG,GAAY,MAAM,GAAG,CAAC,SAAS,CACtC,EAAE,CAAC,QAAoC,EACvC,OAAO,CACR,CAAC;YACF,MAAM,MAAM,GAAG,qBAAqB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YACpD,IAAI,CAAC,MAAM,CAAC,OAAO;gBAAE,OAAO,OAAO,CAAC;YACpC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;YACzC,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QACjD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { type Infer } from "convex/values";
|
|
2
|
+
import type { Doc } from "../_generated/dataModel.js";
|
|
3
|
+
import type { MutationCtx, QueryCtx } from "../_generated/server.js";
|
|
4
|
+
import { failure } from "./schema.js";
|
|
5
|
+
declare const _ref: import("convex/values").VObject<{
|
|
6
|
+
accountId: string;
|
|
7
|
+
currency: string;
|
|
8
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
9
|
+
scopeKey: string;
|
|
10
|
+
version: number;
|
|
11
|
+
}, {
|
|
12
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
13
|
+
scopeKey: import("convex/values").VString<string, "required">;
|
|
14
|
+
currency: import("convex/values").VString<string, "required">;
|
|
15
|
+
operationId: import("convex/values").VId<import("convex/values").GenericId<"processingCostReconciliationOperations">, "required">;
|
|
16
|
+
version: import("convex/values").VFloat64<number, "required">;
|
|
17
|
+
}, "required", "accountId" | "currency" | "operationId" | "scopeKey" | "version">;
|
|
18
|
+
export type OperationRef = Infer<typeof _ref>;
|
|
19
|
+
export declare const conflict: (reason: "identity_changed" | "revision_changed") => {
|
|
20
|
+
readonly status: "conflict";
|
|
21
|
+
readonly reason: "identity_changed" | "revision_changed";
|
|
22
|
+
readonly retryable: false;
|
|
23
|
+
};
|
|
24
|
+
export declare function reference(op: Doc<"processingCostReconciliationOperations">): OperationRef;
|
|
25
|
+
export declare function status(op: Doc<"processingCostReconciliationOperations">): {
|
|
26
|
+
status: "completed";
|
|
27
|
+
result: {
|
|
28
|
+
claim: {
|
|
29
|
+
_creationTime: number;
|
|
30
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
31
|
+
accountId: string;
|
|
32
|
+
amountDue: number;
|
|
33
|
+
claimKey: string;
|
|
34
|
+
collectedAmount: number;
|
|
35
|
+
currency: string;
|
|
36
|
+
openingCollection?: {
|
|
37
|
+
amountDue: number;
|
|
38
|
+
collectedAmount: number;
|
|
39
|
+
operationKey: string;
|
|
40
|
+
revision: number;
|
|
41
|
+
} | undefined;
|
|
42
|
+
outstanding: number;
|
|
43
|
+
reservedAmount: number;
|
|
44
|
+
revision: number;
|
|
45
|
+
scopeKey: string;
|
|
46
|
+
sign: "negative" | "positive" | "zero";
|
|
47
|
+
sourceChargeId: string;
|
|
48
|
+
sourceGross: number;
|
|
49
|
+
sourceProcessingFee: number;
|
|
50
|
+
};
|
|
51
|
+
deficit: {
|
|
52
|
+
amountDue: number;
|
|
53
|
+
currency: string;
|
|
54
|
+
disputeLiability: number;
|
|
55
|
+
processingLiability: number;
|
|
56
|
+
retainedFee: number;
|
|
57
|
+
};
|
|
58
|
+
observation: {
|
|
59
|
+
currency: string;
|
|
60
|
+
disputeFees: number;
|
|
61
|
+
gross: number;
|
|
62
|
+
originalProcessingFee: number;
|
|
63
|
+
paymentIntentId: string;
|
|
64
|
+
principalReturned: number;
|
|
65
|
+
processingFee: number;
|
|
66
|
+
provenance: {
|
|
67
|
+
customerAccountId: string;
|
|
68
|
+
invoiceId: string;
|
|
69
|
+
invoicePaymentId: string;
|
|
70
|
+
recoveryInvoiceItemId?: string | undefined;
|
|
71
|
+
stripePriceId?: string | undefined;
|
|
72
|
+
stripeProductId?: string | undefined;
|
|
73
|
+
subscriptionId?: string | undefined;
|
|
74
|
+
};
|
|
75
|
+
sourceChargeId: string;
|
|
76
|
+
};
|
|
77
|
+
rollbackClaim?: {
|
|
78
|
+
_creationTime: number;
|
|
79
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
80
|
+
accountId: string;
|
|
81
|
+
amountDue: number;
|
|
82
|
+
claimKey: string;
|
|
83
|
+
collectedAmount: number;
|
|
84
|
+
currency: string;
|
|
85
|
+
openingCollection?: {
|
|
86
|
+
amountDue: number;
|
|
87
|
+
collectedAmount: number;
|
|
88
|
+
operationKey: string;
|
|
89
|
+
revision: number;
|
|
90
|
+
} | undefined;
|
|
91
|
+
outstanding: number;
|
|
92
|
+
reservedAmount: number;
|
|
93
|
+
revision: number;
|
|
94
|
+
scopeKey: string;
|
|
95
|
+
sign: "negative" | "positive" | "zero";
|
|
96
|
+
sourceChargeId: string;
|
|
97
|
+
sourceGross: number;
|
|
98
|
+
sourceProcessingFee: number;
|
|
99
|
+
} | undefined;
|
|
100
|
+
};
|
|
101
|
+
accountId: string;
|
|
102
|
+
currency: string;
|
|
103
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
104
|
+
scopeKey: string;
|
|
105
|
+
version: number;
|
|
106
|
+
} | {
|
|
107
|
+
accountId: string;
|
|
108
|
+
currency: string;
|
|
109
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
110
|
+
reason: "fee_pending" | "history_incomplete" | "provider_pending";
|
|
111
|
+
retryable: true;
|
|
112
|
+
scopeKey: string;
|
|
113
|
+
status: "not_ready";
|
|
114
|
+
version: number;
|
|
115
|
+
} | {
|
|
116
|
+
accountId: string;
|
|
117
|
+
currency: string;
|
|
118
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
119
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
120
|
+
retryable: false;
|
|
121
|
+
scopeKey: string;
|
|
122
|
+
status: "conflict";
|
|
123
|
+
version: number;
|
|
124
|
+
} | {
|
|
125
|
+
accountId: string;
|
|
126
|
+
currency: string;
|
|
127
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
128
|
+
reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
|
|
129
|
+
retryable: false;
|
|
130
|
+
scopeKey: string;
|
|
131
|
+
status: "rejected";
|
|
132
|
+
version: number;
|
|
133
|
+
} | {
|
|
134
|
+
accountId: string;
|
|
135
|
+
currency: string;
|
|
136
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
137
|
+
reason: "history_incomplete" | "provider_outcome_unknown";
|
|
138
|
+
retryable: false;
|
|
139
|
+
scopeKey: string;
|
|
140
|
+
status: "unknown";
|
|
141
|
+
version: number;
|
|
142
|
+
} | {
|
|
143
|
+
status: "queued" | "running";
|
|
144
|
+
accountId: string;
|
|
145
|
+
currency: string;
|
|
146
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
147
|
+
scopeKey: string;
|
|
148
|
+
version: number;
|
|
149
|
+
};
|
|
150
|
+
export declare function read(ctx: QueryCtx | MutationCtx, args: OperationRef): Promise<{
|
|
151
|
+
_creationTime: number;
|
|
152
|
+
_id: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
153
|
+
accountId: string;
|
|
154
|
+
claimKey: string;
|
|
155
|
+
currency: string;
|
|
156
|
+
definitionVersion: number;
|
|
157
|
+
expectedRevision: number;
|
|
158
|
+
failure?: {
|
|
159
|
+
reason: "fee_pending" | "history_incomplete" | "provider_pending";
|
|
160
|
+
retryable: true;
|
|
161
|
+
status: "not_ready";
|
|
162
|
+
} | {
|
|
163
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
164
|
+
retryable: false;
|
|
165
|
+
status: "conflict";
|
|
166
|
+
} | {
|
|
167
|
+
reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
|
|
168
|
+
retryable: false;
|
|
169
|
+
status: "rejected";
|
|
170
|
+
} | {
|
|
171
|
+
reason: "history_incomplete" | "provider_outcome_unknown";
|
|
172
|
+
retryable: false;
|
|
173
|
+
status: "unknown";
|
|
174
|
+
} | undefined;
|
|
175
|
+
importHook?: string | undefined;
|
|
176
|
+
maxAttempts: number;
|
|
177
|
+
policy: {
|
|
178
|
+
liability: {
|
|
179
|
+
disputeCosts: "all" | "none";
|
|
180
|
+
processingCosts: "all" | "none" | "uncovered";
|
|
181
|
+
};
|
|
182
|
+
rounding: "ceil" | "floor" | "nearest";
|
|
183
|
+
sellingFee: number;
|
|
184
|
+
};
|
|
185
|
+
projection?: string | undefined;
|
|
186
|
+
provider: string;
|
|
187
|
+
providerApiVersion: string;
|
|
188
|
+
requestKey: string;
|
|
189
|
+
result?: {
|
|
190
|
+
claim: {
|
|
191
|
+
_creationTime: number;
|
|
192
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
193
|
+
accountId: string;
|
|
194
|
+
amountDue: number;
|
|
195
|
+
claimKey: string;
|
|
196
|
+
collectedAmount: number;
|
|
197
|
+
currency: string;
|
|
198
|
+
openingCollection?: {
|
|
199
|
+
amountDue: number;
|
|
200
|
+
collectedAmount: number;
|
|
201
|
+
operationKey: string;
|
|
202
|
+
revision: number;
|
|
203
|
+
} | undefined;
|
|
204
|
+
outstanding: number;
|
|
205
|
+
reservedAmount: number;
|
|
206
|
+
revision: number;
|
|
207
|
+
scopeKey: string;
|
|
208
|
+
sign: "negative" | "positive" | "zero";
|
|
209
|
+
sourceChargeId: string;
|
|
210
|
+
sourceGross: number;
|
|
211
|
+
sourceProcessingFee: number;
|
|
212
|
+
};
|
|
213
|
+
deficit: {
|
|
214
|
+
amountDue: number;
|
|
215
|
+
currency: string;
|
|
216
|
+
disputeLiability: number;
|
|
217
|
+
processingLiability: number;
|
|
218
|
+
retainedFee: number;
|
|
219
|
+
};
|
|
220
|
+
observation: {
|
|
221
|
+
currency: string;
|
|
222
|
+
disputeFees: number;
|
|
223
|
+
gross: number;
|
|
224
|
+
originalProcessingFee: number;
|
|
225
|
+
paymentIntentId: string;
|
|
226
|
+
principalReturned: number;
|
|
227
|
+
processingFee: number;
|
|
228
|
+
provenance: {
|
|
229
|
+
customerAccountId: string;
|
|
230
|
+
invoiceId: string;
|
|
231
|
+
invoicePaymentId: string;
|
|
232
|
+
recoveryInvoiceItemId?: string | undefined;
|
|
233
|
+
stripePriceId?: string | undefined;
|
|
234
|
+
stripeProductId?: string | undefined;
|
|
235
|
+
subscriptionId?: string | undefined;
|
|
236
|
+
};
|
|
237
|
+
sourceChargeId: string;
|
|
238
|
+
};
|
|
239
|
+
rollbackClaim?: {
|
|
240
|
+
_creationTime: number;
|
|
241
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
242
|
+
accountId: string;
|
|
243
|
+
amountDue: number;
|
|
244
|
+
claimKey: string;
|
|
245
|
+
collectedAmount: number;
|
|
246
|
+
currency: string;
|
|
247
|
+
openingCollection?: {
|
|
248
|
+
amountDue: number;
|
|
249
|
+
collectedAmount: number;
|
|
250
|
+
operationKey: string;
|
|
251
|
+
revision: number;
|
|
252
|
+
} | undefined;
|
|
253
|
+
outstanding: number;
|
|
254
|
+
reservedAmount: number;
|
|
255
|
+
revision: number;
|
|
256
|
+
scopeKey: string;
|
|
257
|
+
sign: "negative" | "positive" | "zero";
|
|
258
|
+
sourceChargeId: string;
|
|
259
|
+
sourceGross: number;
|
|
260
|
+
sourceProcessingFee: number;
|
|
261
|
+
} | undefined;
|
|
262
|
+
} | undefined;
|
|
263
|
+
retryDelayMs: number;
|
|
264
|
+
rollback?: {
|
|
265
|
+
expectedRevision: number;
|
|
266
|
+
groupKey: string;
|
|
267
|
+
} | undefined;
|
|
268
|
+
scopeKey: string;
|
|
269
|
+
source: {
|
|
270
|
+
customerAccountId: string;
|
|
271
|
+
gross: number;
|
|
272
|
+
invoiceId?: string | undefined;
|
|
273
|
+
kind: "sale";
|
|
274
|
+
paymentIntentId: string;
|
|
275
|
+
stripeAccountId?: string | undefined;
|
|
276
|
+
stripePriceId?: string | undefined;
|
|
277
|
+
stripeProductId?: string | undefined;
|
|
278
|
+
subscriptionId?: string | undefined;
|
|
279
|
+
} | {
|
|
280
|
+
gross: number;
|
|
281
|
+
groupKey: string;
|
|
282
|
+
kind: "invoice_recovery";
|
|
283
|
+
paymentIntentId: string;
|
|
284
|
+
};
|
|
285
|
+
status: "completed" | "conflict" | "queued" | "rejected" | "running" | "unknown" | "waiting";
|
|
286
|
+
version: number;
|
|
287
|
+
workflowId?: string | undefined;
|
|
288
|
+
}>;
|
|
289
|
+
export declare function setFailure(ctx: MutationCtx, op: Doc<"processingCostReconciliationOperations">, value: Infer<typeof failure>): Promise<{
|
|
290
|
+
accountId: string;
|
|
291
|
+
currency: string;
|
|
292
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
293
|
+
reason: "fee_pending" | "history_incomplete" | "provider_pending";
|
|
294
|
+
retryable: true;
|
|
295
|
+
scopeKey: string;
|
|
296
|
+
status: "not_ready";
|
|
297
|
+
version: number;
|
|
298
|
+
} | {
|
|
299
|
+
accountId: string;
|
|
300
|
+
currency: string;
|
|
301
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
302
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
303
|
+
retryable: false;
|
|
304
|
+
scopeKey: string;
|
|
305
|
+
status: "conflict";
|
|
306
|
+
version: number;
|
|
307
|
+
} | {
|
|
308
|
+
accountId: string;
|
|
309
|
+
currency: string;
|
|
310
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
311
|
+
reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
|
|
312
|
+
retryable: false;
|
|
313
|
+
scopeKey: string;
|
|
314
|
+
status: "rejected";
|
|
315
|
+
version: number;
|
|
316
|
+
} | {
|
|
317
|
+
accountId: string;
|
|
318
|
+
currency: string;
|
|
319
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
320
|
+
reason: "history_incomplete" | "provider_outcome_unknown";
|
|
321
|
+
retryable: false;
|
|
322
|
+
scopeKey: string;
|
|
323
|
+
status: "unknown";
|
|
324
|
+
version: number;
|
|
325
|
+
}>;
|
|
326
|
+
export {};
|
|
327
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/component/processingCostReconciliation/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAa,OAAO,EAAE,MAAM,aAAa,CAAC;AACjD,QAAA,MAAM,IAAI;;;;;;;;;;;;iFAAsB,CAAC;AACjC,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAC9C,eAAO,MAAM,QAAQ,WAAY,kBAAkB,GAAG,kBAAkB;qBAC3D,UAAU;;;CAAsC,CAAC;AAC9D,wBAAgB,SAAS,CACvB,EAAE,EAAE,GAAG,CAAC,wCAAwC,CAAC,GAChD,YAAY,CAQd;AACD,wBAAgB,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,wCAAwC,CAAC;YAG3C,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMvC;AACD,wBAAsB,IAAI,CAAC,GAAG,EAAE,QAAQ,GAAG,WAAW,EAAE,IAAI,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAazE;AAED,wBAAsB,UAAU,CAC9B,GAAG,EAAE,WAAW,EAChB,EAAE,EAAE,GAAG,CAAC,wCAAwC,CAAC,EACjD,KAAK,EAAE,KAAK,CAAC,OAAO,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAO7B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { refFields } from "./schema.js";
|
|
3
|
+
const _ref = v.object(refFields);
|
|
4
|
+
export const conflict = (reason) => ({ status: "conflict", reason, retryable: false });
|
|
5
|
+
export function reference(op) {
|
|
6
|
+
return {
|
|
7
|
+
accountId: op.accountId,
|
|
8
|
+
scopeKey: op.scopeKey,
|
|
9
|
+
currency: op.currency,
|
|
10
|
+
operationId: op._id,
|
|
11
|
+
version: op.version,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function status(op) {
|
|
15
|
+
const ref = reference(op);
|
|
16
|
+
if (op.result)
|
|
17
|
+
return { ...ref, status: "completed", result: op.result };
|
|
18
|
+
if (op.failure)
|
|
19
|
+
return { ...ref, ...op.failure };
|
|
20
|
+
return {
|
|
21
|
+
...ref,
|
|
22
|
+
status: op.status === "queued" ? "queued" : "running",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export async function read(ctx, args) {
|
|
26
|
+
const op = await ctx.db.get("processingCostReconciliationOperations", args.operationId);
|
|
27
|
+
if (!op ||
|
|
28
|
+
Object.entries(reference(op)).some(([k, value]) => value !== args[k]))
|
|
29
|
+
throw new Error("Processing-cost operation identity does not match.");
|
|
30
|
+
return op;
|
|
31
|
+
}
|
|
32
|
+
export async function setFailure(ctx, op, value) {
|
|
33
|
+
await ctx.db.patch("processingCostReconciliationOperations", op._id, {
|
|
34
|
+
status: value.status === "not_ready" ? "waiting" : value.status,
|
|
35
|
+
failure: value,
|
|
36
|
+
});
|
|
37
|
+
return { ...reference(op), ...value };
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/component/processingCostReconciliation/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAc,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAE,SAAS,EAAW,MAAM,aAAa,CAAC;AACjD,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAA+C,EAAE,EAAE,CAC1E,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAU,CAAC;AAC9D,MAAM,UAAU,SAAS,CACvB,EAAiD;IAEjD,OAAO;QACL,SAAS,EAAE,EAAE,CAAC,SAAS;QACvB,QAAQ,EAAE,EAAE,CAAC,QAAQ;QACrB,QAAQ,EAAE,EAAE,CAAC,QAAQ;QACrB,WAAW,EAAE,EAAE,CAAC,GAAG;QACnB,OAAO,EAAE,EAAE,CAAC,OAAO;KACpB,CAAC;AACJ,CAAC;AACD,MAAM,UAAU,MAAM,CAAC,EAAiD;IACtE,MAAM,GAAG,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;IAC1B,IAAI,EAAE,CAAC,MAAM;QACX,OAAO,EAAE,GAAG,GAAG,EAAE,MAAM,EAAE,WAAoB,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC;IACrE,IAAI,EAAE,CAAC,OAAO;QAAE,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IACjD,OAAO;QACL,GAAG,GAAG;QACN,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAE,QAAkB,CAAC,CAAC,CAAE,SAAmB;KAC5E,CAAC;AACJ,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,GAA2B,EAAE,IAAkB;IACxE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CACzB,wCAAwC,EACxC,IAAI,CAAC,WAAW,CACjB,CAAC;IACF,IACE,CAAC,EAAE;QACH,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAChC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAuB,CAAC,CACxD;QAED,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,GAAgB,EAChB,EAAiD,EACjD,KAA4B;IAE5B,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,wCAAwC,EAAE,EAAE,CAAC,GAAG,EAAE;QACnE,MAAM,EAAE,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM;QAC/D,OAAO,EAAE,KAAK;KACf,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC;AACxC,CAAC"}
|