Skip to content

Commit f347311

Browse files
authored
Merge pull request #24 from code-store-platform/feat/update-subs-sdk
Added SalesSDK v2 and enterprise creation method
2 parents 6042d0f + 6ce8365 commit f347311

File tree

5 files changed

+34
-2
lines changed

5 files changed

+34
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @code.store/arcxp-sdk-ts
22

3+
## 5.1.3
4+
5+
### Patch Changes
6+
7+
- Added SalesSDK of v2
8+
39
## 5.1.2
410

511
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code.store/arcxp-sdk-ts",
3-
"version": "5.1.2",
3+
"version": "5.1.3",
44
"description": "A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.",
55
"type": "module",
66
"main": "./dist/index.js",

src/api/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { ArcProtoCenter } from './photo-center/index.js';
1212
import { ArcRedirect } from './redirect/index.js';
1313
import { ArcRetailEvents } from './retail-events/index.js';
1414
import { ArcDeveloperRetail } from './developer-retail/index.js';
15-
import { ArcSales } from './sales/index.js';
15+
import { ArcSales, ArcSalesV2 } from './sales/index.js';
1616
import { ArcSigningService } from './signing-service/index.js';
1717
import { ArcSite } from './site/index.js';
1818
import { ArcTags } from './tags/index.js';
@@ -27,6 +27,7 @@ export const ArcAPI = (options: ArcAPIOptions) => {
2727
Redirect: new ArcRedirect(options),
2828
MigrationCenter: new ArcMigrationCenter(options),
2929
Sales: new ArcSales(options),
30+
SalesV2: new ArcSalesV2(options),
3031
Site: new ArcSite(options),
3132
Websked: new ArcWebsked(options),
3233
Content: new ArcContent(options),

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)