sdx-mailer-sdk 1.0.21 → 1.0.22

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/index.d.ts CHANGED
@@ -48,16 +48,14 @@ export interface CourierExceptionRequest {
48
48
 
49
49
  /**
50
50
  * Request payload for customer-related emails (register, password update, etc.).
51
- * Build this object using `createCustomerMailerRequest`, then pass it to the
51
+ * Build this object using `createCustomerMailPayload`, then pass it to the
52
52
  * corresponding `sendMail*` customer function.
53
53
  */
54
- export interface CustomerMailerRequest {
55
- /** Username or email of the customer */
56
- user: string;
57
- /** Customer password (used in registration emails) */
58
- password: string;
59
- /** Product name shown in the email */
60
- product: string;
54
+ export interface CustomerMailPayload {
55
+ /** Username or email of the customer payload */
56
+ user: any;
57
+ /** Optional product payload used for branding */
58
+ product: any | null;
61
59
  /** Verification or action token included in the email */
62
60
  token: string;
63
61
  /** Reply-to email address */
@@ -66,19 +64,40 @@ export interface CustomerMailerRequest {
66
64
  trx?: string;
67
65
  }
68
66
 
67
+ /**
68
+ * Request payload for the register-by-owner flow.
69
+ * Build this object using `createCustomerMailOwnerPayload`, then pass it to `sendMailRegisterByOwner`.
70
+ */
71
+ export interface CustomerMailOwnerPayload extends CustomerMailPayload {
72
+ /** Initial password assigned by the owner */
73
+ password: string;
74
+ }
75
+
69
76
  /**
70
77
  * Request payload for payment notification emails.
71
- * Build this object using `createPaymentsMailerRequest`, then pass it to `sendMailPayment`.
78
+ * Build this object using `createPaymentMailPayload`, then pass it to `sendMailPayment`.
72
79
  */
73
- export interface PaymentsMailerRequest {
80
+ export interface PaymentMailPayload {
74
81
  /** Transaction ID associated with the payment */
75
82
  trxId: string;
76
- /** Product licence or identifier related to the payment */
77
- licence: string;
83
+ /** Product licence payload related to the payment */
84
+ licence: any | null;
78
85
  /** Transaction/signature identifier — set automatically when the request is signed */
79
86
  trx?: string;
80
87
  }
81
88
 
89
+ /**
90
+ * Backwards-compatible alias for `CustomerMailOwnerPayload`.
91
+ * @deprecated Use `CustomerMailPayload` or `CustomerMailOwnerPayload`.
92
+ */
93
+ export type CustomerMailerRequest = CustomerMailOwnerPayload;
94
+
95
+ /**
96
+ * Backwards-compatible alias for `PaymentMailPayload`.
97
+ * @deprecated Use `PaymentMailPayload`.
98
+ */
99
+ export type PaymentsMailerRequest = PaymentMailPayload;
100
+
82
101
  // ---------------------------------------------------------------------------
83
102
  // COURIER
84
103
  // ---------------------------------------------------------------------------
@@ -188,99 +207,126 @@ export function sendExceptionMail(
188
207
  // ---------------------------------------------------------------------------
189
208
 
190
209
  /**
191
- * Creates a `CustomerMailerRequest` object used for all customer email flows
192
- * (register, password update, etc.).
210
+ * Creates a `CustomerMailPayload` object used for customer email flows that
211
+ * do not include an initial password.
193
212
  *
194
213
  * @param user - Username or email address of the customer.
195
- * @param password - Customer's password (included in registration emails).
196
- * @param product - Product name displayed in the email template.
197
214
  * @param token - Verification or action token to embed in the email (e.g. for password reset links).
198
215
  * @param reply_mail - Reply-to email address shown in the email.
199
- * @returns A `CustomerMailerRequest` instance. Sign it (add a `trx` field) before calling any `sendMail*` function.
216
+ * @param product - Optional product payload used for branding.
217
+ * @returns A `CustomerMailPayload` instance. Sign it (add a `trx` field) before calling any `sendMail*` function.
200
218
  *
201
219
  * @example
202
- * const request = createCustomerMailerRequest(
220
+ * const request = createCustomerMailPayload(
203
221
  * 'usuario@ejemplo.com',
204
- * 'MiP@ss123',
205
- * 'MiProducto',
206
222
  * 'abc123token',
207
- * 'soporte@miapp.com'
223
+ * 'soporte@miapp.com',
224
+ * { id: 1, name: 'MiProducto' }
208
225
  * );
209
226
  */
227
+ export function createCustomerMailPayload(
228
+ user: any,
229
+ token: string,
230
+ reply_mail: string,
231
+ product?: any | null
232
+ ): CustomerMailPayload;
233
+
234
+ /**
235
+ * Creates a `CustomerMailOwnerPayload` object for the register-by-owner flow.
236
+ *
237
+ * @param user - Username or email address of the customer.
238
+ * @param password - Initial password assigned by the owner.
239
+ * @param token - Verification or action token to embed in the email.
240
+ * @param reply_mail - Reply-to email address shown in the email.
241
+ * @param product - Optional product payload used for branding.
242
+ * @returns A `CustomerMailOwnerPayload` instance. Sign it (add a `trx` field) before calling `sendMailRegisterByOwner`.
243
+ */
244
+ export function createCustomerMailOwnerPayload(
245
+ user: any,
246
+ password: string,
247
+ token: string,
248
+ reply_mail: string,
249
+ product?: any | null
250
+ ): CustomerMailOwnerPayload;
251
+
252
+ /**
253
+ * Backwards-compatible alias for `createCustomerMailOwnerPayload`.
254
+ * @deprecated Use `createCustomerMailPayload` or `createCustomerMailOwnerPayload`.
255
+ */
210
256
  export function createCustomerMailerRequest(
211
- user: string,
257
+ user: any,
212
258
  password: string,
213
- product: string,
259
+ product: any | null,
214
260
  token: string,
215
261
  reply_mail: string
216
- ): CustomerMailerRequest;
262
+ ): CustomerMailOwnerPayload;
217
263
 
218
264
  /**
219
265
  * Sends a "update your password" notification email to the customer.
220
266
  *
221
- * The `tokenRQ` must be a **signed** `CustomerMailerRequest` (i.e. it must have a `trx` field set).
267
+ * The `tokenRQ` must be a **signed** `CustomerMailPayload` (i.e. it must have a `trx` field set).
222
268
  * Throws a `WebServiceException` if the request is not signed or if the API call fails.
223
269
  *
224
270
  * @param basicAuth - Authorization header value (e.g. `'Basic dXNlcjpwYXNz'`). Pass `null` to send without auth.
225
271
  * @param endpoint - Base URL of the SDX Mailer API (e.g. `'https://mailer.miapp.com'`).
226
- * @param tokenRQ - Signed `CustomerMailerRequest` to send.
272
+ * @param tokenRQ - Signed `CustomerMailPayload` to send.
227
273
  * @returns A promise that resolves with the API response data.
228
274
  */
229
275
  export function sendMailUpdatePassword(
230
276
  basicAuth: string | null,
231
277
  endpoint: string,
232
- tokenRQ: CustomerMailerRequest
278
+ tokenRQ: CustomerMailPayload
233
279
  ): Promise<any>;
234
280
 
235
281
  /**
236
282
  * Sends a "password updated successfully" confirmation email to the customer.
237
283
  *
238
- * The `tokenRQ` must be a **signed** `CustomerMailerRequest` (i.e. it must have a `trx` field set).
284
+ * The `tokenRQ` must be a **signed** `CustomerMailPayload` (i.e. it must have a `trx` field set).
239
285
  * Throws a `WebServiceException` if the request is not signed or if the API call fails.
240
286
  *
241
287
  * @param basicAuth - Authorization header value (e.g. `'Basic dXNlcjpwYXNz'`). Pass `null` to send without auth.
242
288
  * @param endpoint - Base URL of the SDX Mailer API (e.g. `'https://mailer.miapp.com'`).
243
- * @param tokenRQ - Signed `CustomerMailerRequest` to send.
289
+ * @param tokenRQ - Signed `CustomerMailPayload` to send.
244
290
  * @returns A promise that resolves with the API response data.
245
291
  */
246
292
  export function sendMailSuccessUpdatedPassword(
247
293
  basicAuth: string | null,
248
294
  endpoint: string,
249
- tokenRQ: CustomerMailerRequest
295
+ tokenRQ: CustomerMailPayload
250
296
  ): Promise<any>;
251
297
 
252
298
  /**
253
299
  * Sends a customer registration welcome email.
254
300
  *
255
- * The `tokenRQ` must be a **signed** `CustomerMailerRequest` (i.e. it must have a `trx` field set).
301
+ * The `tokenRQ` must be a **signed** `CustomerMailPayload` (i.e. it must have a `trx` field set).
256
302
  * Throws a `WebServiceException` if the request is not signed or if the API call fails.
257
303
  *
258
304
  * @param basicAuth - Authorization header value (e.g. `'Basic dXNlcjpwYXNz'`). Pass `null` to send without auth.
259
305
  * @param endpoint - Base URL of the SDX Mailer API (e.g. `'https://mailer.miapp.com'`).
260
- * @param tokenRQ - Signed `CustomerMailerRequest` to send.
306
+ * @param tokenRQ - Signed `CustomerMailPayload` to send.
261
307
  * @returns A promise that resolves with the API response data.
262
308
  */
263
309
  export function sendMailRegister(
264
310
  basicAuth: string | null,
265
311
  endpoint: string,
266
- tokenRQ: CustomerMailerRequest
312
+ tokenRQ: CustomerMailPayload
267
313
  ): Promise<any>;
268
314
 
269
315
  /**
270
316
  * Sends a customer registration email triggered by an owner/admin on behalf of the customer.
271
317
  *
272
- * The `tokenRQ` must be a **signed** `CustomerMailerRequest` (i.e. it must have a `trx` field set).
318
+ * The `tokenRQ` must be a **signed** `CustomerMailOwnerPayload` (i.e. it must have a `trx` field set).
273
319
  * Throws a `WebServiceException` if the request is not signed or if the API call fails.
274
320
  *
275
321
  * @param basicAuth - Authorization header value (e.g. `'Basic dXNlcjpwYXNz'`). Pass `null` to send without auth.
276
322
  * @param endpoint - Base URL of the SDX Mailer API (e.g. `'https://mailer.miapp.com'`).
277
- * @param tokenRQ - Signed `CustomerMailerRequest` to send.
323
+ * @param tokenRQ - Signed `CustomerMailOwnerPayload` to send.
278
324
  * @returns A promise that resolves with the API response data.
279
325
  */
280
326
  export function sendMailRegisterByOwner(
281
327
  basicAuth: string | null,
282
328
  endpoint: string,
283
- tokenRQ: CustomerMailerRequest
329
+ tokenRQ: CustomerMailOwnerPayload
284
330
  ): Promise<any>;
285
331
 
286
332
  // ---------------------------------------------------------------------------
@@ -355,29 +401,38 @@ export function sendCustomMail(
355
401
  // ---------------------------------------------------------------------------
356
402
 
357
403
  /**
358
- * Creates a `PaymentsMailerRequest` object ready to be sent via `sendMailPayment`.
404
+ * Creates a `PaymentMailPayload` object ready to be sent via `sendMailPayment`.
359
405
  *
360
406
  * @param trxId - Transaction ID associated with the payment (e.g. order ID, payment reference).
361
- * @param product - Product name or licence identifier related to the payment.
362
- * @returns A `PaymentsMailerRequest` instance. Sign it (add a `trx` field) before calling `sendMailPayment`.
407
+ * @param licence - Licence payload related to the payment.
408
+ * @returns A `PaymentMailPayload` instance. Sign it (add a `trx` field) before calling `sendMailPayment`.
363
409
  *
364
410
  * @example
365
- * const request = createPaymentsMailerRequest('TRX-00123', 'PlanPro');
411
+ * const request = createPaymentMailPayload('TRX-00123', { id: 1, code: 'LIC-001' });
412
+ */
413
+ export function createPaymentMailPayload(
414
+ trxId: string,
415
+ licence: any | null
416
+ ): PaymentMailPayload;
417
+
418
+ /**
419
+ * Backwards-compatible alias for `createPaymentMailPayload`.
420
+ * @deprecated Use `createPaymentMailPayload`.
366
421
  */
367
422
  export function createPaymentsMailerRequest(
368
423
  trxId: string,
369
- product: string
370
- ): PaymentsMailerRequest;
424
+ licence: any | null
425
+ ): PaymentMailPayload;
371
426
 
372
427
  /**
373
428
  * Sends a payment confirmation email via the SDX Mailer API.
374
429
  *
375
- * The `tokenRQ` must be a **signed** `PaymentsMailerRequest` (i.e. it must have a `trx` field set).
430
+ * The `tokenRQ` must be a **signed** `PaymentMailPayload` (i.e. it must have a `trx` field set).
376
431
  * Throws a `WebServiceException` if the request is not signed or if the API call fails.
377
432
  *
378
433
  * @param basicAuth - Authorization header value (e.g. `'Basic dXNlcjpwYXNz'`). Pass `null` to send without auth.
379
434
  * @param endpoint - Base URL of the SDX Mailer API (e.g. `'https://mailer.miapp.com'`).
380
- * @param tokenRQ - Signed `PaymentsMailerRequest` to send.
435
+ * @param tokenRQ - Signed `PaymentMailPayload` to send.
381
436
  * @returns A promise that resolves with the API response data.
382
437
  *
383
438
  * @example
@@ -386,5 +441,5 @@ export function createPaymentsMailerRequest(
386
441
  export function sendMailPayment(
387
442
  basicAuth: string | null,
388
443
  endpoint: string,
389
- tokenRQ: PaymentsMailerRequest
444
+ tokenRQ: PaymentMailPayload
390
445
  ): Promise<any>;
package/index.js CHANGED
@@ -62,13 +62,33 @@ async function sendExceptionMail(basicAuth, endpoint, tokenRQ, productId) {
62
62
  }
63
63
 
64
64
  /**
65
- * Creates a `CustomerMailerRequest` object used for all customer email flows (register, password update, etc.).
65
+ * Creates a `CustomerMailPayload` object used for customer email flows that do not include an initial password.
66
66
  * @param {string} user - Username or email address of the customer.
67
- * @param {string} password - Customer's password (included in registration emails).
68
- * @param {string} product - Product name displayed in the email template.
69
67
  * @param {string} token - Verification or action token to embed in the email (e.g. for password reset links).
70
68
  * @param {string} reply_mail - Reply-to email address shown in the email.
71
- * @returns {import('./src/entities/CustomerMailerRequest')} A CustomerMailerRequest instance. Sign it before calling any `sendMail*` function.
69
+ * @param {object|null} [product] - Optional product payload used for branding.
70
+ * @returns {import('./src/entities/CustomerMailPayload')} A CustomerMailPayload instance. Sign it before calling any `sendMail*` function.
71
+ */
72
+ function createCustomerMailPayload(user, token, reply_mail, product) {
73
+ return customerMailInstance.createCustomerMailPayload(user, token, reply_mail, product)
74
+ }
75
+
76
+ /**
77
+ * Creates a `CustomerMailOwnerPayload` object for the register-by-owner flow.
78
+ * @param {string|object} user - Customer user payload.
79
+ * @param {string} password - Initial password assigned by the owner.
80
+ * @param {string} token - Verification or action token to embed in the email.
81
+ * @param {string} reply_mail - Reply-to email address shown in the email.
82
+ * @param {object|null} [product] - Optional product payload used for branding.
83
+ * @returns {import('./src/entities/CustomerMailOwnerPayload')} A CustomerMailOwnerPayload instance. Sign it before calling `sendMailRegisterByOwner`.
84
+ */
85
+ function createCustomerMailOwnerPayload(user, password, token, reply_mail, product) {
86
+ return customerMailInstance.createCustomerMailOwnerPayload(user, password, token, reply_mail, product)
87
+ }
88
+
89
+ /**
90
+ * Backwards-compatible alias for `createCustomerMailOwnerPayload`.
91
+ * @deprecated Use `createCustomerMailPayload` or `createCustomerMailOwnerPayload`.
72
92
  */
73
93
  function createCustomerMailerRequest(user, password, product, token, reply_mail) {
74
94
  return customerMailInstance.createCustomerMailerRequest(user, password, product, token, reply_mail)
@@ -79,7 +99,7 @@ function createCustomerMailerRequest(user, password, product, token, reply_mail)
79
99
  * The `tokenRQ` must be signed (have a `trx` field). Throws if not signed or if the API fails.
80
100
  * @param {string|null} basicAuth - Authorization header value (e.g. `'Basic dXNlcjpwYXNz'`). Pass `null` to send without auth.
81
101
  * @param {string} endpoint - Base URL of the SDX Mailer API (e.g. `'https://mailer.miapp.com'`).
82
- * @param {import('./src/entities/CustomerMailerRequest')} tokenRQ - Signed CustomerMailerRequest to send.
102
+ * @param {import('./src/entities/CustomerMailPayload')} tokenRQ - Signed CustomerMailPayload to send.
83
103
  * @returns {Promise<any>} Resolves with the API response data.
84
104
  */
85
105
  async function sendMailUpdatePassword(basicAuth, endpoint, tokenRQ) {
@@ -91,7 +111,7 @@ async function sendMailUpdatePassword(basicAuth, endpoint, tokenRQ) {
91
111
  * The `tokenRQ` must be signed (have a `trx` field). Throws if not signed or if the API fails.
92
112
  * @param {string|null} basicAuth - Authorization header value (e.g. `'Basic dXNlcjpwYXNz'`). Pass `null` to send without auth.
93
113
  * @param {string} endpoint - Base URL of the SDX Mailer API (e.g. `'https://mailer.miapp.com'`).
94
- * @param {import('./src/entities/CustomerMailerRequest')} tokenRQ - Signed CustomerMailerRequest to send.
114
+ * @param {import('./src/entities/CustomerMailPayload')} tokenRQ - Signed CustomerMailPayload to send.
95
115
  * @returns {Promise<any>} Resolves with the API response data.
96
116
  */
97
117
  async function sendMailSuccessUpdatedPassword(basicAuth, endpoint, tokenRQ) {
@@ -103,7 +123,7 @@ async function sendMailSuccessUpdatedPassword(basicAuth, endpoint, tokenRQ) {
103
123
  * The `tokenRQ` must be signed (have a `trx` field). Throws if not signed or if the API fails.
104
124
  * @param {string|null} basicAuth - Authorization header value (e.g. `'Basic dXNlcjpwYXNz'`). Pass `null` to send without auth.
105
125
  * @param {string} endpoint - Base URL of the SDX Mailer API (e.g. `'https://mailer.miapp.com'`).
106
- * @param {import('./src/entities/CustomerMailerRequest')} tokenRQ - Signed CustomerMailerRequest to send.
126
+ * @param {import('./src/entities/CustomerMailPayload')} tokenRQ - Signed CustomerMailPayload to send.
107
127
  * @returns {Promise<any>} Resolves with the API response data.
108
128
  */
109
129
  async function sendMailRegister(basicAuth, endpoint, tokenRQ) {
@@ -115,7 +135,7 @@ async function sendMailRegister(basicAuth, endpoint, tokenRQ) {
115
135
  * The `tokenRQ` must be signed (have a `trx` field). Throws if not signed or if the API fails.
116
136
  * @param {string|null} basicAuth - Authorization header value (e.g. `'Basic dXNlcjpwYXNz'`). Pass `null` to send without auth.
117
137
  * @param {string} endpoint - Base URL of the SDX Mailer API (e.g. `'https://mailer.miapp.com'`).
118
- * @param {import('./src/entities/CustomerMailerRequest')} tokenRQ - Signed CustomerMailerRequest to send.
138
+ * @param {import('./src/entities/CustomerMailOwnerPayload')} tokenRQ - Signed CustomerMailOwnerPayload to send.
119
139
  * @returns {Promise<any>} Resolves with the API response data.
120
140
  */
121
141
  async function sendMailRegisterByOwner(basicAuth, endpoint, tokenRQ) {
@@ -123,10 +143,18 @@ async function sendMailRegisterByOwner(basicAuth, endpoint, tokenRQ) {
123
143
  }
124
144
 
125
145
  /**
126
- * Creates a `PaymentsMailerRequest` object ready to be sent via `sendMailPayment`.
146
+ * Creates a `PaymentMailPayload` object ready to be sent via `sendMailPayment`.
127
147
  * @param {string} trxId - Transaction ID associated with the payment (e.g. order ID, payment reference).
128
- * @param {string} product - Product name or licence identifier related to the payment.
129
- * @returns {import('./src/entities/PaymentsMailerRequest')} A PaymentsMailerRequest instance. Sign it before calling `sendMailPayment`.
148
+ * @param {object|null} licence - Licence payload associated with the payment.
149
+ * @returns {import('./src/entities/PaymentMailPayload')} A PaymentMailPayload instance. Sign it before calling `sendMailPayment`.
150
+ */
151
+ function createPaymentMailPayload(trxId, licence) {
152
+ return paymentsMailInstance.createPaymentMailPayload(trxId, licence)
153
+ }
154
+
155
+ /**
156
+ * Backwards-compatible alias for `createPaymentMailPayload`.
157
+ * @deprecated Use `createPaymentMailPayload`.
130
158
  */
131
159
  function createPaymentsMailerRequest(trxId, product) {
132
160
  return paymentsMailInstance.createPaymentsMailerRequest(trxId, product)
@@ -137,7 +165,7 @@ function createPaymentsMailerRequest(trxId, product) {
137
165
  * The `tokenRQ` must be signed (have a `trx` field). Throws if not signed or if the API fails.
138
166
  * @param {string|null} basicAuth - Authorization header value (e.g. `'Basic dXNlcjpwYXNz'`). Pass `null` to send without auth.
139
167
  * @param {string} endpoint - Base URL of the SDX Mailer API (e.g. `'https://mailer.miapp.com'`).
140
- * @param {import('./src/entities/PaymentsMailerRequest')} tokenRQ - Signed PaymentsMailerRequest to send.
168
+ * @param {import('./src/entities/PaymentMailPayload')} tokenRQ - Signed PaymentMailPayload to send.
141
169
  * @returns {Promise<any>} Resolves with the API response data.
142
170
  */
143
171
  async function sendMailPayment(basicAuth, endpoint, tokenRQ) {
@@ -178,9 +206,12 @@ module.exports = {
178
206
  sendMailSuccessUpdatedPassword, // CUSTOMER
179
207
  sendMailRegister, // CUSTOMER
180
208
  sendMailRegisterByOwner, // CUSTOMER
209
+ createCustomerMailPayload, // CUSTOMER
210
+ createCustomerMailOwnerPayload, // CUSTOMER
181
211
  createCustomerMailerRequest, // CUSTOMER
182
212
  sendMailPayment, // PAYMENT
213
+ createPaymentMailPayload, // PAYMENT
183
214
  createPaymentsMailerRequest, // PAYMENT
184
215
  createCustomMailRequest, // CUSTOM
185
216
  sendCustomMail // CUSTOM
186
- };
217
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdx-mailer-sdk",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "A api rest sdx-mailer-sender sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,4 +1,5 @@
1
- const CustomerMailerRequest = require("./entities/CustomerMailerRequest");
1
+ const CustomerMailPayload = require("./entities/CustomerMailPayload");
2
+ const CustomerMailOwnerPayload = require("./entities/CustomerMailOwnerPayload");
2
3
  const WebServiceException = require("./entities/WebServiceException");
3
4
  const CourierService = require("./services/CourierService");
4
5
  const Commons = require("./utils/Commons");
@@ -11,16 +12,29 @@ class CustomerMail {
11
12
  this.service = new CourierService();
12
13
  }
13
14
 
14
- createCustomerMailerRequest(user, password, product, token, reply_mail) {
15
- let request = new CustomerMailerRequest();
15
+ createCustomerMailPayload(user, token, reply_mail, product) {
16
+ let request = new CustomerMailPayload();
17
+ request.user = user;
18
+ request.token = token;
19
+ request.reply_mail = reply_mail;
20
+ request.product = product ?? null;
21
+ return request;
22
+ }
23
+
24
+ createCustomerMailOwnerPayload(user, password, token, reply_mail, product) {
25
+ let request = new CustomerMailOwnerPayload();
16
26
  request.user = user;
17
27
  request.password = password;
18
- request.product = product;
19
28
  request.token = token;
20
29
  request.reply_mail = reply_mail;
30
+ request.product = product ?? null;
21
31
  return request;
22
32
  }
23
33
 
34
+ createCustomerMailerRequest(user, password, product, token, reply_mail) {
35
+ return this.createCustomerMailOwnerPayload(user, password, token, reply_mail, product);
36
+ }
37
+
24
38
  /**
25
39
  * Send Customer update password Mail
26
40
  * @param {*} basicAuth
@@ -1,3 +1,4 @@
1
+ const PaymentMailPayload = require("./entities/PaymentMailPayload");
1
2
  const PaymentsMailerRequest = require("./entities/PaymentsMailerRequest");
2
3
  const WebServiceException = require("./entities/WebServiceException");
3
4
  const CourierService = require("./services/CourierService");
@@ -11,10 +12,17 @@ class PaymentsMail {
11
12
  this.service = new CourierService();
12
13
  }
13
14
 
15
+ createPaymentMailPayload(trxId, licence) {
16
+ let request = new PaymentMailPayload();
17
+ request.trxId = trxId;
18
+ request.licence = licence ?? null;
19
+ return request;
20
+ }
21
+
14
22
  createPaymentsMailerRequest(trxId, licence) {
15
23
  let request = new PaymentsMailerRequest();
16
24
  request.trxId = trxId;
17
- request.licence = licence;
25
+ request.licence = licence ?? null;
18
26
  return request;
19
27
  }
20
28
 
@@ -0,0 +1,10 @@
1
+ const CustomerMailPayload = require('./CustomerMailPayload');
2
+
3
+ class CustomerMailOwnerPayload extends CustomerMailPayload {
4
+ constructor() {
5
+ super();
6
+ this.password = '';
7
+ }
8
+ }
9
+
10
+ module.exports = CustomerMailOwnerPayload;
@@ -0,0 +1,10 @@
1
+ class CustomerMailPayload {
2
+ constructor() {
3
+ this.user = null;
4
+ this.product = null;
5
+ this.token = '';
6
+ this.reply_mail = '';
7
+ }
8
+ }
9
+
10
+ module.exports = CustomerMailPayload;
@@ -1,11 +1 @@
1
-
2
- class CustomerMailerRequest {
3
- constructor() {
4
- this.user = '';
5
- this.product = '';
6
- this.token = '';
7
- this.reply_mail = '';
8
- }
9
- }
10
-
11
- module.exports = CustomerMailerRequest;
1
+ module.exports = require('./CustomerMailOwnerPayload');
@@ -0,0 +1,8 @@
1
+ class PaymentMailPayload {
2
+ constructor() {
3
+ this.trxId = '';
4
+ this.licence = null;
5
+ }
6
+ }
7
+
8
+ module.exports = PaymentMailPayload;
@@ -1,9 +1,2 @@
1
1
 
2
- class PaymentsMailerRequest {
3
- constructor() {
4
- this.trxId = '';
5
- this.licence = '';
6
- }
7
- }
8
-
9
- module.exports = PaymentsMailerRequest;
2
+ module.exports = require('./PaymentMailPayload');