@payhos/api 1.1.0 → 2.0.0
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/README.md +3 -18
- package/api.service.d.ts +4 -0
- package/api.service.js +13 -0
- package/api.service.js.map +1 -0
- package/email.d.ts +8 -0
- package/email.js +23 -0
- package/email.js.map +1 -0
- package/index.d.ts +5 -10
- package/index.js +5 -14
- package/index.js.map +1 -1
- package/model.d.ts +22 -0
- package/{models/index.js → model.js} +1 -1
- package/model.js.map +1 -0
- package/package.json +11 -13
- package/sms.d.ts +7 -0
- package/sms.js +20 -0
- package/sms.js.map +1 -0
- package/models/index.d.ts +0 -30
- package/models/index.js.map +0 -1
- package/modules/airtime/index.d.ts +0 -5
- package/modules/airtime/index.js +0 -11
- package/modules/airtime/index.js.map +0 -1
- package/modules/email/index.d.ts +0 -8
- package/modules/email/index.js +0 -40
- package/modules/email/index.js.map +0 -1
- package/modules/sms/index.d.ts +0 -8
- package/modules/sms/index.js +0 -33
- package/modules/sms/index.js.map +0 -1
- package/modules/utilities/index.d.ts +0 -8
- package/modules/utilities/index.js +0 -28
- package/modules/utilities/index.js.map +0 -1
- package/services/api.service.d.ts +0 -13
- package/services/api.service.js +0 -57
- package/services/api.service.js.map +0 -1
- package/services/utilities.service.d.ts +0 -1
- package/services/utilities.service.js +0 -29
- package/services/utilities.service.js.map +0 -1
- package/test.d.ts +0 -1
- package/test.js +0 -26
- package/test.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# PayHos API SDK
|
|
2
2
|
|
|
3
|
-
[PayHos](https://payhos.com) is an easy go-to solution for many day-to-day
|
|
3
|
+
[PayHos](https://payhos.com) is an easy go-to solution for many day-to-day application problems by providing an easily access to send emails, SMS etc. For a full documentations of PayHos API and fully supported features, visit [PayHos API Docs](https://docs.payhos.com).
|
|
4
4
|
|
|
5
5
|
This API SDK is intended to assist web applications of any kind to interact with the PayHos API server by utilizing its simple schematics. For a more modular usage, this library is designed such that bundlers with tree-shaking is enhanced.
|
|
6
6
|
|
|
@@ -21,7 +21,6 @@ const payhos = new PayHos('<YOUR API TOKEN>');
|
|
|
21
21
|
|
|
22
22
|
// You can access each of PayHos' API features as follows:
|
|
23
23
|
const sms = payhos.sms;
|
|
24
|
-
const airtime = payhos.airtime;
|
|
25
24
|
const email = payhos.email;
|
|
26
25
|
```
|
|
27
26
|
|
|
@@ -32,7 +31,6 @@ const sms = payhos.sms;
|
|
|
32
31
|
const data = {
|
|
33
32
|
message: 'Hello there, this is a test message from PayHos SDK',
|
|
34
33
|
recipients: ['+2348166666666', '+2348055555555'],
|
|
35
|
-
flash: false,
|
|
36
34
|
senderId: 'PayHos',
|
|
37
35
|
};
|
|
38
36
|
|
|
@@ -55,11 +53,11 @@ const data = {
|
|
|
55
53
|
customData: {},
|
|
56
54
|
recipients: [
|
|
57
55
|
{email: 'example@example.com'},
|
|
58
|
-
{ name: 'Alice', email: '
|
|
56
|
+
{ name: 'Alice', email: 'alice@example.com' }
|
|
59
57
|
],
|
|
60
58
|
from: {
|
|
61
59
|
name: 'PayHos',
|
|
62
|
-
email: 'test@
|
|
60
|
+
email: 'test@yourdomain.com'
|
|
63
61
|
}
|
|
64
62
|
};
|
|
65
63
|
|
|
@@ -71,16 +69,3 @@ email.send(data).then(response => {
|
|
|
71
69
|
console.log(err);
|
|
72
70
|
});
|
|
73
71
|
```
|
|
74
|
-
|
|
75
|
-
## Airtime
|
|
76
|
-
```javascript
|
|
77
|
-
const airtime = payhos.airtime;
|
|
78
|
-
|
|
79
|
-
// Coming soon...
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Further Reading
|
|
83
|
-
Have a look at other packages:
|
|
84
|
-
- [pincode](https://www.npmjs.com/package/pincode)
|
|
85
|
-
- [timestamp-date](https://www.npmjs.com/package/timestamp-date)
|
|
86
|
-
- [ng-sub](https://www.npmjs.com/package/ng-sub)
|
package/api.service.d.ts
ADDED
package/api.service.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiHandler = void 0;
|
|
4
|
+
const axios_1 = require("axios");
|
|
5
|
+
const baseUrl = 'http://localhost:8850';
|
|
6
|
+
exports.apiHandler = {
|
|
7
|
+
post: async (path, body, headers) => {
|
|
8
|
+
const url = `${baseUrl}/api/v1/${path}`;
|
|
9
|
+
const res = await axios_1.default.post(url, body, { headers });
|
|
10
|
+
return res.data;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=api.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.service.js","sourceRoot":"","sources":["../src/api.service.ts"],"names":[],"mappings":";;;AAAA,iCAA0B;AAG1B,MAAM,OAAO,GAAG,uBAAuB,CAAC;AAC3B,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,KAAK,EAAK,IAAY,EAAE,IAAc,EAAE,OAAiB,EAAE,EAAE;QACjE,MAAM,GAAG,GAAG,GAAG,OAAO,WAAW,IAAI,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACrD,OAAO,GAAG,CAAC,IAAsB,CAAC;IACpC,CAAC;CACF,CAAA"}
|
package/email.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EmailOpts } from './model';
|
|
2
|
+
export declare class Email {
|
|
3
|
+
private _apiKey;
|
|
4
|
+
constructor(key: string);
|
|
5
|
+
private headers;
|
|
6
|
+
sendEmail<T>(opts: EmailOpts): Promise<import("./model").ApiResponse<T>>;
|
|
7
|
+
sendEmails<T>(opts: EmailOpts[]): Promise<import("./model").ApiResponse<T>>;
|
|
8
|
+
}
|
package/email.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Email = void 0;
|
|
4
|
+
const api_service_1 = require("./api.service");
|
|
5
|
+
class Email {
|
|
6
|
+
constructor(key) {
|
|
7
|
+
this._apiKey = key;
|
|
8
|
+
}
|
|
9
|
+
headers() {
|
|
10
|
+
return {
|
|
11
|
+
Authorization: `Bearer ${this._apiKey}`,
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
sendEmail(opts) {
|
|
16
|
+
return this.sendEmails([opts]);
|
|
17
|
+
}
|
|
18
|
+
sendEmails(opts) {
|
|
19
|
+
return api_service_1.apiHandler.post('emails/send', opts, this.headers());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.Email = Email;
|
|
23
|
+
//# sourceMappingURL=email.js.map
|
package/email.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.js","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAG3C,MAAa,KAAK;IAGhB,YAAY,GAAW;QACrB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACrB,CAAC;IAEO,OAAO;QACb,OAAO;YACL,aAAa,EAAE,UAAU,IAAI,CAAC,OAAO,EAAE;YACvC,cAAc,EAAE,kBAAkB;SACnC,CAAC;IACJ,CAAC;IAEM,SAAS,CAAI,IAAe;QACjC,OAAO,IAAI,CAAC,UAAU,CAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC;IAEM,UAAU,CAAI,IAAiB;QACpC,OAAO,wBAAU,CAAC,IAAI,CAAI,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AArBD,sBAqBC"}
|
package/index.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { PayHosSMSClient } from './modules/sms';
|
|
4
|
-
import { PayHosUtilitiesClient } from './modules/utilities';
|
|
1
|
+
import { Email } from './email';
|
|
2
|
+
import { SMS } from './sms';
|
|
5
3
|
export declare class PayHos {
|
|
6
|
-
sms:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
utilities: PayHosUtilitiesClient;
|
|
10
|
-
constructor(tkn: string);
|
|
4
|
+
sms: SMS;
|
|
5
|
+
email: Email;
|
|
6
|
+
constructor(key: string);
|
|
11
7
|
}
|
|
12
|
-
export * from './models';
|
package/index.js
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PayHos = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const email_1 = require("./modules/email");
|
|
7
|
-
const sms_1 = require("./modules/sms");
|
|
8
|
-
const utilities_1 = require("./modules/utilities");
|
|
9
|
-
const api_service_1 = require("./services/api.service");
|
|
4
|
+
const email_1 = require("./email");
|
|
5
|
+
const sms_1 = require("./sms");
|
|
10
6
|
class PayHos {
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
13
|
-
this.
|
|
14
|
-
this.airtime = new airtime_1.PayHosAirtimeClient(client);
|
|
15
|
-
this.email = new email_1.PayHosEmailClient(client);
|
|
16
|
-
this.utilities = new utilities_1.PayHosUtilitiesClient(client);
|
|
7
|
+
constructor(key) {
|
|
8
|
+
this.sms = new sms_1.SMS(key);
|
|
9
|
+
this.email = new email_1.Email(key);
|
|
17
10
|
}
|
|
18
11
|
}
|
|
19
12
|
exports.PayHos = PayHos;
|
|
20
|
-
// export models
|
|
21
|
-
tslib_1.__exportStar(require("./models"), exports);
|
|
22
13
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,+BAA4B;AAE5B,MAAa,MAAM;IAIjB,YAAY,GAAW;QACrB,IAAI,CAAC,GAAG,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF;AARD,wBAQC"}
|
package/model.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ApiResponse<T> {
|
|
2
|
+
success: boolean;
|
|
3
|
+
code: number;
|
|
4
|
+
data?: T;
|
|
5
|
+
message?: string;
|
|
6
|
+
timestamp: Date;
|
|
7
|
+
}
|
|
8
|
+
export interface Map<T> {
|
|
9
|
+
[key: string]: T;
|
|
10
|
+
}
|
|
11
|
+
export interface EmailOpts {
|
|
12
|
+
recipients: string[];
|
|
13
|
+
subject: string;
|
|
14
|
+
text?: string;
|
|
15
|
+
html?: string;
|
|
16
|
+
attachments?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface SMSOpts {
|
|
19
|
+
recipients: string[];
|
|
20
|
+
message: string;
|
|
21
|
+
senderId: string;
|
|
22
|
+
}
|
package/model.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payhos/api",
|
|
3
|
-
"description": "An API
|
|
4
|
-
"version": "
|
|
3
|
+
"description": "An API package for payhos's API built for JavaScript and Typescript developers",
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "mocha --require ts-node/register test/**/*.ts",
|
|
9
|
-
"deploy": "tsc && node copy && cd dist && npm publish --access=public",
|
|
10
|
-
"unpublish": "npm unpublish @payhos/api@0.
|
|
9
|
+
"deploy": "node copy-models && tsc && node copy-assets && cd dist && npm publish --access=public",
|
|
10
|
+
"unpublish": "npm unpublish @payhos/api@0.8.14"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"axios": "^
|
|
13
|
+
"axios": "^1.3.5"
|
|
14
14
|
},
|
|
15
15
|
"author": {
|
|
16
16
|
"name": "Moses Godson",
|
|
@@ -18,24 +18,22 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "ISC",
|
|
20
20
|
"bugs": {
|
|
21
|
-
"url": "https://
|
|
21
|
+
"url": "https://gitlab.com/Tumba/@payhos/models/issues"
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "git+https://
|
|
25
|
+
"url": "git+https://gitlab.com/Tumba/@payhos/models"
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://payhos.com",
|
|
28
28
|
"keywords": [
|
|
29
29
|
"PayHos",
|
|
30
30
|
"API",
|
|
31
|
-
"
|
|
32
|
-
"Airtime API",
|
|
33
|
-
"Emails API",
|
|
34
|
-
"Data subscription",
|
|
35
|
-
"Electricity bills"
|
|
31
|
+
"Node.js"
|
|
36
32
|
],
|
|
37
33
|
"devDependencies": {
|
|
34
|
+
"@types/fs-extra": "^9.0.13",
|
|
38
35
|
"fs-extra": "^9.0.0",
|
|
39
|
-
"tslib": "^2.3.1"
|
|
36
|
+
"tslib": "^2.3.1",
|
|
37
|
+
"typescript": "^5.4.5"
|
|
40
38
|
}
|
|
41
39
|
}
|
package/sms.d.ts
ADDED
package/sms.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SMS = void 0;
|
|
4
|
+
const api_service_1 = require("./api.service");
|
|
5
|
+
class SMS {
|
|
6
|
+
constructor(key) {
|
|
7
|
+
this._apiKey = key;
|
|
8
|
+
}
|
|
9
|
+
headers() {
|
|
10
|
+
return {
|
|
11
|
+
Authorization: `Bearer ${this._apiKey}`,
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
sendSMS(opts) {
|
|
16
|
+
return api_service_1.apiHandler.post('sms/send', opts, this.headers());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.SMS = SMS;
|
|
20
|
+
//# sourceMappingURL=sms.js.map
|
package/sms.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sms.js","sourceRoot":"","sources":["../src/sms.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAG3C,MAAa,GAAG;IAGd,YAAY,GAAW;QACrB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACrB,CAAC;IAEO,OAAO;QACb,OAAO;YACL,aAAa,EAAE,UAAU,IAAI,CAAC,OAAO,EAAE;YACvC,cAAc,EAAE,kBAAkB;SACnC,CAAC;IACJ,CAAC;IAEM,OAAO,CAAI,IAAa;QAC7B,OAAO,wBAAU,CAAC,IAAI,CAAI,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF;AAjBD,kBAiBC"}
|
package/models/index.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface Map<T> {
|
|
2
|
-
[key: string]: T;
|
|
3
|
-
}
|
|
4
|
-
export interface ApiResponse<T> {
|
|
5
|
-
success: boolean;
|
|
6
|
-
data?: T;
|
|
7
|
-
message?: string;
|
|
8
|
-
stackTrace?: any;
|
|
9
|
-
}
|
|
10
|
-
export interface PayHosSMSPayload {
|
|
11
|
-
message: string;
|
|
12
|
-
recipients: string[];
|
|
13
|
-
flash?: boolean;
|
|
14
|
-
senderId?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface EmailRecipient {
|
|
17
|
-
name?: string;
|
|
18
|
-
email: string;
|
|
19
|
-
}
|
|
20
|
-
export interface PayhosEmailPayload {
|
|
21
|
-
recipients: EmailRecipient[] | string[];
|
|
22
|
-
from?: EmailRecipient;
|
|
23
|
-
subject: string;
|
|
24
|
-
content: string;
|
|
25
|
-
customData?: Map<any>;
|
|
26
|
-
templateId?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface ServerTimeResponse {
|
|
29
|
-
timestamp: Date;
|
|
30
|
-
}
|
package/models/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":""}
|
package/modules/airtime/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PayHosAirtimeClient = void 0;
|
|
4
|
-
class PayHosAirtimeClient {
|
|
5
|
-
constructor(c) {
|
|
6
|
-
this.client = c;
|
|
7
|
-
if (!this.client) { }
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.PayHosAirtimeClient = PayHosAirtimeClient;
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/airtime/index.ts"],"names":[],"mappings":";;;AAEA,MAAa,mBAAmB;IAG9B,YAAY,CAAkB;QAC5B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAEhB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG;IACvB,CAAC;CACF;AARD,kDAQC"}
|
package/modules/email/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PayHosApiClient } from '../../services/api.service';
|
|
2
|
-
import { ApiResponse, PayhosEmailPayload } from '../../models';
|
|
3
|
-
export declare class PayHosEmailClient {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(c: PayHosApiClient);
|
|
6
|
-
private url;
|
|
7
|
-
send(data: PayhosEmailPayload): Promise<ApiResponse<string>>;
|
|
8
|
-
}
|
package/modules/email/index.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PayHosEmailClient = void 0;
|
|
4
|
-
class PayHosEmailClient {
|
|
5
|
-
constructor(c) {
|
|
6
|
-
this.client = c;
|
|
7
|
-
}
|
|
8
|
-
url(path) {
|
|
9
|
-
return '/email/' + path.substring(path.startsWith('/') ? 1 : 0);
|
|
10
|
-
}
|
|
11
|
-
send(data) {
|
|
12
|
-
return new Promise(resolve => {
|
|
13
|
-
const body = {
|
|
14
|
-
content: data.content,
|
|
15
|
-
subject: data.subject,
|
|
16
|
-
templateId: data.templateId,
|
|
17
|
-
customData: data.customData || {},
|
|
18
|
-
from: data.from || { email: 'noreply@payhos.com' },
|
|
19
|
-
recipients: (data.recipients || []).map((r) => {
|
|
20
|
-
if (r === null || r === void 0 ? void 0 : r.email) {
|
|
21
|
-
return r;
|
|
22
|
-
}
|
|
23
|
-
return { name: '', email: (r === null || r === void 0 ? void 0 : r.toString()) || '' };
|
|
24
|
-
}),
|
|
25
|
-
};
|
|
26
|
-
this.client.postApi(this.url('send'), body).then(res => {
|
|
27
|
-
resolve(res);
|
|
28
|
-
}).catch(e => {
|
|
29
|
-
if (e === null || e === void 0 ? void 0 : e.error) {
|
|
30
|
-
resolve(e.error);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
console.error(e);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.PayHosEmailClient = PayHosEmailClient;
|
|
40
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/email/index.ts"],"names":[],"mappings":";;;AAGA,MAAa,iBAAiB;IAG5B,YAAY,CAAkB;QAC5B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;IAEO,GAAG,CAAC,IAAY;QACtB,OAAO,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC;IAEM,IAAI,CAAC,IAAwB;QAClC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;YAC3B,MAAM,IAAI,GAAuB;gBAC/B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,EAAE;gBACjC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE,KAAK,EAAE,oBAAoB,EAAE;gBAClD,UAAU,EAAE,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE;oBACjD,IAAI,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,KAAK,EAAE;wBACZ,OAAO,CAAC,CAAC;qBACV;oBAED,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,QAAQ,EAAE,KAAI,EAAE,EAAE,CAAA;gBACjD,CAAC,CAAC;aACH,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,OAAO,CAAsB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBAC1E,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;gBACX,IAAI,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,KAAK,EAAE;oBACZ,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;iBAClB;qBAAM;oBACL,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClB;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAvCD,8CAuCC"}
|
package/modules/sms/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PayHosApiClient } from '../../services/api.service';
|
|
2
|
-
import { ApiResponse, PayHosSMSPayload } from '../../models';
|
|
3
|
-
export declare class PayHosSMSClient {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(c: PayHosApiClient);
|
|
6
|
-
private url;
|
|
7
|
-
send(data: PayHosSMSPayload): Promise<ApiResponse<string>>;
|
|
8
|
-
}
|
package/modules/sms/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PayHosSMSClient = void 0;
|
|
4
|
-
class PayHosSMSClient {
|
|
5
|
-
constructor(c) {
|
|
6
|
-
this.client = c;
|
|
7
|
-
}
|
|
8
|
-
url(path) {
|
|
9
|
-
return '/sms/' + path.substring(path.startsWith('/') ? 1 : 0);
|
|
10
|
-
}
|
|
11
|
-
send(data) {
|
|
12
|
-
return new Promise(resolve => {
|
|
13
|
-
const body = {
|
|
14
|
-
message: data.message,
|
|
15
|
-
recipients: data.recipients || [],
|
|
16
|
-
flash: data.flash || false,
|
|
17
|
-
senderId: data.senderId || 'PayHos',
|
|
18
|
-
};
|
|
19
|
-
this.client.postApi(this.url('send'), body).then(res => {
|
|
20
|
-
resolve(res);
|
|
21
|
-
}).catch(e => {
|
|
22
|
-
if (e === null || e === void 0 ? void 0 : e.error) {
|
|
23
|
-
resolve(e.error);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
console.error(e);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.PayHosSMSClient = PayHosSMSClient;
|
|
33
|
-
//# sourceMappingURL=index.js.map
|
package/modules/sms/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/sms/index.ts"],"names":[],"mappings":";;;AAGA,MAAa,eAAe;IAG1B,YAAY,CAAkB;QAC5B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;IAEO,GAAG,CAAC,IAAY;QACtB,OAAO,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;IAEM,IAAI,CAAC,IAAsB;QAChC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;YAC3B,MAAM,IAAI,GAAqB;gBAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,EAAE;gBACjC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,KAAK;gBAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,QAAQ;aACpC,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,OAAO,CAAsB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBAC1E,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;gBACX,IAAI,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,KAAK,EAAE;oBACZ,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;iBAClB;qBAAM;oBACL,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClB;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA/BD,0CA+BC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PayHosApiClient } from '../../services/api.service';
|
|
2
|
-
import { ServerTimeResponse } from '../../models';
|
|
3
|
-
export declare class PayHosUtilitiesClient {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(c: PayHosApiClient);
|
|
6
|
-
private url;
|
|
7
|
-
serverTime(): Promise<ServerTimeResponse>;
|
|
8
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PayHosUtilitiesClient = void 0;
|
|
4
|
-
class PayHosUtilitiesClient {
|
|
5
|
-
constructor(c) {
|
|
6
|
-
this.client = c;
|
|
7
|
-
}
|
|
8
|
-
url(path) {
|
|
9
|
-
return '/utilities/' + path.substring(path.startsWith('/') ? 1 : 0);
|
|
10
|
-
}
|
|
11
|
-
serverTime() {
|
|
12
|
-
return new Promise(resolve => {
|
|
13
|
-
this.client.getApi(this.url('date')).then(res => {
|
|
14
|
-
res.timestamp = new Date(res.timestamp);
|
|
15
|
-
resolve(res);
|
|
16
|
-
}).catch(e => {
|
|
17
|
-
if (e === null || e === void 0 ? void 0 : e.error) {
|
|
18
|
-
resolve(e.error);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
console.error(e);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.PayHosUtilitiesClient = PayHosUtilitiesClient;
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/utilities/index.ts"],"names":[],"mappings":";;;AAGA,MAAa,qBAAqB;IAGhC,YAAY,CAAkB;QAC5B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;IAEO,GAAG,CAAC,IAAY;QACtB,OAAO,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;YAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAqB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBAClE,GAAG,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBACxC,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;gBACX,IAAI,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,KAAK,EAAE;oBACZ,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;iBAClB;qBAAM;oBACL,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClB;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAzBD,sDAyBC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Map } from '../models';
|
|
2
|
-
export declare class PayHosApiClient {
|
|
3
|
-
private token;
|
|
4
|
-
private baseUrl;
|
|
5
|
-
constructor(tkn?: string);
|
|
6
|
-
private config;
|
|
7
|
-
private toUrl;
|
|
8
|
-
private handleApiResponse;
|
|
9
|
-
getApi<T>(url: string, params?: Map<string>): Promise<T>;
|
|
10
|
-
postApi<T>(url: string, body: Map<any>, params?: Map<string>): Promise<T>;
|
|
11
|
-
putApi<T>(url: string, body: Map<any>, params?: Map<string>): Promise<T>;
|
|
12
|
-
deleteApi<T>(url: string, params?: Map<string>): Promise<T>;
|
|
13
|
-
}
|
package/services/api.service.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PayHosApiClient = void 0;
|
|
4
|
-
const axios_1 = require("axios");
|
|
5
|
-
class PayHosApiClient {
|
|
6
|
-
constructor(tkn) {
|
|
7
|
-
this.baseUrl = 'https://us-central1-pay-hos.cloudfunctions.net/apiServerFn/api/v1';
|
|
8
|
-
this.token = tkn || '';
|
|
9
|
-
}
|
|
10
|
-
config() {
|
|
11
|
-
const config = {
|
|
12
|
-
headers: {
|
|
13
|
-
'X-PAYHOS_API_TOKEN': this.token,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
return config;
|
|
17
|
-
}
|
|
18
|
-
toUrl(url, params) {
|
|
19
|
-
let result = this.baseUrl + '/' + url.substring(url.startsWith('/') ? 1 : 0) + '?';
|
|
20
|
-
const pms = params || {};
|
|
21
|
-
pms._phos_now = Date.now().toString();
|
|
22
|
-
const keys = Object.keys(pms);
|
|
23
|
-
for (const k of keys) {
|
|
24
|
-
result += `${k}=${pms[k]}&`;
|
|
25
|
-
}
|
|
26
|
-
return result.substring(0, result.length - 1);
|
|
27
|
-
}
|
|
28
|
-
handleApiResponse(promise) {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
promise.then(res => {
|
|
31
|
-
var _a;
|
|
32
|
-
if ((_a = res.data) === null || _a === void 0 ? void 0 : _a.success) {
|
|
33
|
-
resolve(res.data.data);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
reject(res.data.message || res.data.stackTrace || 'Error encountered!');
|
|
37
|
-
}
|
|
38
|
-
}).catch(e => {
|
|
39
|
-
reject(e);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
getApi(url, params) {
|
|
44
|
-
return this.handleApiResponse(axios_1.default.get(this.toUrl(url, params), this.config()));
|
|
45
|
-
}
|
|
46
|
-
async postApi(url, body, params) {
|
|
47
|
-
return this.handleApiResponse(axios_1.default.post(this.toUrl(url, params), body, this.config()));
|
|
48
|
-
}
|
|
49
|
-
async putApi(url, body, params) {
|
|
50
|
-
return this.handleApiResponse(axios_1.default.put(this.toUrl(url, params), body, this.config()));
|
|
51
|
-
}
|
|
52
|
-
async deleteApi(url, params) {
|
|
53
|
-
return this.handleApiResponse(axios_1.default.delete(this.toUrl(url, params), this.config()));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.PayHosApiClient = PayHosApiClient;
|
|
57
|
-
//# sourceMappingURL=api.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.service.js","sourceRoot":"","sources":["../../src/services/api.service.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const formatPhoneNumber: (phone: string) => string;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatPhoneNumber = void 0;
|
|
4
|
-
const formatPhoneNumber = (phone) => {
|
|
5
|
-
let phoneNumber;
|
|
6
|
-
if (phone.startsWith('0')) {
|
|
7
|
-
phoneNumber = phone;
|
|
8
|
-
}
|
|
9
|
-
else if (phone.startsWith('234')) {
|
|
10
|
-
phoneNumber = '0' + phone.substring(3);
|
|
11
|
-
}
|
|
12
|
-
else if (phone.startsWith('+234')) {
|
|
13
|
-
phoneNumber = '0' + phone.substring(4);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
return '';
|
|
17
|
-
}
|
|
18
|
-
// removes space from with number characters
|
|
19
|
-
phoneNumber = phoneNumber.replace(new RegExp(' ', 'g'), '');
|
|
20
|
-
const noNonDigit = !(/\D/i.test(phoneNumber));
|
|
21
|
-
if (phoneNumber.length === 11 && noNonDigit) {
|
|
22
|
-
return phoneNumber;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
return '';
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
exports.formatPhoneNumber = formatPhoneNumber;
|
|
29
|
-
//# sourceMappingURL=utilities.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.service.js","sourceRoot":"","sources":["../../src/services/utilities.service.ts"],"names":[],"mappings":";;;AAAO,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE;IACzD,IAAI,WAAmB,CAAC;IAExB,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACzB,WAAW,GAAG,KAAK,CAAC;KACrB;SAAM,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QAClC,WAAW,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KACxC;SAAM,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QACnC,WAAW,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KACxC;SAAM;QACL,OAAO,EAAE,CAAC;KACX;IAED,4CAA4C;IAC5C,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAE5D,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC9C,IAAI,WAAW,CAAC,MAAM,KAAK,EAAE,IAAI,UAAU,EAAE;QAC3C,OAAO,WAAW,CAAC;KACpB;SAAM;QACL,OAAO,EAAE,CAAC;KACX;AACH,CAAC,CAAA;AAtBY,QAAA,iBAAiB,qBAsB7B"}
|
package/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/test.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const index_1 = require("./index");
|
|
4
|
-
const payhos = new index_1.PayHos('<TOKEN_STRING>');
|
|
5
|
-
const email = payhos.email;
|
|
6
|
-
const data = {
|
|
7
|
-
subject: 'Test Email',
|
|
8
|
-
content: `Hey <strong>Alice</strong>, this is a test email message from <a href="https://payhos.com">PayHos API Hub</a>`,
|
|
9
|
-
customData: {},
|
|
10
|
-
recipients: [
|
|
11
|
-
{ email: 'example@example.com' },
|
|
12
|
-
{ name: 'Alice', email: 'example2@example.com' }
|
|
13
|
-
],
|
|
14
|
-
from: {
|
|
15
|
-
name: 'PayHos',
|
|
16
|
-
email: 'test@test.com'
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
// to send SMS
|
|
20
|
-
email.send(data).then(response => {
|
|
21
|
-
// message(s) sent successfully
|
|
22
|
-
console.log(response);
|
|
23
|
-
}).catch(err => {
|
|
24
|
-
console.log(err);
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=test.js.map
|
package/test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;AAAA,mCAAqD;AAErD,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,gBAAgB,CAAC,CAAC;AAE5C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AAC3B,MAAM,IAAI,GAAuB;IAC/B,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,+GAA+G;IACxH,UAAU,EAAE,EAAE;IACd,UAAU,EAAE;QACV,EAAE,KAAK,EAAE,qBAAqB,EAAE;QAChC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE;KACjD;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,eAAe;KACvB;CACF,CAAC;AAEF,cAAc;AACd,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;IAC/B,+BAA+B;IAC/B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACxB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IACb,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC"}
|