@fantastic.dev/better-stripe 0.58.0 → 0.60.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 +12 -0
- package/README.md +3 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +888 -62
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +428 -15
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +856 -30
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +444 -31
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/paymentSource/resolver.d.ts +12 -1
- package/dist/client/paymentSource/resolver.d.ts.map +1 -1
- package/dist/client/paymentSource/resolver.fixtures.d.ts +220 -0
- package/dist/client/paymentSource/resolver.fixtures.d.ts.map +1 -0
- package/dist/client/paymentSource/resolver.fixtures.js +189 -0
- package/dist/client/paymentSource/resolver.fixtures.js.map +1 -0
- package/dist/client/paymentSource/resolver.js +28 -3
- package/dist/client/paymentSource/resolver.js.map +1 -1
- package/dist/client/settlement/execution.d.ts +25 -0
- package/dist/client/settlement/execution.d.ts.map +1 -1
- package/dist/client/settlement/execution.js +2 -0
- package/dist/client/settlement/execution.js.map +1 -1
- package/dist/client/usage/allowanceClient.d.ts +1 -1
- package/dist/client/usage/catalogPrices.d.ts +1 -1
- package/dist/client/usage/catalogPrices.d.ts.map +1 -1
- package/dist/client/usage/catalogPrices.js +4 -4
- package/dist/client/usage/catalogPrices.js.map +1 -1
- package/dist/client/usage/client.d.ts +2 -2
- package/dist/client/usage/client.d.ts.map +1 -1
- package/dist/client/usage/client.js +2 -2
- package/dist/client/usage/client.js.map +1 -1
- package/dist/client/usage/correctionClient.d.ts +33 -0
- package/dist/client/usage/correctionClient.d.ts.map +1 -0
- package/dist/client/usage/correctionClient.js +27 -0
- package/dist/client/usage/correctionClient.js.map +1 -0
- package/dist/client/usage/correctionEligibility.d.ts +4 -0
- package/dist/client/usage/correctionEligibility.d.ts.map +1 -0
- package/dist/client/usage/correctionEligibility.js +7 -0
- package/dist/client/usage/correctionEligibility.js.map +1 -0
- package/dist/client/usage/correctionInvoice.d.ts +9 -0
- package/dist/client/usage/correctionInvoice.d.ts.map +1 -0
- package/dist/client/usage/correctionInvoice.js +218 -0
- package/dist/client/usage/correctionInvoice.js.map +1 -0
- package/dist/client/usage/correctionInvoiceProof.d.ts +29 -0
- package/dist/client/usage/correctionInvoiceProof.d.ts.map +1 -0
- package/dist/client/usage/correctionInvoiceProof.js +41 -0
- package/dist/client/usage/correctionInvoiceProof.js.map +1 -0
- package/dist/client/usage/correctionProofs.d.ts +36 -0
- package/dist/client/usage/correctionProofs.d.ts.map +1 -0
- package/dist/client/usage/correctionProofs.js +41 -0
- package/dist/client/usage/correctionProofs.js.map +1 -0
- package/dist/client/usage/correctionProvider.d.ts +6 -0
- package/dist/client/usage/correctionProvider.d.ts.map +1 -0
- package/dist/client/usage/correctionProvider.js +243 -0
- package/dist/client/usage/correctionProvider.js.map +1 -0
- package/dist/client/usage/correctionRead.d.ts +27 -0
- package/dist/client/usage/correctionRead.d.ts.map +1 -0
- package/dist/client/usage/correctionRead.js +36 -0
- package/dist/client/usage/correctionRead.js.map +1 -0
- package/dist/client/usage/correctionTerms.d.ts +64 -0
- package/dist/client/usage/correctionTerms.d.ts.map +1 -0
- package/dist/client/usage/correctionTerms.js +65 -0
- package/dist/client/usage/correctionTerms.js.map +1 -0
- package/dist/client/usage/correctionTransport.fixtures.d.ts +37 -0
- package/dist/client/usage/correctionTransport.fixtures.d.ts.map +1 -0
- package/dist/client/usage/correctionTransport.fixtures.js +322 -0
- package/dist/client/usage/correctionTransport.fixtures.js.map +1 -0
- package/dist/client/usage/creditClient.d.ts +1 -1
- package/dist/client/usage/creditRevenue.d.ts +22 -0
- package/dist/client/usage/creditRevenue.d.ts.map +1 -0
- package/dist/client/usage/creditRevenue.js +118 -0
- package/dist/client/usage/creditRevenue.js.map +1 -0
- package/dist/client/usage/creditSettlement.d.ts +29 -0
- package/dist/client/usage/creditSettlement.d.ts.map +1 -0
- package/dist/client/usage/creditSettlement.fixtures.d.ts +215 -0
- package/dist/client/usage/creditSettlement.fixtures.d.ts.map +1 -0
- package/dist/client/usage/creditSettlement.fixtures.js +59 -0
- package/dist/client/usage/creditSettlement.fixtures.js.map +1 -0
- package/dist/client/usage/creditSettlement.js +70 -0
- package/dist/client/usage/creditSettlement.js.map +1 -0
- package/dist/client/usage/creditTransport.fixtures.d.ts +7 -1
- package/dist/client/usage/creditTransport.fixtures.d.ts.map +1 -1
- package/dist/client/usage/creditTransport.fixtures.js +25 -4
- package/dist/client/usage/creditTransport.fixtures.js.map +1 -1
- package/dist/client/usage/index.d.ts +6 -0
- package/dist/client/usage/index.d.ts.map +1 -1
- package/dist/client/usage/invoiceSale.d.ts +22 -0
- package/dist/client/usage/invoiceSale.d.ts.map +1 -0
- package/dist/client/usage/invoiceSale.fixtures.d.ts +285 -0
- package/dist/client/usage/invoiceSale.fixtures.d.ts.map +1 -0
- package/dist/client/usage/invoiceSale.fixtures.js +104 -0
- package/dist/client/usage/invoiceSale.fixtures.js.map +1 -0
- package/dist/client/usage/invoiceSale.js +117 -0
- package/dist/client/usage/invoiceSale.js.map +1 -0
- package/dist/client/usage/observationClient.d.ts +20 -0
- package/dist/client/usage/observationClient.d.ts.map +1 -1
- package/dist/client/usage/observationClient.js +20 -6
- package/dist/client/usage/observationClient.js.map +1 -1
- package/dist/client/usage/records.d.ts +1 -1
- package/dist/client/usage/records.d.ts.map +1 -1
- package/dist/client/usage/records.js.map +1 -1
- package/dist/client/usage/settlement.d.ts +32 -0
- package/dist/client/usage/settlement.d.ts.map +1 -0
- package/dist/client/usage/settlement.js +60 -0
- package/dist/client/usage/settlement.js.map +1 -0
- package/dist/client/usage/settlementClient.d.ts +51 -0
- package/dist/client/usage/settlementClient.d.ts.map +1 -0
- package/dist/client/usage/settlementClient.js +35 -0
- package/dist/client/usage/settlementClient.js.map +1 -0
- package/dist/client/usage/summary.d.ts +3 -0
- package/dist/client/usage/summary.d.ts.map +1 -1
- package/dist/client/usage/summary.js +9 -4
- package/dist/client/usage/summary.js.map +1 -1
- package/dist/client/usageExports.d.ts +2 -0
- package/dist/client/usageExports.d.ts.map +1 -1
- package/dist/component/_generated/api.d.ts +12 -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 +380 -14
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/accountClosure/mutations.d.ts.map +1 -1
- package/dist/component/accountClosure/mutations.js +13 -0
- package/dist/component/accountClosure/mutations.js.map +1 -1
- package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
- package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
- package/dist/component/earnings/triggers.d.ts +368 -32
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/financialObservations/settlementHelpers.d.ts.map +1 -1
- package/dist/component/financialObservations/settlementHelpers.js +2 -0
- package/dist/component/financialObservations/settlementHelpers.js.map +1 -1
- package/dist/component/recoveryWorkflow/helpers.d.ts +25 -0
- package/dist/component/recoveryWorkflow/helpers.d.ts.map +1 -1
- package/dist/component/recoveryWorkflow/mutations.d.ts +25 -0
- package/dist/component/recoveryWorkflow/mutations.d.ts.map +1 -1
- package/dist/component/recoveryWorkflow/queries.d.ts +50 -0
- package/dist/component/recoveryWorkflow/queries.d.ts.map +1 -1
- package/dist/component/recoveryWorkflow/schema.d.ts +566 -10
- package/dist/component/recoveryWorkflow/schema.d.ts.map +1 -1
- package/dist/component/schema.d.ts +428 -15
- package/dist/component/schema.js +4 -0
- package/dist/component/schema.js.map +1 -1
- package/dist/component/settlement/mutations.d.ts +50 -0
- package/dist/component/settlement/mutations.d.ts.map +1 -1
- package/dist/component/settlement/mutations.js +8 -1
- package/dist/component/settlement/mutations.js.map +1 -1
- package/dist/component/settlement/queries.d.ts +25 -0
- package/dist/component/settlement/queries.d.ts.map +1 -1
- package/dist/component/settlement/schema.d.ts +128 -1
- package/dist/component/settlement/schema.d.ts.map +1 -1
- package/dist/component/settlement/schema.js +22 -0
- package/dist/component/settlement/schema.js.map +1 -1
- package/dist/component/usage/queries.d.ts +2 -2
- package/dist/component/usage/schema.d.ts +18 -13
- package/dist/component/usage/schema.d.ts.map +1 -1
- package/dist/component/usage/schema.js +2 -1
- package/dist/component/usage/schema.js.map +1 -1
- package/dist/component/usageAllowance/queries.d.ts +1 -1
- package/dist/component/usageAllowance/queries.d.ts.map +1 -1
- package/dist/component/usageAllowance/queries.js +10 -1
- package/dist/component/usageAllowance/queries.js.map +1 -1
- package/dist/component/usageAllowance/schema.d.ts +5 -5
- package/dist/component/usageAllowance/schema.d.ts.map +1 -1
- package/dist/component/usageAllowance/schema.js +1 -1
- package/dist/component/usageAllowance/schema.js.map +1 -1
- package/dist/component/usageCorrections/accounting.d.ts +5 -0
- package/dist/component/usageCorrections/accounting.d.ts.map +1 -0
- package/dist/component/usageCorrections/accounting.js +55 -0
- package/dist/component/usageCorrections/accounting.js.map +1 -0
- package/dist/component/usageCorrections/cancellation.d.ts +6 -0
- package/dist/component/usageCorrections/cancellation.d.ts.map +1 -0
- package/dist/component/usageCorrections/cancellation.js +29 -0
- package/dist/component/usageCorrections/cancellation.js.map +1 -0
- package/dist/component/usageCorrections/helpers.d.ts +60 -0
- package/dist/component/usageCorrections/helpers.d.ts.map +1 -0
- package/dist/component/usageCorrections/helpers.js +52 -0
- package/dist/component/usageCorrections/helpers.js.map +1 -0
- package/dist/component/usageCorrections/invoice.d.ts +38 -0
- package/dist/component/usageCorrections/invoice.d.ts.map +1 -0
- package/dist/component/usageCorrections/invoice.js +82 -0
- package/dist/component/usageCorrections/invoice.js.map +1 -0
- package/dist/component/usageCorrections/mutations.d.ts +121 -0
- package/dist/component/usageCorrections/mutations.d.ts.map +1 -0
- package/dist/component/usageCorrections/mutations.js +256 -0
- package/dist/component/usageCorrections/mutations.js.map +1 -0
- package/dist/component/usageCorrections/queries.d.ts +115 -0
- package/dist/component/usageCorrections/queries.d.ts.map +1 -0
- package/dist/component/usageCorrections/queries.js +84 -0
- package/dist/component/usageCorrections/queries.js.map +1 -0
- package/dist/component/usageCorrections/schema.d.ts +248 -0
- package/dist/component/usageCorrections/schema.d.ts.map +1 -0
- package/dist/component/usageCorrections/schema.js +74 -0
- package/dist/component/usageCorrections/schema.js.map +1 -0
- package/dist/component/usageCredits/queries.d.ts +1 -1
- package/dist/component/usageCredits/queries.d.ts.map +1 -1
- package/dist/component/usageCredits/queries.js +6 -0
- package/dist/component/usageCredits/queries.js.map +1 -1
- package/dist/component/usageCredits/schema.d.ts +5 -5
- package/dist/component/usageCredits/schema.d.ts.map +1 -1
- package/dist/component/usageCredits/schema.js +1 -1
- package/dist/component/usageCredits/schema.js.map +1 -1
- package/dist/component/usageDelivery/fields.d.ts +2 -2
- package/dist/component/usageDelivery/fields.d.ts.map +1 -1
- package/dist/component/usageDelivery/fields.js +1 -1
- package/dist/component/usageDelivery/fields.js.map +1 -1
- package/dist/component/usageDelivery/helpers.d.ts +7 -6
- package/dist/component/usageDelivery/helpers.d.ts.map +1 -1
- package/dist/component/usageDelivery/mutations.d.ts +6 -6
- package/dist/component/usageDelivery/mutations.d.ts.map +1 -1
- package/dist/component/usageDelivery/mutations.js +9 -1
- package/dist/component/usageDelivery/mutations.js.map +1 -1
- package/dist/component/usageDelivery/queries.d.ts +8 -6
- package/dist/component/usageDelivery/queries.d.ts.map +1 -1
- package/dist/component/usageDelivery/schema.d.ts +4 -4
- package/dist/component/usageDelivery/steps.d.ts +2 -2
- package/dist/component/usageDelivery/steps.js +1 -1
- package/dist/component/usageDelivery/steps.js.map +1 -1
- package/dist/component/usageObservations/queries.d.ts.map +1 -1
- package/dist/component/usageObservations/queries.js +4 -2
- package/dist/component/usageObservations/queries.js.map +1 -1
- package/dist/component/usageSubscriptions/retirement.d.ts.map +1 -1
- package/dist/component/usageSubscriptions/retirement.js +24 -2
- package/dist/component/usageSubscriptions/retirement.js.map +1 -1
- package/docs/README.md +4 -0
- package/docs/settlement.md +4 -0
- package/docs/usage-corrections.md +249 -0
- package/docs/usage-limits.md +1 -1
- package/docs/usage-settlement.md +162 -0
- package/package.json +3 -1
- package/src/client/index.ts +9 -0
- package/src/client/paymentSource/resolver.fixtures.ts +216 -0
- package/src/client/paymentSource/resolver.test.ts +11 -207
- package/src/client/paymentSource/resolver.ts +54 -2
- package/src/client/settlement/execution.ts +24 -0
- package/src/client/usage/catalogPrices.ts +4 -2
- package/src/client/usage/client.ts +2 -2
- package/src/client/usage/correctionClient.test.ts +153 -0
- package/src/client/usage/correctionClient.ts +62 -0
- package/src/client/usage/correctionCredits.test.ts +156 -0
- package/src/client/usage/correctionEligibility.ts +14 -0
- package/src/client/usage/correctionInvoice.test.ts +127 -0
- package/src/client/usage/correctionInvoice.ts +269 -0
- package/src/client/usage/correctionInvoiceProof.ts +40 -0
- package/src/client/usage/correctionProofs.ts +40 -0
- package/src/client/usage/correctionProvider.ts +326 -0
- package/src/client/usage/correctionRead.ts +73 -0
- package/src/client/usage/correctionRecovery.test.ts +113 -0
- package/src/client/usage/correctionTerms.ts +98 -0
- package/src/client/usage/correctionTransport.fixtures.ts +372 -0
- package/src/client/usage/creditRevenue.test.ts +105 -0
- package/src/client/usage/creditRevenue.ts +163 -0
- package/src/client/usage/creditSettlement.fixtures.ts +70 -0
- package/src/client/usage/creditSettlement.test.ts +66 -0
- package/src/client/usage/creditSettlement.ts +94 -0
- package/src/client/usage/creditSettlementRecovery.test.ts +173 -0
- package/src/client/usage/creditTransport.fixtures.ts +29 -4
- package/src/client/usage/index.ts +20 -0
- package/src/client/usage/invoiceSale.fixtures.ts +103 -0
- package/src/client/usage/invoiceSale.test.ts +184 -0
- package/src/client/usage/invoiceSale.ts +155 -0
- package/src/client/usage/observationClient.ts +20 -6
- package/src/client/usage/records.ts +7 -1
- package/src/client/usage/settlement.test.ts +179 -0
- package/src/client/usage/settlement.ts +81 -0
- package/src/client/usage/settlementClient.ts +84 -0
- package/src/client/usage/summary.ts +12 -4
- package/src/client/usageExports.ts +11 -0
- package/src/component/_generated/api.ts +12 -0
- package/src/component/_generated/component.ts +440 -2
- package/src/component/accountClosure/mutations.ts +17 -0
- package/src/component/financialObservations/settlementHelpers.ts +2 -0
- package/src/component/schema.ts +8 -0
- package/src/component/settlement/mutations.ts +10 -1
- package/src/component/settlement/schema.ts +26 -0
- package/src/component/settlement/settlement-claims.test.ts +54 -0
- package/src/component/usage/schema.ts +2 -0
- package/src/component/usageAllowance/queries.ts +8 -1
- package/src/component/usageAllowance/schema.ts +1 -0
- package/src/component/usageCorrections/accounting.ts +79 -0
- package/src/component/usageCorrections/cancellation.ts +32 -0
- package/src/component/usageCorrections/corrections.test.ts +389 -0
- package/src/component/usageCorrections/helpers.ts +57 -0
- package/src/component/usageCorrections/invoice.ts +103 -0
- package/src/component/usageCorrections/mutations.ts +278 -0
- package/src/component/usageCorrections/queries.ts +94 -0
- package/src/component/usageCorrections/schema.ts +90 -0
- package/src/component/usageCredits/queries.ts +4 -0
- package/src/component/usageCredits/schema.ts +1 -0
- package/src/component/usageDelivery/fields.ts +1 -0
- package/src/component/usageDelivery/mutations.ts +8 -3
- package/src/component/usageDelivery/steps.ts +1 -1
- package/src/component/usageObservations/queries.ts +5 -2
- package/src/component/usageSubscriptions/retirement.ts +31 -2
|
@@ -7715,6 +7715,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
7715
7715
|
accountId: string;
|
|
7716
7716
|
allocation?: {
|
|
7717
7717
|
adjustmentAmount?: number;
|
|
7718
|
+
creditSource?: {
|
|
7719
|
+
creditGrantId: string;
|
|
7720
|
+
customerAccount: string;
|
|
7721
|
+
livemode: boolean;
|
|
7722
|
+
purchaseId: string;
|
|
7723
|
+
stripeAccountId: string;
|
|
7724
|
+
stripePriceId: string;
|
|
7725
|
+
stripeProductId: string;
|
|
7726
|
+
};
|
|
7718
7727
|
currency: string;
|
|
7719
7728
|
gross: number;
|
|
7720
7729
|
paymentId?: string;
|
|
@@ -7728,6 +7737,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
7728
7737
|
destinationAccountId: string;
|
|
7729
7738
|
role: "store" | "affiliate" | "other";
|
|
7730
7739
|
}>;
|
|
7740
|
+
usageSource?: {
|
|
7741
|
+
customerAccount: string;
|
|
7742
|
+
invoicePaymentId: string;
|
|
7743
|
+
livemode: boolean;
|
|
7744
|
+
meterId: string;
|
|
7745
|
+
model: "pay_as_you_go" | "included_overage";
|
|
7746
|
+
period: { end: number; start: number };
|
|
7747
|
+
stripeAccountId: string;
|
|
7748
|
+
stripePriceId: string;
|
|
7749
|
+
stripeProductId: string;
|
|
7750
|
+
subscriptionId: string;
|
|
7751
|
+
subscriptionItemId: string;
|
|
7752
|
+
};
|
|
7731
7753
|
};
|
|
7732
7754
|
completion?: string;
|
|
7733
7755
|
currency: string;
|
|
@@ -7820,6 +7842,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
7820
7842
|
activePhase?: "execute" | "reconcile";
|
|
7821
7843
|
allocation?: {
|
|
7822
7844
|
adjustmentAmount?: number;
|
|
7845
|
+
creditSource?: {
|
|
7846
|
+
creditGrantId: string;
|
|
7847
|
+
customerAccount: string;
|
|
7848
|
+
livemode: boolean;
|
|
7849
|
+
purchaseId: string;
|
|
7850
|
+
stripeAccountId: string;
|
|
7851
|
+
stripePriceId: string;
|
|
7852
|
+
stripeProductId: string;
|
|
7853
|
+
};
|
|
7823
7854
|
currency: string;
|
|
7824
7855
|
gross: number;
|
|
7825
7856
|
paymentId?: string;
|
|
@@ -7833,6 +7864,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
7833
7864
|
destinationAccountId: string;
|
|
7834
7865
|
role: "store" | "affiliate" | "other";
|
|
7835
7866
|
}>;
|
|
7867
|
+
usageSource?: {
|
|
7868
|
+
customerAccount: string;
|
|
7869
|
+
invoicePaymentId: string;
|
|
7870
|
+
livemode: boolean;
|
|
7871
|
+
meterId: string;
|
|
7872
|
+
model: "pay_as_you_go" | "included_overage";
|
|
7873
|
+
period: { end: number; start: number };
|
|
7874
|
+
stripeAccountId: string;
|
|
7875
|
+
stripePriceId: string;
|
|
7876
|
+
stripeProductId: string;
|
|
7877
|
+
subscriptionId: string;
|
|
7878
|
+
subscriptionItemId: string;
|
|
7879
|
+
};
|
|
7836
7880
|
};
|
|
7837
7881
|
cancelRequested: boolean;
|
|
7838
7882
|
completion?: string;
|
|
@@ -8132,6 +8176,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8132
8176
|
"internal",
|
|
8133
8177
|
{
|
|
8134
8178
|
adjustmentAmount?: number;
|
|
8179
|
+
creditSource?: {
|
|
8180
|
+
creditGrantId: string;
|
|
8181
|
+
customerAccount: string;
|
|
8182
|
+
livemode: boolean;
|
|
8183
|
+
purchaseId: string;
|
|
8184
|
+
stripeAccountId: string;
|
|
8185
|
+
stripePriceId: string;
|
|
8186
|
+
stripeProductId: string;
|
|
8187
|
+
};
|
|
8135
8188
|
currency: string;
|
|
8136
8189
|
gross: number;
|
|
8137
8190
|
paymentId?: string;
|
|
@@ -8145,11 +8198,33 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8145
8198
|
destinationAccountId: string;
|
|
8146
8199
|
role: "store" | "affiliate" | "other";
|
|
8147
8200
|
}>;
|
|
8201
|
+
usageSource?: {
|
|
8202
|
+
customerAccount: string;
|
|
8203
|
+
invoicePaymentId: string;
|
|
8204
|
+
livemode: boolean;
|
|
8205
|
+
meterId: string;
|
|
8206
|
+
model: "pay_as_you_go" | "included_overage";
|
|
8207
|
+
period: { end: number; start: number };
|
|
8208
|
+
stripeAccountId: string;
|
|
8209
|
+
stripePriceId: string;
|
|
8210
|
+
stripeProductId: string;
|
|
8211
|
+
subscriptionId: string;
|
|
8212
|
+
subscriptionItemId: string;
|
|
8213
|
+
};
|
|
8148
8214
|
},
|
|
8149
8215
|
{
|
|
8150
8216
|
_creationTime: number;
|
|
8151
8217
|
_id: string;
|
|
8152
8218
|
adjustmentAmount?: number;
|
|
8219
|
+
creditSource?: {
|
|
8220
|
+
creditGrantId: string;
|
|
8221
|
+
customerAccount: string;
|
|
8222
|
+
livemode: boolean;
|
|
8223
|
+
purchaseId: string;
|
|
8224
|
+
stripeAccountId: string;
|
|
8225
|
+
stripePriceId: string;
|
|
8226
|
+
stripeProductId: string;
|
|
8227
|
+
};
|
|
8153
8228
|
currency: string;
|
|
8154
8229
|
gross: number;
|
|
8155
8230
|
paymentId?: string;
|
|
@@ -8163,6 +8238,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8163
8238
|
destinationAccountId: string;
|
|
8164
8239
|
role: "store" | "affiliate" | "other";
|
|
8165
8240
|
}>;
|
|
8241
|
+
usageSource?: {
|
|
8242
|
+
customerAccount: string;
|
|
8243
|
+
invoicePaymentId: string;
|
|
8244
|
+
livemode: boolean;
|
|
8245
|
+
meterId: string;
|
|
8246
|
+
model: "pay_as_you_go" | "included_overage";
|
|
8247
|
+
period: { end: number; start: number };
|
|
8248
|
+
stripeAccountId: string;
|
|
8249
|
+
stripePriceId: string;
|
|
8250
|
+
stripeProductId: string;
|
|
8251
|
+
subscriptionId: string;
|
|
8252
|
+
subscriptionItemId: string;
|
|
8253
|
+
};
|
|
8166
8254
|
},
|
|
8167
8255
|
Name
|
|
8168
8256
|
>;
|
|
@@ -8188,6 +8276,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8188
8276
|
_creationTime: number;
|
|
8189
8277
|
_id: string;
|
|
8190
8278
|
adjustmentAmount?: number;
|
|
8279
|
+
creditSource?: {
|
|
8280
|
+
creditGrantId: string;
|
|
8281
|
+
customerAccount: string;
|
|
8282
|
+
livemode: boolean;
|
|
8283
|
+
purchaseId: string;
|
|
8284
|
+
stripeAccountId: string;
|
|
8285
|
+
stripePriceId: string;
|
|
8286
|
+
stripeProductId: string;
|
|
8287
|
+
};
|
|
8191
8288
|
currency: string;
|
|
8192
8289
|
gross: number;
|
|
8193
8290
|
paymentId?: string;
|
|
@@ -8201,6 +8298,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8201
8298
|
destinationAccountId: string;
|
|
8202
8299
|
role: "store" | "affiliate" | "other";
|
|
8203
8300
|
}>;
|
|
8301
|
+
usageSource?: {
|
|
8302
|
+
customerAccount: string;
|
|
8303
|
+
invoicePaymentId: string;
|
|
8304
|
+
livemode: boolean;
|
|
8305
|
+
meterId: string;
|
|
8306
|
+
model: "pay_as_you_go" | "included_overage";
|
|
8307
|
+
period: { end: number; start: number };
|
|
8308
|
+
stripeAccountId: string;
|
|
8309
|
+
stripePriceId: string;
|
|
8310
|
+
stripeProductId: string;
|
|
8311
|
+
subscriptionId: string;
|
|
8312
|
+
subscriptionItemId: string;
|
|
8313
|
+
};
|
|
8204
8314
|
} | null,
|
|
8205
8315
|
Name
|
|
8206
8316
|
>;
|
|
@@ -8307,6 +8417,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8307
8417
|
{
|
|
8308
8418
|
delivery:
|
|
8309
8419
|
| "queued"
|
|
8420
|
+
| "canceled"
|
|
8310
8421
|
| "sending"
|
|
8311
8422
|
| "provider_accepted"
|
|
8312
8423
|
| "rejected"
|
|
@@ -8353,6 +8464,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8353
8464
|
page: Array<{
|
|
8354
8465
|
delivery:
|
|
8355
8466
|
| "queued"
|
|
8467
|
+
| "canceled"
|
|
8356
8468
|
| "sending"
|
|
8357
8469
|
| "provider_accepted"
|
|
8358
8470
|
| "rejected"
|
|
@@ -8444,7 +8556,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8444
8556
|
at: number;
|
|
8445
8557
|
evidenceJson: string;
|
|
8446
8558
|
key: string;
|
|
8447
|
-
kind:
|
|
8559
|
+
kind:
|
|
8560
|
+
"policy" | "reservation" | "commit" | "release" | "correction";
|
|
8448
8561
|
}>;
|
|
8449
8562
|
},
|
|
8450
8563
|
Name
|
|
@@ -8550,6 +8663,319 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8550
8663
|
>;
|
|
8551
8664
|
};
|
|
8552
8665
|
};
|
|
8666
|
+
usageCorrections: {
|
|
8667
|
+
mutations: {
|
|
8668
|
+
adopt: FunctionReference<
|
|
8669
|
+
"mutation",
|
|
8670
|
+
"internal",
|
|
8671
|
+
{ key: string; proofJson: string },
|
|
8672
|
+
{
|
|
8673
|
+
_creationTime: number;
|
|
8674
|
+
_id: string;
|
|
8675
|
+
adjustmentJson?: string;
|
|
8676
|
+
attempt: number;
|
|
8677
|
+
attemptedAt?: number;
|
|
8678
|
+
cashConsequence:
|
|
8679
|
+
| "none"
|
|
8680
|
+
| "operator_resolution_required"
|
|
8681
|
+
| "verified_external_adjustment";
|
|
8682
|
+
correctionId: string;
|
|
8683
|
+
creditNoteId?: string;
|
|
8684
|
+
customerAccount?: string;
|
|
8685
|
+
eventId: string;
|
|
8686
|
+
firstAttemptAt: number;
|
|
8687
|
+
historyCount: number;
|
|
8688
|
+
inputJson: string;
|
|
8689
|
+
invoiceId?: string;
|
|
8690
|
+
key: string;
|
|
8691
|
+
leaseUntil?: number;
|
|
8692
|
+
nativeAdjustmentId?: string;
|
|
8693
|
+
nativeCreditNoteStatus?: "issued" | "void";
|
|
8694
|
+
nativeStatus?: "pending" | "complete";
|
|
8695
|
+
observedAt?: number;
|
|
8696
|
+
quantity: string;
|
|
8697
|
+
reason: string;
|
|
8698
|
+
recordJson: string;
|
|
8699
|
+
refundId?: string;
|
|
8700
|
+
resolution?: "event_cancellation" | "invoice_credit";
|
|
8701
|
+
restoredQuantity: string;
|
|
8702
|
+
scaledQuantity: string;
|
|
8703
|
+
scopeKey: string;
|
|
8704
|
+
state:
|
|
8705
|
+
| "requested"
|
|
8706
|
+
| "provider_accepted"
|
|
8707
|
+
| "confirmed"
|
|
8708
|
+
| "held"
|
|
8709
|
+
| "unsupported"
|
|
8710
|
+
| "invoice_adjustment_required";
|
|
8711
|
+
stripeAccountId?: string;
|
|
8712
|
+
subscriptionJson: string;
|
|
8713
|
+
},
|
|
8714
|
+
Name
|
|
8715
|
+
>;
|
|
8716
|
+
claim: FunctionReference<
|
|
8717
|
+
"mutation",
|
|
8718
|
+
"internal",
|
|
8719
|
+
{ key: string },
|
|
8720
|
+
{ attempt: number; kind: "ready" | "busy" | "done" },
|
|
8721
|
+
Name
|
|
8722
|
+
>;
|
|
8723
|
+
prepare: FunctionReference<
|
|
8724
|
+
"mutation",
|
|
8725
|
+
"internal",
|
|
8726
|
+
{ inputJson: string },
|
|
8727
|
+
{
|
|
8728
|
+
_creationTime: number;
|
|
8729
|
+
_id: string;
|
|
8730
|
+
adjustmentJson?: string;
|
|
8731
|
+
attempt: number;
|
|
8732
|
+
attemptedAt?: number;
|
|
8733
|
+
cashConsequence:
|
|
8734
|
+
| "none"
|
|
8735
|
+
| "operator_resolution_required"
|
|
8736
|
+
| "verified_external_adjustment";
|
|
8737
|
+
correctionId: string;
|
|
8738
|
+
creditNoteId?: string;
|
|
8739
|
+
customerAccount?: string;
|
|
8740
|
+
eventId: string;
|
|
8741
|
+
firstAttemptAt: number;
|
|
8742
|
+
historyCount: number;
|
|
8743
|
+
inputJson: string;
|
|
8744
|
+
invoiceId?: string;
|
|
8745
|
+
key: string;
|
|
8746
|
+
leaseUntil?: number;
|
|
8747
|
+
nativeAdjustmentId?: string;
|
|
8748
|
+
nativeCreditNoteStatus?: "issued" | "void";
|
|
8749
|
+
nativeStatus?: "pending" | "complete";
|
|
8750
|
+
observedAt?: number;
|
|
8751
|
+
quantity: string;
|
|
8752
|
+
reason: string;
|
|
8753
|
+
recordJson: string;
|
|
8754
|
+
refundId?: string;
|
|
8755
|
+
resolution?: "event_cancellation" | "invoice_credit";
|
|
8756
|
+
restoredQuantity: string;
|
|
8757
|
+
scaledQuantity: string;
|
|
8758
|
+
scopeKey: string;
|
|
8759
|
+
state:
|
|
8760
|
+
| "requested"
|
|
8761
|
+
| "provider_accepted"
|
|
8762
|
+
| "confirmed"
|
|
8763
|
+
| "held"
|
|
8764
|
+
| "unsupported"
|
|
8765
|
+
| "invoice_adjustment_required";
|
|
8766
|
+
stripeAccountId?: string;
|
|
8767
|
+
subscriptionJson: string;
|
|
8768
|
+
},
|
|
8769
|
+
Name
|
|
8770
|
+
>;
|
|
8771
|
+
save: FunctionReference<
|
|
8772
|
+
"mutation",
|
|
8773
|
+
"internal",
|
|
8774
|
+
{ attempt: number; key: string; outcomeJson: string },
|
|
8775
|
+
{
|
|
8776
|
+
_creationTime: number;
|
|
8777
|
+
_id: string;
|
|
8778
|
+
adjustmentJson?: string;
|
|
8779
|
+
attempt: number;
|
|
8780
|
+
attemptedAt?: number;
|
|
8781
|
+
cashConsequence:
|
|
8782
|
+
| "none"
|
|
8783
|
+
| "operator_resolution_required"
|
|
8784
|
+
| "verified_external_adjustment";
|
|
8785
|
+
correctionId: string;
|
|
8786
|
+
creditNoteId?: string;
|
|
8787
|
+
customerAccount?: string;
|
|
8788
|
+
eventId: string;
|
|
8789
|
+
firstAttemptAt: number;
|
|
8790
|
+
historyCount: number;
|
|
8791
|
+
inputJson: string;
|
|
8792
|
+
invoiceId?: string;
|
|
8793
|
+
key: string;
|
|
8794
|
+
leaseUntil?: number;
|
|
8795
|
+
nativeAdjustmentId?: string;
|
|
8796
|
+
nativeCreditNoteStatus?: "issued" | "void";
|
|
8797
|
+
nativeStatus?: "pending" | "complete";
|
|
8798
|
+
observedAt?: number;
|
|
8799
|
+
quantity: string;
|
|
8800
|
+
reason: string;
|
|
8801
|
+
recordJson: string;
|
|
8802
|
+
refundId?: string;
|
|
8803
|
+
resolution?: "event_cancellation" | "invoice_credit";
|
|
8804
|
+
restoredQuantity: string;
|
|
8805
|
+
scaledQuantity: string;
|
|
8806
|
+
scopeKey: string;
|
|
8807
|
+
state:
|
|
8808
|
+
| "requested"
|
|
8809
|
+
| "provider_accepted"
|
|
8810
|
+
| "confirmed"
|
|
8811
|
+
| "held"
|
|
8812
|
+
| "unsupported"
|
|
8813
|
+
| "invoice_adjustment_required";
|
|
8814
|
+
stripeAccountId?: string;
|
|
8815
|
+
subscriptionJson: string;
|
|
8816
|
+
},
|
|
8817
|
+
Name
|
|
8818
|
+
>;
|
|
8819
|
+
};
|
|
8820
|
+
queries: {
|
|
8821
|
+
get: FunctionReference<
|
|
8822
|
+
"query",
|
|
8823
|
+
"internal",
|
|
8824
|
+
{
|
|
8825
|
+
correctionId: string;
|
|
8826
|
+
eventId: string;
|
|
8827
|
+
scope: {
|
|
8828
|
+
customerAccount: string;
|
|
8829
|
+
livemode: boolean;
|
|
8830
|
+
meterId: string;
|
|
8831
|
+
stripeAccountId: string;
|
|
8832
|
+
};
|
|
8833
|
+
},
|
|
8834
|
+
{
|
|
8835
|
+
_creationTime: number;
|
|
8836
|
+
_id: string;
|
|
8837
|
+
adjustmentJson?: string;
|
|
8838
|
+
attempt: number;
|
|
8839
|
+
attemptedAt?: number;
|
|
8840
|
+
cashConsequence:
|
|
8841
|
+
| "none"
|
|
8842
|
+
| "operator_resolution_required"
|
|
8843
|
+
| "verified_external_adjustment";
|
|
8844
|
+
correctionId: string;
|
|
8845
|
+
creditNoteId?: string;
|
|
8846
|
+
customerAccount?: string;
|
|
8847
|
+
eventId: string;
|
|
8848
|
+
firstAttemptAt: number;
|
|
8849
|
+
historyCount: number;
|
|
8850
|
+
inputJson: string;
|
|
8851
|
+
invoiceId?: string;
|
|
8852
|
+
key: string;
|
|
8853
|
+
leaseUntil?: number;
|
|
8854
|
+
nativeAdjustmentId?: string;
|
|
8855
|
+
nativeCreditNoteStatus?: "issued" | "void";
|
|
8856
|
+
nativeStatus?: "pending" | "complete";
|
|
8857
|
+
observedAt?: number;
|
|
8858
|
+
quantity: string;
|
|
8859
|
+
reason: string;
|
|
8860
|
+
recordJson: string;
|
|
8861
|
+
refundId?: string;
|
|
8862
|
+
resolution?: "event_cancellation" | "invoice_credit";
|
|
8863
|
+
restoredQuantity: string;
|
|
8864
|
+
scaledQuantity: string;
|
|
8865
|
+
scopeKey: string;
|
|
8866
|
+
state:
|
|
8867
|
+
| "requested"
|
|
8868
|
+
| "provider_accepted"
|
|
8869
|
+
| "confirmed"
|
|
8870
|
+
| "held"
|
|
8871
|
+
| "unsupported"
|
|
8872
|
+
| "invoice_adjustment_required";
|
|
8873
|
+
stripeAccountId?: string;
|
|
8874
|
+
subscriptionJson: string;
|
|
8875
|
+
} | null,
|
|
8876
|
+
Name
|
|
8877
|
+
>;
|
|
8878
|
+
periodHistory: FunctionReference<
|
|
8879
|
+
"query",
|
|
8880
|
+
"internal",
|
|
8881
|
+
{
|
|
8882
|
+
paginationOpts: {
|
|
8883
|
+
cursor: string | null;
|
|
8884
|
+
endCursor?: string | null;
|
|
8885
|
+
id?: number;
|
|
8886
|
+
maximumBytesRead?: number;
|
|
8887
|
+
maximumRowsRead?: number;
|
|
8888
|
+
numItems: number;
|
|
8889
|
+
};
|
|
8890
|
+
period: { end: number; start: number };
|
|
8891
|
+
scope: {
|
|
8892
|
+
customerAccount: string;
|
|
8893
|
+
livemode: boolean;
|
|
8894
|
+
meterId: string;
|
|
8895
|
+
stripeAccountId: string;
|
|
8896
|
+
};
|
|
8897
|
+
},
|
|
8898
|
+
{
|
|
8899
|
+
continueCursor: string;
|
|
8900
|
+
isDone: boolean;
|
|
8901
|
+
legacyHistoryMissing: boolean;
|
|
8902
|
+
page: Array<{
|
|
8903
|
+
_creationTime: number;
|
|
8904
|
+
_id: string;
|
|
8905
|
+
at: number;
|
|
8906
|
+
eventId: string;
|
|
8907
|
+
evidenceJson: string;
|
|
8908
|
+
key: string;
|
|
8909
|
+
occurredAt?: number;
|
|
8910
|
+
reason: string;
|
|
8911
|
+
recordJson: string;
|
|
8912
|
+
scopeKey: string;
|
|
8913
|
+
sequence: number;
|
|
8914
|
+
state:
|
|
8915
|
+
| "requested"
|
|
8916
|
+
| "provider_accepted"
|
|
8917
|
+
| "confirmed"
|
|
8918
|
+
| "held"
|
|
8919
|
+
| "unsupported"
|
|
8920
|
+
| "invoice_adjustment_required";
|
|
8921
|
+
subscriptionJson: string;
|
|
8922
|
+
}>;
|
|
8923
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
8924
|
+
splitCursor?: string | null;
|
|
8925
|
+
},
|
|
8926
|
+
Name
|
|
8927
|
+
>;
|
|
8928
|
+
readHistory: FunctionReference<
|
|
8929
|
+
"query",
|
|
8930
|
+
"internal",
|
|
8931
|
+
{
|
|
8932
|
+
eventId: string;
|
|
8933
|
+
paginationOpts: {
|
|
8934
|
+
cursor: string | null;
|
|
8935
|
+
endCursor?: string | null;
|
|
8936
|
+
id?: number;
|
|
8937
|
+
maximumBytesRead?: number;
|
|
8938
|
+
maximumRowsRead?: number;
|
|
8939
|
+
numItems: number;
|
|
8940
|
+
};
|
|
8941
|
+
scope: {
|
|
8942
|
+
customerAccount: string;
|
|
8943
|
+
livemode: boolean;
|
|
8944
|
+
meterId: string;
|
|
8945
|
+
stripeAccountId: string;
|
|
8946
|
+
};
|
|
8947
|
+
},
|
|
8948
|
+
{
|
|
8949
|
+
continueCursor: string;
|
|
8950
|
+
isDone: boolean;
|
|
8951
|
+
page: Array<{
|
|
8952
|
+
_creationTime: number;
|
|
8953
|
+
_id: string;
|
|
8954
|
+
at: number;
|
|
8955
|
+
eventId: string;
|
|
8956
|
+
evidenceJson: string;
|
|
8957
|
+
key: string;
|
|
8958
|
+
occurredAt?: number;
|
|
8959
|
+
reason: string;
|
|
8960
|
+
recordJson: string;
|
|
8961
|
+
scopeKey: string;
|
|
8962
|
+
sequence: number;
|
|
8963
|
+
state:
|
|
8964
|
+
| "requested"
|
|
8965
|
+
| "provider_accepted"
|
|
8966
|
+
| "confirmed"
|
|
8967
|
+
| "held"
|
|
8968
|
+
| "unsupported"
|
|
8969
|
+
| "invoice_adjustment_required";
|
|
8970
|
+
subscriptionJson: string;
|
|
8971
|
+
}>;
|
|
8972
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
8973
|
+
splitCursor?: string | null;
|
|
8974
|
+
},
|
|
8975
|
+
Name
|
|
8976
|
+
>;
|
|
8977
|
+
};
|
|
8978
|
+
};
|
|
8553
8979
|
usageCredits: {
|
|
8554
8980
|
mutations: {
|
|
8555
8981
|
cancelPurchase: FunctionReference<
|
|
@@ -8931,7 +9357,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8931
9357
|
| "release"
|
|
8932
9358
|
| "observation"
|
|
8933
9359
|
| "recovery"
|
|
8934
|
-
| "closure"
|
|
9360
|
+
| "closure"
|
|
9361
|
+
| "correction";
|
|
8935
9362
|
purchaseKey?: string;
|
|
8936
9363
|
sourceKey: string;
|
|
8937
9364
|
}>;
|
|
@@ -8962,6 +9389,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8962
9389
|
held: boolean;
|
|
8963
9390
|
providerIdentifier: string;
|
|
8964
9391
|
reason?:
|
|
9392
|
+
| "usage_canceled"
|
|
8965
9393
|
| "billing_period_closed"
|
|
8966
9394
|
| "rate_limited"
|
|
8967
9395
|
| "provider_unavailable"
|
|
@@ -8974,6 +9402,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
8974
9402
|
receipt?: { created: number; identifier: string };
|
|
8975
9403
|
state:
|
|
8976
9404
|
| "queued"
|
|
9405
|
+
| "canceled"
|
|
8977
9406
|
| "sending"
|
|
8978
9407
|
| "provider_accepted"
|
|
8979
9408
|
| "rejected"
|
|
@@ -9041,6 +9470,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
9041
9470
|
held: boolean;
|
|
9042
9471
|
providerIdentifier: string;
|
|
9043
9472
|
reason?:
|
|
9473
|
+
| "usage_canceled"
|
|
9044
9474
|
| "billing_period_closed"
|
|
9045
9475
|
| "rate_limited"
|
|
9046
9476
|
| "provider_unavailable"
|
|
@@ -9053,6 +9483,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
9053
9483
|
receipt?: { created: number; identifier: string };
|
|
9054
9484
|
state:
|
|
9055
9485
|
| "queued"
|
|
9486
|
+
| "canceled"
|
|
9056
9487
|
| "sending"
|
|
9057
9488
|
| "provider_accepted"
|
|
9058
9489
|
| "rejected"
|
|
@@ -9096,6 +9527,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
9096
9527
|
held: boolean;
|
|
9097
9528
|
providerIdentifier: string;
|
|
9098
9529
|
reason?:
|
|
9530
|
+
| "usage_canceled"
|
|
9099
9531
|
| "billing_period_closed"
|
|
9100
9532
|
| "rate_limited"
|
|
9101
9533
|
| "provider_unavailable"
|
|
@@ -9108,6 +9540,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
9108
9540
|
receipt?: { created: number; identifier: string };
|
|
9109
9541
|
state:
|
|
9110
9542
|
| "queued"
|
|
9543
|
+
| "canceled"
|
|
9111
9544
|
| "sending"
|
|
9112
9545
|
| "provider_accepted"
|
|
9113
9546
|
| "rejected"
|
|
@@ -9151,6 +9584,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
9151
9584
|
held: boolean;
|
|
9152
9585
|
providerIdentifier: string;
|
|
9153
9586
|
reason?:
|
|
9587
|
+
| "usage_canceled"
|
|
9154
9588
|
| "billing_period_closed"
|
|
9155
9589
|
| "rate_limited"
|
|
9156
9590
|
| "provider_unavailable"
|
|
@@ -9163,6 +9597,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
9163
9597
|
receipt?: { created: number; identifier: string };
|
|
9164
9598
|
state:
|
|
9165
9599
|
| "queued"
|
|
9600
|
+
| "canceled"
|
|
9166
9601
|
| "sending"
|
|
9167
9602
|
| "provider_accepted"
|
|
9168
9603
|
| "rejected"
|
|
@@ -9221,6 +9656,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
9221
9656
|
_creationTime: number;
|
|
9222
9657
|
_id: string;
|
|
9223
9658
|
attempts: number;
|
|
9659
|
+
correctionKey?: string;
|
|
9224
9660
|
definitionVersion?: 1;
|
|
9225
9661
|
dispatch?: string;
|
|
9226
9662
|
eventId: string;
|
|
@@ -9232,6 +9668,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
9232
9668
|
provider?: string;
|
|
9233
9669
|
providerIdentifier: string;
|
|
9234
9670
|
reason?:
|
|
9671
|
+
| "usage_canceled"
|
|
9235
9672
|
| "billing_period_closed"
|
|
9236
9673
|
| "rate_limited"
|
|
9237
9674
|
| "provider_unavailable"
|
|
@@ -9245,6 +9682,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
9245
9682
|
scopeKey: string;
|
|
9246
9683
|
state:
|
|
9247
9684
|
| "queued"
|
|
9685
|
+
| "canceled"
|
|
9248
9686
|
| "sending"
|
|
9249
9687
|
| "provider_accepted"
|
|
9250
9688
|
| "rejected"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { unresolvedCorrectionStates } from "../usageCorrections/cancellation.js";
|
|
1
2
|
import { v } from "convex/values";
|
|
2
3
|
import { mutation } from "../_generated/server.js";
|
|
3
4
|
import { closureByStripeId } from "./helpers.js";
|
|
@@ -7,6 +8,22 @@ export const prepare = mutation({
|
|
|
7
8
|
args: { stripeAccountId: v.string() },
|
|
8
9
|
returns: v.object({ closure: closureDoc, isRetry: v.boolean() }),
|
|
9
10
|
handler: async (ctx, { stripeAccountId }) => {
|
|
11
|
+
for (const state of unresolvedCorrectionStates) {
|
|
12
|
+
const payerCorrection = await ctx.db
|
|
13
|
+
.query("usageCorrections")
|
|
14
|
+
.withIndex("by_payer_state", (q) =>
|
|
15
|
+
q.eq("customerAccount", stripeAccountId).eq("state", state),
|
|
16
|
+
)
|
|
17
|
+
.first();
|
|
18
|
+
const realmCorrection = await ctx.db
|
|
19
|
+
.query("usageCorrections")
|
|
20
|
+
.withIndex("by_realm_state", (q) =>
|
|
21
|
+
q.eq("stripeAccountId", stripeAccountId).eq("state", state),
|
|
22
|
+
)
|
|
23
|
+
.first();
|
|
24
|
+
if (payerCorrection || realmCorrection)
|
|
25
|
+
throw new Error("Resolve usage corrections before account closure");
|
|
26
|
+
}
|
|
10
27
|
const payerLock = await ctx.db
|
|
11
28
|
.query("usageSubscriptionLocks")
|
|
12
29
|
.withIndex("by_payer", (q) => q.eq("customerAccount", stripeAccountId))
|
|
@@ -81,6 +81,8 @@ export async function settlementFingerprint(row: Doc<"settlementAllocations">) {
|
|
|
81
81
|
sourceChargeId: row.sourceChargeId,
|
|
82
82
|
paymentIntentId: row.paymentIntentId,
|
|
83
83
|
sourceInvoiceId: row.sourceInvoiceId,
|
|
84
|
+
...(row.usageSource ? { usageSource: row.usageSource } : {}),
|
|
85
|
+
...(row.creditSource ? { creditSource: row.creditSource } : {}),
|
|
84
86
|
gross: row.gross,
|
|
85
87
|
currency: row.currency,
|
|
86
88
|
processingFee: row.processingFee,
|
package/src/component/schema.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
claimsTable as usageCorrectionClaims,
|
|
3
|
+
operationsTable as usageCorrections,
|
|
4
|
+
historyTable as usageCorrectionHistory,
|
|
5
|
+
} from "./usageCorrections/schema.js";
|
|
1
6
|
import {
|
|
2
7
|
policiesTable as usageAllowancePolicies,
|
|
3
8
|
historyTable as usageAllowanceHistory,
|
|
@@ -120,6 +125,9 @@ import { pricesTable, productsTable } from "./products/schema";
|
|
|
120
125
|
import { webhookEventsTable } from "./webhooks/schema";
|
|
121
126
|
|
|
122
127
|
export default defineSchema({
|
|
128
|
+
usageCorrectionClaims,
|
|
129
|
+
usageCorrections,
|
|
130
|
+
usageCorrectionHistory,
|
|
123
131
|
usageAllowancePolicies,
|
|
124
132
|
usageAllowanceHistory,
|
|
125
133
|
usageSubscriptionControls,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { canonicalFingerprint } from "../operationEvidence/canonical.js";
|
|
1
2
|
import { observeSettlementAllocation } from "../financialObservations/settlement.js";
|
|
2
3
|
import { paginator } from "convex-helpers/server/pagination";
|
|
3
4
|
import schema from "../schema.js";
|
|
@@ -16,6 +17,10 @@ export const reserveSettlementAllocation = mutation({
|
|
|
16
17
|
args: allocationFields,
|
|
17
18
|
returns: doc,
|
|
18
19
|
handler: async (ctx, args) => {
|
|
20
|
+
if (args.usageSource && args.creditSource)
|
|
21
|
+
throw new Error(
|
|
22
|
+
"Settlement cannot combine invoice and credit purchase sources",
|
|
23
|
+
);
|
|
19
24
|
const existing = await ctx.db
|
|
20
25
|
.query("settlementAllocations")
|
|
21
26
|
.withIndex("by_source_charge", (q) =>
|
|
@@ -26,7 +31,11 @@ export const reserveSettlementAllocation = mutation({
|
|
|
26
31
|
if (
|
|
27
32
|
existing.currency !== args.currency ||
|
|
28
33
|
existing.paymentIntentId !== args.paymentIntentId ||
|
|
29
|
-
existing.sourceInvoiceId !== args.sourceInvoiceId
|
|
34
|
+
existing.sourceInvoiceId !== args.sourceInvoiceId ||
|
|
35
|
+
(await canonicalFingerprint(existing.usageSource ?? null)) !==
|
|
36
|
+
(await canonicalFingerprint(args.usageSource ?? null)) ||
|
|
37
|
+
(await canonicalFingerprint(existing.creditSource ?? null)) !==
|
|
38
|
+
(await canonicalFingerprint(args.creditSource ?? null))
|
|
30
39
|
)
|
|
31
40
|
throw new Error("Settlement source identity cannot change.");
|
|
32
41
|
await observeSettlementAllocation(ctx, existing);
|