Skip to content

Commit dfaad60

Browse files
committed
Resolved review comments
1 parent a510307 commit dfaad60

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ var { SendMailClient } = require('zeptomail');
334334

335335
const url = process.env.ZEPTOMAIL_URL;
336336
const token = process.env.ZEPTOMAIL_TOKEN;
337-
let zeptoMaiClient = new SendMailClient({url, token});
337+
const zeptoMaiClient = new SendMailClient({ url, token });
338338

339339

340340
// Configure Parse Server
@@ -347,7 +347,7 @@ const server = new ParseServer({
347347
... otherAdapterOptions,
348348

349349
apiCallback: async ({ payload, locale }) => {
350-
const zeptoMailPayload = ApiPayloadConverter.zeptomail({ api: '1.1', originalPayload: payload});
350+
const zeptoMailPayload = ApiPayloadConverter.zeptomail({ api: '1.1', payload });
351351
await zeptoMaiClient.sendMail(zeptoMailPayload);
352352
},
353353
}

src/ApiPayloadConverter.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ class ApiPayloadConverter {
66

77
/**
88
* @description Converts the mail payload for the official Mailgun client.
9-
* @param {Object} originalPayload The original payload (provider agnostic).
9+
* @param {Object} data The original payload (provider agnostic).
1010
* @returns {Object} The payload according to Mailgun client specification.
1111
*/
12-
static mailgun(originalPayload) {
12+
static mailgun(data) {
1313

1414
// Clone payload
15-
const payload = Object.assign({}, originalPayload);
15+
const payload = Object.assign({}, data);
1616

1717
// Transform reply-to
1818
if (payload.replyTo) {
@@ -25,13 +25,13 @@ class ApiPayloadConverter {
2525

2626
/**
2727
* @description Converts the mail payload for the AWS Simple Mail Service (AWS JavaScript SDK v3).
28-
* @param {Object} originalPayload The original payload (provider agnostic).
28+
* @param {Object} data The original payload (provider agnostic).
2929
* @returns {Object} The payload according to AWS SDK specification.
3030
*/
31-
static awsSes(originalPayload) {
31+
static awsSes(data) {
3232

3333
// Clone payload
34-
const payload = Object.assign({}, originalPayload);
34+
const payload = Object.assign({}, data);
3535

3636
// Transform sender
3737
payload.Source = [payload.from];
@@ -95,16 +95,16 @@ class ApiPayloadConverter {
9595

9696
/**
9797
* Converts the mail payload for the ZeptoMail.
98-
* @param {Object} originalPayload The original payload
99-
* @param {String} originalPayload.api The provider API version.
100-
* @param {Object} originalPayload.payload The payload to convert to be compatible with the provider API.
98+
* @param {Object} data The original payload
99+
* @param {String} data.api The provider API version.
100+
* @param {Object} data.payload The payload to convert to be compatible with the provider API.
101101
* @returns {Object} The payload according to ZeptoMail SDK specification.
102102
*/
103-
static zeptomail(originalPayload) {
103+
static zeptomail(data) {
104104

105105
// Clone payload
106-
const payload = Object.assign({}, originalPayload.payload);
107-
switch (originalPayload.api) {
106+
const payload = Object.assign({}, data.payload);
107+
switch (data.api) {
108108
case '1.1': {
109109

110110
// Transform sender
@@ -144,7 +144,7 @@ class ApiPayloadConverter {
144144
break;
145145
}
146146
default:
147-
throw new Error(`Unsupported ZeptoMail API version '${originalPayload.api}'.`);
147+
throw new Error(`Unsupported ZeptoMail API version '${ data.api }'.`);
148148
}
149149
return payload;
150150
}

0 commit comments

Comments
 (0)