litegate-sdk 1.0.3 → 1.0.6

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/dist/client.d.ts CHANGED
@@ -3,7 +3,7 @@ export declare class LiteGateClient {
3
3
  PublicKey: string;
4
4
  PrivateKey: string;
5
5
  constructor(PublicKey: string, PrivateKey: string);
6
- initiateTelebirrPayment(title: string, amount: string, buyer_phone_number: string): Promise<any>;
6
+ initiateTelebirrPayment(title: string, amount: string, buyer_phone_number: string, test_mode?: boolean): Promise<any>;
7
7
  telebirrCallback({ notify_url, appid, notify_time, merch_code, merch_order_id, payment_order_id, total_amount, trans_currency, trade_status, trans_end_time, callback_info, sign, sign_type, transId, }: {
8
8
  notify_url: string;
9
9
  appid: string;
@@ -20,6 +20,6 @@ export declare class LiteGateClient {
20
20
  sign_type: string;
21
21
  transId: string;
22
22
  }): Promise<any>;
23
- initiateCbebirrPayment(title: string, amount: string, buyer_phone_number: string, publicKey: string, privateKey: string): Promise<any>;
23
+ initiateCbebirrPayment(title: string, amount: string, buyer_phone_number: string, test_mode?: boolean, test_url?: null): Promise<any>;
24
24
  cbebirrCallback(EncVal: string): Promise<any>;
25
25
  }
package/dist/client.js CHANGED
@@ -8,9 +8,10 @@ class LiteGateClient {
8
8
  this.PublicKey = PublicKey;
9
9
  this.PrivateKey = PrivateKey;
10
10
  }
11
- async initiateTelebirrPayment(title, amount, buyer_phone_number) {
12
- const body = { title, amount, buyer_phone_number };
11
+ async initiateTelebirrPayment(title, amount, buyer_phone_number, test_mode = false) {
12
+ const body = { title, amount, buyer_phone_number, test_mode };
13
13
  const signature = await (0, signature_1.signRequest)(body, this.PrivateKey);
14
+ console.log(signature);
14
15
  const response = await fetch(`${this.baseUrl}/v1/telebirr/initiate/`, {
15
16
  method: "POST",
16
17
  headers: {
@@ -56,14 +57,14 @@ class LiteGateClient {
56
57
  }
57
58
  return response.json();
58
59
  }
59
- async initiateCbebirrPayment(title, amount, buyer_phone_number, publicKey, privateKey) {
60
- const body = { title, amount, buyer_phone_number };
61
- const signature = await (0, signature_1.signRequest)(body, privateKey);
60
+ async initiateCbebirrPayment(title, amount, buyer_phone_number, test_mode = false, test_url = null) {
61
+ const body = { title, amount, buyer_phone_number, test_mode, test_url };
62
+ const signature = await (0, signature_1.signRequest)(body, this.PrivateKey);
62
63
  const response = await fetch(`${this.baseUrl}/v1/cbebirr/initiate/`, {
63
64
  method: "POST",
64
65
  headers: {
65
66
  "Content-Type": "application/json",
66
- Authorization: `PublicKey ${publicKey}`,
67
+ Authorization: `PublicKey ${this.PublicKey}`,
67
68
  "X-SIGNATURE": signature,
68
69
  },
69
70
  body: JSON.stringify(body),
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "litegate-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "Official TypeScript SDK for LiteGate API",
5
- "main": "index.js",
5
+ "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
8
  "dist"
@@ -21,6 +21,7 @@
21
21
  "axios": "^1.13.2",
22
22
  "crypto": "^1.0.1",
23
23
  "jose": "^6.1.3",
24
+ "litegate-sdk": "^1.0.3",
24
25
  "node-forge": "^1.3.3",
25
26
  "openapi-typescript": "^7.10.1"
26
27
  },