@first-iraqi-bank/sdk 0.1.3 → 0.1.4

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/payment.cjs CHANGED
@@ -25,15 +25,24 @@ __export(payment_exports, {
25
25
  module.exports = __toCommonJS(payment_exports);
26
26
 
27
27
  // src/shared/net.ts
28
+ var MAP_ENVIRONMENT_TO_BASE_URL = {
29
+ dev: "https://fib-dev.fib.iq",
30
+ stage: "https://fib-stage.fib.iq",
31
+ prod: "https://fib.prod.fib.iq"
32
+ };
28
33
  var BaseHTTP = class {
29
34
  #baseUrl;
30
35
  #clientId;
31
36
  #clientSecret;
32
37
  #grantType = "client_credentials";
33
38
  constructor(clientId, clientSecret, env) {
39
+ const rawBaseURL = MAP_ENVIRONMENT_TO_BASE_URL[env];
40
+ if (!rawBaseURL) {
41
+ throw new Error(`Invalid environment: ${env}`);
42
+ }
34
43
  this.#clientId = clientId;
35
44
  this.#clientSecret = clientSecret;
36
- this.#baseUrl = new URL(`https://fib-${env}.fib.iq`);
45
+ this.#baseUrl = new URL(rawBaseURL);
37
46
  }
38
47
  getBaseUrl() {
39
48
  return this.#baseUrl;
package/dist/payment.js CHANGED
@@ -1,13 +1,22 @@
1
1
  // src/shared/net.ts
2
+ var MAP_ENVIRONMENT_TO_BASE_URL = {
3
+ dev: "https://fib-dev.fib.iq",
4
+ stage: "https://fib-stage.fib.iq",
5
+ prod: "https://fib.prod.fib.iq"
6
+ };
2
7
  var BaseHTTP = class {
3
8
  #baseUrl;
4
9
  #clientId;
5
10
  #clientSecret;
6
11
  #grantType = "client_credentials";
7
12
  constructor(clientId, clientSecret, env) {
13
+ const rawBaseURL = MAP_ENVIRONMENT_TO_BASE_URL[env];
14
+ if (!rawBaseURL) {
15
+ throw new Error(`Invalid environment: ${env}`);
16
+ }
8
17
  this.#clientId = clientId;
9
18
  this.#clientSecret = clientSecret;
10
- this.#baseUrl = new URL(`https://fib-${env}.fib.iq`);
19
+ this.#baseUrl = new URL(rawBaseURL);
11
20
  }
12
21
  getBaseUrl() {
13
22
  return this.#baseUrl;
package/dist/payout.cjs CHANGED
@@ -25,15 +25,24 @@ __export(payout_exports, {
25
25
  module.exports = __toCommonJS(payout_exports);
26
26
 
27
27
  // src/shared/net.ts
28
+ var MAP_ENVIRONMENT_TO_BASE_URL = {
29
+ dev: "https://fib-dev.fib.iq",
30
+ stage: "https://fib-stage.fib.iq",
31
+ prod: "https://fib.prod.fib.iq"
32
+ };
28
33
  var BaseHTTP = class {
29
34
  #baseUrl;
30
35
  #clientId;
31
36
  #clientSecret;
32
37
  #grantType = "client_credentials";
33
38
  constructor(clientId, clientSecret, env) {
39
+ const rawBaseURL = MAP_ENVIRONMENT_TO_BASE_URL[env];
40
+ if (!rawBaseURL) {
41
+ throw new Error(`Invalid environment: ${env}`);
42
+ }
34
43
  this.#clientId = clientId;
35
44
  this.#clientSecret = clientSecret;
36
- this.#baseUrl = new URL(`https://fib-${env}.fib.iq`);
45
+ this.#baseUrl = new URL(rawBaseURL);
37
46
  }
38
47
  getBaseUrl() {
39
48
  return this.#baseUrl;
package/dist/payout.js CHANGED
@@ -1,13 +1,22 @@
1
1
  // src/shared/net.ts
2
+ var MAP_ENVIRONMENT_TO_BASE_URL = {
3
+ dev: "https://fib-dev.fib.iq",
4
+ stage: "https://fib-stage.fib.iq",
5
+ prod: "https://fib.prod.fib.iq"
6
+ };
2
7
  var BaseHTTP = class {
3
8
  #baseUrl;
4
9
  #clientId;
5
10
  #clientSecret;
6
11
  #grantType = "client_credentials";
7
12
  constructor(clientId, clientSecret, env) {
13
+ const rawBaseURL = MAP_ENVIRONMENT_TO_BASE_URL[env];
14
+ if (!rawBaseURL) {
15
+ throw new Error(`Invalid environment: ${env}`);
16
+ }
8
17
  this.#clientId = clientId;
9
18
  this.#clientSecret = clientSecret;
10
- this.#baseUrl = new URL(`https://fib-${env}.fib.iq`);
19
+ this.#baseUrl = new URL(rawBaseURL);
11
20
  }
12
21
  getBaseUrl() {
13
22
  return this.#baseUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@first-iraqi-bank/sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Accept payment and send payout from and to First Iraqi Bank customers with ease!",
5
5
  "type": "module",
6
6
  "files": [