@ariary/ariary 2.0.8 → 3.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 +13 -12
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/dist/index.mjs +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,15 +5,16 @@ Complete SDK for managing payments and notifications with Ariari.
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install @ariary/ariary
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Configuration
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import Ariari from '
|
|
14
|
+
import { Ariari } from '@ariary/ariary';
|
|
15
15
|
|
|
16
|
-
Ariari
|
|
16
|
+
const ariari = new Ariari();
|
|
17
|
+
ariari.config({
|
|
17
18
|
projectId: 'your-project-id',
|
|
18
19
|
secretId: 'your-secret-id'
|
|
19
20
|
});
|
|
@@ -24,7 +25,7 @@ Ariari.config({
|
|
|
24
25
|
### Send Notification
|
|
25
26
|
|
|
26
27
|
```typescript
|
|
27
|
-
const task = await
|
|
28
|
+
const task = await ariari.send(
|
|
28
29
|
{ phone: '+261123456789', message: 'Message 1' },
|
|
29
30
|
{ phone: ['+261987654321', '+261555555555'], message: 'Message 2' }
|
|
30
31
|
);
|
|
@@ -42,22 +43,22 @@ const details = await task.smsDetails();
|
|
|
42
43
|
### List Tasks
|
|
43
44
|
|
|
44
45
|
```typescript
|
|
45
|
-
const result = await
|
|
46
|
+
const result = await ariari.tasks({
|
|
46
47
|
from: 0,
|
|
47
48
|
count: 20,
|
|
48
49
|
order: -1
|
|
49
50
|
});
|
|
50
51
|
|
|
51
|
-
const nextResult = await
|
|
52
|
+
const nextResult = await ariari.tasks(result.next);
|
|
52
53
|
...
|
|
53
|
-
const prevResult = await
|
|
54
|
+
const prevResult = await ariari.tasks(result.prev);
|
|
54
55
|
```
|
|
55
56
|
|
|
56
57
|
## Payment
|
|
57
58
|
|
|
58
59
|
|
|
59
60
|
```typescript
|
|
60
|
-
const payment = await
|
|
61
|
+
const payment = await ariari.payment.create({
|
|
61
62
|
code: 'PAY-123',
|
|
62
63
|
amount: 5000,
|
|
63
64
|
projectId: 'your-project-id'
|
|
@@ -73,21 +74,21 @@ await payment.updateRest('TICKET123');
|
|
|
73
74
|
### Get All Payments
|
|
74
75
|
|
|
75
76
|
```typescript
|
|
76
|
-
const payments = await
|
|
77
|
+
const payments = await ariari.payment.getAll();
|
|
77
78
|
```
|
|
78
79
|
|
|
79
80
|
### Get Payment by ID
|
|
80
81
|
|
|
81
82
|
```typescript
|
|
82
|
-
const payment =
|
|
83
|
+
const payment = ariari.payment.getById('payment-id-123');
|
|
83
84
|
await payment.get();
|
|
84
85
|
await payment.updateRest('TICKET123');
|
|
85
86
|
```
|
|
86
87
|
```typescript
|
|
87
|
-
const payment = await
|
|
88
|
+
const payment = await ariari.payment({
|
|
88
89
|
phone: '261345678901',
|
|
89
90
|
amount: 5000
|
|
90
91
|
});
|
|
91
92
|
|
|
92
|
-
const payments = await
|
|
93
|
+
const payments = await ariari.payment.getPayments();
|
|
93
94
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -59,6 +59,10 @@ declare class Payment {
|
|
|
59
59
|
updateRest: (ticketCode: string) => Promise<unknown>;
|
|
60
60
|
}
|
|
61
61
|
declare class Ariari {
|
|
62
|
+
config(cfg: {
|
|
63
|
+
projectId: string;
|
|
64
|
+
secretId: string;
|
|
65
|
+
}): void;
|
|
62
66
|
send(...data: Message[]): Promise<Task>;
|
|
63
67
|
tasks(param: GetTaskParam): Promise<unknown>;
|
|
64
68
|
createPayment(data: {
|
package/dist/index.d.ts
CHANGED
|
@@ -59,6 +59,10 @@ declare class Payment {
|
|
|
59
59
|
updateRest: (ticketCode: string) => Promise<unknown>;
|
|
60
60
|
}
|
|
61
61
|
declare class Ariari {
|
|
62
|
+
config(cfg: {
|
|
63
|
+
projectId: string;
|
|
64
|
+
secretId: string;
|
|
65
|
+
}): void;
|
|
62
66
|
send(...data: Message[]): Promise<Task>;
|
|
63
67
|
tasks(param: GetTaskParam): Promise<unknown>;
|
|
64
68
|
createPayment(data: {
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,9 @@ module.exports = __toCommonJS(src_exports);
|
|
|
28
28
|
|
|
29
29
|
// src/config/index.ts
|
|
30
30
|
var config = null;
|
|
31
|
+
function setConfig(cfg) {
|
|
32
|
+
config = cfg;
|
|
33
|
+
}
|
|
31
34
|
function getConfig() {
|
|
32
35
|
return config;
|
|
33
36
|
}
|
|
@@ -119,6 +122,9 @@ var Ariari = class {
|
|
|
119
122
|
this.Task = Task;
|
|
120
123
|
this.Payment = Payment;
|
|
121
124
|
}
|
|
125
|
+
config(cfg) {
|
|
126
|
+
setConfig(cfg);
|
|
127
|
+
}
|
|
122
128
|
async send(...data) {
|
|
123
129
|
const messages = data.map((item) => ({
|
|
124
130
|
phones: (Array.isArray(item.phone) ? item.phone : [item.phone]).map(normalizePhoneNumber),
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// src/config/index.ts
|
|
2
2
|
var config = null;
|
|
3
|
+
function setConfig(cfg) {
|
|
4
|
+
config = cfg;
|
|
5
|
+
}
|
|
3
6
|
function getConfig() {
|
|
4
7
|
return config;
|
|
5
8
|
}
|
|
@@ -91,6 +94,9 @@ var Ariari = class {
|
|
|
91
94
|
this.Task = Task;
|
|
92
95
|
this.Payment = Payment;
|
|
93
96
|
}
|
|
97
|
+
config(cfg) {
|
|
98
|
+
setConfig(cfg);
|
|
99
|
+
}
|
|
94
100
|
async send(...data) {
|
|
95
101
|
const messages = data.map((item) => ({
|
|
96
102
|
phones: (Array.isArray(item.phone) ? item.phone : [item.phone]).map(normalizePhoneNumber),
|