Skip to content

Commit ce76ef9

Browse files
committed
Added SalesSDK v2 and enterprise creation method
1 parent 6042d0f commit ce76ef9

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/api/sales/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import FormData from 'form-data';
22
import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js';
33
import type {
4+
CreateEnterpriseGroupPayload,
5+
CreateEnterpriseGroupResponse,
46
MigrateBatchSubscriptionsParams,
57
MigrateBatchSubscriptionsPayload,
68
MigrateBatchSubscriptionsResponse,
@@ -25,3 +27,14 @@ export class ArcSales extends ArcAbstractAPI {
2527
return data;
2628
}
2729
}
30+
31+
export class ArcSalesV2 extends ArcAbstractAPI {
32+
constructor(options: ArcAPIOptions) {
33+
super({ ...options, apiPath: 'sales/api/v2' });
34+
}
35+
36+
async createEnterpriseGroup(payload: CreateEnterpriseGroupPayload): Promise<CreateEnterpriseGroupResponse> {
37+
const { data } = await this.client.post<CreateEnterpriseGroupResponse>('/subscriptions/enterprise', payload);
38+
return data;
39+
}
40+
}

src/api/sales/types.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,15 @@ export type Refund = {
9292
tax: number;
9393
providerReference?: string;
9494
};
95+
96+
export type CreateEnterpriseGroupPayload = {
97+
name: string;
98+
sku: string;
99+
};
100+
101+
export type CreateEnterpriseGroupResponse = {
102+
name: string;
103+
sku: string;
104+
nonceExpirationInDays: number;
105+
id: number;
106+
};

0 commit comments

Comments
 (0)