@fantastic.dev/better-stripe 0.42.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 +15 -0
- package/README.md +1 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +1022 -0
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +511 -0
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +1054 -32
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +527 -16
- 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/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 +18 -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 +515 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
- package/dist/component/balanceFunding/mutations.d.ts +16 -16
- package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
- package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
- package/dist/component/earnings/triggers.d.ts +318 -16
- 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 +511 -0
- package/dist/component/schema.js +2 -0
- package/dist/component/schema.js.map +1 -1
- package/package.json +1 -1
- package/src/client/costRecovery-invoices.ts +19 -4
- package/src/client/costRecovery.ts +4 -2
- 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 +18 -0
- package/src/component/_generated/component.ts +570 -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,178 @@
|
|
|
1
|
+
import { readCollectedInvoiceFunding } from "./invoiceFunding.js";
|
|
2
|
+
import Stripe from "stripe";
|
|
3
|
+
import type { Component, RunCtx } from "../helpers.js";
|
|
4
|
+
import { componentRef } from "../webhooks/helpers.js";
|
|
5
|
+
import { resolveVerifiedPaymentSource } from "../paymentSource/resolver.js";
|
|
6
|
+
import { getProcessingCostContext } from "../settlement/processingCosts.js";
|
|
7
|
+
import { ProcessingCostHistoryIncomplete } from "../settlement/processingCostHistory.js";
|
|
8
|
+
import { processingCostOutcome } from "../financialOutcomes/adapters.js";
|
|
9
|
+
import { costObservationSchema, processingCostRef } from "./contracts.js";
|
|
10
|
+
import type {
|
|
11
|
+
ProcessingCostProviderRequest,
|
|
12
|
+
ProcessingCostProviderReceipt,
|
|
13
|
+
ProcessingCostSnapshot,
|
|
14
|
+
} from "./contracts.js";
|
|
15
|
+
export type ProcessingCostProviderOptions = {
|
|
16
|
+
stripeSecretKey: string;
|
|
17
|
+
httpClient?: NonNullable<
|
|
18
|
+
ConstructorParameters<typeof Stripe>[1]
|
|
19
|
+
>["httpClient"];
|
|
20
|
+
};
|
|
21
|
+
export async function observeProcessingCostProvider(
|
|
22
|
+
component: Component,
|
|
23
|
+
ctx: RunCtx,
|
|
24
|
+
request: ProcessingCostProviderRequest,
|
|
25
|
+
options: ProcessingCostProviderOptions,
|
|
26
|
+
): Promise<ProcessingCostProviderReceipt> {
|
|
27
|
+
const echo = {
|
|
28
|
+
...processingCostRef(request),
|
|
29
|
+
providerApiVersion: request.providerApiVersion,
|
|
30
|
+
definitionVersion: request.definitionVersion,
|
|
31
|
+
};
|
|
32
|
+
const unknown = {
|
|
33
|
+
...echo,
|
|
34
|
+
outcome: {
|
|
35
|
+
status: "unknown",
|
|
36
|
+
reason: "provider_outcome_unknown",
|
|
37
|
+
retryable: false,
|
|
38
|
+
},
|
|
39
|
+
} as const;
|
|
40
|
+
try {
|
|
41
|
+
const op = (await ctx.runQuery(
|
|
42
|
+
componentRef(component, "processingCostReconciliation/queries/snapshot"),
|
|
43
|
+
processingCostRef(request),
|
|
44
|
+
)) as ProcessingCostSnapshot;
|
|
45
|
+
if (
|
|
46
|
+
op.providerApiVersion !== request.providerApiVersion ||
|
|
47
|
+
op.definitionVersion !== request.definitionVersion ||
|
|
48
|
+
request.definitionVersion !== 1
|
|
49
|
+
)
|
|
50
|
+
return {
|
|
51
|
+
...echo,
|
|
52
|
+
outcome: {
|
|
53
|
+
status: "conflict",
|
|
54
|
+
reason: "identity_changed",
|
|
55
|
+
retryable: false,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
const stripe = new Stripe(options.stripeSecretKey, {
|
|
59
|
+
apiVersion: request.providerApiVersion as Stripe.LatestApiVersion,
|
|
60
|
+
maxNetworkRetries: 0,
|
|
61
|
+
...(options.httpClient ? { httpClient: options.httpClient } : {}),
|
|
62
|
+
});
|
|
63
|
+
if (op.source.kind === "invoice_recovery") {
|
|
64
|
+
const funded = await readCollectedInvoiceFunding(
|
|
65
|
+
stripe,
|
|
66
|
+
component,
|
|
67
|
+
ctx,
|
|
68
|
+
op,
|
|
69
|
+
);
|
|
70
|
+
if (funded.status !== "ready") return { ...echo, outcome: funded };
|
|
71
|
+
const { cost, provenance } = funded.value;
|
|
72
|
+
const observed = costObservationSchema.safeParse({
|
|
73
|
+
paymentIntentId: cost.paymentIntentId,
|
|
74
|
+
sourceChargeId: cost.chargeId,
|
|
75
|
+
currency: cost.currency,
|
|
76
|
+
gross: cost.gross,
|
|
77
|
+
originalProcessingFee: cost.processingFee,
|
|
78
|
+
processingFee: Math.max(
|
|
79
|
+
0,
|
|
80
|
+
cost.processingFee + cost.refundFeeAdjustment,
|
|
81
|
+
),
|
|
82
|
+
disputeFees: Math.max(0, cost.disputeFeeAdjustment),
|
|
83
|
+
principalReturned: cost.principalReturned,
|
|
84
|
+
provenance,
|
|
85
|
+
});
|
|
86
|
+
return observed.success
|
|
87
|
+
? { ...echo, outcome: { status: "ready", value: observed.data } }
|
|
88
|
+
: unknown;
|
|
89
|
+
}
|
|
90
|
+
const input = op.source;
|
|
91
|
+
const source = await resolveVerifiedPaymentSource(stripe, {
|
|
92
|
+
paymentIntentId: input.paymentIntentId,
|
|
93
|
+
gross: input.gross,
|
|
94
|
+
currency: op.currency,
|
|
95
|
+
customerAccountId: input.customerAccountId,
|
|
96
|
+
...(input.invoiceId ? { invoiceId: input.invoiceId } : {}),
|
|
97
|
+
...(input.subscriptionId ? { subscriptionId: input.subscriptionId } : {}),
|
|
98
|
+
...(input.stripeAccountId
|
|
99
|
+
? { stripeAccountId: input.stripeAccountId }
|
|
100
|
+
: {}),
|
|
101
|
+
maxHistoryPages: 5,
|
|
102
|
+
maxHistoryItems: 500,
|
|
103
|
+
});
|
|
104
|
+
if (source.status !== "ready") return { ...echo, outcome: source };
|
|
105
|
+
if (
|
|
106
|
+
(input.stripePriceId !== undefined &&
|
|
107
|
+
input.stripePriceId !== source.value.stripePriceId) ||
|
|
108
|
+
(input.stripeProductId !== undefined &&
|
|
109
|
+
input.stripeProductId !== source.value.stripeProductId)
|
|
110
|
+
)
|
|
111
|
+
return {
|
|
112
|
+
...echo,
|
|
113
|
+
outcome: {
|
|
114
|
+
status: "conflict",
|
|
115
|
+
reason: "identity_changed",
|
|
116
|
+
retryable: false,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
const cost = await getProcessingCostContext(stripe, {
|
|
120
|
+
paymentIntentId: input.paymentIntentId,
|
|
121
|
+
...(input.stripeAccountId
|
|
122
|
+
? { stripeAccountId: input.stripeAccountId }
|
|
123
|
+
: {}),
|
|
124
|
+
historyBounds: { maxPages: 5, maxItems: 500 },
|
|
125
|
+
});
|
|
126
|
+
if (cost.status !== "ready")
|
|
127
|
+
return { ...echo, outcome: processingCostOutcome(cost) };
|
|
128
|
+
if (
|
|
129
|
+
cost.chargeId !== source.value.chargeId ||
|
|
130
|
+
cost.paymentIntentId !== source.value.paymentIntentId ||
|
|
131
|
+
cost.currency !== source.value.currency ||
|
|
132
|
+
cost.gross !== source.value.gross ||
|
|
133
|
+
cost.processingFee !== source.value.processingFee
|
|
134
|
+
)
|
|
135
|
+
return {
|
|
136
|
+
...echo,
|
|
137
|
+
outcome: {
|
|
138
|
+
status: "conflict",
|
|
139
|
+
reason: "identity_changed",
|
|
140
|
+
retryable: false,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
const observed = costObservationSchema.safeParse({
|
|
144
|
+
paymentIntentId: cost.paymentIntentId,
|
|
145
|
+
sourceChargeId: cost.chargeId,
|
|
146
|
+
currency: cost.currency,
|
|
147
|
+
gross: cost.gross,
|
|
148
|
+
originalProcessingFee: cost.processingFee,
|
|
149
|
+
processingFee: Math.max(0, cost.processingFee + cost.refundFeeAdjustment),
|
|
150
|
+
disputeFees: Math.max(0, cost.disputeFeeAdjustment),
|
|
151
|
+
principalReturned: cost.principalReturned,
|
|
152
|
+
provenance: {
|
|
153
|
+
invoiceId: source.value.invoiceId,
|
|
154
|
+
invoicePaymentId: source.value.invoicePaymentId,
|
|
155
|
+
customerAccountId: source.value.customerAccountId,
|
|
156
|
+
...(source.value.subscriptionId
|
|
157
|
+
? { subscriptionId: source.value.subscriptionId }
|
|
158
|
+
: {}),
|
|
159
|
+
stripePriceId: source.value.stripePriceId,
|
|
160
|
+
stripeProductId: source.value.stripeProductId,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
return observed.success
|
|
164
|
+
? { ...echo, outcome: { status: "ready", value: observed.data } }
|
|
165
|
+
: unknown;
|
|
166
|
+
} catch (error) {
|
|
167
|
+
return error instanceof ProcessingCostHistoryIncomplete
|
|
168
|
+
? {
|
|
169
|
+
...echo,
|
|
170
|
+
outcome: {
|
|
171
|
+
status: "unknown",
|
|
172
|
+
reason: "history_incomplete",
|
|
173
|
+
retryable: false,
|
|
174
|
+
},
|
|
175
|
+
}
|
|
176
|
+
: unknown;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
|
+
import { completeHistory } from "../paymentSource/history.js";
|
|
3
|
+
export type ProcessingCostHistoryBounds = {
|
|
4
|
+
maxPages: number;
|
|
5
|
+
maxItems: number;
|
|
6
|
+
};
|
|
7
|
+
export class ProcessingCostHistoryIncomplete extends Error {
|
|
8
|
+
constructor() {
|
|
9
|
+
super("Processing-cost history is incomplete.");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export async function boundedCostHistory<T extends { id: string }>(
|
|
13
|
+
fetch: (
|
|
14
|
+
cursor: string | undefined,
|
|
15
|
+
limit: number,
|
|
16
|
+
) => Promise<Stripe.ApiList<T>>,
|
|
17
|
+
bounds: ProcessingCostHistoryBounds,
|
|
18
|
+
): Promise<T[]> {
|
|
19
|
+
if (
|
|
20
|
+
!Number.isSafeInteger(bounds.maxPages) ||
|
|
21
|
+
bounds.maxPages < 1 ||
|
|
22
|
+
bounds.maxPages > 20 ||
|
|
23
|
+
!Number.isSafeInteger(bounds.maxItems) ||
|
|
24
|
+
bounds.maxItems < 1 ||
|
|
25
|
+
bounds.maxItems > 2000
|
|
26
|
+
)
|
|
27
|
+
throw new RangeError("Invalid processing-cost history bounds.");
|
|
28
|
+
const result = await completeHistory(fetch, bounds.maxPages, bounds.maxItems);
|
|
29
|
+
if (result.status !== "complete") throw new ProcessingCostHistoryIncomplete();
|
|
30
|
+
return result.data;
|
|
31
|
+
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
boundedCostHistory,
|
|
3
|
+
type ProcessingCostHistoryBounds,
|
|
4
|
+
} from "./processingCostHistory.js";
|
|
1
5
|
import type Stripe from "stripe";
|
|
2
6
|
|
|
3
7
|
export type ProcessingCostOptions = {
|
|
4
8
|
/** Host authorizes the payment and optional connected-account context. */
|
|
5
9
|
paymentIntentId: string;
|
|
6
10
|
stripeAccountId?: string;
|
|
11
|
+
/** Optional complete-history budgets. Existing callers retain their pagination behavior. */
|
|
12
|
+
historyBounds?: ProcessingCostHistoryBounds;
|
|
7
13
|
};
|
|
8
14
|
export type ProcessingCostTransaction = {
|
|
9
15
|
id: string;
|
|
@@ -114,6 +120,14 @@ export async function getProcessingCostContext(
|
|
|
114
120
|
typeof value === "string"
|
|
115
121
|
? await stripe.balanceTransactions.retrieve(value, {}, requestOptions)
|
|
116
122
|
: value;
|
|
123
|
+
if (
|
|
124
|
+
opts.historyBounds &&
|
|
125
|
+
(tx.object !== "balance_transaction" ||
|
|
126
|
+
!tx.id ||
|
|
127
|
+
id(tx.source) !== sourceId ||
|
|
128
|
+
(typeof value === "string" && tx.id !== value))
|
|
129
|
+
)
|
|
130
|
+
throw new Error("Processing-cost transaction identity does not match.");
|
|
117
131
|
if (tx.currency !== currency) throw new NotReady("currency_mismatch");
|
|
118
132
|
[tx.amount, tx.fee, tx.net].forEach(integer);
|
|
119
133
|
if (integer(tx.amount - tx.fee) !== tx.net)
|
|
@@ -162,17 +176,26 @@ export async function getProcessingCostContext(
|
|
|
162
176
|
if (gross < 0 || original.amount !== gross)
|
|
163
177
|
throw new Error("Payment and processed charge amounts do not reconcile.");
|
|
164
178
|
const refunds = new Map<string, ProcessingCostRecord>();
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
const refundParams = {
|
|
180
|
+
payment_intent: payment.id,
|
|
181
|
+
limit: 100,
|
|
182
|
+
expand: ["data.balance_transaction", "data.failure_balance_transaction"],
|
|
183
|
+
};
|
|
184
|
+
const refundRows = opts.historyBounds
|
|
185
|
+
? await boundedCostHistory(
|
|
186
|
+
(cursor, limit) =>
|
|
187
|
+
stripe.refunds.list(
|
|
188
|
+
{
|
|
189
|
+
...refundParams,
|
|
190
|
+
limit,
|
|
191
|
+
...(cursor ? { starting_after: cursor } : {}),
|
|
192
|
+
},
|
|
193
|
+
requestOptions,
|
|
194
|
+
),
|
|
195
|
+
opts.historyBounds,
|
|
196
|
+
)
|
|
197
|
+
: stripe.refunds.list(refundParams, requestOptions);
|
|
198
|
+
for await (const refund of refundRows) {
|
|
176
199
|
if (
|
|
177
200
|
id(refund.charge) !== charge.id ||
|
|
178
201
|
(refund.payment_intent && id(refund.payment_intent) !== payment.id)
|
|
@@ -213,10 +236,22 @@ export async function getProcessingCostContext(
|
|
|
213
236
|
});
|
|
214
237
|
}
|
|
215
238
|
const disputes = new Map<string, ProcessingCostRecord>();
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
239
|
+
const disputeParams = { payment_intent: payment.id, limit: 100 };
|
|
240
|
+
const disputeRows = opts.historyBounds
|
|
241
|
+
? await boundedCostHistory(
|
|
242
|
+
(cursor, limit) =>
|
|
243
|
+
stripe.disputes.list(
|
|
244
|
+
{
|
|
245
|
+
...disputeParams,
|
|
246
|
+
limit,
|
|
247
|
+
...(cursor ? { starting_after: cursor } : {}),
|
|
248
|
+
},
|
|
249
|
+
requestOptions,
|
|
250
|
+
),
|
|
251
|
+
opts.historyBounds,
|
|
252
|
+
)
|
|
253
|
+
: stripe.disputes.list(disputeParams, requestOptions);
|
|
254
|
+
for await (const dispute of disputeRows) {
|
|
220
255
|
if (
|
|
221
256
|
id(dispute.charge) !== charge.id ||
|
|
222
257
|
(dispute.payment_intent && id(dispute.payment_intent) !== payment.id)
|
|
@@ -125,6 +125,15 @@ import type * as payoutSync_validators from "../payoutSync/validators.js";
|
|
|
125
125
|
import type * as payoutWorker_helpers from "../payoutWorker/helpers.js";
|
|
126
126
|
import type * as payoutWorker_mutations from "../payoutWorker/mutations.js";
|
|
127
127
|
import type * as payoutWorker_queries from "../payoutWorker/queries.js";
|
|
128
|
+
import type * as processingCostReconciliation_adoption from "../processingCostReconciliation/adoption.js";
|
|
129
|
+
import type * as processingCostReconciliation_bridge from "../processingCostReconciliation/bridge.js";
|
|
130
|
+
import type * as processingCostReconciliation_helpers from "../processingCostReconciliation/helpers.js";
|
|
131
|
+
import type * as processingCostReconciliation_mutations from "../processingCostReconciliation/mutations.js";
|
|
132
|
+
import type * as processingCostReconciliation_queries from "../processingCostReconciliation/queries.js";
|
|
133
|
+
import type * as processingCostReconciliation_rollback from "../processingCostReconciliation/rollback.js";
|
|
134
|
+
import type * as processingCostReconciliation_steps from "../processingCostReconciliation/steps.js";
|
|
135
|
+
import type * as processingCostReconciliation_validation from "../processingCostReconciliation/validation.js";
|
|
136
|
+
import type * as processingCostReconciliation_workflow from "../processingCostReconciliation/workflow.js";
|
|
128
137
|
import type * as products_mutations from "../products/mutations.js";
|
|
129
138
|
import type * as products_queries from "../products/queries.js";
|
|
130
139
|
import type * as products_validators from "../products/validators.js";
|
|
@@ -274,6 +283,15 @@ const fullApi: ApiFromModules<{
|
|
|
274
283
|
"payoutWorker/helpers": typeof payoutWorker_helpers;
|
|
275
284
|
"payoutWorker/mutations": typeof payoutWorker_mutations;
|
|
276
285
|
"payoutWorker/queries": typeof payoutWorker_queries;
|
|
286
|
+
"processingCostReconciliation/adoption": typeof processingCostReconciliation_adoption;
|
|
287
|
+
"processingCostReconciliation/bridge": typeof processingCostReconciliation_bridge;
|
|
288
|
+
"processingCostReconciliation/helpers": typeof processingCostReconciliation_helpers;
|
|
289
|
+
"processingCostReconciliation/mutations": typeof processingCostReconciliation_mutations;
|
|
290
|
+
"processingCostReconciliation/queries": typeof processingCostReconciliation_queries;
|
|
291
|
+
"processingCostReconciliation/rollback": typeof processingCostReconciliation_rollback;
|
|
292
|
+
"processingCostReconciliation/steps": typeof processingCostReconciliation_steps;
|
|
293
|
+
"processingCostReconciliation/validation": typeof processingCostReconciliation_validation;
|
|
294
|
+
"processingCostReconciliation/workflow": typeof processingCostReconciliation_workflow;
|
|
277
295
|
"products/mutations": typeof products_mutations;
|
|
278
296
|
"products/queries": typeof products_queries;
|
|
279
297
|
"products/validators": typeof products_validators;
|