starta.apiclient 1.112.11313 → 1.112.11323

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.
@@ -1,10 +1,7 @@
1
- import { CertificateInput, StartaRequestRunner } from '../../types';
1
+ import { StartaRequestRunner } from '../../types';
2
2
  export default class Certificates {
3
3
  private _requestRunner;
4
4
  constructor(requestRunner: StartaRequestRunner);
5
- add(organizationLogin: string, certificate: CertificateInput): Promise<import("../../types").StartaResponse>;
6
- update(organizationLogin: string, certificateTypeId: string, certificate: CertificateInput): Promise<import("../../types").StartaResponse>;
7
- delete(organizationLogin: string, certificateTypeId: string): Promise<import("../../types").StartaResponse>;
8
5
  index(organizationLogin: string, { customerId }?: {
9
6
  customerId?: string;
10
7
  }): Promise<import("../../types").StartaResponse>;
@@ -5,26 +5,6 @@ class Certificates {
5
5
  constructor(requestRunner) {
6
6
  this._requestRunner = requestRunner;
7
7
  }
8
- add(organizationLogin, certificate) {
9
- return this._requestRunner.performRequest({
10
- url: `accounts/${organizationLogin}/certificateTypes`,
11
- method: 'POST',
12
- body: certificate,
13
- });
14
- }
15
- update(organizationLogin, certificateTypeId, certificate) {
16
- return this._requestRunner.performRequest({
17
- url: `accounts/${organizationLogin}/certificateTypes/${certificateTypeId}`,
18
- method: 'PUT',
19
- body: certificate,
20
- });
21
- }
22
- delete(organizationLogin, certificateTypeId) {
23
- return this._requestRunner.performRequest({
24
- url: `accounts/${organizationLogin}/certificateTypes/${certificateTypeId}`,
25
- method: 'DELETE',
26
- });
27
- }
28
8
  index(organizationLogin, { customerId } = {}) {
29
9
  return this._requestRunner.performRequest({
30
10
  url: `accounts/${organizationLogin}/certificates${(0, _helpers_1.buildQuery)({ customerId })}`,
@@ -119,4 +119,5 @@ export default class Customers {
119
119
  }): Promise<import("../../../types").StartaResponse>;
120
120
  issueLoyaltyCard(organizationLogin: string, customerId: string, cardTypeId: string): Promise<import("../../../types").StartaResponse>;
121
121
  deleteLoyaltyCard(organizationLogin: string, customerId: string, cardId: string): Promise<import("../../../types").StartaResponse>;
122
+ getLoyaltyCard(organizationLogin: string, customerId: string, cardId: string): Promise<import("../../../types").StartaResponse>;
122
123
  }
@@ -126,16 +126,22 @@ class Customers {
126
126
  }
127
127
  issueLoyaltyCard(organizationLogin, customerId, cardTypeId) {
128
128
  return this._requestRunner.performRequest({
129
- url: `/accounts/${organizationLogin}/customers/${customerId}/loyalty/cards`,
129
+ url: `accounts/${organizationLogin}/customers/${customerId}/loyalty/cards`,
130
130
  method: 'POST',
131
131
  body: { cardTypeId },
132
132
  });
133
133
  }
134
134
  deleteLoyaltyCard(organizationLogin, customerId, cardId) {
135
135
  return this._requestRunner.performRequest({
136
- url: `/accounts/${organizationLogin}/customers/${customerId}/loyalty/cards/${cardId}`,
136
+ url: `accounts/${organizationLogin}/customers/${customerId}/loyalty/cards/${cardId}`,
137
137
  method: 'DELETE',
138
138
  });
139
139
  }
140
+ getLoyaltyCard(organizationLogin, customerId, cardId) {
141
+ return this._requestRunner.performRequest({
142
+ url: `accounts/${organizationLogin}/customers/${customerId}/loyalty/cards/${cardId}`,
143
+ method: 'GET',
144
+ });
145
+ }
140
146
  }
141
147
  exports.default = Customers;
@@ -1,13 +1,19 @@
1
- import { LoyaltyCardType, LoyaltyProgramType, StartaRequestRunner } from '../../types';
1
+ import { LoyaltyCardType, LoyaltyProgramType, StartaRequestRunner, CertificateInput, MembershipInput } from '../../types';
2
2
  export default class Loyalty {
3
3
  private _requestRunner;
4
4
  constructor(requestRunner: StartaRequestRunner);
5
5
  getSettings(organizationLogin: string): Promise<import("../../types").StartaResponse>;
6
+ getIssuedCards(organizationLogin: string): Promise<import("../../types").StartaResponse>;
6
7
  addCardType(organizationLogin: string, cardType: LoyaltyCardType): Promise<import("../../types").StartaResponse>;
7
8
  updateCardType(organizationLogin: string, cardTypeId: string, cardType: LoyaltyCardType): Promise<import("../../types").StartaResponse>;
8
9
  deleteCardType(organizationLogin: string, cardTypeId: string): Promise<import("../../types").StartaResponse>;
9
- getIssuedCards(organizationLogin: string): Promise<import("../../types").StartaResponse>;
10
10
  addProgramType(organizationLogin: string, programType: LoyaltyProgramType): Promise<import("../../types").StartaResponse>;
11
11
  editProgramType(organizationLogin: string, programTypeId: string, programType: LoyaltyProgramType): Promise<import("../../types").StartaResponse>;
12
12
  deleteProgramType(organizationLogin: string, programTypeId: string): Promise<import("../../types").StartaResponse>;
13
+ addCertificateType(organizationLogin: string, certificate: CertificateInput): Promise<import("../../types").StartaResponse>;
14
+ updateCertificateType(organizationLogin: string, certificateTypeId: string, certificate: CertificateInput): Promise<import("../../types").StartaResponse>;
15
+ deleteCertificateType(organizationLogin: string, certificateTypeId: string): Promise<import("../../types").StartaResponse>;
16
+ addMembershipType(organizationLogin: string, membership: MembershipInput): Promise<import("../../types").StartaResponse>;
17
+ updateMembershipType(organizationLogin: string, membershipTypeId: string, membership: MembershipInput): Promise<import("../../types").StartaResponse>;
18
+ deleteMembershipType(organizationLogin: string, membershipTypeId: string): Promise<import("../../types").StartaResponse>;
13
19
  }
@@ -4,12 +4,21 @@ class Loyalty {
4
4
  constructor(requestRunner) {
5
5
  this._requestRunner = requestRunner;
6
6
  }
7
+ // #region General loyalty settings
7
8
  getSettings(organizationLogin) {
8
9
  return this._requestRunner.performRequest({
9
10
  method: 'GET',
10
11
  url: `/accounts/${organizationLogin}/loyalty/settings`,
11
12
  });
12
13
  }
14
+ getIssuedCards(organizationLogin) {
15
+ return this._requestRunner.performRequest({
16
+ url: `/accounts/${organizationLogin}/loyalty/issued-cards`,
17
+ method: 'GET',
18
+ });
19
+ }
20
+ // #endregion
21
+ // #region Card types management
13
22
  addCardType(organizationLogin, cardType) {
14
23
  return this._requestRunner.performRequest({
15
24
  url: `/accounts/${organizationLogin}/loyalty/settings/cardTypes`,
@@ -30,12 +39,8 @@ class Loyalty {
30
39
  method: 'DELETE',
31
40
  });
32
41
  }
33
- getIssuedCards(organizationLogin) {
34
- return this._requestRunner.performRequest({
35
- url: `/accounts/${organizationLogin}/loyalty/issued-cards`,
36
- method: 'GET',
37
- });
38
- }
42
+ // #endregion
43
+ // #region Program types management
39
44
  addProgramType(organizationLogin, programType) {
40
45
  return this._requestRunner.performRequest({
41
46
  url: `/accounts/${organizationLogin}/loyalty/settings/programTypes`,
@@ -56,5 +61,49 @@ class Loyalty {
56
61
  method: 'DELETE',
57
62
  });
58
63
  }
64
+ // #endregion
65
+ // #region Certificate types management
66
+ addCertificateType(organizationLogin, certificate) {
67
+ return this._requestRunner.performRequest({
68
+ url: `accounts/${organizationLogin}/loyalty/settings/certificateTypes`,
69
+ method: 'POST',
70
+ body: certificate,
71
+ });
72
+ }
73
+ updateCertificateType(organizationLogin, certificateTypeId, certificate) {
74
+ return this._requestRunner.performRequest({
75
+ url: `accounts/${organizationLogin}/loyalty/settings/certificateTypes/${certificateTypeId}`,
76
+ method: 'PUT',
77
+ body: certificate,
78
+ });
79
+ }
80
+ deleteCertificateType(organizationLogin, certificateTypeId) {
81
+ return this._requestRunner.performRequest({
82
+ url: `accounts/${organizationLogin}/loyalty/settings/certificateTypes/${certificateTypeId}`,
83
+ method: 'DELETE',
84
+ });
85
+ }
86
+ // #endregion
87
+ // #region Membership types management
88
+ addMembershipType(organizationLogin, membership) {
89
+ return this._requestRunner.performRequest({
90
+ url: `accounts/${organizationLogin}/loyalty/settings/membershipTypes`,
91
+ method: 'POST',
92
+ body: membership,
93
+ });
94
+ }
95
+ updateMembershipType(organizationLogin, membershipTypeId, membership) {
96
+ return this._requestRunner.performRequest({
97
+ url: `accounts/${organizationLogin}/loyalty/settings/membershipTypes/${membershipTypeId}`,
98
+ method: 'PUT',
99
+ body: membership,
100
+ });
101
+ }
102
+ deleteMembershipType(organizationLogin, membershipTypeId) {
103
+ return this._requestRunner.performRequest({
104
+ url: `accounts/${organizationLogin}/loyalty/settings/membershipTypes/${membershipTypeId}`,
105
+ method: 'DELETE',
106
+ });
107
+ }
59
108
  }
60
109
  exports.default = Loyalty;
@@ -2,39 +2,6 @@ import { StartaRequestRunner } from '../../types';
2
2
  export default class Memberships {
3
3
  private _requestRunner;
4
4
  constructor(requestRunner: StartaRequestRunner);
5
- add(organizationLogin: string, { name, price, dueDatePeriod, dueDateCount, activateAfter, usageRules, branchIds, autoActivate, autoActivateAfterPeriod, autoActivateAfterCount, recalculatePrice, }: {
6
- name: string;
7
- price: number;
8
- dueDatePeriod: 'days' | 'weeks' | 'months' | 'years';
9
- dueDateCount: number;
10
- activateAfter: 'buyMembership' | 'firstOrder';
11
- usageRules: Array<{
12
- serviceIds: Array<string>;
13
- count?: number;
14
- }>;
15
- branchIds: Array<string>;
16
- autoActivate: boolean;
17
- autoActivateAfterPeriod?: 'days' | 'weeks' | 'months' | 'years';
18
- autoActivateAfterCount?: number;
19
- recalculatePrice: boolean;
20
- }): Promise<import("../../types").StartaResponse>;
21
- update(organizationLogin: string, membershipTypeId: string, { name, price, dueDatePeriod, dueDateCount, activateAfter, usageRules, branchIds, autoActivate, autoActivateAfterPeriod, autoActivateAfterCount, recalculatePrice, }: {
22
- name: string;
23
- price: number;
24
- dueDatePeriod: 'days' | 'weeks' | 'months' | 'years';
25
- dueDateCount: number;
26
- activateAfter: 'buyMembership' | 'firstOrder';
27
- usageRules: Array<{
28
- serviceIds: Array<string>;
29
- count?: number;
30
- }>;
31
- branchIds: Array<string>;
32
- autoActivate: boolean;
33
- autoActivateAfterPeriod?: 'days' | 'weeks' | 'months' | 'years';
34
- autoActivateAfterCount?: number;
35
- recalculatePrice: boolean;
36
- }): Promise<import("../../types").StartaResponse>;
37
- delete(organizationLogin: string, membershipTypeId: string): Promise<import("../../types").StartaResponse>;
38
5
  index(organizationLogin: string, { customerId }?: {
39
6
  customerId?: string;
40
7
  }): Promise<import("../../types").StartaResponse>;
@@ -5,50 +5,6 @@ class Memberships {
5
5
  constructor(requestRunner) {
6
6
  this._requestRunner = requestRunner;
7
7
  }
8
- add(organizationLogin, { name, price, dueDatePeriod, dueDateCount, activateAfter, usageRules, branchIds, autoActivate, autoActivateAfterPeriod, autoActivateAfterCount, recalculatePrice, }) {
9
- return this._requestRunner.performRequest({
10
- url: `accounts/${organizationLogin}/membershipTypes`,
11
- method: 'POST',
12
- body: {
13
- name,
14
- price,
15
- dueDatePeriod,
16
- dueDateCount,
17
- activateAfter,
18
- usageRules,
19
- branchIds,
20
- autoActivate,
21
- autoActivateAfterPeriod,
22
- autoActivateAfterCount,
23
- recalculatePrice,
24
- },
25
- });
26
- }
27
- update(organizationLogin, membershipTypeId, { name, price, dueDatePeriod, dueDateCount, activateAfter, usageRules, branchIds, autoActivate, autoActivateAfterPeriod, autoActivateAfterCount, recalculatePrice, }) {
28
- return this._requestRunner.performRequest({
29
- url: `accounts/${organizationLogin}/membershipTypes/${membershipTypeId}`,
30
- method: 'PUT',
31
- body: {
32
- name,
33
- price,
34
- dueDatePeriod,
35
- dueDateCount,
36
- activateAfter,
37
- usageRules,
38
- branchIds,
39
- autoActivate,
40
- autoActivateAfterPeriod,
41
- autoActivateAfterCount,
42
- recalculatePrice,
43
- },
44
- });
45
- }
46
- delete(organizationLogin, membershipTypeId) {
47
- return this._requestRunner.performRequest({
48
- url: `accounts/${organizationLogin}/membershipTypes/${membershipTypeId}`,
49
- method: 'DELETE',
50
- });
51
- }
52
8
  index(organizationLogin, { customerId } = {}) {
53
9
  return this._requestRunner.performRequest({
54
10
  url: `accounts/${organizationLogin}/memberships${(0, _helpers_1.buildQuery)({ customerId })}`,
@@ -32,8 +32,8 @@ export default class Orders {
32
32
  resources?: Array<string>;
33
33
  }): Promise<import("../../types").StartaResponse>;
34
34
  get(organizationOrCustomerLogin: string, orderId: any): Promise<import("../../types").StartaResponse>;
35
- add(organizationLogin: string, { products, usedMaterials, customerId, scheduleId, status, repeatSettings, organizationComment, }: OrderData): Promise<import("../../types").StartaResponse>;
36
- update(organizationLogin: string, orderId: string, { products, usedMaterials, scheduleId, status, repeatSettings, organizationComment, customerId, }: OrderData): Promise<import("../../types").StartaResponse>;
35
+ add(organizationLogin: string, { products, usedMaterials, customerId, scheduleId, status, repeatSettings, organizationComment, loyaltyCardId, }: OrderData): Promise<import("../../types").StartaResponse>;
36
+ update(organizationLogin: string, orderId: string, { products, usedMaterials, scheduleId, status, repeatSettings, organizationComment, customerId, loyaltyCardId, }: OrderData): Promise<import("../../types").StartaResponse>;
37
37
  cancel(organizationLogin: string, orderId: string): Promise<import("../../types").StartaResponse>;
38
38
  delete(organizationLogin: string, orderId: string): Promise<import("../../types").StartaResponse>;
39
39
  setConfirmation(organizationOrCustomerLogin: string, orderId: string, { isConfirmed }: {
@@ -46,7 +46,7 @@ class Orders {
46
46
  method: 'GET',
47
47
  });
48
48
  }
49
- add(organizationLogin, { products, usedMaterials, customerId, scheduleId, status = 'new', repeatSettings, organizationComment, }) {
49
+ add(organizationLogin, { products, usedMaterials, customerId, scheduleId, status = 'new', repeatSettings, organizationComment, loyaltyCardId, }) {
50
50
  return this._requestRunner.performRequest({
51
51
  url: `accounts/${organizationLogin}/orders`,
52
52
  method: 'POST',
@@ -58,10 +58,11 @@ class Orders {
58
58
  status,
59
59
  repeatSettings,
60
60
  organizationComment,
61
+ loyaltyCardId,
61
62
  },
62
63
  });
63
64
  }
64
- update(organizationLogin, orderId, { products, usedMaterials, scheduleId, status, repeatSettings, organizationComment, customerId, }) {
65
+ update(organizationLogin, orderId, { products, usedMaterials, scheduleId, status, repeatSettings, organizationComment, customerId, loyaltyCardId, }) {
65
66
  return this._requestRunner.performRequest({
66
67
  url: `accounts/${organizationLogin}/orders/${orderId}`,
67
68
  method: 'PUT',
@@ -73,6 +74,7 @@ class Orders {
73
74
  repeatSettings,
74
75
  organizationComment,
75
76
  customerId,
77
+ loyaltyCardId,
76
78
  },
77
79
  });
78
80
  }
@@ -6,16 +6,17 @@ export default class Payments {
6
6
  signature: any;
7
7
  data: any;
8
8
  }): Promise<import("../../types").StartaResponse>;
9
- addManual(organizationLogin: string, { orderId, date, amount, method, membershipId, serviceId, cashRegisterId, certificateId, certificateCode, }: {
9
+ addManual(organizationLogin: string, { orderId, date, amount, method, membershipId, serviceId, cashRegisterId, certificateId, certificateCode, loyaltyCardId, }: {
10
10
  orderId: string;
11
11
  date: string;
12
12
  amount?: number;
13
- method: 'card' | 'wire' | 'cash' | 'membership' | 'certificate';
13
+ method: 'card' | 'wire' | 'cash' | 'membership' | 'certificate' | 'loyaltyCard';
14
14
  certificateId?: string;
15
15
  certificateCode?: string;
16
16
  membershipId?: string;
17
17
  serviceId?: string;
18
18
  cashRegisterId?: string;
19
+ loyaltyCardId?: string;
19
20
  }): Promise<import("../../types").StartaResponse>;
20
21
  deletePayment(organizationLogin: string, { orderId, transactionId }: {
21
22
  orderId: string;
@@ -14,7 +14,7 @@ class Payments {
14
14
  },
15
15
  });
16
16
  }
17
- addManual(organizationLogin, { orderId, date, amount, method, membershipId, serviceId, cashRegisterId, certificateId, certificateCode, }) {
17
+ addManual(organizationLogin, { orderId, date, amount, method, membershipId, serviceId, cashRegisterId, certificateId, certificateCode, loyaltyCardId, }) {
18
18
  return this._requestRunner.performRequest({
19
19
  url: `accounts/${organizationLogin}/payments/manual`,
20
20
  method: 'POST',
@@ -28,6 +28,7 @@ class Payments {
28
28
  certificateCode,
29
29
  serviceId,
30
30
  cashRegisterId,
31
+ loyaltyCardId,
31
32
  },
32
33
  });
33
34
  }
package/lib/types.d.ts CHANGED
@@ -277,6 +277,7 @@ export declare type OrderData = {
277
277
  repeatSettings?: OrderRepeatSettings;
278
278
  organizationComment?: string;
279
279
  customerId?: string;
280
+ loyaltyCardId?: string;
280
281
  };
281
282
  export declare type OrderItem = {
282
283
  type: 'service' | 'product' | 'roomRent' | 'seminar';
@@ -475,4 +476,20 @@ export declare type LoyaltyProgramType = {
475
476
  };
476
477
  loyaltyCardIds: string[];
477
478
  };
479
+ export declare type MembershipInput = {
480
+ name: string;
481
+ price: number;
482
+ dueDatePeriod: 'days' | 'weeks' | 'months' | 'years';
483
+ dueDateCount: number;
484
+ activateAfter: 'buyMembership' | 'firstOrder';
485
+ usageRules: Array<{
486
+ serviceIds: Array<string>;
487
+ count?: number;
488
+ }>;
489
+ branchIds: Array<string>;
490
+ autoActivate: boolean;
491
+ autoActivateAfterPeriod?: 'days' | 'weeks' | 'months' | 'years';
492
+ autoActivateAfterCount?: number;
493
+ recalculatePrice: boolean;
494
+ };
478
495
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starta.apiclient",
3
- "version": "1.112.11313",
3
+ "version": "1.112.11323",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Wrapper for starta.one api",
6
6
  "author": "Collaboracia OÜ",