@konplit-services/common 1.0.313 → 1.0.314
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.
|
@@ -24,22 +24,26 @@ const hasPermission = (userType, permissionCode) => {
|
|
|
24
24
|
}
|
|
25
25
|
const user = req.currentUser;
|
|
26
26
|
if (userType !== user.userType) {
|
|
27
|
+
console.log("user types", userType, user.userType);
|
|
27
28
|
throw new forbidden_error_1.ForbiddenError(language_1.lang.forbidden, error_codes_1.error_codes.INVALID_FORBIDDEN);
|
|
28
29
|
}
|
|
29
30
|
try {
|
|
30
31
|
let permissions = [];
|
|
31
32
|
const perm = yield base_1.redisWrapper.get((0, constants_1.getPermissions)(user.id));
|
|
32
33
|
if (!perm) {
|
|
34
|
+
console.log("no permis", perm);
|
|
33
35
|
throw new forbidden_error_1.ForbiddenError(language_1.lang.forbidden, error_codes_1.error_codes.INVALID_FORBIDDEN);
|
|
34
36
|
}
|
|
35
37
|
permissions = JSON.parse(perm);
|
|
36
38
|
if (!permissions.includes(permissionCode)) {
|
|
39
|
+
console.log("permission", permissionCode);
|
|
37
40
|
throw new forbidden_error_1.ForbiddenError(language_1.lang.forbidden, error_codes_1.error_codes.INVALID_FORBIDDEN);
|
|
38
41
|
}
|
|
39
42
|
return next();
|
|
40
43
|
}
|
|
41
44
|
catch (error) {
|
|
42
45
|
console.log();
|
|
46
|
+
console.log("error log", error);
|
|
43
47
|
throw error;
|
|
44
48
|
}
|
|
45
49
|
});
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Usage } from "../helper";
|
|
2
|
+
export interface EmailBase {
|
|
3
|
+
business_logo?: string;
|
|
4
|
+
business_name?: string;
|
|
5
|
+
business_support_email?: string;
|
|
6
|
+
year: number;
|
|
7
|
+
usage?: Usage;
|
|
8
|
+
}
|
|
9
|
+
export interface InvoiceTemplateData extends EmailBase {
|
|
10
|
+
customer_name?: string;
|
|
11
|
+
customer_email: string;
|
|
12
|
+
merchant_name: string;
|
|
13
|
+
invoice_id: string;
|
|
14
|
+
sent_date: string;
|
|
15
|
+
due_date: string;
|
|
16
|
+
items: Array<{
|
|
17
|
+
item: string;
|
|
18
|
+
qty: number;
|
|
19
|
+
unit: number;
|
|
20
|
+
}>;
|
|
21
|
+
subtotal: number;
|
|
22
|
+
shipping: number;
|
|
23
|
+
discount: number;
|
|
24
|
+
tax: number;
|
|
25
|
+
total_amount: number;
|
|
26
|
+
note?: string;
|
|
27
|
+
invoice_payment_url?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface InvoiceReceiptTemplateData extends EmailBase {
|
|
30
|
+
customer_name: string;
|
|
31
|
+
customer_email: string;
|
|
32
|
+
merchant_name: string;
|
|
33
|
+
invoice_id: string;
|
|
34
|
+
payment_date: string;
|
|
35
|
+
transaction_id: string;
|
|
36
|
+
total_amount: number;
|
|
37
|
+
}
|
|
38
|
+
export interface NewSubscriptionTemplateData extends EmailBase {
|
|
39
|
+
customer_name: string;
|
|
40
|
+
customer_email: string;
|
|
41
|
+
merchant_name: string;
|
|
42
|
+
subscription_name: string;
|
|
43
|
+
amount: number;
|
|
44
|
+
frequency: string;
|
|
45
|
+
payment_method: string;
|
|
46
|
+
card_last4?: string;
|
|
47
|
+
start_date: string;
|
|
48
|
+
next_charge_date: string;
|
|
49
|
+
}
|
|
50
|
+
export interface PreChargeNotificationTemplateData extends EmailBase {
|
|
51
|
+
customer_name: string;
|
|
52
|
+
customer_email: string;
|
|
53
|
+
merchant_name: string;
|
|
54
|
+
subscription_name: string;
|
|
55
|
+
amount: number;
|
|
56
|
+
minutes_until_charge: number;
|
|
57
|
+
charge_date: string;
|
|
58
|
+
frequency: string;
|
|
59
|
+
payment_method: string;
|
|
60
|
+
card_last4?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface ChargeReceiptTemplateData extends EmailBase {
|
|
63
|
+
customer_name: string;
|
|
64
|
+
customer_email: string;
|
|
65
|
+
merchant_name: string;
|
|
66
|
+
subscription_name: string;
|
|
67
|
+
amount: number;
|
|
68
|
+
charge_date: string;
|
|
69
|
+
transaction_id: string;
|
|
70
|
+
next_charge_date: string;
|
|
71
|
+
payment_method: string;
|
|
72
|
+
card_last4?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface CancellationConfirmationTemplateData extends EmailBase {
|
|
75
|
+
customer_name: string;
|
|
76
|
+
customer_email: string;
|
|
77
|
+
merchant_name: string;
|
|
78
|
+
subscription_name: string;
|
|
79
|
+
cancellation_date: string;
|
|
80
|
+
last_charge_amount: number;
|
|
81
|
+
last_charge_date: string;
|
|
82
|
+
payment_method: string;
|
|
83
|
+
card_last4?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface PaymentFailureTemplateData extends EmailBase {
|
|
86
|
+
customer_name: string;
|
|
87
|
+
customer_email: string;
|
|
88
|
+
merchant_name: string;
|
|
89
|
+
subscription_name: string;
|
|
90
|
+
amount: number;
|
|
91
|
+
failed_charge_date: string;
|
|
92
|
+
retry_date: string;
|
|
93
|
+
payment_method: string;
|
|
94
|
+
card_last4?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface CustomerTransactionReceiptTemplateData extends EmailBase {
|
|
97
|
+
customer_name: string;
|
|
98
|
+
customer_email: string;
|
|
99
|
+
merchant_name: string;
|
|
100
|
+
amount: number;
|
|
101
|
+
plan_name?: string;
|
|
102
|
+
page_name?: string;
|
|
103
|
+
payment_purpose?: string;
|
|
104
|
+
reference: string;
|
|
105
|
+
transaction_date: string;
|
|
106
|
+
payment_method: string;
|
|
107
|
+
card_last4?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface MerchantTransactionNotificationTemplateData extends EmailBase {
|
|
110
|
+
customer_name: string;
|
|
111
|
+
merchant_name: string;
|
|
112
|
+
merchant_email: string;
|
|
113
|
+
amount: number;
|
|
114
|
+
plan_name?: string;
|
|
115
|
+
page_name?: string;
|
|
116
|
+
payment_purpose?: string;
|
|
117
|
+
reference: string;
|
|
118
|
+
transaction_date: string;
|
|
119
|
+
payment_method: string;
|
|
120
|
+
card_last4?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface TwoFactorAuthStatusTemplateData extends EmailBase {
|
|
123
|
+
status: string;
|
|
124
|
+
email: string;
|
|
125
|
+
to: string;
|
|
126
|
+
}
|
|
127
|
+
export interface AdminAccountCreationTemplateData extends EmailBase {
|
|
128
|
+
first_name: string;
|
|
129
|
+
to: string;
|
|
130
|
+
password_reset_url: string;
|
|
131
|
+
}
|
|
132
|
+
export interface EmailVerificationTemplateData extends EmailBase {
|
|
133
|
+
token: string;
|
|
134
|
+
support_email: string;
|
|
135
|
+
to: string;
|
|
136
|
+
}
|
|
137
|
+
export interface PasswordResetTemplateData extends EmailBase {
|
|
138
|
+
name: string;
|
|
139
|
+
token: string;
|
|
140
|
+
support_email: string;
|
|
141
|
+
to: string;
|
|
142
|
+
}
|
|
143
|
+
export interface MerchantPasswordUpdateTemplateData extends EmailBase {
|
|
144
|
+
merchant_name: string;
|
|
145
|
+
support_email: string;
|
|
146
|
+
support_phone: string;
|
|
147
|
+
ceo_name: string;
|
|
148
|
+
to: string;
|
|
149
|
+
}
|
|
150
|
+
export interface PendingPaymentRequestTemplateData extends EmailBase {
|
|
151
|
+
first_name: string;
|
|
152
|
+
customer_email: string;
|
|
153
|
+
merchant_name: string;
|
|
154
|
+
payment_url: string;
|
|
155
|
+
note?: string;
|
|
156
|
+
}
|
|
157
|
+
export interface MerchantWelcomeTemplateData extends EmailBase {
|
|
158
|
+
merchant_name: string;
|
|
159
|
+
merchant_email: string;
|
|
160
|
+
support_email: string;
|
|
161
|
+
support_phone: string;
|
|
162
|
+
ceo_name: string;
|
|
163
|
+
}
|
|
164
|
+
export interface PasswordChangeRequestTemplateData extends EmailBase {
|
|
165
|
+
name: string;
|
|
166
|
+
to: string;
|
|
167
|
+
token: string;
|
|
168
|
+
support_email: string;
|
|
169
|
+
account_name?: string;
|
|
170
|
+
}
|
|
171
|
+
export interface TokenVerificationTemplateData extends EmailBase {
|
|
172
|
+
token: string;
|
|
173
|
+
to: string;
|
|
174
|
+
}
|
|
175
|
+
export interface MerchantInvitationTemplateData extends EmailBase {
|
|
176
|
+
merchant_name: string;
|
|
177
|
+
to: string;
|
|
178
|
+
}
|
|
179
|
+
export interface CustomerWelcomeTemplateData extends EmailBase {
|
|
180
|
+
first_name: string;
|
|
181
|
+
login_url: string;
|
|
182
|
+
to: string;
|
|
183
|
+
}
|