starta.apiclient 1.37.6313 → 1.37.6358

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,5 +1,6 @@
1
1
  import { StartaRequestRunner } from '../../types';
2
2
  import Customers from './customers';
3
+ import Salaries from './salaries';
3
4
  import Orders from './orders';
4
5
  import Rooms from './rooms';
5
6
  import Seminars from './seminars';
@@ -117,6 +118,7 @@ export default class Organizations {
117
118
  }): Promise<import("../../types").StartaResponse>;
118
119
  get orders(): Orders;
119
120
  get customers(): Customers;
121
+ get salaries(): Salaries;
120
122
  get rooms(): Rooms;
121
123
  get seminars(): Seminars;
122
124
  get members(): Members;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const customers_1 = require("./customers");
4
+ const salaries_1 = require("./salaries");
4
5
  const orders_1 = require("./orders");
5
6
  const rooms_1 = require("./rooms");
6
7
  const seminars_1 = require("./seminars");
@@ -259,6 +260,9 @@ class Organizations {
259
260
  get customers() {
260
261
  return new customers_1.default(this._requestRunner);
261
262
  }
263
+ get salaries() {
264
+ return new salaries_1.default(this._requestRunner);
265
+ }
262
266
  get rooms() {
263
267
  return new rooms_1.default(this._requestRunner);
264
268
  }
@@ -22,7 +22,7 @@ export default class ProductOperations {
22
22
  toWarehouseId: string;
23
23
  products: Array<{
24
24
  id: string;
25
- quantityForSale: number;
25
+ quantity: number;
26
26
  }>;
27
27
  }): Promise<import("../../types").StartaResponse>;
28
28
  }
@@ -0,0 +1,19 @@
1
+ import { StartaRequestRunner } from '../../../types';
2
+ export default class BonusesAndFines {
3
+ private _requestRunner;
4
+ constructor(requestRunner: StartaRequestRunner);
5
+ setBonuses(organizationLogin: string, { bonuses, }: {
6
+ bonuses: Array<{
7
+ id?: string;
8
+ name: string;
9
+ baseAmount: number;
10
+ }>;
11
+ }): Promise<import("../../../types").StartaResponse>;
12
+ setFines(organizationLogin: string, { fines, }: {
13
+ fines: Array<{
14
+ id?: string;
15
+ name: string;
16
+ baseAmount: number;
17
+ }>;
18
+ }): Promise<import("../../../types").StartaResponse>;
19
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class BonusesAndFines {
4
+ constructor(requestRunner) {
5
+ this._requestRunner = requestRunner;
6
+ }
7
+ setBonuses(organizationLogin, { bonuses, }) {
8
+ return this._requestRunner.performRequest({
9
+ url: `accounts/${organizationLogin}/salaries/bonuses`,
10
+ method: 'PUT',
11
+ body: bonuses,
12
+ });
13
+ }
14
+ setFines(organizationLogin, { fines, }) {
15
+ return this._requestRunner.performRequest({
16
+ url: `accounts/${organizationLogin}/salaries/fines`,
17
+ method: 'PUT',
18
+ body: fines,
19
+ });
20
+ }
21
+ }
22
+ exports.default = BonusesAndFines;
@@ -0,0 +1,11 @@
1
+ import { StartaRequestRunner } from '../../../types';
2
+ import BonusesAndFines from './bonusesAndFines';
3
+ import Rules from './rules';
4
+ import Schemes from './schemes';
5
+ export default class Salaries {
6
+ private _requestRunner;
7
+ constructor(requestRunner: StartaRequestRunner);
8
+ get rules(): Rules;
9
+ get schemes(): Schemes;
10
+ get bonusesAndFines(): BonusesAndFines;
11
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const bonusesAndFines_1 = require("./bonusesAndFines");
4
+ const rules_1 = require("./rules");
5
+ const schemes_1 = require("./schemes");
6
+ class Salaries {
7
+ constructor(requestRunner) {
8
+ this._requestRunner = requestRunner;
9
+ }
10
+ get rules() {
11
+ return new rules_1.default(this._requestRunner);
12
+ }
13
+ get schemes() {
14
+ return new schemes_1.default(this._requestRunner);
15
+ }
16
+ get bonusesAndFines() {
17
+ return new bonusesAndFines_1.default(this._requestRunner);
18
+ }
19
+ }
20
+ exports.default = Salaries;
@@ -0,0 +1,90 @@
1
+ import { StartaRequestRunner } from '../../../types';
2
+ export default class Rules {
3
+ private _requestRunner;
4
+ constructor(requestRunner: StartaRequestRunner);
5
+ add(organizationLogin: string, { name, baseAmount, baseAmountPeriod, guaranteedMinimumAmount, guaranteedMinimumAmountPeriod, forServices, forProducts, rewards, ignoreClientDiscountOnCost, includeProductCostInCalculation, includeServiceCostInCalculation, applyPreviousClientDiscount, considerSubscriptionPayment, }: {
6
+ name: string;
7
+ baseAmount: number;
8
+ baseAmountPeriod: 'day' | 'month';
9
+ guaranteedMinimumAmount: number;
10
+ guaranteedMinimumAmountPeriod: 'day' | 'month';
11
+ forServices: {
12
+ enabled: boolean;
13
+ amount: number;
14
+ amountType: 'relative' | 'absolute';
15
+ items: Array<{
16
+ ids: Array<string>;
17
+ amount: number;
18
+ amountType: 'relative' | 'absolute';
19
+ }>;
20
+ };
21
+ forProducts: {
22
+ enabled: boolean;
23
+ amount: number;
24
+ amountType: 'relative' | 'absolute';
25
+ items: Array<{
26
+ categoryId: string;
27
+ ids: Array<string>;
28
+ amount: number;
29
+ amountType: 'relative' | 'absolute';
30
+ }>;
31
+ };
32
+ rewards: {
33
+ enabled: boolean;
34
+ items: Array<{
35
+ amount: number;
36
+ amountType: 'relative' | 'absolute';
37
+ from: 'dailyTurnover' | 'dailyProfit';
38
+ for: 'all' | 'services' | 'products';
39
+ }>;
40
+ };
41
+ ignoreClientDiscountOnCost: boolean;
42
+ includeProductCostInCalculation: boolean;
43
+ includeServiceCostInCalculation: boolean;
44
+ applyPreviousClientDiscount: boolean;
45
+ considerSubscriptionPayment: boolean;
46
+ }): Promise<import("../../../types").StartaResponse>;
47
+ update(organizationLogin: string, ruleId: string, { name, baseAmount, baseAmountPeriod, guaranteedMinimumAmount, guaranteedMinimumAmountPeriod, forServices, forProducts, rewards, ignoreClientDiscountOnCost, includeProductCostInCalculation, includeServiceCostInCalculation, applyPreviousClientDiscount, considerSubscriptionPayment, }: {
48
+ name: string;
49
+ baseAmount: number;
50
+ baseAmountPeriod: 'day' | 'month';
51
+ guaranteedMinimumAmount: number;
52
+ guaranteedMinimumAmountPeriod: 'day' | 'month';
53
+ forServices: {
54
+ enabled: boolean;
55
+ amount: number;
56
+ amountType: 'relative' | 'absolute';
57
+ items: Array<{
58
+ ids: Array<string>;
59
+ amount: number;
60
+ amountType: 'relative' | 'absolute';
61
+ }>;
62
+ };
63
+ forProducts: {
64
+ enabled: boolean;
65
+ amount: number;
66
+ amountType: 'relative' | 'absolute';
67
+ items: Array<{
68
+ categoryId: string;
69
+ ids: Array<string>;
70
+ amount: number;
71
+ amountType: 'relative' | 'absolute';
72
+ }>;
73
+ };
74
+ rewards: {
75
+ enabled: boolean;
76
+ items: Array<{
77
+ amount: number;
78
+ amountType: 'relative' | 'absolute';
79
+ from: 'dailyTurnover' | 'dailyProfit';
80
+ for: 'all' | 'services' | 'products';
81
+ }>;
82
+ };
83
+ ignoreClientDiscountOnCost: boolean;
84
+ includeProductCostInCalculation: boolean;
85
+ includeServiceCostInCalculation: boolean;
86
+ applyPreviousClientDiscount: boolean;
87
+ considerSubscriptionPayment: boolean;
88
+ }): Promise<import("../../../types").StartaResponse>;
89
+ delete(organizationLogin: string, ruleId: string): Promise<import("../../../types").StartaResponse>;
90
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Rules {
4
+ constructor(requestRunner) {
5
+ this._requestRunner = requestRunner;
6
+ }
7
+ add(organizationLogin, { name, baseAmount, baseAmountPeriod, guaranteedMinimumAmount, guaranteedMinimumAmountPeriod, forServices, forProducts, rewards, ignoreClientDiscountOnCost, includeProductCostInCalculation, includeServiceCostInCalculation, applyPreviousClientDiscount, considerSubscriptionPayment, }) {
8
+ return this._requestRunner.performRequest({
9
+ url: `accounts/${organizationLogin}/salaries/rules`,
10
+ method: 'POST',
11
+ body: {
12
+ name,
13
+ baseAmount,
14
+ baseAmountPeriod,
15
+ guaranteedMinimumAmount,
16
+ guaranteedMinimumAmountPeriod,
17
+ forServices,
18
+ forProducts,
19
+ rewards,
20
+ ignoreClientDiscountOnCost,
21
+ includeProductCostInCalculation,
22
+ includeServiceCostInCalculation,
23
+ applyPreviousClientDiscount,
24
+ considerSubscriptionPayment,
25
+ },
26
+ });
27
+ }
28
+ update(organizationLogin, ruleId, { name, baseAmount, baseAmountPeriod, guaranteedMinimumAmount, guaranteedMinimumAmountPeriod, forServices, forProducts, rewards, ignoreClientDiscountOnCost, includeProductCostInCalculation, includeServiceCostInCalculation, applyPreviousClientDiscount, considerSubscriptionPayment, }) {
29
+ return this._requestRunner.performRequest({
30
+ url: `accounts/${organizationLogin}/salaries/rules/${ruleId}`,
31
+ method: 'PUT',
32
+ body: {
33
+ name,
34
+ baseAmount,
35
+ baseAmountPeriod,
36
+ guaranteedMinimumAmount,
37
+ guaranteedMinimumAmountPeriod,
38
+ forServices,
39
+ forProducts,
40
+ rewards,
41
+ ignoreClientDiscountOnCost,
42
+ includeProductCostInCalculation,
43
+ includeServiceCostInCalculation,
44
+ applyPreviousClientDiscount,
45
+ considerSubscriptionPayment,
46
+ },
47
+ });
48
+ }
49
+ delete(organizationLogin, ruleId) {
50
+ return this._requestRunner.performRequest({
51
+ url: `accounts/${organizationLogin}/salaries/rules/${ruleId}`,
52
+ method: 'DELETE',
53
+ });
54
+ }
55
+ }
56
+ exports.default = Rules;
@@ -0,0 +1,24 @@
1
+ import { StartaRequestRunner } from '../../../types';
2
+ export default class Schemes {
3
+ private _requestRunner;
4
+ constructor(requestRunner: StartaRequestRunner);
5
+ add(organizationLogin: string, { name, type, ruleId, employees, }: {
6
+ name: string;
7
+ type: 'simple' | 'advanced';
8
+ ruleId: string;
9
+ employees: Array<{
10
+ login: string;
11
+ sinceDate: string;
12
+ }>;
13
+ }): Promise<import("../../../types").StartaResponse>;
14
+ update(organizationLogin: string, schemeId: string, { name, type, ruleId, employees, }: {
15
+ name: string;
16
+ type: 'simple' | 'advanced';
17
+ ruleId: string;
18
+ employees: Array<{
19
+ login: string;
20
+ sinceDate: string;
21
+ }>;
22
+ }): Promise<import("../../../types").StartaResponse>;
23
+ delete(organizationLogin: string, schemeId: string): Promise<import("../../../types").StartaResponse>;
24
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Schemes {
4
+ constructor(requestRunner) {
5
+ this._requestRunner = requestRunner;
6
+ }
7
+ add(organizationLogin, { name, type, ruleId, employees, }) {
8
+ return this._requestRunner.performRequest({
9
+ url: `accounts/${organizationLogin}/salaries/schemes`,
10
+ method: 'POST',
11
+ body: {
12
+ name,
13
+ type,
14
+ ruleId,
15
+ employees,
16
+ },
17
+ });
18
+ }
19
+ update(organizationLogin, schemeId, { name, type, ruleId, employees, }) {
20
+ return this._requestRunner.performRequest({
21
+ url: `accounts/${organizationLogin}/salaries/schemes/${schemeId}`,
22
+ method: 'PUT',
23
+ body: {
24
+ name,
25
+ type,
26
+ ruleId,
27
+ employees,
28
+ },
29
+ });
30
+ }
31
+ delete(organizationLogin, schemeId) {
32
+ return this._requestRunner.performRequest({
33
+ url: `accounts/${organizationLogin}/salaries/schemes/${schemeId}`,
34
+ method: 'DELETE',
35
+ });
36
+ }
37
+ }
38
+ exports.default = Schemes;
package/lib/types.d.ts CHANGED
@@ -87,7 +87,7 @@ export type ProductOperation = {
87
87
  id: string;
88
88
  name: string;
89
89
  supplyPrice: number;
90
- quantityForSale: number;
90
+ quantity: number;
91
91
  discount?: number;
92
92
  discountType?: 'relative' | 'absolute';
93
93
  totalPrice: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starta.apiclient",
3
- "version": "1.37.6313",
3
+ "version": "1.37.6358",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Wrapper for starta.one api",
6
6
  "author": "Collaboracia OÜ",