@fantastic.dev/better-stripe 0.58.0 → 0.59.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.
Files changed (198) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +238 -18
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +119 -9
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +238 -18
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +119 -9
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/client/usage/allowanceClient.d.ts +1 -1
  12. package/dist/client/usage/client.d.ts +2 -2
  13. package/dist/client/usage/client.d.ts.map +1 -1
  14. package/dist/client/usage/client.js +2 -2
  15. package/dist/client/usage/client.js.map +1 -1
  16. package/dist/client/usage/correctionClient.d.ts +33 -0
  17. package/dist/client/usage/correctionClient.d.ts.map +1 -0
  18. package/dist/client/usage/correctionClient.js +27 -0
  19. package/dist/client/usage/correctionClient.js.map +1 -0
  20. package/dist/client/usage/correctionEligibility.d.ts +4 -0
  21. package/dist/client/usage/correctionEligibility.d.ts.map +1 -0
  22. package/dist/client/usage/correctionEligibility.js +7 -0
  23. package/dist/client/usage/correctionEligibility.js.map +1 -0
  24. package/dist/client/usage/correctionInvoice.d.ts +9 -0
  25. package/dist/client/usage/correctionInvoice.d.ts.map +1 -0
  26. package/dist/client/usage/correctionInvoice.js +218 -0
  27. package/dist/client/usage/correctionInvoice.js.map +1 -0
  28. package/dist/client/usage/correctionInvoiceProof.d.ts +29 -0
  29. package/dist/client/usage/correctionInvoiceProof.d.ts.map +1 -0
  30. package/dist/client/usage/correctionInvoiceProof.js +41 -0
  31. package/dist/client/usage/correctionInvoiceProof.js.map +1 -0
  32. package/dist/client/usage/correctionProofs.d.ts +36 -0
  33. package/dist/client/usage/correctionProofs.d.ts.map +1 -0
  34. package/dist/client/usage/correctionProofs.js +41 -0
  35. package/dist/client/usage/correctionProofs.js.map +1 -0
  36. package/dist/client/usage/correctionProvider.d.ts +6 -0
  37. package/dist/client/usage/correctionProvider.d.ts.map +1 -0
  38. package/dist/client/usage/correctionProvider.js +243 -0
  39. package/dist/client/usage/correctionProvider.js.map +1 -0
  40. package/dist/client/usage/correctionRead.d.ts +27 -0
  41. package/dist/client/usage/correctionRead.d.ts.map +1 -0
  42. package/dist/client/usage/correctionRead.js +36 -0
  43. package/dist/client/usage/correctionRead.js.map +1 -0
  44. package/dist/client/usage/correctionTerms.d.ts +64 -0
  45. package/dist/client/usage/correctionTerms.d.ts.map +1 -0
  46. package/dist/client/usage/correctionTerms.js +65 -0
  47. package/dist/client/usage/correctionTerms.js.map +1 -0
  48. package/dist/client/usage/correctionTransport.fixtures.d.ts +37 -0
  49. package/dist/client/usage/correctionTransport.fixtures.d.ts.map +1 -0
  50. package/dist/client/usage/correctionTransport.fixtures.js +322 -0
  51. package/dist/client/usage/correctionTransport.fixtures.js.map +1 -0
  52. package/dist/client/usage/creditClient.d.ts +1 -1
  53. package/dist/client/usage/index.d.ts +2 -0
  54. package/dist/client/usage/index.d.ts.map +1 -1
  55. package/dist/client/usage/observationClient.d.ts +20 -0
  56. package/dist/client/usage/observationClient.d.ts.map +1 -1
  57. package/dist/client/usage/observationClient.js +20 -6
  58. package/dist/client/usage/observationClient.js.map +1 -1
  59. package/dist/client/usage/records.d.ts +1 -1
  60. package/dist/client/usage/records.d.ts.map +1 -1
  61. package/dist/client/usage/records.js.map +1 -1
  62. package/dist/client/usage/summary.d.ts +3 -0
  63. package/dist/client/usage/summary.d.ts.map +1 -1
  64. package/dist/client/usage/summary.js +9 -4
  65. package/dist/client/usage/summary.js.map +1 -1
  66. package/dist/client/usageExports.d.ts +2 -0
  67. package/dist/client/usageExports.d.ts.map +1 -1
  68. package/dist/component/_generated/api.d.ts +12 -0
  69. package/dist/component/_generated/api.d.ts.map +1 -1
  70. package/dist/component/_generated/api.js.map +1 -1
  71. package/dist/component/_generated/component.d.ts +255 -14
  72. package/dist/component/_generated/component.d.ts.map +1 -1
  73. package/dist/component/accountClosure/mutations.d.ts.map +1 -1
  74. package/dist/component/accountClosure/mutations.js +13 -0
  75. package/dist/component/accountClosure/mutations.js.map +1 -1
  76. package/dist/component/balanceFunding/mutations.d.ts +27 -27
  77. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  78. package/dist/component/earnings/triggers.d.ts +212 -26
  79. package/dist/component/earnings/triggers.d.ts.map +1 -1
  80. package/dist/component/schema.d.ts +119 -9
  81. package/dist/component/schema.js +4 -0
  82. package/dist/component/schema.js.map +1 -1
  83. package/dist/component/usage/queries.d.ts +2 -2
  84. package/dist/component/usage/schema.d.ts +18 -13
  85. package/dist/component/usage/schema.d.ts.map +1 -1
  86. package/dist/component/usage/schema.js +2 -1
  87. package/dist/component/usage/schema.js.map +1 -1
  88. package/dist/component/usageAllowance/queries.d.ts +1 -1
  89. package/dist/component/usageAllowance/queries.d.ts.map +1 -1
  90. package/dist/component/usageAllowance/queries.js +10 -1
  91. package/dist/component/usageAllowance/queries.js.map +1 -1
  92. package/dist/component/usageAllowance/schema.d.ts +5 -5
  93. package/dist/component/usageAllowance/schema.d.ts.map +1 -1
  94. package/dist/component/usageAllowance/schema.js +1 -1
  95. package/dist/component/usageAllowance/schema.js.map +1 -1
  96. package/dist/component/usageCorrections/accounting.d.ts +5 -0
  97. package/dist/component/usageCorrections/accounting.d.ts.map +1 -0
  98. package/dist/component/usageCorrections/accounting.js +55 -0
  99. package/dist/component/usageCorrections/accounting.js.map +1 -0
  100. package/dist/component/usageCorrections/cancellation.d.ts +6 -0
  101. package/dist/component/usageCorrections/cancellation.d.ts.map +1 -0
  102. package/dist/component/usageCorrections/cancellation.js +29 -0
  103. package/dist/component/usageCorrections/cancellation.js.map +1 -0
  104. package/dist/component/usageCorrections/helpers.d.ts +60 -0
  105. package/dist/component/usageCorrections/helpers.d.ts.map +1 -0
  106. package/dist/component/usageCorrections/helpers.js +52 -0
  107. package/dist/component/usageCorrections/helpers.js.map +1 -0
  108. package/dist/component/usageCorrections/invoice.d.ts +38 -0
  109. package/dist/component/usageCorrections/invoice.d.ts.map +1 -0
  110. package/dist/component/usageCorrections/invoice.js +82 -0
  111. package/dist/component/usageCorrections/invoice.js.map +1 -0
  112. package/dist/component/usageCorrections/mutations.d.ts +121 -0
  113. package/dist/component/usageCorrections/mutations.d.ts.map +1 -0
  114. package/dist/component/usageCorrections/mutations.js +256 -0
  115. package/dist/component/usageCorrections/mutations.js.map +1 -0
  116. package/dist/component/usageCorrections/queries.d.ts +115 -0
  117. package/dist/component/usageCorrections/queries.d.ts.map +1 -0
  118. package/dist/component/usageCorrections/queries.js +84 -0
  119. package/dist/component/usageCorrections/queries.js.map +1 -0
  120. package/dist/component/usageCorrections/schema.d.ts +248 -0
  121. package/dist/component/usageCorrections/schema.d.ts.map +1 -0
  122. package/dist/component/usageCorrections/schema.js +74 -0
  123. package/dist/component/usageCorrections/schema.js.map +1 -0
  124. package/dist/component/usageCredits/queries.d.ts +1 -1
  125. package/dist/component/usageCredits/queries.d.ts.map +1 -1
  126. package/dist/component/usageCredits/queries.js +6 -0
  127. package/dist/component/usageCredits/queries.js.map +1 -1
  128. package/dist/component/usageCredits/schema.d.ts +5 -5
  129. package/dist/component/usageCredits/schema.d.ts.map +1 -1
  130. package/dist/component/usageCredits/schema.js +1 -1
  131. package/dist/component/usageCredits/schema.js.map +1 -1
  132. package/dist/component/usageDelivery/fields.d.ts +2 -2
  133. package/dist/component/usageDelivery/fields.d.ts.map +1 -1
  134. package/dist/component/usageDelivery/fields.js +1 -1
  135. package/dist/component/usageDelivery/fields.js.map +1 -1
  136. package/dist/component/usageDelivery/helpers.d.ts +7 -6
  137. package/dist/component/usageDelivery/helpers.d.ts.map +1 -1
  138. package/dist/component/usageDelivery/mutations.d.ts +6 -6
  139. package/dist/component/usageDelivery/mutations.d.ts.map +1 -1
  140. package/dist/component/usageDelivery/mutations.js +9 -1
  141. package/dist/component/usageDelivery/mutations.js.map +1 -1
  142. package/dist/component/usageDelivery/queries.d.ts +8 -6
  143. package/dist/component/usageDelivery/queries.d.ts.map +1 -1
  144. package/dist/component/usageDelivery/schema.d.ts +4 -4
  145. package/dist/component/usageDelivery/steps.d.ts +2 -2
  146. package/dist/component/usageDelivery/steps.js +1 -1
  147. package/dist/component/usageDelivery/steps.js.map +1 -1
  148. package/dist/component/usageObservations/queries.d.ts.map +1 -1
  149. package/dist/component/usageObservations/queries.js +4 -2
  150. package/dist/component/usageObservations/queries.js.map +1 -1
  151. package/dist/component/usageSubscriptions/retirement.d.ts.map +1 -1
  152. package/dist/component/usageSubscriptions/retirement.js +24 -2
  153. package/dist/component/usageSubscriptions/retirement.js.map +1 -1
  154. package/docs/README.md +2 -0
  155. package/docs/usage-corrections.md +249 -0
  156. package/docs/usage-limits.md +1 -1
  157. package/package.json +2 -1
  158. package/src/client/usage/client.ts +2 -2
  159. package/src/client/usage/correctionClient.test.ts +153 -0
  160. package/src/client/usage/correctionClient.ts +62 -0
  161. package/src/client/usage/correctionCredits.test.ts +156 -0
  162. package/src/client/usage/correctionEligibility.ts +14 -0
  163. package/src/client/usage/correctionInvoice.test.ts +127 -0
  164. package/src/client/usage/correctionInvoice.ts +269 -0
  165. package/src/client/usage/correctionInvoiceProof.ts +40 -0
  166. package/src/client/usage/correctionProofs.ts +40 -0
  167. package/src/client/usage/correctionProvider.ts +326 -0
  168. package/src/client/usage/correctionRead.ts +73 -0
  169. package/src/client/usage/correctionRecovery.test.ts +113 -0
  170. package/src/client/usage/correctionTerms.ts +98 -0
  171. package/src/client/usage/correctionTransport.fixtures.ts +372 -0
  172. package/src/client/usage/index.ts +11 -0
  173. package/src/client/usage/observationClient.ts +20 -6
  174. package/src/client/usage/records.ts +7 -1
  175. package/src/client/usage/summary.ts +12 -4
  176. package/src/client/usageExports.ts +11 -0
  177. package/src/component/_generated/api.ts +12 -0
  178. package/src/component/_generated/component.ts +330 -2
  179. package/src/component/accountClosure/mutations.ts +17 -0
  180. package/src/component/schema.ts +8 -0
  181. package/src/component/usage/schema.ts +2 -0
  182. package/src/component/usageAllowance/queries.ts +8 -1
  183. package/src/component/usageAllowance/schema.ts +1 -0
  184. package/src/component/usageCorrections/accounting.ts +79 -0
  185. package/src/component/usageCorrections/cancellation.ts +32 -0
  186. package/src/component/usageCorrections/corrections.test.ts +389 -0
  187. package/src/component/usageCorrections/helpers.ts +57 -0
  188. package/src/component/usageCorrections/invoice.ts +103 -0
  189. package/src/component/usageCorrections/mutations.ts +278 -0
  190. package/src/component/usageCorrections/queries.ts +94 -0
  191. package/src/component/usageCorrections/schema.ts +90 -0
  192. package/src/component/usageCredits/queries.ts +4 -0
  193. package/src/component/usageCredits/schema.ts +1 -0
  194. package/src/component/usageDelivery/fields.ts +1 -0
  195. package/src/component/usageDelivery/mutations.ts +8 -3
  196. package/src/component/usageDelivery/steps.ts +1 -1
  197. package/src/component/usageObservations/queries.ts +5 -2
  198. package/src/component/usageSubscriptions/retirement.ts +31 -2
@@ -0,0 +1,218 @@
1
+ import Stripe from "stripe";
2
+ import { runMutationOrThrow } from "../helpers.js";
3
+ import { componentRef } from "../webhooks/helpers.js";
4
+ import { verifyRealm } from "./catalogTypes.js";
5
+ import { subscriptionSnapshot } from "../../component/usage/helpers.js";
6
+ import { invoiceCorrectionOptions, correctionView, } from "./correctionTerms.js";
7
+ import { invoiceCorrectionProof } from "./correctionInvoiceProof.js";
8
+ import { referenceId, paymentReference, } from "../billing/invoicePaymentShared.js";
9
+ const requireProof = (valid) => {
10
+ if (!valid)
11
+ throw new Error("Native invoice correction requires reconciliation");
12
+ };
13
+ /** Read-only provider adoption. The operator creates notes/refunds through existing authorized billing workflows. */
14
+ export async function observeInvoiceCorrection(component, ctx, input, options) {
15
+ const opts = invoiceCorrectionOptions.parse(input);
16
+ const row = (await ctx.runQuery(componentRef(component, "usageCorrections/queries/get"), {
17
+ scope: opts.scope,
18
+ eventId: opts.eventId,
19
+ correctionId: opts.correctionId,
20
+ }));
21
+ if (!row)
22
+ throw new Error("Usage correction unavailable");
23
+ if (row.adjustmentJson) {
24
+ const pinned = invoiceCorrectionProof.parse(JSON.parse(row.adjustmentJson));
25
+ if (pinned.creditNoteId !== opts.creditNoteId ||
26
+ pinned.invoiceId !== opts.invoiceId ||
27
+ pinned.amount !== opts.amount)
28
+ throw new Error("Invoice adjustment replay conflict");
29
+ }
30
+ const record = JSON.parse(row.recordJson), sub = subscriptionSnapshot(row.subscriptionJson);
31
+ if (!options.stripeSecretKey || record.binding.plan.model === "prepaid")
32
+ return {
33
+ status: "held",
34
+ reason: record.binding.plan.model === "prepaid"
35
+ ? "prepaid_credit_reconciliation_required"
36
+ : "provider_unavailable",
37
+ };
38
+ const stripe = new Stripe(options.stripeSecretKey, {
39
+ apiVersion: record.binding.apiVersion,
40
+ maxNetworkRetries: 0,
41
+ timeout: 15000,
42
+ ...(options.httpClient ? { httpClient: options.httpClient } : {}),
43
+ });
44
+ let proof;
45
+ try {
46
+ await verifyRealm(stripe, {
47
+ stripeAccountId: record.scope.stripeAccountId,
48
+ livemode: record.scope.livemode,
49
+ });
50
+ const [note, invoice, customer] = await Promise.all([
51
+ stripe.creditNotes.retrieve(opts.creditNoteId),
52
+ stripe.invoices.retrieve(opts.invoiceId),
53
+ stripe.customers.retrieve(record.scope.customerAccount),
54
+ ]);
55
+ requireProof(!customer.deleted &&
56
+ customer.id === record.binding.stripeCustomerId &&
57
+ customer.customer_account === record.scope.customerAccount &&
58
+ customer.livemode === record.scope.livemode);
59
+ requireProof(note.id === opts.creditNoteId &&
60
+ note.object === "credit_note" &&
61
+ note.livemode === record.scope.livemode &&
62
+ note.customer_account === record.scope.customerAccount &&
63
+ referenceId(note.customer) === record.binding.stripeCustomerId &&
64
+ referenceId(note.invoice) === opts.invoiceId &&
65
+ (note.status === "issued" ||
66
+ (note.status === "void" &&
67
+ row.adjustmentJson &&
68
+ note.pre_payment_amount === note.amount &&
69
+ note.post_payment_amount === 0)) &&
70
+ note.currency === record.binding.plan.rate.currency &&
71
+ note.amount === opts.amount &&
72
+ note.total === note.amount &&
73
+ note.subtotal === note.amount &&
74
+ note.discount_amount === 0 &&
75
+ note.amount_shipping === 0 &&
76
+ Array.isArray(note.total_taxes) &&
77
+ note.total_taxes.length === 0 &&
78
+ note.customer_balance_transaction === null &&
79
+ (note.out_of_band_amount === null || note.out_of_band_amount === 0) &&
80
+ Array.isArray(note.pretax_credit_amounts) &&
81
+ note.pretax_credit_amounts.length === 0 &&
82
+ note.lines.has_more === false &&
83
+ note.lines.data.length === 1 &&
84
+ note.amount === note.pre_payment_amount + note.post_payment_amount);
85
+ requireProof(invoice.id === opts.invoiceId &&
86
+ invoice.livemode === record.scope.livemode &&
87
+ invoice.customer_account === record.scope.customerAccount &&
88
+ referenceId(invoice.customer) === record.binding.stripeCustomerId &&
89
+ invoice.currency === record.binding.plan.rate.currency &&
90
+ ["open", "paid"].includes(invoice.status ?? "") &&
91
+ referenceId(invoice.parent?.subscription_details?.subscription) ===
92
+ sub.subscriptionId &&
93
+ invoice.lines.has_more === false);
94
+ const noteLine = note.lines.data[0], line = invoice.lines.data.find((line) => line.id === noteLine.invoice_line_item);
95
+ requireProof(noteLine.type === "invoice_line_item" &&
96
+ noteLine.livemode === record.scope.livemode &&
97
+ noteLine.amount === opts.amount &&
98
+ noteLine.discount_amount === 0 &&
99
+ (noteLine.taxes === null ||
100
+ (Array.isArray(noteLine.taxes) && noteLine.taxes.length === 0)) &&
101
+ Array.isArray(noteLine.pretax_credit_amounts) &&
102
+ noteLine.pretax_credit_amounts.length === 0 &&
103
+ line &&
104
+ line.currency === record.binding.plan.rate.currency &&
105
+ line.amount >= opts.amount &&
106
+ line.pricing?.price_details?.price === record.binding.stripePriceId &&
107
+ line.parent?.subscription_item_details?.subscription_item ===
108
+ sub.subscriptionItemId &&
109
+ !line.parent?.subscription_item_details?.proration &&
110
+ line.period.start === sub.period.start &&
111
+ line.period.end === sub.period.end &&
112
+ Array.isArray(line.pretax_credit_amounts) &&
113
+ line.pretax_credit_amounts.length === 0);
114
+ let paymentIntentId = null, chargeId = null, refundId = null;
115
+ if (note.post_payment_amount > 0) {
116
+ requireProof(note.refunds.length === 1 &&
117
+ note.refunds[0].type === "refund" &&
118
+ note.refunds[0].amount_refunded === note.post_payment_amount);
119
+ refundId = referenceId(note.refunds[0].refund) ?? null;
120
+ requireProof(refundId);
121
+ const refund = await stripe.refunds.retrieve(refundId);
122
+ paymentIntentId = referenceId(refund.payment_intent) ?? null;
123
+ chargeId = referenceId(refund.charge) ?? null;
124
+ requireProof(refund.id === refundId &&
125
+ refund.status === "succeeded" &&
126
+ refund.amount === note.post_payment_amount &&
127
+ refund.currency === note.currency &&
128
+ paymentIntentId &&
129
+ chargeId);
130
+ const [payment, charge, payments] = await Promise.all([
131
+ stripe.paymentIntents.retrieve(paymentIntentId),
132
+ stripe.charges.retrieve(chargeId),
133
+ stripe.invoicePayments.list({
134
+ invoice: invoice.id,
135
+ status: "paid",
136
+ limit: 100,
137
+ }),
138
+ ]);
139
+ const references = payments.data.map(paymentReference);
140
+ requireProof(payments.has_more === false &&
141
+ references.some(({ invoicePayment: p }) => referenceId(p.invoice) === invoice.id &&
142
+ p.status === "paid" &&
143
+ p.currency === note.currency &&
144
+ p.amount_paid !== null &&
145
+ p.amount_paid >= refund.amount &&
146
+ p.payment.type === "payment_intent" &&
147
+ referenceId(p.payment.payment_intent) === paymentIntentId));
148
+ requireProof([
149
+ refund.amount,
150
+ payment.amount,
151
+ payment.amount_received,
152
+ charge.amount,
153
+ charge.amount_captured,
154
+ charge.amount_refunded,
155
+ ].every((value) => Number.isSafeInteger(value) && value >= 0));
156
+ requireProof(refund.object === "refund" &&
157
+ payment.object === "payment_intent" &&
158
+ charge.object === "charge" &&
159
+ charge.amount_captured === payment.amount_received &&
160
+ charge.amount_captured <= charge.amount &&
161
+ charge.amount_captured <= payment.amount &&
162
+ (!payment.customer ||
163
+ referenceId(payment.customer) ===
164
+ record.binding.stripeCustomerId) &&
165
+ referenceId(charge.customer) === referenceId(payment.customer));
166
+ requireProof(payment.id === paymentIntentId &&
167
+ payment.livemode === record.scope.livemode &&
168
+ payment.customer_account === record.scope.customerAccount &&
169
+ payment.status === "succeeded" &&
170
+ payment.currency === note.currency &&
171
+ referenceId(payment.latest_charge) === chargeId &&
172
+ payment.amount_received >= refund.amount &&
173
+ charge.id === chargeId &&
174
+ charge.payment_intent === paymentIntentId &&
175
+ charge.livemode === record.scope.livemode &&
176
+ charge.currency === note.currency &&
177
+ charge.paid &&
178
+ charge.captured &&
179
+ charge.status === "succeeded" &&
180
+ !charge.disputed &&
181
+ charge.amount_captured >= refund.amount &&
182
+ charge.amount_refunded >= refund.amount &&
183
+ charge.amount_refunded <= charge.amount_captured);
184
+ }
185
+ else
186
+ requireProof(note.refunds.length === 0);
187
+ proof = invoiceCorrectionProof.parse({
188
+ creditNoteStatus: note.status,
189
+ stripeAccountId: record.scope.stripeAccountId,
190
+ customerAccount: record.scope.customerAccount,
191
+ livemode: record.scope.livemode,
192
+ stripeCustomerId: record.binding.stripeCustomerId,
193
+ subscriptionId: sub.subscriptionId,
194
+ subscriptionItemId: sub.subscriptionItemId,
195
+ stripePriceId: record.binding.stripePriceId,
196
+ period: sub.period,
197
+ creditNoteId: note.id,
198
+ invoiceId: invoice.id,
199
+ invoiceLineId: line.id,
200
+ currency: note.currency,
201
+ amount: note.amount,
202
+ prePaymentAmount: note.pre_payment_amount,
203
+ postPaymentAmount: note.post_payment_amount,
204
+ paymentIntentId,
205
+ chargeId,
206
+ refundId,
207
+ });
208
+ }
209
+ catch {
210
+ return {
211
+ status: "held",
212
+ reason: "native_invoice_adjustment_unverified",
213
+ };
214
+ }
215
+ const saved = (await runMutationOrThrow(ctx, componentRef(component, "usageCorrections/mutations/adopt"), { key: row.key, proofJson: JSON.stringify(proof) }));
216
+ return correctionView(saved);
217
+ }
218
+ //# sourceMappingURL=correctionInvoice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correctionInvoice.js","sourceRoot":"","sources":["../../../src/client/usage/correctionInvoice.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EACL,wBAAwB,EACxB,cAAc,GAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,WAAW,EACX,gBAAgB,GACjB,MAAM,oCAAoC,CAAC;AAC5C,MAAM,YAAY,GAAG,CAAC,KAAc,EAAE,EAAE;IACtC,IAAI,CAAC,KAAK;QACR,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;AACzE,CAAC,CAAC;AACF,qHAAqH;AACrH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,SAAoB,EACpB,GAAW,EACX,KAAoC,EACpC,OAAqC;IAErC,MAAM,IAAI,GAAG,wBAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,QAAQ,CAC7B,YAAY,CAAC,SAAS,EAAE,8BAA8B,CAAC,EACvD;QACE,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,YAAY,EAAE,IAAI,CAAC,YAAY;KAChC,CACF,CAAmC,CAAC;IACrC,IAAI,CAAC,GAAG;QAAE,MAAM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AAM,kBAAkB,CACrC,GAAG,EACH,YAAY,CAAC,SAAS,EAAE,kCAAkC,CAAC,EAC3D,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CACnD,CAA4B,CAAC;IAC9B,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { z } from "zod";
2
+ export declare const invoiceCorrectionProof: z.ZodObject<{
3
+ creditNoteStatus: z.ZodEnum<{
4
+ issued: "issued";
5
+ void: "void";
6
+ }>;
7
+ stripeAccountId: z.ZodString;
8
+ livemode: z.ZodBoolean;
9
+ customerAccount: z.ZodString;
10
+ stripeCustomerId: z.ZodString;
11
+ subscriptionId: z.ZodString;
12
+ subscriptionItemId: z.ZodString;
13
+ stripePriceId: z.ZodString;
14
+ period: z.ZodObject<{
15
+ start: z.ZodNumber;
16
+ end: z.ZodNumber;
17
+ }, z.core.$strict>;
18
+ creditNoteId: z.ZodString;
19
+ invoiceId: z.ZodString;
20
+ invoiceLineId: z.ZodString;
21
+ currency: z.ZodString;
22
+ amount: z.ZodNumber;
23
+ prePaymentAmount: z.ZodNumber;
24
+ postPaymentAmount: z.ZodNumber;
25
+ paymentIntentId: z.ZodNullable<z.ZodString>;
26
+ chargeId: z.ZodNullable<z.ZodString>;
27
+ refundId: z.ZodNullable<z.ZodString>;
28
+ }, z.core.$strict>;
29
+ //# sourceMappingURL=correctionInvoiceProof.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correctionInvoiceProof.d.ts","sourceRoot":"","sources":["../../../src/client/usage/correctionInvoiceProof.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;kBAsCjC,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ export const invoiceCorrectionProof = z.strictObject({
3
+ creditNoteStatus: z.enum(["issued", "void"]),
4
+ stripeAccountId: z.string(),
5
+ livemode: z.boolean(),
6
+ customerAccount: z.string(),
7
+ stripeCustomerId: z.string(),
8
+ subscriptionId: z.string(),
9
+ subscriptionItemId: z.string(),
10
+ stripePriceId: z.string(),
11
+ period: z.strictObject({ start: z.number().int(), end: z.number().int() }),
12
+ creditNoteId: z
13
+ .string()
14
+ .regex(/^cn_[a-zA-Z0-9]+$/)
15
+ .max(100),
16
+ invoiceId: z
17
+ .string()
18
+ .regex(/^in_[a-zA-Z0-9]+$/)
19
+ .max(100),
20
+ invoiceLineId: z.string().max(100),
21
+ currency: z.string().regex(/^[a-z]{3}$/),
22
+ amount: z.number().int().positive().max(99999999),
23
+ prePaymentAmount: z.number().int().nonnegative(),
24
+ postPaymentAmount: z.number().int().nonnegative(),
25
+ paymentIntentId: z
26
+ .string()
27
+ .regex(/^pi_[a-zA-Z0-9]+$/)
28
+ .max(100)
29
+ .nullable(),
30
+ chargeId: z
31
+ .string()
32
+ .regex(/^ch_[a-zA-Z0-9]+$/)
33
+ .max(100)
34
+ .nullable(),
35
+ refundId: z
36
+ .string()
37
+ .regex(/^re_[a-zA-Z0-9]+$/)
38
+ .max(100)
39
+ .nullable(),
40
+ });
41
+ //# sourceMappingURL=correctionInvoiceProof.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correctionInvoiceProof.js","sourceRoot":"","sources":["../../../src/client/usage/correctionInvoiceProof.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,YAAY,CAAC;IACnD,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5C,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,eA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AC;SACR,QAAQ,EAAE;IACb,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,KAAK,CAAC,mBAAmB,CAAC;SAC1B,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;CACd,CAAC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ export declare const correctionOutcome: z.ZodUnion<readonly [z.ZodObject<{
3
+ status: z.ZodEnum<{
4
+ complete: "complete";
5
+ pending: "pending";
6
+ }>;
7
+ eventName: z.ZodString;
8
+ identifier: z.ZodString;
9
+ livemode: z.ZodBoolean;
10
+ nativeAdjustmentId: z.ZodNullable<z.ZodString>;
11
+ creditBackingVerified: z.ZodBoolean;
12
+ billingSafe: z.ZodDefault<z.ZodBoolean>;
13
+ invoiceId: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strict>, z.ZodObject<{
15
+ status: z.ZodLiteral<"local_complete">;
16
+ creditBackingVerified: z.ZodLiteral<true>;
17
+ }, z.core.$strict>, z.ZodObject<{
18
+ status: z.ZodEnum<{
19
+ held: "held";
20
+ invoice_adjustment_required: "invoice_adjustment_required";
21
+ unsupported: "unsupported";
22
+ }>;
23
+ reason: z.ZodEnum<{
24
+ billing_period_closed: "billing_period_closed";
25
+ credit_backing_requires_reconciliation: "credit_backing_requires_reconciliation";
26
+ native_cancellation_expired: "native_cancellation_expired";
27
+ native_cancellation_rejected: "native_cancellation_rejected";
28
+ native_invoice_finalized: "native_invoice_finalized";
29
+ native_invoice_history_incomplete: "native_invoice_history_incomplete";
30
+ original_delivery_unresolved: "original_delivery_unresolved";
31
+ provider_outcome_unknown: "provider_outcome_unknown";
32
+ provider_unavailable: "provider_unavailable";
33
+ }>;
34
+ invoiceId: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strict>]>;
36
+ //# sourceMappingURL=correctionProofs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correctionProofs.d.ts","sourceRoot":"","sources":["../../../src/client/usage/correctionProofs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAsC5B,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ export const correctionOutcome = z.union([
3
+ z.strictObject({
4
+ status: z.enum(["pending", "complete"]),
5
+ eventName: z.string().min(1).max(100),
6
+ identifier: z.string().min(1).max(100),
7
+ livemode: z.boolean(),
8
+ nativeAdjustmentId: z.string().min(1).max(100).nullable(),
9
+ creditBackingVerified: z.boolean(),
10
+ billingSafe: z.boolean().default(false),
11
+ invoiceId: z
12
+ .string()
13
+ .regex(/^in_[a-zA-Z0-9]+$/)
14
+ .max(100)
15
+ .optional(),
16
+ }),
17
+ z.strictObject({
18
+ status: z.literal("local_complete"),
19
+ creditBackingVerified: z.literal(true),
20
+ }),
21
+ z.strictObject({
22
+ status: z.enum(["held", "invoice_adjustment_required", "unsupported"]),
23
+ reason: z.enum([
24
+ "native_cancellation_expired",
25
+ "original_delivery_unresolved",
26
+ "provider_unavailable",
27
+ "provider_outcome_unknown",
28
+ "billing_period_closed",
29
+ "native_invoice_finalized",
30
+ "native_invoice_history_incomplete",
31
+ "credit_backing_requires_reconciliation",
32
+ "native_cancellation_rejected",
33
+ ]),
34
+ invoiceId: z
35
+ .string()
36
+ .regex(/^in_[a-zA-Z0-9]+$/)
37
+ .max(100)
38
+ .optional(),
39
+ }),
40
+ ]);
41
+ //# sourceMappingURL=correctionProofs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correctionProofs.js","sourceRoot":"","sources":["../../../src/client/usage/correctionProofs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC;IACvC,CAAC,CAAC,YAAY,CAAC;QACb,MAAM,EAAE,CAAC,CAAC,IAA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R,QAAQ,EAAE;KACd,CAAC;CACH,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Component, RunCtx } from "../helpers.js";
2
+ import type { UsageDeliveryProviderOptions } from "./deliveryProvider.js";
3
+ import { type UsageCorrectionOptions } from "./correctionTerms.js";
4
+ /** All native context comes from the immutable component event, never browser claims. */
5
+ export declare function requestUsageCorrection(component: Component, ctx: RunCtx, input: UsageCorrectionOptions, options?: UsageDeliveryProviderOptions): Promise<import("./correctionTerms.js").UsageCorrectionView>;
6
+ //# sourceMappingURL=correctionProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correctionProvider.d.ts","sourceRoot":"","sources":["../../../src/client/usage/correctionProvider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAK1E,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AA8E9B,yFAAyF;AACzF,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,sBAAsB,EAC7B,OAAO,GAAE,4BAAiC,+DAkO3C"}