myxl-core 1.0.0 → 1.0.2

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 (40) hide show
  1. package/dist/ciam.d.ts +2 -2
  2. package/dist/ciam.js +5 -5
  3. package/dist/client.js +0 -1
  4. package/dist/device.d.ts +2 -2
  5. package/dist/device.js +5 -5
  6. package/dist/index.d.ts +2 -3
  7. package/dist/index.js +336 -139
  8. package/dist/lib/decoy.d.ts +6 -0
  9. package/dist/lib/decoy.js +547 -75
  10. package/dist/lib/payment.d.ts +2 -2
  11. package/dist/lib/utils.d.ts +1 -0
  12. package/dist/lib/utils.js +8 -3
  13. package/dist/package.js +1 -3
  14. package/dist/payments/ewallet.d.ts +3 -11
  15. package/dist/payments/ewallet.js +154 -90
  16. package/dist/payments/index.d.ts +5 -1
  17. package/dist/payments/index.js +308 -94
  18. package/dist/payments/{balance.d.ts → method/balance.d.ts} +1 -1
  19. package/dist/payments/{balance.js → method/balance.js} +1 -1
  20. package/dist/payments/method/ewallet.d.ts +11 -0
  21. package/dist/payments/method/ewallet.js +372 -0
  22. package/dist/payments/method/index.d.ts +3 -0
  23. package/dist/payments/method/index.js +631 -0
  24. package/dist/payments/method/qris.d.ts +2 -0
  25. package/dist/payments/method/qris.js +377 -0
  26. package/dist/payments/pulsa-decoy-v2.d.ts +2 -0
  27. package/dist/payments/pulsa-decoy-v2.js +476 -0
  28. package/dist/payments/pulsa-decoy.d.ts +8 -0
  29. package/dist/payments/pulsa-decoy.js +475 -0
  30. package/dist/payments/pulsa.d.ts +2 -0
  31. package/dist/payments/pulsa.js +452 -0
  32. package/dist/payments/qris-decoy-v2.d.ts +2 -0
  33. package/dist/payments/qris-decoy-v2.js +449 -0
  34. package/dist/payments/qris-decoy.d.ts +5 -0
  35. package/dist/payments/qris-decoy.js +448 -0
  36. package/dist/payments/qris.d.ts +2 -2
  37. package/dist/payments/qris.js +146 -82
  38. package/package.json +41 -9
  39. package/dist/payments/decoy.d.ts +0 -1
  40. package/dist/payments/decoy.js +0 -6
package/dist/ciam.d.ts CHANGED
@@ -9,7 +9,7 @@ export type AuthToken = {
9
9
  session_state: string;
10
10
  scope: string;
11
11
  };
12
- export declare function getNewToken(refreshToken: string, axDeviceId: string, axFingerprint: string): Promise<AuthToken>;
12
+ export declare function refreshToken(refreshToken: string, axDeviceId: string, axFingerprint: string): Promise<AuthToken>;
13
13
  export type Profile = {
14
14
  age: number;
15
15
  alternate_phone_number: string;
@@ -254,6 +254,6 @@ export type MyPackagesResponse = {
254
254
  show_autobuy_banner: boolean;
255
255
  };
256
256
  };
257
- export declare function fetchMyPackages({ idToken }: {
257
+ export declare function getMyPackages({ idToken }: {
258
258
  idToken: string;
259
259
  }): Promise<MyPackagesResponse>;
package/dist/ciam.js CHANGED
@@ -256,7 +256,7 @@ init_utils();
256
256
  import axios2 from "axios";
257
257
  import { DateTime as DateTime2, FixedOffsetZone } from "luxon";
258
258
  import { v4 as uuidv42 } from "uuid";
259
- async function getNewToken(refreshToken, axDeviceId, axFingerprint) {
259
+ async function refreshToken(refreshToken2, axDeviceId, axFingerprint) {
260
260
  try {
261
261
  const url = `${BASE_CIAM_URL}/realms/xl-ciam/protocol/openid-connect/token`;
262
262
  const gmt7Zone = FixedOffsetZone.instance(420);
@@ -278,7 +278,7 @@ async function getNewToken(refreshToken, axDeviceId, axFingerprint) {
278
278
  };
279
279
  const data = new URLSearchParams({
280
280
  grant_type: "refresh_token",
281
- refresh_token: refreshToken
281
+ refresh_token: refreshToken2
282
282
  });
283
283
  const resp = await axios2.post(url, data.toString(), {
284
284
  headers,
@@ -331,7 +331,7 @@ async function checkQuota(msisdn) {
331
331
  const response = await axios2.get(url);
332
332
  return response.data;
333
333
  }
334
- async function fetchMyPackages({ idToken }) {
334
+ async function getMyPackages({ idToken }) {
335
335
  const path = "api/v8/packages/quota-details";
336
336
  const rawPayload = {
337
337
  is_enterprise: false,
@@ -341,11 +341,11 @@ async function fetchMyPackages({ idToken }) {
341
341
  return await sendApiRequest(path, rawPayload, idToken, "POST");
342
342
  }
343
343
  export {
344
+ refreshToken,
344
345
  getTieringInfo,
345
346
  getRedeemables,
346
347
  getProfile,
347
- getNewToken,
348
+ getMyPackages,
348
349
  getBalance,
349
- fetchMyPackages,
350
350
  checkQuota
351
351
  };
package/dist/client.js CHANGED
@@ -258,7 +258,6 @@ async function getTransactionHistory({ idToken }) {
258
258
  is_enterprise: false,
259
259
  lang: "en"
260
260
  };
261
- console.log("Fetching transaction history...");
262
261
  const res = await sendApiRequest(path, payload, idToken, "POST");
263
262
  return res.data.list;
264
263
  }
package/dist/device.d.ts CHANGED
@@ -9,14 +9,14 @@ export type DeviceInfo = {
9
9
  android_release: string;
10
10
  msisdn: string;
11
11
  };
12
- export declare function buildFingerprintPlain(dev: DeviceInfo): string;
12
+ export declare function buildFingerprintPlaintext(dev: DeviceInfo): string;
13
13
  export declare function axFingerprint(dev: DeviceInfo, secretKey32Ascii: string): string;
14
14
  /**
15
15
  * Equivalent to Python `load_ax_fp()`
16
16
  * - kalau file ada & isinya tidak kosong -> return isinya
17
17
  * - kalau tidak -> generate DeviceInfo random, encrypt, simpan, return
18
18
  */
19
- export declare function generateAxFp(params?: {
19
+ export declare function generateAxFingerprint(params?: {
20
20
  ip?: string;
21
21
  msisdn?: string;
22
22
  }): string;
package/dist/device.js CHANGED
@@ -57,7 +57,7 @@ import crypto from "crypto";
57
57
  function randint(min, max) {
58
58
  return Math.floor(Math.random() * (max - min + 1)) + min;
59
59
  }
60
- function buildFingerprintPlain(dev) {
60
+ function buildFingerprintPlaintext(dev) {
61
61
  return `${dev.manufacturer}|${dev.model}|${dev.lang}|${dev.resolution}|` + `${dev.tz_short}|${dev.ip}|${dev.font_scale}|Android ${dev.android_release}|${dev.msisdn}`;
62
62
  }
63
63
  function pkcs7Pad(buf, blockSize = 16) {
@@ -72,14 +72,14 @@ function axFingerprint(dev, secretKey32Ascii) {
72
72
  throw new Error(`AX_FP_KEY invalid length: got ${key.length} bytes. Expected 16/24/32 ASCII chars.`);
73
73
  }
74
74
  const iv = Buffer.alloc(16, 0);
75
- const pt = Buffer.from(buildFingerprintPlain(dev), "utf8");
75
+ const pt = Buffer.from(buildFingerprintPlaintext(dev), "utf8");
76
76
  const padded = pkcs7Pad(pt, 16);
77
77
  const cipher = crypto.createCipheriv(key.length === 16 ? "aes-128-cbc" : key.length === 24 ? "aes-192-cbc" : "aes-256-cbc", key, iv);
78
78
  cipher.setAutoPadding(false);
79
79
  const ct = Buffer.concat([cipher.update(padded), cipher.final()]);
80
80
  return ct.toString("base64");
81
81
  }
82
- function generateAxFp(params) {
82
+ function generateAxFingerprint(params) {
83
83
  const dev = {
84
84
  manufacturer: "samsung" + String(randint(1000, 9999)),
85
85
  model: "SM-N93" + String(randint(1000, 9999)),
@@ -101,7 +101,7 @@ function getAxDeviceId(axFp) {
101
101
  }
102
102
  export {
103
103
  getAxDeviceId,
104
- generateAxFp,
105
- buildFingerprintPlain,
104
+ generateAxFingerprint,
105
+ buildFingerprintPlaintext,
106
106
  axFingerprint
107
107
  };
package/dist/index.d.ts CHANGED
@@ -10,10 +10,9 @@ export * as Notification from "./notification";
10
10
  export * as Package from "./package";
11
11
  export * as Payments from "./payments";
12
12
  export * as Profile from "./profile";
13
- export * as Types from "./@types/payment";
13
+ export * as PaymentTypes from "./@types/payment";
14
14
  export * as Utils from "./lib/utils";
15
15
  export * as Verification from "./verification";
16
16
  export * as EncryptHelper from "./lib/encrypt-helper";
17
- export * as Payment from "./lib/payment";
17
+ export * as Settlement from "./lib/payment";
18
18
  export * as Decoy from "./lib/decoy";
19
- export * as PaymentsDecoy from "./payments/decoy";