Skip to content

Commit 630753b

Browse files
authored
Merge pull request #155 from orbcorp/release-please--branches--main--changes--next--components--orb-billing
release: 2.3.0
2 parents b848d1f + 61f722c commit 630753b

32 files changed

+742
-143
lines changed

.devcontainer/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ RUN apt-get update && apt-get install -y \
77
yarnpkg \
88
&& apt-get clean autoclean
99

10+
# Ensure UTF-8 encoding
11+
ENV LANG=C.UTF-8
12+
ENV LC_ALL=C.UTF-8
13+
1014
# Yarn
1115
RUN ln -sf /usr/bin/yarnpkg /usr/bin/yarn
1216

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ jobs:
2828
- name: Check types
2929
run: |
3030
yarn build
31+
32+

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ dist
55
/deno
66
/*.tgz
77
.idea/
8+

.prettierignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CHANGELOG.md
2-
/ecosystem-tests
2+
/ecosystem-tests/*/**
33
/node_modules
44
/deno
55

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "2.2.0"
2+
".": "2.3.0"
33
}

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 81
1+
configured_endpoints: 82

CHANGELOG.md

+33
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
# Changelog
22

3+
## 2.3.0 (2024-04-24)
4+
5+
Full Changelog: [v2.2.0...v2.3.0](https://github.com/orbcorp/orb-node/compare/v2.2.0...v2.3.0)
6+
7+
### Features
8+
9+
* **api:** add effective_date field ([#163](https://github.com/orbcorp/orb-node/issues/163)) ([96a98bd](https://github.com/orbcorp/orb-node/commit/96a98bd315ceb6f2239dee6267bcf0b3a7e84a39))
10+
* **api:** add subscription update endpoint ([#168](https://github.com/orbcorp/orb-node/issues/168)) ([09b5798](https://github.com/orbcorp/orb-node/commit/09b5798769187bcb18c92210c8b336b169f72343))
11+
* **api:** add the shared model PaginationMetadata ([#164](https://github.com/orbcorp/orb-node/issues/164)) ([15f5af3](https://github.com/orbcorp/orb-node/commit/15f5af31b39a66ef8a626af50d09abf3202afc8f))
12+
* **api:** price evaluation endpoint generally available ([#169](https://github.com/orbcorp/orb-node/issues/169)) ([492a728](https://github.com/orbcorp/orb-node/commit/492a72833150267df706054e5d8c1ce998b27999))
13+
* **api:** updates ([#154](https://github.com/orbcorp/orb-node/issues/154)) ([01aef6d](https://github.com/orbcorp/orb-node/commit/01aef6d41d2fd0f6174eb6116ac2a670cfc96882))
14+
* **api:** updates ([#159](https://github.com/orbcorp/orb-node/issues/159)) ([5b6287c](https://github.com/orbcorp/orb-node/commit/5b6287c047ed1a5eab7e498690838062c233a1a7))
15+
16+
17+
### Bug Fixes
18+
19+
* **api:** add shared model BillingCycleRelativeDate ([#167](https://github.com/orbcorp/orb-node/issues/167)) ([8677375](https://github.com/orbcorp/orb-node/commit/867737537ddecdfcaaf33bb0bd3fe29532f265c4))
20+
* **api:** some path params were incorrectly typed as nullable ([#166](https://github.com/orbcorp/orb-node/issues/166)) ([eeb81d4](https://github.com/orbcorp/orb-node/commit/eeb81d4ade556528cf564b850b0d1b932fbfd999))
21+
* use UTC timezone for verifying webhook signature ([9a0b87a](https://github.com/orbcorp/orb-node/commit/9a0b87a704a84608383c66cb5acb73f55aa97b3c)), closes [#156](https://github.com/orbcorp/orb-node/issues/156)
22+
23+
24+
### Chores
25+
26+
* **internal:** formatting ([#161](https://github.com/orbcorp/orb-node/issues/161)) ([db765d8](https://github.com/orbcorp/orb-node/commit/db765d86efc540e6301fc15912360ba66218c673))
27+
* **internal:** update gitignore ([#160](https://github.com/orbcorp/orb-node/issues/160)) ([7a2c39f](https://github.com/orbcorp/orb-node/commit/7a2c39f468ea6aba7133d6fdfd28c632c119e145))
28+
* **internal:** use @swc/jest for running tests ([#165](https://github.com/orbcorp/orb-node/issues/165)) ([c744e70](https://github.com/orbcorp/orb-node/commit/c744e70bf74385171fea39d73c9611f792661a3c))
29+
* use debug instead of console log for webhook signature logging ([590cbf1](https://github.com/orbcorp/orb-node/commit/590cbf17e37a7eb071d6d31295b3f9cc9bb46579))
30+
31+
32+
### Build System
33+
34+
* configure UTF-8 locale in devcontainer ([#162](https://github.com/orbcorp/orb-node/issues/162)) ([aa09c7d](https://github.com/orbcorp/orb-node/commit/aa09c7dfc261b6e05e8e944f23a55463f80d13da))
35+
336
## 2.2.0 (2024-04-08)
437

538
Full Changelog: [v2.1.2...v2.2.0](https://github.com/orbcorp/orb-node/compare/v2.1.2...v2.2.0)

api.md

+7-21
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
Types:
44

5+
- <code><a href="./src/resources/shared.ts">BillingCycleRelativeDate</a></code>
56
- <code><a href="./src/resources/shared.ts">Discount</a></code>
7+
- <code><a href="./src/resources/shared.ts">PaginationMetadata</a></code>
68

79
# TopLevel
810

@@ -253,12 +255,15 @@ Methods:
253255

254256
Types:
255257

258+
- <code><a href="./src/resources/prices/prices.ts">EvaluatePriceGroup</a></code>
256259
- <code><a href="./src/resources/prices/prices.ts">Price</a></code>
260+
- <code><a href="./src/resources/prices/prices.ts">PriceEvaluateResponse</a></code>
257261

258262
Methods:
259263

260264
- <code title="post /prices">client.prices.<a href="./src/resources/prices/prices.ts">create</a>({ ...params }) -> Price</code>
261265
- <code title="get /prices">client.prices.<a href="./src/resources/prices/prices.ts">list</a>({ ...params }) -> PricesPage</code>
266+
- <code title="post /prices/{price_id}/evaluate">client.prices.<a href="./src/resources/prices/prices.ts">evaluate</a>(priceId, { ...params }) -> PriceEvaluateResponse</code>
262267
- <code title="get /prices/{price_id}">client.prices.<a href="./src/resources/prices/prices.ts">fetch</a>(priceId) -> Price</code>
263268

264269
## ExternalPriceID
@@ -280,6 +285,7 @@ Types:
280285
Methods:
281286

282287
- <code title="post /subscriptions">client.subscriptions.<a href="./src/resources/subscriptions.ts">create</a>({ ...params }) -> Subscription</code>
288+
- <code title="put /subscriptions/{subscription_id}">client.subscriptions.<a href="./src/resources/subscriptions.ts">update</a>(subscriptionId, { ...params }) -> Subscription</code>
283289
- <code title="get /subscriptions">client.subscriptions.<a href="./src/resources/subscriptions.ts">list</a>({ ...params }) -> SubscriptionsPage</code>
284290
- <code title="post /subscriptions/{subscription_id}/cancel">client.subscriptions.<a href="./src/resources/subscriptions.ts">cancel</a>(subscriptionId, { ...params }) -> Subscription</code>
285291
- <code title="get /subscriptions/{subscription_id}">client.subscriptions.<a href="./src/resources/subscriptions.ts">fetch</a>(subscriptionId) -> Subscription</code>
@@ -292,24 +298,4 @@ Methods:
292298
- <code title="post /subscriptions/{subscription_id}/unschedule_cancellation">client.subscriptions.<a href="./src/resources/subscriptions.ts">unscheduleCancellation</a>(subscriptionId) -> Subscription</code>
293299
- <code title="post /subscriptions/{subscription_id}/unschedule_fixed_fee_quantity_updates">client.subscriptions.<a href="./src/resources/subscriptions.ts">unscheduleFixedFeeQuantityUpdates</a>(subscriptionId, { ...params }) -> Subscription</code>
294300
- <code title="post /subscriptions/{subscription_id}/unschedule_pending_plan_changes">client.subscriptions.<a href="./src/resources/subscriptions.ts">unschedulePendingPlanChanges</a>(subscriptionId) -> Subscription</code>
295-
- <code title="post /subscriptions/{subscription_id}/update_fixed_fee_quantity">client.subscriptions.<a href="./src/resources/subscriptions.ts">updateFixedFeeQuantity</a>(subscriptionId, { ...params }) -> Subscription</code>
296-
297-
# Webhooks
298-
299-
Methods:
300-
301-
- <code>client.webhooks.<a href="./src/resources/webhooks.ts">unwrap</a>(payload, headers, secret) -> Object</code>
302-
- <code>client.webhooks.<a href="./src/resources/webhooks.ts">verifySignature</a>(body, headers, secret) -> void</code>
303-
304-
# Beta
305-
306-
## Price
307-
308-
Types:
309-
310-
- <code><a href="./src/resources/beta/price.ts">EvaluatePriceGroup</a></code>
311-
- <code><a href="./src/resources/beta/price.ts">PriceEvaluateResponse</a></code>
312-
313-
Methods:
314-
315-
- <code title="post /prices/{price_id}/evaluate">client.beta.price.<a href="./src/resources/beta/price.ts">evaluate</a>(priceId, { ...params }) -> PriceEvaluateResponse</code>
301+
- <code title="post /subscriptions/{subscription_id}/update_fixed_fee_quantity">client.subscriptions.<a href="./src/resources/subscriptions.ts">updateFixedFeeQuantity</a>(subscriptionId, { ...params }) -> Subscription</code>

jest.config.ts

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import type { JestConfigWithTsJest } from 'ts-jest';
33
const config: JestConfigWithTsJest = {
44
preset: 'ts-jest/presets/default-esm',
55
testEnvironment: 'node',
6+
transform: {
7+
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
8+
},
69
moduleNameMapper: {
710
'^orb-billing$': '<rootDir>/src/index.ts',
811
'^orb-billing/_shims/auto/(.*)$': '<rootDir>/src/_shims/auto/$1-node',

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "orb-billing",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"description": "The official TypeScript library for the Orb API",
55
"author": "Orb <[email protected]>",
66
"types": "dist/index.d.ts",
@@ -37,6 +37,8 @@
3737
"web-streams-polyfill": "^3.2.1"
3838
},
3939
"devDependencies": {
40+
"@swc/core": "^1.3.102",
41+
"@swc/jest": "^0.2.29",
4042
"@types/jest": "^29.4.0",
4143
"@typescript-eslint/eslint-plugin": "^6.7.0",
4244
"@typescript-eslint/parser": "^6.7.0",

src/index.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ export class Orb extends Core.APIClient {
141141
plans: API.Plans = new API.Plans(this);
142142
prices: API.Prices = new API.Prices(this);
143143
subscriptions: API.Subscriptions = new API.Subscriptions(this);
144-
beta: API.Beta = new API.Beta(this);
145144
webhooks: API.Webhooks = new API.Webhooks(this);
146145

147146
protected override defaultQuery(): Core.DefaultQuery | undefined {
@@ -190,6 +189,9 @@ export class Orb extends Core.APIClient {
190189
static OrbInternalServerError = Errors.OrbInternalServerError;
191190
static UnprocessableEntityError = Errors.UnprocessableEntityError;
192191
static DuplicateResourceCreation = Errors.DuplicateResourceCreation;
192+
193+
static toFile = Uploads.toFile;
194+
static fileFromPath = Uploads.fileFromPath;
193195
}
194196

195197
export const {
@@ -224,10 +226,6 @@ export import toFile = Uploads.toFile;
224226
export import fileFromPath = Uploads.fileFromPath;
225227

226228
export namespace Orb {
227-
// Helper functions
228-
export import toFile = Uploads.toFile;
229-
export import fileFromPath = Uploads.fileFromPath;
230-
231229
export import RequestOptions = Core.RequestOptions;
232230

233231
export import Page = Pagination.Page;
@@ -300,10 +298,13 @@ export namespace Orb {
300298
export import PlanListParams = API.PlanListParams;
301299

302300
export import Prices = API.Prices;
301+
export import EvaluatePriceGroup = API.EvaluatePriceGroup;
303302
export import Price = API.Price;
303+
export import PriceEvaluateResponse = API.PriceEvaluateResponse;
304304
export import PricesPage = API.PricesPage;
305305
export import PriceCreateParams = API.PriceCreateParams;
306306
export import PriceListParams = API.PriceListParams;
307+
export import PriceEvaluateParams = API.PriceEvaluateParams;
307308

308309
export import Subscriptions = API.Subscriptions;
309310
export import Subscription = API.Subscription;
@@ -313,6 +314,7 @@ export namespace Orb {
313314
export import SubscriptionsPage = API.SubscriptionsPage;
314315
export import SubscriptionFetchScheduleResponsesPage = API.SubscriptionFetchScheduleResponsesPage;
315316
export import SubscriptionCreateParams = API.SubscriptionCreateParams;
317+
export import SubscriptionUpdateParams = API.SubscriptionUpdateParams;
316318
export import SubscriptionListParams = API.SubscriptionListParams;
317319
export import SubscriptionCancelParams = API.SubscriptionCancelParams;
318320
export import SubscriptionFetchCostsParams = API.SubscriptionFetchCostsParams;
@@ -324,9 +326,9 @@ export namespace Orb {
324326
export import SubscriptionUnscheduleFixedFeeQuantityUpdatesParams = API.SubscriptionUnscheduleFixedFeeQuantityUpdatesParams;
325327
export import SubscriptionUpdateFixedFeeQuantityParams = API.SubscriptionUpdateFixedFeeQuantityParams;
326328

327-
export import Beta = API.Beta;
328-
329+
export import BillingCycleRelativeDate = API.BillingCycleRelativeDate;
329330
export import Discount = API.Discount;
331+
export import PaginationMetadata = API.PaginationMetadata;
330332
}
331333

332334
export default Orb;

src/resources/coupons/coupons.ts

+3-26
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export namespace Coupon {
144144
}
145145

146146
export interface CouponCreateParams {
147-
discount: CouponCreateParams.PercentageDiscount | CouponCreateParams.AmountDiscount;
147+
discount: CouponCreateParams.NewCouponPercentageDiscount | CouponCreateParams.NewCouponAmountDiscount;
148148

149149
/**
150150
* This string can be used to redeem this coupon for a given subscription.
@@ -165,39 +165,16 @@ export interface CouponCreateParams {
165165
}
166166

167167
export namespace CouponCreateParams {
168-
export interface PercentageDiscount {
169-
/**
170-
* List of price_ids that this discount applies to. For plan/plan phase discounts,
171-
* this can be a subset of prices.
172-
*/
173-
applies_to_price_ids: Array<string>;
174-
168+
export interface NewCouponPercentageDiscount {
175169
discount_type: 'percentage';
176170

177-
/**
178-
* Only available if discount_type is `percentage`. This is a number between 0
179-
* and 1.
180-
*/
181171
percentage_discount: number;
182-
183-
reason?: string | null;
184172
}
185173

186-
export interface AmountDiscount {
187-
/**
188-
* Only available if discount_type is `amount`.
189-
*/
174+
export interface NewCouponAmountDiscount {
190175
amount_discount: string;
191176

192-
/**
193-
* List of price_ids that this discount applies to. For plan/plan phase discounts,
194-
* this can be a subset of prices.
195-
*/
196-
applies_to_price_ids: Array<string>;
197-
198177
discount_type: 'amount';
199-
200-
reason?: string | null;
201178
}
202179
}
203180

src/resources/customers/costs.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ export class Costs extends APIResource {
144144
* `grouping_value` and `secondary_grouping_value` available.
145145
*/
146146
list(
147-
customerId: string | null,
147+
customerId: string,
148148
query?: CostListParams,
149149
options?: Core.RequestOptions,
150150
): Core.APIPromise<CostListResponse>;
151-
list(customerId: string | null, options?: Core.RequestOptions): Core.APIPromise<CostListResponse>;
151+
list(customerId: string, options?: Core.RequestOptions): Core.APIPromise<CostListResponse>;
152152
list(
153-
customerId: string | null,
153+
customerId: string,
154154
query: CostListParams | Core.RequestOptions = {},
155155
options?: Core.RequestOptions,
156156
): Core.APIPromise<CostListResponse> {
@@ -297,16 +297,16 @@ export class Costs extends APIResource {
297297
* `grouping_value` and `secondary_grouping_value` available.
298298
*/
299299
listByExternalId(
300-
externalCustomerId: string | null,
300+
externalCustomerId: string,
301301
query?: CostListByExternalIDParams,
302302
options?: Core.RequestOptions,
303303
): Core.APIPromise<CostListByExternalIDResponse>;
304304
listByExternalId(
305-
externalCustomerId: string | null,
305+
externalCustomerId: string,
306306
options?: Core.RequestOptions,
307307
): Core.APIPromise<CostListByExternalIDResponse>;
308308
listByExternalId(
309-
externalCustomerId: string | null,
309+
externalCustomerId: string,
310310
query: CostListByExternalIDParams | Core.RequestOptions = {},
311311
options?: Core.RequestOptions,
312312
): Core.APIPromise<CostListByExternalIDResponse> {

src/resources/customers/credits/credits.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ export class Credits extends APIResource {
1616
* Returns a paginated list of unexpired, non-zero credit blocks for a customer.
1717
*/
1818
list(
19-
customerId: string | null,
19+
customerId: string,
2020
query?: CreditListParams,
2121
options?: Core.RequestOptions,
2222
): Core.PagePromise<CreditListResponsesPage, CreditListResponse>;
2323
list(
24-
customerId: string | null,
24+
customerId: string,
2525
options?: Core.RequestOptions,
2626
): Core.PagePromise<CreditListResponsesPage, CreditListResponse>;
2727
list(
28-
customerId: string | null,
28+
customerId: string,
2929
query: CreditListParams | Core.RequestOptions = {},
3030
options?: Core.RequestOptions,
3131
): Core.PagePromise<CreditListResponsesPage, CreditListResponse> {
@@ -42,16 +42,16 @@ export class Credits extends APIResource {
4242
* Returns a paginated list of unexpired, non-zero credit blocks for a customer.
4343
*/
4444
listByExternalId(
45-
externalCustomerId: string | null,
45+
externalCustomerId: string,
4646
query?: CreditListByExternalIDParams,
4747
options?: Core.RequestOptions,
4848
): Core.PagePromise<CreditListByExternalIDResponsesPage, CreditListByExternalIDResponse>;
4949
listByExternalId(
50-
externalCustomerId: string | null,
50+
externalCustomerId: string,
5151
options?: Core.RequestOptions,
5252
): Core.PagePromise<CreditListByExternalIDResponsesPage, CreditListByExternalIDResponse>;
5353
listByExternalId(
54-
externalCustomerId: string | null,
54+
externalCustomerId: string,
5555
query: CreditListByExternalIDParams | Core.RequestOptions = {},
5656
options?: Core.RequestOptions,
5757
): Core.PagePromise<CreditListByExternalIDResponsesPage, CreditListByExternalIDResponse> {
@@ -75,6 +75,8 @@ export interface CreditListResponse {
7575

7676
balance: number;
7777

78+
effective_date: string | null;
79+
7880
expiry_date: string | null;
7981

8082
per_unit_cost_basis: string | null;
@@ -87,6 +89,8 @@ export interface CreditListByExternalIDResponse {
8789

8890
balance: number;
8991

92+
effective_date: string | null;
93+
9094
expiry_date: string | null;
9195

9296
per_unit_cost_basis: string | null;

0 commit comments

Comments
 (0)