sdx-mailer-sdk 1.0.0 → 1.0.2
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/package.json
CHANGED
package/src/CourierMail.ts
CHANGED
|
@@ -21,9 +21,7 @@ export default class CourierMail {
|
|
|
21
21
|
request.receiver = receiver
|
|
22
22
|
request.reply_mail = reply_mail
|
|
23
23
|
if(btn_label != null || btn_link != null){
|
|
24
|
-
request.link = new CourierLink();
|
|
25
|
-
request.link.btn_label = btn_label
|
|
26
|
-
request.link.btn_link = btn_link
|
|
24
|
+
request.link = new CourierLink(btn_label,btn_link);
|
|
27
25
|
}
|
|
28
26
|
return request;
|
|
29
27
|
}
|
|
@@ -32,19 +30,19 @@ export default class CourierMail {
|
|
|
32
30
|
return new CourierExceptionRequest(error,detail,context);
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
public async sendCourierMail(endpoint:string,tokenRQ:any,productId:number,isBasic:boolean) {
|
|
33
|
+
public async sendCourierMail(basicAuth:string|null,endpoint:string,tokenRQ:any,productId:number,isBasic:boolean) {
|
|
36
34
|
const url = endpoint + '/courier' + ((isBasic)? '/basic' : '');
|
|
37
35
|
if(!Commons.validField(tokenRQ.trx)){
|
|
38
36
|
throw WebServiceException.BAD_REQUEST("Request must be signed")
|
|
39
37
|
}
|
|
40
|
-
return await this.service.postMail(
|
|
38
|
+
return await this.service.postMail(basicAuth, tokenRQ, url, 'sendContactMail',productId);
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
public async sendExceptionMail(endpoint:string,tokenRQ:any,productId:number) {
|
|
41
|
+
public async sendExceptionMail(basicAuth:string|null,endpoint:string,tokenRQ:any,productId:number) {
|
|
44
42
|
const url = endpoint + '/courier';
|
|
45
43
|
if(!Commons.validField(tokenRQ.trx)){
|
|
46
44
|
throw WebServiceException.BAD_REQUEST("Request must be signed")
|
|
47
45
|
}
|
|
48
|
-
return await this.service.postMail(
|
|
46
|
+
return await this.service.postMail(basicAuth, tokenRQ, url, 'sendContactMail',productId);
|
|
49
47
|
}
|
|
50
48
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import CourierLink from "./CourierLink";
|
|
2
2
|
|
|
3
3
|
export default class CourierRequest {
|
|
4
|
-
public subject
|
|
5
|
-
public title
|
|
6
|
-
public message
|
|
7
|
-
public receiver
|
|
8
|
-
public reply_mail
|
|
9
|
-
public link
|
|
4
|
+
public subject!: string;
|
|
5
|
+
public title!: string;
|
|
6
|
+
public message!:string;
|
|
7
|
+
public receiver!:string;
|
|
8
|
+
public reply_mail!:string;
|
|
9
|
+
public link!:CourierLink|null;
|
|
10
10
|
}
|
|
@@ -3,7 +3,7 @@ import Commons from '../utils/Commons';
|
|
|
3
3
|
|
|
4
4
|
export default class CourierService {
|
|
5
5
|
public async postMail(basicAuth: string | null, body: any, url: string, methodName: string, productId: number) {
|
|
6
|
-
const res = await axios.post(url, body, this.buildOptions(basicAuth, true,productId)).catch(function (err) {
|
|
6
|
+
const res = await axios.post(url, body, this.buildOptions(basicAuth, true,productId)).catch(function (err:any) {
|
|
7
7
|
throw Commons.buildWebServiceException(err, 'POST', methodName);
|
|
8
8
|
});
|
|
9
9
|
return res.data;
|