@paygentic/sdk 0.9.4 → 0.9.6
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/README.md +12 -5
- package/dist/commonjs/funcs/pricesUpdate.d.ts +1 -1
- package/dist/commonjs/funcs/pricesUpdate.d.ts.map +1 -1
- package/dist/commonjs/funcs/pricesUpdate.js +2 -2
- package/dist/commonjs/funcs/pricesUpdate.js.map +1 -1
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +19 -0
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.js +127 -0
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.js.map +1 -0
- package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts +18 -0
- package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.js +128 -0
- package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.js.map +1 -0
- package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.d.ts +19 -0
- package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.js +129 -0
- package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts +53 -0
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts.map +1 -0
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.js +63 -0
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.js.map +1 -0
- package/dist/commonjs/models/errors/index.d.ts +1 -0
- package/dist/commonjs/models/errors/index.d.ts.map +1 -1
- package/dist/commonjs/models/errors/index.js +1 -0
- package/dist/commonjs/models/errors/index.js.map +1 -1
- package/dist/commonjs/models/errors/updateprice.d.ts +36 -0
- package/dist/commonjs/models/errors/updateprice.d.ts.map +1 -0
- package/dist/commonjs/models/errors/updateprice.js +77 -0
- package/dist/commonjs/models/errors/updateprice.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +4 -1
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +4 -1
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/operations/createprice.d.ts +8 -3
- package/dist/commonjs/models/operations/createprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createprice.js +2 -1
- package/dist/commonjs/models/operations/createprice.js.map +1 -1
- package/dist/commonjs/models/operations/createsubscriptionadjustment.d.ts +18 -0
- package/dist/commonjs/models/operations/createsubscriptionadjustment.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createsubscriptionadjustment.js +56 -0
- package/dist/commonjs/models/operations/createsubscriptionadjustment.js.map +1 -0
- package/dist/commonjs/models/operations/deletesubscriptionadjustment.d.ts +20 -0
- package/dist/commonjs/models/operations/deletesubscriptionadjustment.d.ts.map +1 -0
- package/dist/commonjs/models/operations/deletesubscriptionadjustment.js +50 -0
- package/dist/commonjs/models/operations/deletesubscriptionadjustment.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +3 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +3 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listsubscriptionadjustments.d.ts +25 -0
- package/dist/commonjs/models/operations/listsubscriptionadjustments.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listsubscriptionadjustments.js +51 -0
- package/dist/commonjs/models/operations/listsubscriptionadjustments.js.map +1 -0
- package/dist/commonjs/models/operations/updateprice.d.ts +18 -3
- package/dist/commonjs/models/operations/updateprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateprice.js +14 -2
- package/dist/commonjs/models/operations/updateprice.js.map +1 -1
- package/dist/commonjs/models/planversionpriceslot.d.ts +4 -0
- package/dist/commonjs/models/planversionpriceslot.d.ts.map +1 -1
- package/dist/commonjs/models/planversionpriceslot.js +1 -0
- package/dist/commonjs/models/planversionpriceslot.js.map +1 -1
- package/dist/commonjs/models/price.d.ts +4 -0
- package/dist/commonjs/models/price.d.ts.map +1 -1
- package/dist/commonjs/models/price.js +1 -0
- package/dist/commonjs/models/price.js.map +1 -1
- package/dist/commonjs/models/pricemodel.d.ts +2 -2
- package/dist/commonjs/models/pricemodel.js +1 -1
- package/dist/commonjs/models/pricemodelinput.d.ts +3 -2
- package/dist/commonjs/models/pricemodelinput.d.ts.map +1 -1
- package/dist/commonjs/models/pricemodelinput.js +2 -1
- package/dist/commonjs/models/pricemodelinput.js.map +1 -1
- package/dist/commonjs/models/priceproperties.d.ts +125 -0
- package/dist/commonjs/models/priceproperties.d.ts.map +1 -0
- package/dist/commonjs/models/priceproperties.js +152 -0
- package/dist/commonjs/models/priceproperties.js.map +1 -0
- package/dist/commonjs/models/schemasprice.d.ts +7 -3
- package/dist/commonjs/models/schemasprice.d.ts.map +1 -1
- package/dist/commonjs/models/schemasprice.js +3 -2
- package/dist/commonjs/models/schemasprice.js.map +1 -1
- package/dist/commonjs/models/subscriptionadjustment.d.ts +49 -0
- package/dist/commonjs/models/subscriptionadjustment.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptionadjustment.js +68 -0
- package/dist/commonjs/models/subscriptionadjustment.js.map +1 -0
- package/dist/commonjs/models/subscriptionadjustmentsresponse.d.ts +16 -0
- package/dist/commonjs/models/subscriptionadjustmentsresponse.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptionadjustmentsresponse.js +53 -0
- package/dist/commonjs/models/subscriptionadjustmentsresponse.js.map +1 -0
- package/dist/commonjs/sdk/subscriptions.d.ts +21 -0
- package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
- package/dist/commonjs/sdk/subscriptions.js +30 -0
- package/dist/commonjs/sdk/subscriptions.js.map +1 -1
- package/dist/esm/funcs/pricesUpdate.d.ts +1 -1
- package/dist/esm/funcs/pricesUpdate.d.ts.map +1 -1
- package/dist/esm/funcs/pricesUpdate.js +2 -2
- package/dist/esm/funcs/pricesUpdate.js.map +1 -1
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +19 -0
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.js +91 -0
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.js.map +1 -0
- package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts +18 -0
- package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.js +92 -0
- package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.js.map +1 -0
- package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.d.ts +19 -0
- package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.js +93 -0
- package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts +53 -0
- package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts.map +1 -0
- package/dist/esm/models/createsubscriptionadjustmentrequest.js +26 -0
- package/dist/esm/models/createsubscriptionadjustmentrequest.js.map +1 -0
- package/dist/esm/models/errors/index.d.ts +1 -0
- package/dist/esm/models/errors/index.d.ts.map +1 -1
- package/dist/esm/models/errors/index.js +1 -0
- package/dist/esm/models/errors/index.js.map +1 -1
- package/dist/esm/models/errors/updateprice.d.ts +36 -0
- package/dist/esm/models/errors/updateprice.d.ts.map +1 -0
- package/dist/esm/models/errors/updateprice.js +40 -0
- package/dist/esm/models/errors/updateprice.js.map +1 -0
- package/dist/esm/models/index.d.ts +4 -1
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +4 -1
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/operations/createprice.d.ts +8 -3
- package/dist/esm/models/operations/createprice.d.ts.map +1 -1
- package/dist/esm/models/operations/createprice.js +2 -1
- package/dist/esm/models/operations/createprice.js.map +1 -1
- package/dist/esm/models/operations/createsubscriptionadjustment.d.ts +18 -0
- package/dist/esm/models/operations/createsubscriptionadjustment.d.ts.map +1 -0
- package/dist/esm/models/operations/createsubscriptionadjustment.js +19 -0
- package/dist/esm/models/operations/createsubscriptionadjustment.js.map +1 -0
- package/dist/esm/models/operations/deletesubscriptionadjustment.d.ts +20 -0
- package/dist/esm/models/operations/deletesubscriptionadjustment.d.ts.map +1 -0
- package/dist/esm/models/operations/deletesubscriptionadjustment.js +13 -0
- package/dist/esm/models/operations/deletesubscriptionadjustment.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +3 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +3 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listsubscriptionadjustments.d.ts +25 -0
- package/dist/esm/models/operations/listsubscriptionadjustments.d.ts.map +1 -0
- package/dist/esm/models/operations/listsubscriptionadjustments.js +14 -0
- package/dist/esm/models/operations/listsubscriptionadjustments.js.map +1 -0
- package/dist/esm/models/operations/updateprice.d.ts +18 -3
- package/dist/esm/models/operations/updateprice.d.ts.map +1 -1
- package/dist/esm/models/operations/updateprice.js +12 -1
- package/dist/esm/models/operations/updateprice.js.map +1 -1
- package/dist/esm/models/planversionpriceslot.d.ts +4 -0
- package/dist/esm/models/planversionpriceslot.d.ts.map +1 -1
- package/dist/esm/models/planversionpriceslot.js +1 -0
- package/dist/esm/models/planversionpriceslot.js.map +1 -1
- package/dist/esm/models/price.d.ts +4 -0
- package/dist/esm/models/price.d.ts.map +1 -1
- package/dist/esm/models/price.js +1 -0
- package/dist/esm/models/price.js.map +1 -1
- package/dist/esm/models/pricemodel.d.ts +2 -2
- package/dist/esm/models/pricemodel.js +1 -1
- package/dist/esm/models/pricemodelinput.d.ts +3 -2
- package/dist/esm/models/pricemodelinput.d.ts.map +1 -1
- package/dist/esm/models/pricemodelinput.js +2 -1
- package/dist/esm/models/pricemodelinput.js.map +1 -1
- package/dist/esm/models/priceproperties.d.ts +125 -0
- package/dist/esm/models/priceproperties.d.ts.map +1 -0
- package/dist/esm/models/priceproperties.js +104 -0
- package/dist/esm/models/priceproperties.js.map +1 -0
- package/dist/esm/models/schemasprice.d.ts +7 -3
- package/dist/esm/models/schemasprice.d.ts.map +1 -1
- package/dist/esm/models/schemasprice.js +3 -2
- package/dist/esm/models/schemasprice.js.map +1 -1
- package/dist/esm/models/subscriptionadjustment.d.ts +49 -0
- package/dist/esm/models/subscriptionadjustment.d.ts.map +1 -0
- package/dist/esm/models/subscriptionadjustment.js +31 -0
- package/dist/esm/models/subscriptionadjustment.js.map +1 -0
- package/dist/esm/models/subscriptionadjustmentsresponse.d.ts +16 -0
- package/dist/esm/models/subscriptionadjustmentsresponse.d.ts.map +1 -0
- package/dist/esm/models/subscriptionadjustmentsresponse.js +16 -0
- package/dist/esm/models/subscriptionadjustmentsresponse.js.map +1 -0
- package/dist/esm/sdk/subscriptions.d.ts +21 -0
- package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
- package/dist/esm/sdk/subscriptions.js +30 -0
- package/dist/esm/sdk/subscriptions.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/pricesUpdate.ts +5 -1
- package/src/funcs/subscriptionsCreateSubscriptionAdjustment.ts +186 -0
- package/src/funcs/subscriptionsDeleteSubscriptionAdjustment.ts +185 -0
- package/src/funcs/subscriptionsListSubscriptionAdjustments.ts +183 -0
- package/src/lib/config.ts +2 -2
- package/src/models/createsubscriptionadjustmentrequest.ts +85 -0
- package/src/models/errors/index.ts +1 -0
- package/src/models/errors/updateprice.ts +71 -0
- package/src/models/index.ts +4 -1
- package/src/models/operations/createprice.ts +10 -4
- package/src/models/operations/createsubscriptionadjustment.ts +48 -0
- package/src/models/operations/deletesubscriptionadjustment.ts +42 -0
- package/src/models/operations/index.ts +3 -0
- package/src/models/operations/listsubscriptionadjustments.ts +48 -0
- package/src/models/operations/updateprice.ts +40 -4
- package/src/models/planversionpriceslot.ts +5 -0
- package/src/models/price.ts +5 -0
- package/src/models/pricemodel.ts +2 -2
- package/src/models/pricemodelinput.ts +3 -2
- package/src/models/priceproperties.ts +325 -0
- package/src/models/schemasprice.ts +11 -6
- package/src/models/subscriptionadjustment.ts +94 -0
- package/src/models/subscriptionadjustmentsresponse.ts +44 -0
- package/src/sdk/subscriptions.ts +54 -0
- package/dist/commonjs/models/pricepropertiesunion.d.ts +0 -152
- package/dist/commonjs/models/pricepropertiesunion.d.ts.map +0 -1
- package/dist/commonjs/models/pricepropertiesunion.js +0 -169
- package/dist/commonjs/models/pricepropertiesunion.js.map +0 -1
- package/dist/esm/models/pricepropertiesunion.d.ts +0 -152
- package/dist/esm/models/pricepropertiesunion.d.ts.map +0 -1
- package/dist/esm/models/pricepropertiesunion.js +0 -121
- package/dist/esm/models/pricepropertiesunion.js.map +0 -1
- package/src/models/pricepropertiesunion.ts +0 -364
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Percentage pricing model
|
|
12
|
+
*/
|
|
13
|
+
export type PercentagePriceProperties = {
|
|
14
|
+
/**
|
|
15
|
+
* Ceiling amount limiting total charge regardless of percentage calculation. Sample values: '500.00' caps fees at $500 maximum, '2000.00' limits charges to $2000 per period
|
|
16
|
+
*/
|
|
17
|
+
maxCharge: string;
|
|
18
|
+
/**
|
|
19
|
+
* Floor amount charged regardless of percentage calculation. Sample values: '5.00' ensures minimum $5 fee, '25.00' guarantees at least $25 per billing event
|
|
20
|
+
*/
|
|
21
|
+
minCharge: string;
|
|
22
|
+
/**
|
|
23
|
+
* Rate expressed as decimal between 0 and 10, supporting up to 4 decimal precision. Sample values: '0.03' represents 3%, '0.075' represents 7.5%, '1.10' represents 110%
|
|
24
|
+
*/
|
|
25
|
+
percentage: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type VolumeTier = {
|
|
29
|
+
/**
|
|
30
|
+
* Inclusive upper bound of the band, as a decimal string. Null on the last band only, which carries the remainder. Sample values: '100' bounds the band at 100 units, null leaves the top open.
|
|
31
|
+
*/
|
|
32
|
+
upTo: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Per-unit cost inside this band, as a decimal string, capped at 6 decimal places. Sample values: '5' represents $5 per unit, '0.004' represents $0.004 per unit.
|
|
35
|
+
*/
|
|
36
|
+
unitPrice: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Volume pricing model
|
|
41
|
+
*/
|
|
42
|
+
export type VolumePriceProperties = {
|
|
43
|
+
/**
|
|
44
|
+
* Ordered ladder of bands. The band is selected by the period's total metered usage, and its rate applies to every billed unit. A band matches when the quantity is less than or equal to its `upTo`, and the first matching band wins; the previous band's `upTo` is the exclusive lower bound, and the first band's floor is 0.
|
|
45
|
+
*/
|
|
46
|
+
tiers: Array<VolumeTier>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Dynamic pricing model
|
|
51
|
+
*/
|
|
52
|
+
export type DynamicPriceProperties = {
|
|
53
|
+
/**
|
|
54
|
+
* Upper limit of the price range for dynamic pricing. Sample values: '0.10' means $0.10 per token for large volumes at peak times
|
|
55
|
+
*/
|
|
56
|
+
maxPrice: string;
|
|
57
|
+
/**
|
|
58
|
+
* Lower limit of the price range for dynamic pricing. Sample values: '0.01' means $0.01 per token for low volumes during off-peak hours
|
|
59
|
+
*/
|
|
60
|
+
minPrice: string;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Standard pricing model
|
|
65
|
+
*/
|
|
66
|
+
export type StandardPriceProperties = {
|
|
67
|
+
/**
|
|
68
|
+
* Per-unit cost in decimal format for fixed-rate pricing. Sample values: '0.00002' represents $0.00002 per token, '0.15' represents $0.15 per gigabyte stored, '0.05' represents $0.05 per API call. Per unit. Total per period = quantity × unitPrice; see the `quantity` field. A negative value defines a usage-scaled rebate: the line's subtotal is negative and reduces the invoice. A rebate never drives an invoice total below zero, so set rebate rates below the charges they offset. A negative unitPrice is only valid on a metered price (a billableMetricId is required — there is no usage to scale on a fee price) and cannot be combined with grantDiscountEnabled, a hard-limit feature, or a pricingUnitId. When a rebate and a charge price share a billable metric but attach to different features, they compute against different quantity bases: a price attached to a feature bills the overage against its allowance, while a featureless price bills the raw metered usage. That is a permitted configuration, not an error. Attach both to the same feature to bill them against one basis.
|
|
69
|
+
*/
|
|
70
|
+
unitPrice: string;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type PriceProperties =
|
|
74
|
+
| PercentagePriceProperties
|
|
75
|
+
| DynamicPriceProperties
|
|
76
|
+
| StandardPriceProperties
|
|
77
|
+
| VolumePriceProperties;
|
|
78
|
+
|
|
79
|
+
/** @internal */
|
|
80
|
+
export const PercentagePriceProperties$inboundSchema: z.ZodType<
|
|
81
|
+
PercentagePriceProperties,
|
|
82
|
+
z.ZodTypeDef,
|
|
83
|
+
unknown
|
|
84
|
+
> = z.object({
|
|
85
|
+
maxCharge: z.string(),
|
|
86
|
+
minCharge: z.string(),
|
|
87
|
+
percentage: z.string(),
|
|
88
|
+
});
|
|
89
|
+
/** @internal */
|
|
90
|
+
export type PercentagePriceProperties$Outbound = {
|
|
91
|
+
maxCharge: string;
|
|
92
|
+
minCharge: string;
|
|
93
|
+
percentage: string;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/** @internal */
|
|
97
|
+
export const PercentagePriceProperties$outboundSchema: z.ZodType<
|
|
98
|
+
PercentagePriceProperties$Outbound,
|
|
99
|
+
z.ZodTypeDef,
|
|
100
|
+
PercentagePriceProperties
|
|
101
|
+
> = z.object({
|
|
102
|
+
maxCharge: z.string(),
|
|
103
|
+
minCharge: z.string(),
|
|
104
|
+
percentage: z.string(),
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export function percentagePricePropertiesToJSON(
|
|
108
|
+
percentagePriceProperties: PercentagePriceProperties,
|
|
109
|
+
): string {
|
|
110
|
+
return JSON.stringify(
|
|
111
|
+
PercentagePriceProperties$outboundSchema.parse(percentagePriceProperties),
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
export function percentagePricePropertiesFromJSON(
|
|
115
|
+
jsonString: string,
|
|
116
|
+
): SafeParseResult<PercentagePriceProperties, SDKValidationError> {
|
|
117
|
+
return safeParse(
|
|
118
|
+
jsonString,
|
|
119
|
+
(x) => PercentagePriceProperties$inboundSchema.parse(JSON.parse(x)),
|
|
120
|
+
`Failed to parse 'PercentagePriceProperties' from JSON`,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** @internal */
|
|
125
|
+
export const VolumeTier$inboundSchema: z.ZodType<
|
|
126
|
+
VolumeTier,
|
|
127
|
+
z.ZodTypeDef,
|
|
128
|
+
unknown
|
|
129
|
+
> = z.object({
|
|
130
|
+
upTo: z.nullable(z.string()),
|
|
131
|
+
unitPrice: z.string(),
|
|
132
|
+
});
|
|
133
|
+
/** @internal */
|
|
134
|
+
export type VolumeTier$Outbound = {
|
|
135
|
+
upTo: string | null;
|
|
136
|
+
unitPrice: string;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/** @internal */
|
|
140
|
+
export const VolumeTier$outboundSchema: z.ZodType<
|
|
141
|
+
VolumeTier$Outbound,
|
|
142
|
+
z.ZodTypeDef,
|
|
143
|
+
VolumeTier
|
|
144
|
+
> = z.object({
|
|
145
|
+
upTo: z.nullable(z.string()),
|
|
146
|
+
unitPrice: z.string(),
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export function volumeTierToJSON(volumeTier: VolumeTier): string {
|
|
150
|
+
return JSON.stringify(VolumeTier$outboundSchema.parse(volumeTier));
|
|
151
|
+
}
|
|
152
|
+
export function volumeTierFromJSON(
|
|
153
|
+
jsonString: string,
|
|
154
|
+
): SafeParseResult<VolumeTier, SDKValidationError> {
|
|
155
|
+
return safeParse(
|
|
156
|
+
jsonString,
|
|
157
|
+
(x) => VolumeTier$inboundSchema.parse(JSON.parse(x)),
|
|
158
|
+
`Failed to parse 'VolumeTier' from JSON`,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** @internal */
|
|
163
|
+
export const VolumePriceProperties$inboundSchema: z.ZodType<
|
|
164
|
+
VolumePriceProperties,
|
|
165
|
+
z.ZodTypeDef,
|
|
166
|
+
unknown
|
|
167
|
+
> = z.object({
|
|
168
|
+
tiers: z.array(z.lazy(() => VolumeTier$inboundSchema)),
|
|
169
|
+
});
|
|
170
|
+
/** @internal */
|
|
171
|
+
export type VolumePriceProperties$Outbound = {
|
|
172
|
+
tiers: Array<VolumeTier$Outbound>;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/** @internal */
|
|
176
|
+
export const VolumePriceProperties$outboundSchema: z.ZodType<
|
|
177
|
+
VolumePriceProperties$Outbound,
|
|
178
|
+
z.ZodTypeDef,
|
|
179
|
+
VolumePriceProperties
|
|
180
|
+
> = z.object({
|
|
181
|
+
tiers: z.array(z.lazy(() => VolumeTier$outboundSchema)),
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
export function volumePricePropertiesToJSON(
|
|
185
|
+
volumePriceProperties: VolumePriceProperties,
|
|
186
|
+
): string {
|
|
187
|
+
return JSON.stringify(
|
|
188
|
+
VolumePriceProperties$outboundSchema.parse(volumePriceProperties),
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
export function volumePricePropertiesFromJSON(
|
|
192
|
+
jsonString: string,
|
|
193
|
+
): SafeParseResult<VolumePriceProperties, SDKValidationError> {
|
|
194
|
+
return safeParse(
|
|
195
|
+
jsonString,
|
|
196
|
+
(x) => VolumePriceProperties$inboundSchema.parse(JSON.parse(x)),
|
|
197
|
+
`Failed to parse 'VolumePriceProperties' from JSON`,
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** @internal */
|
|
202
|
+
export const DynamicPriceProperties$inboundSchema: z.ZodType<
|
|
203
|
+
DynamicPriceProperties,
|
|
204
|
+
z.ZodTypeDef,
|
|
205
|
+
unknown
|
|
206
|
+
> = z.object({
|
|
207
|
+
maxPrice: z.string(),
|
|
208
|
+
minPrice: z.string(),
|
|
209
|
+
});
|
|
210
|
+
/** @internal */
|
|
211
|
+
export type DynamicPriceProperties$Outbound = {
|
|
212
|
+
maxPrice: string;
|
|
213
|
+
minPrice: string;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/** @internal */
|
|
217
|
+
export const DynamicPriceProperties$outboundSchema: z.ZodType<
|
|
218
|
+
DynamicPriceProperties$Outbound,
|
|
219
|
+
z.ZodTypeDef,
|
|
220
|
+
DynamicPriceProperties
|
|
221
|
+
> = z.object({
|
|
222
|
+
maxPrice: z.string(),
|
|
223
|
+
minPrice: z.string(),
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
export function dynamicPricePropertiesToJSON(
|
|
227
|
+
dynamicPriceProperties: DynamicPriceProperties,
|
|
228
|
+
): string {
|
|
229
|
+
return JSON.stringify(
|
|
230
|
+
DynamicPriceProperties$outboundSchema.parse(dynamicPriceProperties),
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
export function dynamicPricePropertiesFromJSON(
|
|
234
|
+
jsonString: string,
|
|
235
|
+
): SafeParseResult<DynamicPriceProperties, SDKValidationError> {
|
|
236
|
+
return safeParse(
|
|
237
|
+
jsonString,
|
|
238
|
+
(x) => DynamicPriceProperties$inboundSchema.parse(JSON.parse(x)),
|
|
239
|
+
`Failed to parse 'DynamicPriceProperties' from JSON`,
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** @internal */
|
|
244
|
+
export const StandardPriceProperties$inboundSchema: z.ZodType<
|
|
245
|
+
StandardPriceProperties,
|
|
246
|
+
z.ZodTypeDef,
|
|
247
|
+
unknown
|
|
248
|
+
> = z.object({
|
|
249
|
+
unitPrice: z.string(),
|
|
250
|
+
});
|
|
251
|
+
/** @internal */
|
|
252
|
+
export type StandardPriceProperties$Outbound = {
|
|
253
|
+
unitPrice: string;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
/** @internal */
|
|
257
|
+
export const StandardPriceProperties$outboundSchema: z.ZodType<
|
|
258
|
+
StandardPriceProperties$Outbound,
|
|
259
|
+
z.ZodTypeDef,
|
|
260
|
+
StandardPriceProperties
|
|
261
|
+
> = z.object({
|
|
262
|
+
unitPrice: z.string(),
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
export function standardPricePropertiesToJSON(
|
|
266
|
+
standardPriceProperties: StandardPriceProperties,
|
|
267
|
+
): string {
|
|
268
|
+
return JSON.stringify(
|
|
269
|
+
StandardPriceProperties$outboundSchema.parse(standardPriceProperties),
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
export function standardPricePropertiesFromJSON(
|
|
273
|
+
jsonString: string,
|
|
274
|
+
): SafeParseResult<StandardPriceProperties, SDKValidationError> {
|
|
275
|
+
return safeParse(
|
|
276
|
+
jsonString,
|
|
277
|
+
(x) => StandardPriceProperties$inboundSchema.parse(JSON.parse(x)),
|
|
278
|
+
`Failed to parse 'StandardPriceProperties' from JSON`,
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** @internal */
|
|
283
|
+
export const PriceProperties$inboundSchema: z.ZodType<
|
|
284
|
+
PriceProperties,
|
|
285
|
+
z.ZodTypeDef,
|
|
286
|
+
unknown
|
|
287
|
+
> = z.union([
|
|
288
|
+
z.lazy(() => PercentagePriceProperties$inboundSchema),
|
|
289
|
+
z.lazy(() => DynamicPriceProperties$inboundSchema),
|
|
290
|
+
z.lazy(() => StandardPriceProperties$inboundSchema),
|
|
291
|
+
z.lazy(() => VolumePriceProperties$inboundSchema),
|
|
292
|
+
]);
|
|
293
|
+
/** @internal */
|
|
294
|
+
export type PriceProperties$Outbound =
|
|
295
|
+
| PercentagePriceProperties$Outbound
|
|
296
|
+
| DynamicPriceProperties$Outbound
|
|
297
|
+
| StandardPriceProperties$Outbound
|
|
298
|
+
| VolumePriceProperties$Outbound;
|
|
299
|
+
|
|
300
|
+
/** @internal */
|
|
301
|
+
export const PriceProperties$outboundSchema: z.ZodType<
|
|
302
|
+
PriceProperties$Outbound,
|
|
303
|
+
z.ZodTypeDef,
|
|
304
|
+
PriceProperties
|
|
305
|
+
> = z.union([
|
|
306
|
+
z.lazy(() => PercentagePriceProperties$outboundSchema),
|
|
307
|
+
z.lazy(() => DynamicPriceProperties$outboundSchema),
|
|
308
|
+
z.lazy(() => StandardPriceProperties$outboundSchema),
|
|
309
|
+
z.lazy(() => VolumePriceProperties$outboundSchema),
|
|
310
|
+
]);
|
|
311
|
+
|
|
312
|
+
export function pricePropertiesToJSON(
|
|
313
|
+
priceProperties: PriceProperties,
|
|
314
|
+
): string {
|
|
315
|
+
return JSON.stringify(PriceProperties$outboundSchema.parse(priceProperties));
|
|
316
|
+
}
|
|
317
|
+
export function pricePropertiesFromJSON(
|
|
318
|
+
jsonString: string,
|
|
319
|
+
): SafeParseResult<PriceProperties, SDKValidationError> {
|
|
320
|
+
return safeParse(
|
|
321
|
+
jsonString,
|
|
322
|
+
(x) => PriceProperties$inboundSchema.parse(JSON.parse(x)),
|
|
323
|
+
`Failed to parse 'PriceProperties' from JSON`,
|
|
324
|
+
);
|
|
325
|
+
}
|
|
@@ -10,9 +10,9 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
|
10
10
|
import { PriceFeature, PriceFeature$inboundSchema } from "./pricefeature.js";
|
|
11
11
|
import { PriceModel, PriceModel$inboundSchema } from "./pricemodel.js";
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "./
|
|
13
|
+
PriceProperties,
|
|
14
|
+
PriceProperties$inboundSchema,
|
|
15
|
+
} from "./priceproperties.js";
|
|
16
16
|
|
|
17
17
|
export const SchemasPriceObject = {
|
|
18
18
|
Price: "price",
|
|
@@ -56,11 +56,11 @@ export type SchemasPrice = {
|
|
|
56
56
|
createdAt: Date;
|
|
57
57
|
invoiceDisplayName: string;
|
|
58
58
|
/**
|
|
59
|
-
* Pricing model of a price as returned by the API. Includes legacy models ('dynamic', '
|
|
59
|
+
* Pricing model of a price as returned by the API. Includes the legacy models ('dynamic', 'percentage') retained for existing prices; 'standard' and 'volume' can be created (see PriceModelInput).
|
|
60
60
|
*/
|
|
61
61
|
model?: PriceModel | undefined;
|
|
62
62
|
paymentTerm: SchemasPricePaymentTerm;
|
|
63
|
-
properties:
|
|
63
|
+
properties: PriceProperties;
|
|
64
64
|
updatedAt: Date;
|
|
65
65
|
/**
|
|
66
66
|
* Features associated with this price
|
|
@@ -70,6 +70,10 @@ export type SchemasPrice = {
|
|
|
70
70
|
* When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
|
|
71
71
|
*/
|
|
72
72
|
grantDiscountEnabled: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* A fixed amount owed whole rather than a per-period rate. An obligation is not prorated over a partial first period: when a subscription starts before its billing anchor, no truncated stub is billed and the first charge is the full amount at the next anchor. An obligation also refuses an interval boundary that falls strictly inside one of its own billing periods, since part of an amount owed whole is not a thing to bill. Defaults to false, which is a rate and is today's behaviour for every price. Not supported on a metered price, whose amount resolves from usage at close.
|
|
75
|
+
*/
|
|
76
|
+
isObligation: boolean;
|
|
73
77
|
/**
|
|
74
78
|
* Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
75
79
|
*/
|
|
@@ -103,10 +107,11 @@ export const SchemasPrice$inboundSchema: z.ZodType<
|
|
|
103
107
|
invoiceDisplayName: z.string(),
|
|
104
108
|
model: PriceModel$inboundSchema.optional(),
|
|
105
109
|
paymentTerm: SchemasPricePaymentTerm$inboundSchema,
|
|
106
|
-
properties:
|
|
110
|
+
properties: PriceProperties$inboundSchema,
|
|
107
111
|
updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
108
112
|
features: z.array(PriceFeature$inboundSchema).optional(),
|
|
109
113
|
grantDiscountEnabled: z.boolean().default(false),
|
|
114
|
+
isObligation: z.boolean().default(false),
|
|
110
115
|
quantity: z.number().int(),
|
|
111
116
|
});
|
|
112
117
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export const SubscriptionAdjustmentObject = {
|
|
12
|
+
SubscriptionAdjustment: "subscriptionAdjustment",
|
|
13
|
+
} as const;
|
|
14
|
+
export type SubscriptionAdjustmentObject = ClosedEnum<
|
|
15
|
+
typeof SubscriptionAdjustmentObject
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
export const SubscriptionAdjustmentType = {
|
|
19
|
+
PercentageDiscount: "percentageDiscount",
|
|
20
|
+
} as const;
|
|
21
|
+
export type SubscriptionAdjustmentType = ClosedEnum<
|
|
22
|
+
typeof SubscriptionAdjustmentType
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export type SubscriptionAdjustment = {
|
|
26
|
+
object: SubscriptionAdjustmentObject;
|
|
27
|
+
/**
|
|
28
|
+
* The adjustment ID
|
|
29
|
+
*/
|
|
30
|
+
id: string;
|
|
31
|
+
/**
|
|
32
|
+
* Unique identifier for a subscription
|
|
33
|
+
*/
|
|
34
|
+
subscriptionId: string;
|
|
35
|
+
type: SubscriptionAdjustmentType;
|
|
36
|
+
/**
|
|
37
|
+
* The discount rate as a decimal fraction between 0 and 1. "0.35" means 35 percent.
|
|
38
|
+
*/
|
|
39
|
+
percentageDiscount: string;
|
|
40
|
+
/**
|
|
41
|
+
* The first instant the discount applies. Inclusive.
|
|
42
|
+
*/
|
|
43
|
+
effectiveFrom: Date;
|
|
44
|
+
/**
|
|
45
|
+
* The instant the discount stops applying. Exclusive. Null means the discount never stops.
|
|
46
|
+
*/
|
|
47
|
+
effectiveTo: Date | null;
|
|
48
|
+
/**
|
|
49
|
+
* The deal's own name, shown on each discount line of the invoice.
|
|
50
|
+
*/
|
|
51
|
+
description: string | null;
|
|
52
|
+
createdAt: Date;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** @internal */
|
|
56
|
+
export const SubscriptionAdjustmentObject$inboundSchema: z.ZodNativeEnum<
|
|
57
|
+
typeof SubscriptionAdjustmentObject
|
|
58
|
+
> = z.nativeEnum(SubscriptionAdjustmentObject);
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const SubscriptionAdjustmentType$inboundSchema: z.ZodNativeEnum<
|
|
62
|
+
typeof SubscriptionAdjustmentType
|
|
63
|
+
> = z.nativeEnum(SubscriptionAdjustmentType);
|
|
64
|
+
|
|
65
|
+
/** @internal */
|
|
66
|
+
export const SubscriptionAdjustment$inboundSchema: z.ZodType<
|
|
67
|
+
SubscriptionAdjustment,
|
|
68
|
+
z.ZodTypeDef,
|
|
69
|
+
unknown
|
|
70
|
+
> = z.object({
|
|
71
|
+
object: SubscriptionAdjustmentObject$inboundSchema,
|
|
72
|
+
id: z.string(),
|
|
73
|
+
subscriptionId: z.string(),
|
|
74
|
+
type: SubscriptionAdjustmentType$inboundSchema,
|
|
75
|
+
percentageDiscount: z.string(),
|
|
76
|
+
effectiveFrom: z.string().datetime({ offset: true }).transform(v =>
|
|
77
|
+
new Date(v)
|
|
78
|
+
),
|
|
79
|
+
effectiveTo: z.nullable(
|
|
80
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
81
|
+
),
|
|
82
|
+
description: z.nullable(z.string()),
|
|
83
|
+
createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export function subscriptionAdjustmentFromJSON(
|
|
87
|
+
jsonString: string,
|
|
88
|
+
): SafeParseResult<SubscriptionAdjustment, SDKValidationError> {
|
|
89
|
+
return safeParse(
|
|
90
|
+
jsonString,
|
|
91
|
+
(x) => SubscriptionAdjustment$inboundSchema.parse(JSON.parse(x)),
|
|
92
|
+
`Failed to parse 'SubscriptionAdjustment' from JSON`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
OffsetPagination,
|
|
11
|
+
OffsetPagination$inboundSchema,
|
|
12
|
+
} from "./offsetpagination.js";
|
|
13
|
+
import {
|
|
14
|
+
SubscriptionAdjustment,
|
|
15
|
+
SubscriptionAdjustment$inboundSchema,
|
|
16
|
+
} from "./subscriptionadjustment.js";
|
|
17
|
+
|
|
18
|
+
export type SubscriptionAdjustmentsResponse = {
|
|
19
|
+
data: Array<SubscriptionAdjustment>;
|
|
20
|
+
/**
|
|
21
|
+
* Offset-based pagination response.
|
|
22
|
+
*/
|
|
23
|
+
pagination: OffsetPagination;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export const SubscriptionAdjustmentsResponse$inboundSchema: z.ZodType<
|
|
28
|
+
SubscriptionAdjustmentsResponse,
|
|
29
|
+
z.ZodTypeDef,
|
|
30
|
+
unknown
|
|
31
|
+
> = z.object({
|
|
32
|
+
data: z.array(SubscriptionAdjustment$inboundSchema),
|
|
33
|
+
pagination: OffsetPagination$inboundSchema,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export function subscriptionAdjustmentsResponseFromJSON(
|
|
37
|
+
jsonString: string,
|
|
38
|
+
): SafeParseResult<SubscriptionAdjustmentsResponse, SDKValidationError> {
|
|
39
|
+
return safeParse(
|
|
40
|
+
jsonString,
|
|
41
|
+
(x) => SubscriptionAdjustmentsResponse$inboundSchema.parse(JSON.parse(x)),
|
|
42
|
+
`Failed to parse 'SubscriptionAdjustmentsResponse' from JSON`,
|
|
43
|
+
);
|
|
44
|
+
}
|
package/src/sdk/subscriptions.ts
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { subscriptionsCreate } from "../funcs/subscriptionsCreate.js";
|
|
6
|
+
import { subscriptionsCreateSubscriptionAdjustment } from "../funcs/subscriptionsCreateSubscriptionAdjustment.js";
|
|
7
|
+
import { subscriptionsDeleteSubscriptionAdjustment } from "../funcs/subscriptionsDeleteSubscriptionAdjustment.js";
|
|
6
8
|
import { subscriptionsGeneratePortalLink } from "../funcs/subscriptionsGeneratePortalLink.js";
|
|
7
9
|
import { subscriptionsGet } from "../funcs/subscriptionsGet.js";
|
|
8
10
|
import { subscriptionsList } from "../funcs/subscriptionsList.js";
|
|
11
|
+
import { subscriptionsListSubscriptionAdjustments } from "../funcs/subscriptionsListSubscriptionAdjustments.js";
|
|
9
12
|
import { subscriptionsReconcileSubscriptionFeatures } from "../funcs/subscriptionsReconcileSubscriptionFeatures.js";
|
|
10
13
|
import { subscriptionsTerminate } from "../funcs/subscriptionsTerminate.js";
|
|
11
14
|
import { subscriptionsUpdateSubscription } from "../funcs/subscriptionsUpdateSubscription.js";
|
|
@@ -124,4 +127,55 @@ export class Subscriptions extends ClientSDK {
|
|
|
124
127
|
options,
|
|
125
128
|
));
|
|
126
129
|
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* List Adjustments
|
|
133
|
+
*
|
|
134
|
+
* @remarks
|
|
135
|
+
* Reads the adjustments on the subscription, oldest window first. A subscription with no adjustment returns an empty array. Paginated, because a long-running subscription accumulates one adjustment per rate change of every deal it has carried.
|
|
136
|
+
*/
|
|
137
|
+
async listSubscriptionAdjustments(
|
|
138
|
+
request: operations.ListSubscriptionAdjustmentsRequest,
|
|
139
|
+
options?: RequestOptions,
|
|
140
|
+
): Promise<models.SubscriptionAdjustmentsResponse> {
|
|
141
|
+
return unwrapAsync(subscriptionsListSubscriptionAdjustments(
|
|
142
|
+
this,
|
|
143
|
+
request,
|
|
144
|
+
options,
|
|
145
|
+
));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Create Adjustment
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* Attaches a percentage discount to the subscription for a dated window. Every invoice calculated while the window is open carries one discount line for each discounted charge, and tax is assessed on the reduced amount. An invoice that already exists is not changed, including one still in draft — the discount reaches the periods that close after it is created. There is no update operation, and a window cannot be changed after it is created. To change a rate before any invoice has issued under the discount, delete the adjustment and create a replacement. Once an invoice has issued the adjustment is permanent, so set effectiveTo at creation time whenever the deal has a known end date.
|
|
153
|
+
*/
|
|
154
|
+
async createSubscriptionAdjustment(
|
|
155
|
+
request: operations.CreateSubscriptionAdjustmentRequest,
|
|
156
|
+
options?: RequestOptions,
|
|
157
|
+
): Promise<models.SubscriptionAdjustment> {
|
|
158
|
+
return unwrapAsync(subscriptionsCreateSubscriptionAdjustment(
|
|
159
|
+
this,
|
|
160
|
+
request,
|
|
161
|
+
options,
|
|
162
|
+
));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Delete Adjustment
|
|
167
|
+
*
|
|
168
|
+
* @remarks
|
|
169
|
+
* Deletes an adjustment that has not yet reached an issued invoice. No invoice changes: an invoice still in draft keeps its numbers, and loses the discount only when its period is calculated again. An adjustment that has already discounted an issued invoice cannot be deleted, because the invoice records why the customer was charged that amount. Its window cannot be shortened afterwards either, so set effectiveTo at creation time whenever the deal has a known end date.
|
|
170
|
+
*/
|
|
171
|
+
async deleteSubscriptionAdjustment(
|
|
172
|
+
request: operations.DeleteSubscriptionAdjustmentRequest,
|
|
173
|
+
options?: RequestOptions,
|
|
174
|
+
): Promise<void> {
|
|
175
|
+
return unwrapAsync(subscriptionsDeleteSubscriptionAdjustment(
|
|
176
|
+
this,
|
|
177
|
+
request,
|
|
178
|
+
options,
|
|
179
|
+
));
|
|
180
|
+
}
|
|
127
181
|
}
|