@viardex/viardex-libs 1.0.0 → 1.0.1
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/dist/notification/notification.client.d.ts +46 -1
- package/dist/notification/notification.client.js +238 -17
- package/dist/notification/notification.enum.d.ts +45 -1
- package/dist/notification/notification.enum.js +59 -0
- package/dist/notification/notification.interface.d.ts +256 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ClientProxy } from '@nestjs/microservices';
|
|
2
|
-
import { OTPMail, ResetTransactionPinEmail, PasswordResetMail, EmailVerificationMail, DeviceVerificationMail, BulkEmail, BaseEmail } from './notification.interface';
|
|
2
|
+
import { OTPMail, ResetTransactionPinEmail, PasswordResetMail, EmailVerificationMail, DeviceVerificationMail, BulkEmail, BaseEmail, TransactionSuccessMail, AccountSuspendedMail, VirtualAccountCreatedMail, CardCreatedMail, CardFrozenMail, CardUnfrozenMail, CardTransactionMail, CardPinActivatedMail, CryptoTransactionMail, CryptoExchangeRateAlertMail, CashbackEarnedMail, CashbackWithdrawalMail, ReferralBonusEarnedMail, NewReferralSignupMail, GiftCardOrderPlacedMail, GiftCardOrderCompletedMail, GiftCardOrderFailedMail, ESIMOrderPlacedMail, ESIMOrderCompletedMail, ESIMOrderFailedMail, KYCApplicationSubmittedMail, KYCApplicationApprovedMail, KYCApplicationRejectedMail, KYCRequiresMoreInfoMail, LoginFromNewDeviceMail, PasswordChangedMail, TransactionPinChangedMail, SuspiciousActivityAlertMail, AccountLockedMail, TicketCreatedMail, TicketUpdatedMail, TicketResolvedMail, CardSavedMail, CardRemovedMail, PushNotification } from './notification.interface';
|
|
3
3
|
export declare class Notification {
|
|
4
4
|
private readonly natsClient;
|
|
5
5
|
constructor(natsClient: ClientProxy);
|
|
6
6
|
private validatePhoneNumber;
|
|
7
7
|
private validateEmailAddress;
|
|
8
|
+
private emitEmailNotification;
|
|
8
9
|
sendBulkEmail(data: BulkEmail): Promise<void>;
|
|
9
10
|
sendForgetPinOTPMail(to: string, data: ResetTransactionPinEmail): Promise<void>;
|
|
10
11
|
sendPasswordResetMail(to: string, data: PasswordResetMail): Promise<void>;
|
|
@@ -28,4 +29,48 @@ export declare class Notification {
|
|
|
28
29
|
* @param data - OTP data
|
|
29
30
|
*/
|
|
30
31
|
sendOTPByVoice(to: string, data: OTPMail): Promise<void>;
|
|
32
|
+
sendTransactionSuccessMail(to: string, data: TransactionSuccessMail): Promise<void>;
|
|
33
|
+
sendTransactionSuccessSms(to: string, data: Omit<TransactionSuccessMail, keyof BaseEmail>): Promise<void>;
|
|
34
|
+
sendAccountSuspendedMail(to: string, data: AccountSuspendedMail): Promise<void>;
|
|
35
|
+
sendVirtualAccountCreatedMail(to: string, data: VirtualAccountCreatedMail): Promise<void>;
|
|
36
|
+
sendVirtualAccountCreditSms(to: string, data: Omit<TransactionSuccessMail, keyof BaseEmail>): Promise<void>;
|
|
37
|
+
sendCardCreatedMail(to: string, data: CardCreatedMail): Promise<void>;
|
|
38
|
+
sendCardFrozenMail(to: string, data: CardFrozenMail): Promise<void>;
|
|
39
|
+
sendCardUnfrozenMail(to: string, data: CardUnfrozenMail): Promise<void>;
|
|
40
|
+
sendCardTransactionMail(to: string, data: CardTransactionMail): Promise<void>;
|
|
41
|
+
sendCardTransactionSms(to: string, data: Omit<CardTransactionMail, keyof BaseEmail>): Promise<void>;
|
|
42
|
+
sendCardPinActivatedMail(to: string, data: CardPinActivatedMail): Promise<void>;
|
|
43
|
+
sendCryptoTransactionMail(to: string, data: CryptoTransactionMail): Promise<void>;
|
|
44
|
+
sendCryptoTransactionSms(to: string, data: Omit<CryptoTransactionMail, keyof BaseEmail>): Promise<void>;
|
|
45
|
+
sendCryptoExchangeRateAlertMail(to: string, data: CryptoExchangeRateAlertMail): Promise<void>;
|
|
46
|
+
sendCashbackEarnedMail(to: string, data: CashbackEarnedMail): Promise<void>;
|
|
47
|
+
sendCashbackEarnedSms(to: string, data: Omit<CashbackEarnedMail, keyof BaseEmail>): Promise<void>;
|
|
48
|
+
sendCashbackWithdrawalMail(to: string, data: CashbackWithdrawalMail): Promise<void>;
|
|
49
|
+
sendReferralBonusEarnedMail(to: string, data: ReferralBonusEarnedMail): Promise<void>;
|
|
50
|
+
sendReferralBonusEarnedSms(to: string, data: Omit<ReferralBonusEarnedMail, keyof BaseEmail>): Promise<void>;
|
|
51
|
+
sendNewReferralSignupMail(to: string, data: NewReferralSignupMail): Promise<void>;
|
|
52
|
+
sendGiftCardOrderPlacedMail(to: string, data: GiftCardOrderPlacedMail): Promise<void>;
|
|
53
|
+
sendGiftCardOrderCompletedMail(to: string, data: GiftCardOrderCompletedMail): Promise<void>;
|
|
54
|
+
sendGiftCardOrderFailedMail(to: string, data: GiftCardOrderFailedMail): Promise<void>;
|
|
55
|
+
sendESIMOrderPlacedMail(to: string, data: ESIMOrderPlacedMail): Promise<void>;
|
|
56
|
+
sendESIMOrderCompletedMail(to: string, data: ESIMOrderCompletedMail): Promise<void>;
|
|
57
|
+
sendESIMOrderFailedMail(to: string, data: ESIMOrderFailedMail): Promise<void>;
|
|
58
|
+
sendKYCApplicationSubmittedMail(to: string, data: KYCApplicationSubmittedMail): Promise<void>;
|
|
59
|
+
sendKYCApplicationApprovedMail(to: string, data: KYCApplicationApprovedMail): Promise<void>;
|
|
60
|
+
sendKYCApplicationRejectedMail(to: string, data: KYCApplicationRejectedMail): Promise<void>;
|
|
61
|
+
sendKYCRequiresMoreInfoMail(to: string, data: KYCRequiresMoreInfoMail): Promise<void>;
|
|
62
|
+
sendLoginFromNewDeviceMail(to: string, data: LoginFromNewDeviceMail): Promise<void>;
|
|
63
|
+
sendLoginFromNewDeviceSms(to: string, data: Omit<LoginFromNewDeviceMail, keyof BaseEmail>): Promise<void>;
|
|
64
|
+
sendPasswordChangedMail(to: string, data: PasswordChangedMail): Promise<void>;
|
|
65
|
+
sendTransactionPinChangedMail(to: string, data: TransactionPinChangedMail): Promise<void>;
|
|
66
|
+
sendSuspiciousActivityAlertMail(to: string, data: SuspiciousActivityAlertMail): Promise<void>;
|
|
67
|
+
sendSuspiciousActivityAlertSms(to: string, data: Omit<SuspiciousActivityAlertMail, keyof BaseEmail>): Promise<void>;
|
|
68
|
+
sendAccountLockedMail(to: string, data: AccountLockedMail): Promise<void>;
|
|
69
|
+
sendAccountLockedSms(to: string, data: Omit<AccountLockedMail, keyof BaseEmail>): Promise<void>;
|
|
70
|
+
sendTicketCreatedMail(to: string, data: TicketCreatedMail): Promise<void>;
|
|
71
|
+
sendTicketUpdatedMail(to: string, data: TicketUpdatedMail): Promise<void>;
|
|
72
|
+
sendTicketResolvedMail(to: string, data: TicketResolvedMail): Promise<void>;
|
|
73
|
+
sendCardSavedMail(to: string, data: CardSavedMail): Promise<void>;
|
|
74
|
+
sendCardRemovedMail(to: string, data: CardRemovedMail): Promise<void>;
|
|
75
|
+
sendPushNotification(data: PushNotification): Promise<void>;
|
|
31
76
|
}
|
|
@@ -29,36 +29,34 @@ let Notification = class Notification {
|
|
|
29
29
|
throw new common_1.BadRequestException('Invalid email address');
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
emitEmailNotification(subject, to, data) {
|
|
33
|
+
const dataWithYear = {
|
|
34
|
+
...data,
|
|
35
|
+
currentYear: data.currentYear ?? new Date().getFullYear(),
|
|
36
|
+
};
|
|
37
|
+
this.natsClient.emit(subject, {
|
|
38
|
+
to,
|
|
39
|
+
data: dataWithYear,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
32
42
|
async sendBulkEmail(data) {
|
|
33
43
|
this.natsClient.emit(notification_enum_1.NotificationSubject.NOTIFICATION_EMAIL_BULK, data);
|
|
34
44
|
}
|
|
35
45
|
async sendForgetPinOTPMail(to, data) {
|
|
36
46
|
this.validateEmailAddress(to);
|
|
37
|
-
this.
|
|
38
|
-
to,
|
|
39
|
-
data,
|
|
40
|
-
});
|
|
47
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.FORGET_PIN_OTP_MAIL, to, data);
|
|
41
48
|
}
|
|
42
49
|
async sendPasswordResetMail(to, data) {
|
|
43
50
|
this.validateEmailAddress(to);
|
|
44
|
-
this.
|
|
45
|
-
to,
|
|
46
|
-
data,
|
|
47
|
-
});
|
|
51
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.PASSWORD_RESET_MAIL, to, data);
|
|
48
52
|
}
|
|
49
53
|
async sendEmailVerificationMail(to, data) {
|
|
50
54
|
this.validateEmailAddress(to);
|
|
51
|
-
this.
|
|
52
|
-
to,
|
|
53
|
-
data,
|
|
54
|
-
});
|
|
55
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.EMAIL_VERIFICATION_EMAIL, to, data);
|
|
55
56
|
}
|
|
56
57
|
async sendDeviceVerificationEmail(to, data) {
|
|
57
58
|
this.validateEmailAddress(to);
|
|
58
|
-
this.
|
|
59
|
-
to,
|
|
60
|
-
data,
|
|
61
|
-
});
|
|
59
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.DEVICE_VERIFICATION_MAIL, to, { ...data });
|
|
62
60
|
}
|
|
63
61
|
/**
|
|
64
62
|
* Sends generated OTP via email
|
|
@@ -67,9 +65,13 @@ let Notification = class Notification {
|
|
|
67
65
|
*/
|
|
68
66
|
async sendOTPByMail(to, data) {
|
|
69
67
|
this.validateEmailAddress(to);
|
|
68
|
+
const dataWithYear = {
|
|
69
|
+
...data,
|
|
70
|
+
currentYear: data.currentYear ?? new Date().getFullYear(),
|
|
71
|
+
};
|
|
70
72
|
this.natsClient.emit(notification_enum_1.NotificationSubject.OTP_MAIL, {
|
|
71
73
|
to,
|
|
72
|
-
...
|
|
74
|
+
...dataWithYear,
|
|
73
75
|
});
|
|
74
76
|
}
|
|
75
77
|
/**
|
|
@@ -96,6 +98,225 @@ let Notification = class Notification {
|
|
|
96
98
|
...data,
|
|
97
99
|
});
|
|
98
100
|
}
|
|
101
|
+
// Transaction Notifications
|
|
102
|
+
async sendTransactionSuccessMail(to, data) {
|
|
103
|
+
this.validateEmailAddress(to);
|
|
104
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.TRANSACTION_SUCCESS_MAIL, to, data);
|
|
105
|
+
}
|
|
106
|
+
async sendTransactionSuccessSms(to, data) {
|
|
107
|
+
this.validatePhoneNumber(to);
|
|
108
|
+
this.natsClient.emit(notification_enum_1.NotificationSubject.TRANSACTION_SUCCESS_SMS, {
|
|
109
|
+
to,
|
|
110
|
+
data,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
// Account Notifications
|
|
114
|
+
async sendAccountSuspendedMail(to, data) {
|
|
115
|
+
this.validateEmailAddress(to);
|
|
116
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.ACCOUNT_SUSPENDED_MAIL, to, data);
|
|
117
|
+
}
|
|
118
|
+
// Virtual Account Notifications
|
|
119
|
+
async sendVirtualAccountCreatedMail(to, data) {
|
|
120
|
+
this.validateEmailAddress(to);
|
|
121
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.VIRTUAL_ACCOUNT_CREATED_MAIL, to, data);
|
|
122
|
+
}
|
|
123
|
+
async sendVirtualAccountCreditSms(to, data) {
|
|
124
|
+
this.validatePhoneNumber(to);
|
|
125
|
+
this.natsClient.emit(notification_enum_1.NotificationSubject.VIRTUAL_ACCOUNT_CREDIT_SMS, {
|
|
126
|
+
to,
|
|
127
|
+
data,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// Card Notifications
|
|
131
|
+
async sendCardCreatedMail(to, data) {
|
|
132
|
+
this.validateEmailAddress(to);
|
|
133
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.CARD_CREATED_MAIL, to, data);
|
|
134
|
+
}
|
|
135
|
+
async sendCardFrozenMail(to, data) {
|
|
136
|
+
this.validateEmailAddress(to);
|
|
137
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.CARD_FROZEN_MAIL, to, data);
|
|
138
|
+
}
|
|
139
|
+
async sendCardUnfrozenMail(to, data) {
|
|
140
|
+
this.validateEmailAddress(to);
|
|
141
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.CARD_UNFROZEN_MAIL, to, data);
|
|
142
|
+
}
|
|
143
|
+
async sendCardTransactionMail(to, data) {
|
|
144
|
+
this.validateEmailAddress(to);
|
|
145
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.CARD_TRANSACTION_MAIL, to, data);
|
|
146
|
+
}
|
|
147
|
+
async sendCardTransactionSms(to, data) {
|
|
148
|
+
this.validatePhoneNumber(to);
|
|
149
|
+
this.natsClient.emit(notification_enum_1.NotificationSubject.CARD_TRANSACTION_SMS, {
|
|
150
|
+
to,
|
|
151
|
+
data,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async sendCardPinActivatedMail(to, data) {
|
|
155
|
+
this.validateEmailAddress(to);
|
|
156
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.CARD_PIN_ACTIVATED_MAIL, to, data);
|
|
157
|
+
}
|
|
158
|
+
// Crypto Notifications
|
|
159
|
+
async sendCryptoTransactionMail(to, data) {
|
|
160
|
+
this.validateEmailAddress(to);
|
|
161
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.CRYPTO_TRANSACTION_MAIL, to, data);
|
|
162
|
+
}
|
|
163
|
+
async sendCryptoTransactionSms(to, data) {
|
|
164
|
+
this.validatePhoneNumber(to);
|
|
165
|
+
this.natsClient.emit(notification_enum_1.NotificationSubject.CRYPTO_TRANSACTION_SMS, {
|
|
166
|
+
to,
|
|
167
|
+
data,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
async sendCryptoExchangeRateAlertMail(to, data) {
|
|
171
|
+
this.validateEmailAddress(to);
|
|
172
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.CRYPTO_EXCHANGE_RATE_ALERT_MAIL, to, data);
|
|
173
|
+
}
|
|
174
|
+
// Cashback Notifications
|
|
175
|
+
async sendCashbackEarnedMail(to, data) {
|
|
176
|
+
this.validateEmailAddress(to);
|
|
177
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.CASHBACK_EARNED_MAIL, to, data);
|
|
178
|
+
}
|
|
179
|
+
async sendCashbackEarnedSms(to, data) {
|
|
180
|
+
this.validatePhoneNumber(to);
|
|
181
|
+
this.natsClient.emit(notification_enum_1.NotificationSubject.CASHBACK_EARNED_SMS, {
|
|
182
|
+
to,
|
|
183
|
+
data,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
async sendCashbackWithdrawalMail(to, data) {
|
|
187
|
+
this.validateEmailAddress(to);
|
|
188
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.CASHBACK_WITHDRAWAL_MAIL, to, data);
|
|
189
|
+
}
|
|
190
|
+
// Referral Notifications
|
|
191
|
+
async sendReferralBonusEarnedMail(to, data) {
|
|
192
|
+
this.validateEmailAddress(to);
|
|
193
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.REFERRAL_BONUS_EARNED_MAIL, to, data);
|
|
194
|
+
}
|
|
195
|
+
async sendReferralBonusEarnedSms(to, data) {
|
|
196
|
+
this.validatePhoneNumber(to);
|
|
197
|
+
this.natsClient.emit(notification_enum_1.NotificationSubject.REFERRAL_BONUS_EARNED_SMS, {
|
|
198
|
+
to,
|
|
199
|
+
data,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
async sendNewReferralSignupMail(to, data) {
|
|
203
|
+
this.validateEmailAddress(to);
|
|
204
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.NEW_REFERRAL_SIGNUP_MAIL, to, data);
|
|
205
|
+
}
|
|
206
|
+
// Gift Card Notifications
|
|
207
|
+
async sendGiftCardOrderPlacedMail(to, data) {
|
|
208
|
+
this.validateEmailAddress(to);
|
|
209
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.GIFT_CARD_ORDER_PLACED_MAIL, to, data);
|
|
210
|
+
}
|
|
211
|
+
async sendGiftCardOrderCompletedMail(to, data) {
|
|
212
|
+
this.validateEmailAddress(to);
|
|
213
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.GIFT_CARD_ORDER_COMPLETED_MAIL, to, data);
|
|
214
|
+
}
|
|
215
|
+
async sendGiftCardOrderFailedMail(to, data) {
|
|
216
|
+
this.validateEmailAddress(to);
|
|
217
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.GIFT_CARD_ORDER_FAILED_MAIL, to, data);
|
|
218
|
+
}
|
|
219
|
+
// ESIM Notifications
|
|
220
|
+
async sendESIMOrderPlacedMail(to, data) {
|
|
221
|
+
this.validateEmailAddress(to);
|
|
222
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.ESIM_ORDER_PLACED_MAIL, to, data);
|
|
223
|
+
}
|
|
224
|
+
async sendESIMOrderCompletedMail(to, data) {
|
|
225
|
+
this.validateEmailAddress(to);
|
|
226
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.ESIM_ORDER_COMPLETED_MAIL, to, data);
|
|
227
|
+
}
|
|
228
|
+
async sendESIMOrderFailedMail(to, data) {
|
|
229
|
+
this.validateEmailAddress(to);
|
|
230
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.ESIM_ORDER_FAILED_MAIL, to, data);
|
|
231
|
+
}
|
|
232
|
+
// KYC Notifications
|
|
233
|
+
async sendKYCApplicationSubmittedMail(to, data) {
|
|
234
|
+
this.validateEmailAddress(to);
|
|
235
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.KYC_APPLICATION_SUBMITTED_MAIL, to, data);
|
|
236
|
+
}
|
|
237
|
+
async sendKYCApplicationApprovedMail(to, data) {
|
|
238
|
+
this.validateEmailAddress(to);
|
|
239
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.KYC_APPLICATION_APPROVED_MAIL, to, data);
|
|
240
|
+
}
|
|
241
|
+
async sendKYCApplicationRejectedMail(to, data) {
|
|
242
|
+
this.validateEmailAddress(to);
|
|
243
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.KYC_APPLICATION_REJECTED_MAIL, to, data);
|
|
244
|
+
}
|
|
245
|
+
async sendKYCRequiresMoreInfoMail(to, data) {
|
|
246
|
+
this.validateEmailAddress(to);
|
|
247
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.KYC_REQUIRES_MORE_INFO_MAIL, to, data);
|
|
248
|
+
}
|
|
249
|
+
// Security Notifications
|
|
250
|
+
async sendLoginFromNewDeviceMail(to, data) {
|
|
251
|
+
this.validateEmailAddress(to);
|
|
252
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.LOGIN_FROM_NEW_DEVICE_MAIL, to, data);
|
|
253
|
+
}
|
|
254
|
+
async sendLoginFromNewDeviceSms(to, data) {
|
|
255
|
+
this.validatePhoneNumber(to);
|
|
256
|
+
this.natsClient.emit(notification_enum_1.NotificationSubject.LOGIN_FROM_NEW_DEVICE_SMS, {
|
|
257
|
+
to,
|
|
258
|
+
data,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
async sendPasswordChangedMail(to, data) {
|
|
262
|
+
this.validateEmailAddress(to);
|
|
263
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.PASSWORD_CHANGED_MAIL, to, data);
|
|
264
|
+
}
|
|
265
|
+
async sendTransactionPinChangedMail(to, data) {
|
|
266
|
+
this.validateEmailAddress(to);
|
|
267
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.TRANSACTION_PIN_CHANGED_MAIL, to, data);
|
|
268
|
+
}
|
|
269
|
+
async sendSuspiciousActivityAlertMail(to, data) {
|
|
270
|
+
this.validateEmailAddress(to);
|
|
271
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.SUSPICIOUS_ACTIVITY_ALERT_MAIL, to, data);
|
|
272
|
+
}
|
|
273
|
+
async sendSuspiciousActivityAlertSms(to, data) {
|
|
274
|
+
this.validatePhoneNumber(to);
|
|
275
|
+
this.natsClient.emit(notification_enum_1.NotificationSubject.SUSPICIOUS_ACTIVITY_ALERT_SMS, {
|
|
276
|
+
to,
|
|
277
|
+
data,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
async sendAccountLockedMail(to, data) {
|
|
281
|
+
this.validateEmailAddress(to);
|
|
282
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.ACCOUNT_LOCKED_MAIL, to, data);
|
|
283
|
+
}
|
|
284
|
+
async sendAccountLockedSms(to, data) {
|
|
285
|
+
this.validatePhoneNumber(to);
|
|
286
|
+
this.natsClient.emit(notification_enum_1.NotificationSubject.ACCOUNT_LOCKED_SMS, {
|
|
287
|
+
to,
|
|
288
|
+
data,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
// Support/Ticket Notifications
|
|
292
|
+
async sendTicketCreatedMail(to, data) {
|
|
293
|
+
this.validateEmailAddress(to);
|
|
294
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.TICKET_CREATED_MAIL, to, data);
|
|
295
|
+
}
|
|
296
|
+
async sendTicketUpdatedMail(to, data) {
|
|
297
|
+
this.validateEmailAddress(to);
|
|
298
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.TICKET_UPDATED_MAIL, to, data);
|
|
299
|
+
}
|
|
300
|
+
async sendTicketResolvedMail(to, data) {
|
|
301
|
+
this.validateEmailAddress(to);
|
|
302
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.TICKET_RESOLVED_MAIL, to, data);
|
|
303
|
+
}
|
|
304
|
+
// Saved Card Notifications
|
|
305
|
+
async sendCardSavedMail(to, data) {
|
|
306
|
+
this.validateEmailAddress(to);
|
|
307
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.CARD_SAVED_MAIL, to, data);
|
|
308
|
+
}
|
|
309
|
+
async sendCardRemovedMail(to, data) {
|
|
310
|
+
this.validateEmailAddress(to);
|
|
311
|
+
this.emitEmailNotification(notification_enum_1.NotificationSubject.CARD_REMOVED_MAIL, to, data);
|
|
312
|
+
}
|
|
313
|
+
// Push Notifications
|
|
314
|
+
async sendPushNotification(data) {
|
|
315
|
+
if (!data.userId) {
|
|
316
|
+
throw new common_1.BadRequestException('userId is required for push notifications');
|
|
317
|
+
}
|
|
318
|
+
this.natsClient.emit(notification_enum_1.NotificationSubject.PUSH_NOTIFICATION, data);
|
|
319
|
+
}
|
|
99
320
|
};
|
|
100
321
|
exports.Notification = Notification;
|
|
101
322
|
exports.Notification = Notification = __decorate([
|
|
@@ -6,5 +6,49 @@ export declare enum NotificationSubject {
|
|
|
6
6
|
FORGET_PIN_OTP_MAIL = "notification.mail.forgetpin.otp",
|
|
7
7
|
DEVICE_VERIFICATION_MAIL = "notification.mail.device.verification",
|
|
8
8
|
NOTIFICATION_OTP_TEXT = "notification.text.otp",
|
|
9
|
-
NOTIFICATION_OTP_VOICE = "notification.voice.otp"
|
|
9
|
+
NOTIFICATION_OTP_VOICE = "notification.voice.otp",
|
|
10
|
+
TRANSACTION_SUCCESS_MAIL = "notification.transaction.success.mail",
|
|
11
|
+
TRANSACTION_SUCCESS_SMS = "notification.transaction.success.sms",
|
|
12
|
+
ACCOUNT_SUSPENDED_MAIL = "notification.account.suspended.mail",
|
|
13
|
+
VIRTUAL_ACCOUNT_CREATED_MAIL = "notification.virtual_account.created.mail",
|
|
14
|
+
VIRTUAL_ACCOUNT_CREDIT_SMS = "notification.virtual_account.credit.sms",
|
|
15
|
+
CARD_CREATED_MAIL = "notification.card.created.mail",
|
|
16
|
+
CARD_FROZEN_MAIL = "notification.card.frozen.mail",
|
|
17
|
+
CARD_UNFROZEN_MAIL = "notification.card.unfrozen.mail",
|
|
18
|
+
CARD_TRANSACTION_MAIL = "notification.card.transaction.mail",
|
|
19
|
+
CARD_TRANSACTION_SMS = "notification.card.transaction.sms",
|
|
20
|
+
CARD_PIN_ACTIVATED_MAIL = "notification.card.pin_activated.mail",
|
|
21
|
+
CRYPTO_TRANSACTION_MAIL = "notification.crypto.transaction.mail",
|
|
22
|
+
CRYPTO_TRANSACTION_SMS = "notification.crypto.transaction.sms",
|
|
23
|
+
CRYPTO_EXCHANGE_RATE_ALERT_MAIL = "notification.crypto.exchange_rate.alert.mail",
|
|
24
|
+
CASHBACK_EARNED_MAIL = "notification.cashback.earned.mail",
|
|
25
|
+
CASHBACK_EARNED_SMS = "notification.cashback.earned.sms",
|
|
26
|
+
CASHBACK_WITHDRAWAL_MAIL = "notification.cashback.withdrawal.mail",
|
|
27
|
+
REFERRAL_BONUS_EARNED_MAIL = "notification.referral.bonus_earned.mail",
|
|
28
|
+
REFERRAL_BONUS_EARNED_SMS = "notification.referral.bonus_earned.sms",
|
|
29
|
+
NEW_REFERRAL_SIGNUP_MAIL = "notification.referral.new_signup.mail",
|
|
30
|
+
GIFT_CARD_ORDER_PLACED_MAIL = "notification.gift_card.order_placed.mail",
|
|
31
|
+
GIFT_CARD_ORDER_COMPLETED_MAIL = "notification.gift_card.order_completed.mail",
|
|
32
|
+
GIFT_CARD_ORDER_FAILED_MAIL = "notification.gift_card.order_failed.mail",
|
|
33
|
+
ESIM_ORDER_PLACED_MAIL = "notification.esim.order_placed.mail",
|
|
34
|
+
ESIM_ORDER_COMPLETED_MAIL = "notification.esim.order_completed.mail",
|
|
35
|
+
ESIM_ORDER_FAILED_MAIL = "notification.esim.order_failed.mail",
|
|
36
|
+
KYC_APPLICATION_SUBMITTED_MAIL = "notification.kyc.application_submitted.mail",
|
|
37
|
+
KYC_APPLICATION_APPROVED_MAIL = "notification.kyc.application_approved.mail",
|
|
38
|
+
KYC_APPLICATION_REJECTED_MAIL = "notification.kyc.application_rejected.mail",
|
|
39
|
+
KYC_REQUIRES_MORE_INFO_MAIL = "notification.kyc.requires_more_info.mail",
|
|
40
|
+
LOGIN_FROM_NEW_DEVICE_MAIL = "notification.security.login_new_device.mail",
|
|
41
|
+
LOGIN_FROM_NEW_DEVICE_SMS = "notification.security.login_new_device.sms",
|
|
42
|
+
PASSWORD_CHANGED_MAIL = "notification.security.password_changed.mail",
|
|
43
|
+
TRANSACTION_PIN_CHANGED_MAIL = "notification.security.transaction_pin_changed.mail",
|
|
44
|
+
SUSPICIOUS_ACTIVITY_ALERT_MAIL = "notification.security.suspicious_activity.mail",
|
|
45
|
+
SUSPICIOUS_ACTIVITY_ALERT_SMS = "notification.security.suspicious_activity.sms",
|
|
46
|
+
ACCOUNT_LOCKED_MAIL = "notification.security.account_locked.mail",
|
|
47
|
+
ACCOUNT_LOCKED_SMS = "notification.security.account_locked.sms",
|
|
48
|
+
TICKET_CREATED_MAIL = "notification.ticket.created.mail",
|
|
49
|
+
TICKET_UPDATED_MAIL = "notification.ticket.updated.mail",
|
|
50
|
+
TICKET_RESOLVED_MAIL = "notification.ticket.resolved.mail",
|
|
51
|
+
CARD_SAVED_MAIL = "notification.saved_card.saved.mail",
|
|
52
|
+
CARD_REMOVED_MAIL = "notification.saved_card.removed.mail",
|
|
53
|
+
PUSH_NOTIFICATION = "notification.push"
|
|
10
54
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NotificationSubject = void 0;
|
|
4
4
|
var NotificationSubject;
|
|
5
5
|
(function (NotificationSubject) {
|
|
6
|
+
// Existing
|
|
6
7
|
NotificationSubject["NOTIFICATION_EMAIL_BULK"] = "notification.email.bulk";
|
|
7
8
|
NotificationSubject["OTP_MAIL"] = "notification.mail.otp";
|
|
8
9
|
NotificationSubject["EMAIL_VERIFICATION_EMAIL"] = "notification.mail.email.verification";
|
|
@@ -11,4 +12,62 @@ var NotificationSubject;
|
|
|
11
12
|
NotificationSubject["DEVICE_VERIFICATION_MAIL"] = "notification.mail.device.verification";
|
|
12
13
|
NotificationSubject["NOTIFICATION_OTP_TEXT"] = "notification.text.otp";
|
|
13
14
|
NotificationSubject["NOTIFICATION_OTP_VOICE"] = "notification.voice.otp";
|
|
15
|
+
// Transaction
|
|
16
|
+
NotificationSubject["TRANSACTION_SUCCESS_MAIL"] = "notification.transaction.success.mail";
|
|
17
|
+
NotificationSubject["TRANSACTION_SUCCESS_SMS"] = "notification.transaction.success.sms";
|
|
18
|
+
// Account
|
|
19
|
+
NotificationSubject["ACCOUNT_SUSPENDED_MAIL"] = "notification.account.suspended.mail";
|
|
20
|
+
// Virtual Account
|
|
21
|
+
NotificationSubject["VIRTUAL_ACCOUNT_CREATED_MAIL"] = "notification.virtual_account.created.mail";
|
|
22
|
+
NotificationSubject["VIRTUAL_ACCOUNT_CREDIT_SMS"] = "notification.virtual_account.credit.sms";
|
|
23
|
+
// Card
|
|
24
|
+
NotificationSubject["CARD_CREATED_MAIL"] = "notification.card.created.mail";
|
|
25
|
+
NotificationSubject["CARD_FROZEN_MAIL"] = "notification.card.frozen.mail";
|
|
26
|
+
NotificationSubject["CARD_UNFROZEN_MAIL"] = "notification.card.unfrozen.mail";
|
|
27
|
+
NotificationSubject["CARD_TRANSACTION_MAIL"] = "notification.card.transaction.mail";
|
|
28
|
+
NotificationSubject["CARD_TRANSACTION_SMS"] = "notification.card.transaction.sms";
|
|
29
|
+
NotificationSubject["CARD_PIN_ACTIVATED_MAIL"] = "notification.card.pin_activated.mail";
|
|
30
|
+
// Crypto
|
|
31
|
+
NotificationSubject["CRYPTO_TRANSACTION_MAIL"] = "notification.crypto.transaction.mail";
|
|
32
|
+
NotificationSubject["CRYPTO_TRANSACTION_SMS"] = "notification.crypto.transaction.sms";
|
|
33
|
+
NotificationSubject["CRYPTO_EXCHANGE_RATE_ALERT_MAIL"] = "notification.crypto.exchange_rate.alert.mail";
|
|
34
|
+
// Cashback
|
|
35
|
+
NotificationSubject["CASHBACK_EARNED_MAIL"] = "notification.cashback.earned.mail";
|
|
36
|
+
NotificationSubject["CASHBACK_EARNED_SMS"] = "notification.cashback.earned.sms";
|
|
37
|
+
NotificationSubject["CASHBACK_WITHDRAWAL_MAIL"] = "notification.cashback.withdrawal.mail";
|
|
38
|
+
// Referral
|
|
39
|
+
NotificationSubject["REFERRAL_BONUS_EARNED_MAIL"] = "notification.referral.bonus_earned.mail";
|
|
40
|
+
NotificationSubject["REFERRAL_BONUS_EARNED_SMS"] = "notification.referral.bonus_earned.sms";
|
|
41
|
+
NotificationSubject["NEW_REFERRAL_SIGNUP_MAIL"] = "notification.referral.new_signup.mail";
|
|
42
|
+
// Gift Card
|
|
43
|
+
NotificationSubject["GIFT_CARD_ORDER_PLACED_MAIL"] = "notification.gift_card.order_placed.mail";
|
|
44
|
+
NotificationSubject["GIFT_CARD_ORDER_COMPLETED_MAIL"] = "notification.gift_card.order_completed.mail";
|
|
45
|
+
NotificationSubject["GIFT_CARD_ORDER_FAILED_MAIL"] = "notification.gift_card.order_failed.mail";
|
|
46
|
+
// ESIM
|
|
47
|
+
NotificationSubject["ESIM_ORDER_PLACED_MAIL"] = "notification.esim.order_placed.mail";
|
|
48
|
+
NotificationSubject["ESIM_ORDER_COMPLETED_MAIL"] = "notification.esim.order_completed.mail";
|
|
49
|
+
NotificationSubject["ESIM_ORDER_FAILED_MAIL"] = "notification.esim.order_failed.mail";
|
|
50
|
+
// KYC
|
|
51
|
+
NotificationSubject["KYC_APPLICATION_SUBMITTED_MAIL"] = "notification.kyc.application_submitted.mail";
|
|
52
|
+
NotificationSubject["KYC_APPLICATION_APPROVED_MAIL"] = "notification.kyc.application_approved.mail";
|
|
53
|
+
NotificationSubject["KYC_APPLICATION_REJECTED_MAIL"] = "notification.kyc.application_rejected.mail";
|
|
54
|
+
NotificationSubject["KYC_REQUIRES_MORE_INFO_MAIL"] = "notification.kyc.requires_more_info.mail";
|
|
55
|
+
// Security
|
|
56
|
+
NotificationSubject["LOGIN_FROM_NEW_DEVICE_MAIL"] = "notification.security.login_new_device.mail";
|
|
57
|
+
NotificationSubject["LOGIN_FROM_NEW_DEVICE_SMS"] = "notification.security.login_new_device.sms";
|
|
58
|
+
NotificationSubject["PASSWORD_CHANGED_MAIL"] = "notification.security.password_changed.mail";
|
|
59
|
+
NotificationSubject["TRANSACTION_PIN_CHANGED_MAIL"] = "notification.security.transaction_pin_changed.mail";
|
|
60
|
+
NotificationSubject["SUSPICIOUS_ACTIVITY_ALERT_MAIL"] = "notification.security.suspicious_activity.mail";
|
|
61
|
+
NotificationSubject["SUSPICIOUS_ACTIVITY_ALERT_SMS"] = "notification.security.suspicious_activity.sms";
|
|
62
|
+
NotificationSubject["ACCOUNT_LOCKED_MAIL"] = "notification.security.account_locked.mail";
|
|
63
|
+
NotificationSubject["ACCOUNT_LOCKED_SMS"] = "notification.security.account_locked.sms";
|
|
64
|
+
// Support/Ticket
|
|
65
|
+
NotificationSubject["TICKET_CREATED_MAIL"] = "notification.ticket.created.mail";
|
|
66
|
+
NotificationSubject["TICKET_UPDATED_MAIL"] = "notification.ticket.updated.mail";
|
|
67
|
+
NotificationSubject["TICKET_RESOLVED_MAIL"] = "notification.ticket.resolved.mail";
|
|
68
|
+
// Saved Card
|
|
69
|
+
NotificationSubject["CARD_SAVED_MAIL"] = "notification.saved_card.saved.mail";
|
|
70
|
+
NotificationSubject["CARD_REMOVED_MAIL"] = "notification.saved_card.removed.mail";
|
|
71
|
+
// Push Notifications
|
|
72
|
+
NotificationSubject["PUSH_NOTIFICATION"] = "notification.push";
|
|
14
73
|
})(NotificationSubject || (exports.NotificationSubject = NotificationSubject = {}));
|