telebirr-nodejs 1.0.6 → 1.0.8

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.
Files changed (2) hide show
  1. package/README.md +28 -29
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -21,13 +21,13 @@ You should never hard-code secrets. Always load them from process.env.
21
21
 
22
22
  ### Required Credentials
23
23
 
24
- | Name | Description |
25
- | ---------------------- | ---------------------------- |
26
- | `FABRIC_APP_ID` | Fabric application ID |
27
- | `FABRIC_APP_SECRET` | Fabric application secret |
28
- | `MERCHANT_APP_ID` | Merchant application ID |
29
- | `MERCHANT_CODE` | Merchant code |
30
- | `MERCHANT_PRIVATE_KEY` | RSA private key (PEM string) |
24
+ | Name | Description |
25
+ | ---------------------- | -------------------------------------------------------------------------------------- |
26
+ | `FABRIC_APP_ID` | Fabric application ID (c4182ef8-9249-458a-985e-06d191f4d505 uuid-v4 string) |
27
+ | `FABRIC_APP_SECRET` | Fabric application secret ("fad0f06383c6297f54rr78694b974599" 32 hex character string) |
28
+ | `MERCHANT_APP_ID` | Merchant application ID ("7606201678956824" 16 integer character string) |
29
+ | `MERCHANT_CODE` | Merchant code ("000000" 6 integer character string) |
30
+ | `MERCHANT_PRIVATE_KEY` | RSA private key (PEM string) |
31
31
 
32
32
  ---
33
33
 
@@ -42,6 +42,8 @@ You should never hard-code secrets. Always load them from process.env.
42
42
 
43
43
  ### Basic Setup
44
44
 
45
+ ---
46
+
45
47
  ```bash
46
48
  import { TelebirrClient } from "telebirr-nodejs";
47
49
 
@@ -51,7 +53,7 @@ const client = new TelebirrClient({
51
53
  appSecret: process.env.FABRIC_APP_SECRET!,
52
54
  merchantAppId: process.env.MERCHANT_APP_ID!,
53
55
  merchantCode: process.env.MERCHANT_CODE!,
54
- privateKey: process.env.MERCHANT_PRIVATE_KEY!,
56
+ merchantPrivateKey: process.env.MERCHANT_PRIVATE_KEY!,
55
57
  notifyUrl: process.env.TELEBIRR_NOTIFY_URL!,
56
58
  redirectUrl: process.env.TELEBIRR_REDIRECT_URL!,
57
59
  http: true, // allow HTTP in simulator mode
@@ -75,15 +77,13 @@ MERCHANT_PRIVATE_KEY must be the full PEM string, including:
75
77
 
76
78
  ### Example API Routes
77
79
 
78
- Below is a complete demo using three routes:
79
-
80
80
  1. POST /payment/initiate
81
- 2. GET /payment/status/:merchOrderId
81
+ 2. GET /payment/status
82
82
  3. POST /payment/refund
83
83
 
84
84
  ---
85
85
 
86
- ### 1 Initiate Payment
86
+ ### 1. Initiate Payment
87
87
 
88
88
  Creates an order and redirects the user to the Telebirr checkout page.
89
89
 
@@ -104,7 +104,7 @@ If you are using a frontend framework (for example React) and do not want to los
104
104
 
105
105
  ---
106
106
 
107
- ### 2 Query Payment Status
107
+ ### 2. Query Payment Status
108
108
 
109
109
  Used to check the payment result using the merchant order ID.
110
110
 
@@ -123,13 +123,12 @@ https://developer.ethiotelecom.et/docs/H5%20C2B%20Web%20Payment%20Integration%20
123
123
 
124
124
  ---
125
125
 
126
- ### 3 Refund Payment
126
+ ### 3. Refund Payment
127
127
 
128
128
  Refunds a completed transaction.
129
129
 
130
130
  ```bash
131
131
  app.post("/payment/refund", async (req, res) => {
132
-
133
132
  const refundData = await client.refundOrder({
134
133
  merchOrderId: "order123",
135
134
  refundRequestNo: "original-transaction-id",
@@ -138,7 +137,7 @@ app.post("/payment/refund", async (req, res) => {
138
137
  });
139
138
 
140
139
  res.json(refundData);
141
- });
140
+ });
142
141
 
143
142
  ```
144
143
 
@@ -154,13 +153,13 @@ To use the simulator provided by this package, set the mode to simulate.
154
153
  ```bash
155
154
  import { TelebirrClient } from "telebirr-nodejs";
156
155
 
157
- const client = new TelebirrClient({
158
- mode: "simulate",
159
- notifyUrl: "https://example.com/notify",
160
- redirectUrl: "https://example.com/redirect",
161
- http: true,
162
- IntegrationOption: "C2B",
163
- });
156
+ const client = new TelebirrClient({
157
+ mode: "simulate",
158
+ notifyUrl: "https://example.com/notify",
159
+ redirectUrl: "https://example.com/redirect",
160
+ http: true,
161
+ IntegrationOption: "C2B",
162
+ });
164
163
 
165
164
  ```
166
165
 
@@ -192,12 +191,12 @@ You can generate private and public keys instantly.
192
191
  ```bash
193
192
  import { generateKeys } from "telebirr-nodejs";
194
193
 
195
- generateKeys({
196
- dir: process.cwd(),
197
- privateKeyName: "telefy_private.pem",
198
- publicKeyName: "telefy_public.pem",
199
- overwrite: false,
200
- });
194
+ generateKeys({
195
+ dir: process.cwd(),
196
+ privateKeyName: "telefy_private.pem",
197
+ publicKeyName: "telefy_public.pem",
198
+ overwrite: false,
199
+ });
201
200
 
202
201
  ```
203
202
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telebirr-nodejs",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Unofficial Telebirr Node.js SDK.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",