Skip to content

Commit d06698d

Browse files
committed
add site
1 parent f347311 commit d06698d

5 files changed

Lines changed: 45 additions & 5 deletions

File tree

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.4
4+
5+
### Patch Changes
6+
7+
- add site to createEnterpriseGroup request
8+
39
## 5.1.3
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.3",
3+
"version": "5.1.4",
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/abstract-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export abstract class ArcAbstractAPI {
3838
// apply retry
3939
const retry = typeof axiosRetry === 'function' ? axiosRetry : (axiosRetry as any).default;
4040
retry(this.client, {
41-
retries: 5,
41+
retries: 10,
4242
retryDelay: axiosRetry.exponentialDelay,
4343
retryCondition: (err: AxiosError) => this.retryCondition(err),
4444
});

src/api/sales/index.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import FormData from 'form-data';
22
import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js';
33
import type {
4+
CreateEnterpriseGroupParams,
45
CreateEnterpriseGroupPayload,
56
CreateEnterpriseGroupResponse,
7+
CreateNonceResponse,
68
MigrateBatchSubscriptionsParams,
79
MigrateBatchSubscriptionsPayload,
810
MigrateBatchSubscriptionsResponse,
@@ -33,8 +35,31 @@ export class ArcSalesV2 extends ArcAbstractAPI {
3335
super({ ...options, apiPath: 'sales/api/v2' });
3436
}
3537

36-
async createEnterpriseGroup(payload: CreateEnterpriseGroupPayload): Promise<CreateEnterpriseGroupResponse> {
37-
const { data } = await this.client.post<CreateEnterpriseGroupResponse>('/subscriptions/enterprise', payload);
38+
async getEnterpriseGroups(params: CreateEnterpriseGroupParams): Promise<CreateEnterpriseGroupResponse> {
39+
const { data } = await this.client.get<any>('/subscriptions/enterprise', {
40+
params: {
41+
'arc-site': params.site,
42+
},
43+
});
44+
return data;
45+
}
46+
47+
async createEnterpriseGroup(
48+
params: CreateEnterpriseGroupParams,
49+
payload: CreateEnterpriseGroupPayload
50+
): Promise<CreateEnterpriseGroupResponse> {
51+
const { data } = await this.client.post<CreateEnterpriseGroupResponse>('/subscriptions/enterprise', payload, {
52+
params: {
53+
'arc-site': params.site,
54+
},
55+
});
56+
return data;
57+
}
58+
59+
async createNonce(website: string, enterpriseGroupId: number) {
60+
const { data } = await this.client.get<CreateNonceResponse>(`/subscriptions/enterprise/${enterpriseGroupId}`, {
61+
params: { 'arc-site': website },
62+
});
3863
return data;
3964
}
4065
}

src/api/sales/types.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { UserAttribute } from '../identity/types';
21
import type { Website } from '../../types/ans-types';
2+
import type { UserAttribute } from '../identity/types';
33

44
export type MigrateBatchSubscriptionsPayload = {
55
subscriptions: (PaidSubscription | FreeSubscription | SharedSubscription | LinkedSubscription)[];
@@ -93,6 +93,10 @@ export type Refund = {
9393
providerReference?: string;
9494
};
9595

96+
export type CreateEnterpriseGroupParams = {
97+
site: string;
98+
};
99+
96100
export type CreateEnterpriseGroupPayload = {
97101
name: string;
98102
sku: string;
@@ -104,3 +108,8 @@ export type CreateEnterpriseGroupResponse = {
104108
nonceExpirationInDays: number;
105109
id: number;
106110
};
111+
112+
export type CreateNonceResponse = {
113+
nonce: string;
114+
expires: string;
115+
};

0 commit comments

Comments
 (0)