starta.apiclient 1.112.12488 → 1.112.12519
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.
|
@@ -36,6 +36,7 @@ import Loans from './loans';
|
|
|
36
36
|
import PnlPlans from './pnlPlans';
|
|
37
37
|
import Loyalty from './loyalty';
|
|
38
38
|
import Calendar from './calendar';
|
|
39
|
+
import PromoCodes from './promocodes';
|
|
39
40
|
import { CreateOrg, TariffDetails } from '../../types';
|
|
40
41
|
export default class Organizations {
|
|
41
42
|
private _requestRunner;
|
|
@@ -162,4 +163,5 @@ export default class Organizations {
|
|
|
162
163
|
get resourceOperations(): ResourceOperations;
|
|
163
164
|
get notificationCenter(): NotificationCenter;
|
|
164
165
|
get warehouseOperations(): WarehouseOperations;
|
|
166
|
+
get promocodes(): PromoCodes;
|
|
165
167
|
}
|
|
@@ -37,6 +37,7 @@ const loans_1 = require("./loans");
|
|
|
37
37
|
const pnlPlans_1 = require("./pnlPlans");
|
|
38
38
|
const loyalty_1 = require("./loyalty");
|
|
39
39
|
const calendar_1 = require("./calendar");
|
|
40
|
+
const promocodes_1 = require("./promocodes");
|
|
40
41
|
const _helpers_1 = require("../_helpers");
|
|
41
42
|
class Organizations {
|
|
42
43
|
constructor(requestRunner) {
|
|
@@ -411,5 +412,8 @@ class Organizations {
|
|
|
411
412
|
get warehouseOperations() {
|
|
412
413
|
return new warehouseOperations_1.default(this._requestRunner);
|
|
413
414
|
}
|
|
415
|
+
get promocodes() {
|
|
416
|
+
return new promocodes_1.default(this._requestRunner);
|
|
417
|
+
}
|
|
414
418
|
}
|
|
415
419
|
exports.default = Organizations;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PromoCodeInput, StartaRequestRunner } from '../../types';
|
|
2
|
+
export default class PromoCodesApi {
|
|
3
|
+
private _requestRunner;
|
|
4
|
+
constructor(requestRunner: StartaRequestRunner);
|
|
5
|
+
index(organizationLogin: string): Promise<import("../../types").StartaResponse>;
|
|
6
|
+
get(organizationLogin: string, promoCodeId: string): Promise<import("../../types").StartaResponse>;
|
|
7
|
+
add(organizationLogin: string, promo: PromoCodeInput): Promise<import("../../types").StartaResponse>;
|
|
8
|
+
update(organizationLogin: string, promoCodeId: string, promo: PromoCodeInput): Promise<import("../../types").StartaResponse>;
|
|
9
|
+
delete(organizationLogin: string, promoCodeId: string): Promise<import("../../types").StartaResponse>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class PromoCodesApi {
|
|
4
|
+
constructor(requestRunner) {
|
|
5
|
+
this._requestRunner = requestRunner;
|
|
6
|
+
}
|
|
7
|
+
// #region PromoCodes: list & get
|
|
8
|
+
index(organizationLogin) {
|
|
9
|
+
return this._requestRunner.performRequest({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
url: `/accounts/${organizationLogin}/promocodes`,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
get(organizationLogin, promoCodeId) {
|
|
15
|
+
return this._requestRunner.performRequest({
|
|
16
|
+
method: 'GET',
|
|
17
|
+
url: `/accounts/${organizationLogin}/promocodes/${promoCodeId}`,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
// #endregion
|
|
21
|
+
// #region Create / Update / Delete
|
|
22
|
+
add(organizationLogin, promo) {
|
|
23
|
+
return this._requestRunner.performRequest({
|
|
24
|
+
method: 'POST',
|
|
25
|
+
url: `/accounts/${organizationLogin}/promocodes`,
|
|
26
|
+
body: promo,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
update(organizationLogin, promoCodeId, promo) {
|
|
30
|
+
return this._requestRunner.performRequest({
|
|
31
|
+
method: 'PUT',
|
|
32
|
+
url: `/accounts/${organizationLogin}/promocodes/${promoCodeId}`,
|
|
33
|
+
body: promo,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
delete(organizationLogin, promoCodeId) {
|
|
37
|
+
return this._requestRunner.performRequest({
|
|
38
|
+
method: 'DELETE',
|
|
39
|
+
url: `/accounts/${organizationLogin}/promocodes/${promoCodeId}`,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.default = PromoCodesApi;
|
package/lib/types.d.ts
CHANGED
|
@@ -329,6 +329,27 @@ export type CriteriaData = {
|
|
|
329
329
|
period: 'day' | 'month';
|
|
330
330
|
conditions: Array<CriteriaCondition>;
|
|
331
331
|
};
|
|
332
|
+
export interface PromoCodeInput {
|
|
333
|
+
enabled: boolean;
|
|
334
|
+
name: string;
|
|
335
|
+
code: string;
|
|
336
|
+
description?: string;
|
|
337
|
+
discountType: 'percent' | 'fixedAmount';
|
|
338
|
+
discountValue: number;
|
|
339
|
+
validFrom?: string;
|
|
340
|
+
validTo?: string;
|
|
341
|
+
limitTotalUses?: number;
|
|
342
|
+
onlyForNewCustomers?: boolean;
|
|
343
|
+
allowMultipleUseBySingleCustomer?: boolean;
|
|
344
|
+
minOrderPrice?: number;
|
|
345
|
+
maxDiscountAmount?: number;
|
|
346
|
+
applyTo: {
|
|
347
|
+
servicesEnabled: boolean;
|
|
348
|
+
serviceIds?: string[];
|
|
349
|
+
productsEnabled: boolean;
|
|
350
|
+
productIds?: string[];
|
|
351
|
+
};
|
|
352
|
+
}
|
|
332
353
|
export type OrgRewardType = 'ProfileInCatalog' | 'SystemUser' | 'StartOfFame' | 'HandsFree' | 'SNBoost';
|
|
333
354
|
type CustomerContactData = {
|
|
334
355
|
channel: 'call' | 'telegram' | 'viber' | 'sms';
|