myxl-core 1.0.1 → 1.0.3
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.js +0 -1
- package/dist/index.js +165 -55
- package/dist/lib/decoy.d.ts +9 -7
- package/dist/lib/decoy.js +557 -7
- package/dist/lib/utils.js +2 -3
- package/dist/package.js +1 -3
- package/dist/payments/ewallet.d.ts +1 -1
- package/dist/payments/ewallet.js +2 -24
- package/dist/payments/index.js +45 -36
- package/dist/payments/method/ewallet.js +2 -3
- package/dist/payments/method/index.js +2 -3
- package/dist/payments/method/qris.js +2 -3
- package/dist/payments/pulsa-decoy-v2.d.ts +1 -2
- package/dist/payments/pulsa-decoy-v2.js +9 -2
- package/dist/payments/pulsa-decoy.d.ts +1 -0
- package/dist/payments/pulsa-decoy.js +13 -2
- package/dist/payments/qris-decoy-v2.d.ts +1 -1
- package/dist/payments/qris-decoy-v2.js +87 -101
- package/dist/payments/qris-decoy.d.ts +3 -2
- package/dist/payments/qris-decoy.js +90 -100
- package/dist/payments/qris.d.ts +1 -1
- package/dist/payments/qris.js +2 -24
- package/package.json +1 -1
package/dist/client.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -284,16 +284,15 @@ async function interceptPage(idToken, optionCode, isEnterprise = false) {
|
|
|
284
284
|
lang: "en",
|
|
285
285
|
package_option_code: optionCode
|
|
286
286
|
};
|
|
287
|
-
console.log("Fetching intercept page...");
|
|
288
287
|
try {
|
|
289
288
|
const res = await sendApiRequest(path, rawPayload, idToken, "POST");
|
|
290
289
|
if ("status" in res) {
|
|
291
290
|
console.log(`Intercept status: ${res["status"]}`);
|
|
292
291
|
} else {
|
|
293
|
-
console.
|
|
292
|
+
console.error("Intercept error");
|
|
294
293
|
}
|
|
295
294
|
} catch (err) {
|
|
296
|
-
console.
|
|
295
|
+
console.error("Intercept error", err);
|
|
297
296
|
}
|
|
298
297
|
}
|
|
299
298
|
function unseal(getter, fallback) {
|
|
@@ -551,7 +550,6 @@ async function getTransactionHistory({ idToken }) {
|
|
|
551
550
|
is_enterprise: false,
|
|
552
551
|
lang: "en"
|
|
553
552
|
};
|
|
554
|
-
console.log("Fetching transaction history...");
|
|
555
553
|
const res = await sendApiRequest(path, payload, idToken, "POST");
|
|
556
554
|
return res.data.list;
|
|
557
555
|
}
|
|
@@ -867,7 +865,6 @@ async function getPackage({
|
|
|
867
865
|
is_upsell_pdp: false,
|
|
868
866
|
package_variant_code: packageVariantCode
|
|
869
867
|
};
|
|
870
|
-
console.log("Fetching package...");
|
|
871
868
|
const response = await sendApiRequest(path, payload, idToken, "POST");
|
|
872
869
|
return response.data;
|
|
873
870
|
}
|
|
@@ -908,10 +905,9 @@ async function getAddons({
|
|
|
908
905
|
lang: "en",
|
|
909
906
|
package_option_code: packageOptionCode
|
|
910
907
|
};
|
|
911
|
-
console.log("Fetching addons...");
|
|
912
908
|
const res = await sendApiRequest(path, rawPayload, idToken, "POST");
|
|
913
909
|
if (!("data" in res)) {
|
|
914
|
-
console.
|
|
910
|
+
console.error("Error getting addons:", res.error ?? "Unknown error");
|
|
915
911
|
return null;
|
|
916
912
|
}
|
|
917
913
|
return res.data;
|
|
@@ -921,34 +917,15 @@ var exports_payments = {};
|
|
|
921
917
|
__export(exports_payments, {
|
|
922
918
|
payQrisWithDecoy: () => payQrisWithDecoy,
|
|
923
919
|
payQrisDecoyV2: () => payQrisDecoyV2,
|
|
920
|
+
payQrisDecoy: () => payQrisDecoy,
|
|
924
921
|
payQris: () => payQris,
|
|
925
922
|
payPulsaWithDecoy: () => payPulsaWithDecoy,
|
|
926
923
|
payPulsaDecoyV2: () => payPulsaDecoyV2,
|
|
924
|
+
payPulsaDecoy: () => payPulsaDecoy,
|
|
927
925
|
payPulsa: () => payPulsa,
|
|
928
926
|
payEwallet: () => payEwallet
|
|
929
927
|
});
|
|
930
928
|
|
|
931
|
-
// src/lib/payment.ts
|
|
932
|
-
init_utils();
|
|
933
|
-
var exports_payment = {};
|
|
934
|
-
__export(exports_payment, {
|
|
935
|
-
getTransactionDetail: () => getTransactionDetail
|
|
936
|
-
});
|
|
937
|
-
async function getTransactionDetail({
|
|
938
|
-
idToken,
|
|
939
|
-
transactionId
|
|
940
|
-
}) {
|
|
941
|
-
const path = "payments/api/v8/pending-detail";
|
|
942
|
-
const payload = {
|
|
943
|
-
transaction_id: transactionId,
|
|
944
|
-
is_enterprise: false,
|
|
945
|
-
lang: "en",
|
|
946
|
-
status: ""
|
|
947
|
-
};
|
|
948
|
-
const res = await sendApiRequest(path, payload, idToken, "POST");
|
|
949
|
-
return res.data;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
929
|
// src/payments/ewallet.ts
|
|
953
930
|
init_utils();
|
|
954
931
|
|
|
@@ -1307,10 +1284,6 @@ async function payEwallet(idToken, accessToken, pkg, overwriteAmount, walletNumb
|
|
|
1307
1284
|
walletNumber,
|
|
1308
1285
|
paymentMethod
|
|
1309
1286
|
});
|
|
1310
|
-
if (result.status === "SUCCESS") {
|
|
1311
|
-
const transaction = await getTransactionDetail({ idToken, transactionId: result.data.transaction_code });
|
|
1312
|
-
return transaction;
|
|
1313
|
-
}
|
|
1314
1287
|
return result;
|
|
1315
1288
|
}
|
|
1316
1289
|
// src/payments/pulsa.ts
|
|
@@ -1361,7 +1334,6 @@ async function payPulsaWithDecoy(idToken, accessToken, pkg, useDecoyToken = fals
|
|
|
1361
1334
|
if (result.status === "SUCCESS") {
|
|
1362
1335
|
return result;
|
|
1363
1336
|
}
|
|
1364
|
-
console.log(JSON.stringify(result, null, 2));
|
|
1365
1337
|
if (result.message.includes("Bizz-err.Amount.Total")) {
|
|
1366
1338
|
const match = result.message.match(/=\s*(\d+)/);
|
|
1367
1339
|
result = await settle(Number(match ? match[1] : 0));
|
|
@@ -1371,8 +1343,27 @@ async function payPulsaWithDecoy(idToken, accessToken, pkg, useDecoyToken = fals
|
|
|
1371
1343
|
}
|
|
1372
1344
|
return result;
|
|
1373
1345
|
}
|
|
1346
|
+
async function payPulsaDecoy(idToken, accessToken, pkg, decoyPkg) {
|
|
1347
|
+
const decoyItem = {
|
|
1348
|
+
item_name: decoyPkg.package_option.name,
|
|
1349
|
+
item_code: decoyPkg.package_option.package_option_code,
|
|
1350
|
+
item_price: decoyPkg.package_option.price,
|
|
1351
|
+
product_type: decoyPkg.package_option.product_type,
|
|
1352
|
+
token_confirmation: decoyPkg.token_confirmation,
|
|
1353
|
+
tax: 0
|
|
1354
|
+
};
|
|
1355
|
+
await payPulsaWithDecoy(idToken, accessToken, pkg, false, decoyItem);
|
|
1356
|
+
}
|
|
1374
1357
|
// src/payments/pulsa-decoy-v2.ts
|
|
1375
|
-
async function payPulsaDecoyV2(idToken, accessToken, pkg,
|
|
1358
|
+
async function payPulsaDecoyV2(idToken, accessToken, pkg, decoyPkg) {
|
|
1359
|
+
const decoyItem = {
|
|
1360
|
+
item_name: decoyPkg.package_option.name,
|
|
1361
|
+
item_code: decoyPkg.package_option.package_option_code,
|
|
1362
|
+
item_price: decoyPkg.package_option.price,
|
|
1363
|
+
product_type: decoyPkg.package_option.product_type,
|
|
1364
|
+
token_confirmation: decoyPkg.token_confirmation,
|
|
1365
|
+
tax: 0
|
|
1366
|
+
};
|
|
1376
1367
|
await payPulsaWithDecoy(idToken, accessToken, pkg, true, decoyItem);
|
|
1377
1368
|
}
|
|
1378
1369
|
// src/payments/qris-decoy.ts
|
|
@@ -1397,15 +1388,30 @@ async function payQrisWithDecoy(idToken, accessToken, pkg, overwriteAmount, deco
|
|
|
1397
1388
|
items: [mainItem, finalDecoyItem],
|
|
1398
1389
|
paymentTargetsMethodsOption: finalDecoyItem.item_code
|
|
1399
1390
|
});
|
|
1400
|
-
if (result.status === "SUCCESS") {
|
|
1401
|
-
const transaction = await getTransactionDetail({ idToken, transactionId: result.data.transaction_code });
|
|
1402
|
-
return transaction;
|
|
1403
|
-
}
|
|
1404
1391
|
return result;
|
|
1405
1392
|
}
|
|
1393
|
+
async function payQrisDecoy(idToken, accessToken, pkg, overwriteAmount, decoyPkg) {
|
|
1394
|
+
const decoyItem = {
|
|
1395
|
+
item_name: decoyPkg.package_option.name,
|
|
1396
|
+
item_code: decoyPkg.package_option.package_option_code,
|
|
1397
|
+
item_price: decoyPkg.package_option.price,
|
|
1398
|
+
product_type: decoyPkg.package_option.product_type,
|
|
1399
|
+
token_confirmation: decoyPkg.token_confirmation,
|
|
1400
|
+
tax: 0
|
|
1401
|
+
};
|
|
1402
|
+
await payQrisWithDecoy(idToken, accessToken, pkg, overwriteAmount, decoyItem);
|
|
1403
|
+
}
|
|
1406
1404
|
// src/payments/qris-decoy-v2.ts
|
|
1407
|
-
async function payQrisDecoyV2(idToken, accessToken, pkg, overwriteAmount) {
|
|
1408
|
-
|
|
1405
|
+
async function payQrisDecoyV2(idToken, accessToken, pkg, overwriteAmount, decoyPkg) {
|
|
1406
|
+
const decoyItem = {
|
|
1407
|
+
item_name: decoyPkg.package_option.name,
|
|
1408
|
+
item_code: decoyPkg.package_option.package_option_code,
|
|
1409
|
+
item_price: decoyPkg.package_option.price,
|
|
1410
|
+
product_type: decoyPkg.package_option.product_type,
|
|
1411
|
+
token_confirmation: decoyPkg.token_confirmation,
|
|
1412
|
+
tax: 0
|
|
1413
|
+
};
|
|
1414
|
+
await payQrisWithDecoy(idToken, accessToken, pkg, overwriteAmount, decoyItem);
|
|
1409
1415
|
}
|
|
1410
1416
|
// src/payments/qris.ts
|
|
1411
1417
|
init_utils();
|
|
@@ -1428,10 +1434,6 @@ async function payQris(idToken, accessToken, pkg, overwriteAmount) {
|
|
|
1428
1434
|
item: mainItem,
|
|
1429
1435
|
items: [mainItem]
|
|
1430
1436
|
});
|
|
1431
|
-
if (result.status === "SUCCESS") {
|
|
1432
|
-
const transaction = await getTransactionDetail({ idToken, transactionId: result.data.transaction_code });
|
|
1433
|
-
return transaction;
|
|
1434
|
-
}
|
|
1435
1437
|
return result;
|
|
1436
1438
|
}
|
|
1437
1439
|
// src/profile.ts
|
|
@@ -1450,8 +1452,8 @@ async function getPendingTransaction(idToken) {
|
|
|
1450
1452
|
return res.data;
|
|
1451
1453
|
}
|
|
1452
1454
|
// src/@types/payment.ts
|
|
1453
|
-
var
|
|
1454
|
-
__export(
|
|
1455
|
+
var exports_payment = {};
|
|
1456
|
+
__export(exports_payment, {
|
|
1455
1457
|
PaymentMethodEnum: () => PaymentMethodEnum
|
|
1456
1458
|
});
|
|
1457
1459
|
var PaymentMethodEnum;
|
|
@@ -1501,17 +1503,108 @@ async function checkDukcapil(msisdn, kk, nik) {
|
|
|
1501
1503
|
// src/index.ts
|
|
1502
1504
|
init_encrypt_helper();
|
|
1503
1505
|
|
|
1506
|
+
// src/lib/payment.ts
|
|
1507
|
+
init_utils();
|
|
1508
|
+
var exports_payment2 = {};
|
|
1509
|
+
__export(exports_payment2, {
|
|
1510
|
+
getTransactionDetail: () => getTransactionDetail
|
|
1511
|
+
});
|
|
1512
|
+
async function getTransactionDetail({
|
|
1513
|
+
idToken,
|
|
1514
|
+
transactionId
|
|
1515
|
+
}) {
|
|
1516
|
+
const path = "payments/api/v8/pending-detail";
|
|
1517
|
+
const payload = {
|
|
1518
|
+
transaction_id: transactionId,
|
|
1519
|
+
is_enterprise: false,
|
|
1520
|
+
lang: "en",
|
|
1521
|
+
status: ""
|
|
1522
|
+
};
|
|
1523
|
+
const res = await sendApiRequest(path, payload, idToken, "POST");
|
|
1524
|
+
return res.data;
|
|
1525
|
+
}
|
|
1504
1526
|
// src/lib/decoy.ts
|
|
1505
1527
|
var exports_decoy = {};
|
|
1506
1528
|
__export(exports_decoy, {
|
|
1507
1529
|
getDecoyName: () => getDecoyName,
|
|
1508
1530
|
getDecoyData: () => getDecoyData,
|
|
1509
|
-
|
|
1531
|
+
fetchDecoy: () => fetchDecoy,
|
|
1532
|
+
decoyIsExits: () => decoyIsExits
|
|
1510
1533
|
});
|
|
1511
|
-
|
|
1534
|
+
// src/data/decoys.json
|
|
1535
|
+
var decoys_default = {
|
|
1536
|
+
prio: {
|
|
1537
|
+
balance: {
|
|
1538
|
+
family_name: "PRIO PASS",
|
|
1539
|
+
family_code: "2512b72a-a3cd-4c70-a736-132cf2c1f0c0",
|
|
1540
|
+
is_enterprise: null,
|
|
1541
|
+
migration_type: null,
|
|
1542
|
+
variant_code: "cff298bd-8ec8-4696-b689-12407d36be15",
|
|
1543
|
+
option_name: "PRIO PASS 30 days",
|
|
1544
|
+
order: 1,
|
|
1545
|
+
price: 999000
|
|
1546
|
+
},
|
|
1547
|
+
qris: {
|
|
1548
|
+
family_name: "Conference",
|
|
1549
|
+
family_code: "5dab52d5-6f02-4678-b72f-088396ceb113",
|
|
1550
|
+
is_enterprise: true,
|
|
1551
|
+
migration_type: "PRIOH_TO_PRIO",
|
|
1552
|
+
variant_code: "bf84ad5b-87e9-4769-9bd2-2359535c05e4",
|
|
1553
|
+
option_name: "Conference 2GB",
|
|
1554
|
+
order: 1,
|
|
1555
|
+
price: 2000
|
|
1556
|
+
},
|
|
1557
|
+
qris0: {
|
|
1558
|
+
family_name: "Conference",
|
|
1559
|
+
family_code: "5dab52d5-6f02-4678-b72f-088396ceb113",
|
|
1560
|
+
is_enterprise: true,
|
|
1561
|
+
migration_type: "PRIOH_TO_PRIO",
|
|
1562
|
+
variant_code: "bf84ad5b-87e9-4769-9bd2-2359535c05e4",
|
|
1563
|
+
option_name: "Conference 2GB",
|
|
1564
|
+
order: 1,
|
|
1565
|
+
price: 2000
|
|
1566
|
+
}
|
|
1567
|
+
},
|
|
1568
|
+
default: {
|
|
1569
|
+
balance: {
|
|
1570
|
+
family_name: "XL PASS",
|
|
1571
|
+
family_code: "b0a20d74-0c54-4e3b-8f3f-01e7482e50bf",
|
|
1572
|
+
is_enterprise: true,
|
|
1573
|
+
migration_type: "NONE",
|
|
1574
|
+
variant_code: "719d093f-6f8d-46a4-8390-6a0003a172ea",
|
|
1575
|
+
option_name: "XL PASS 30 days",
|
|
1576
|
+
order: 1,
|
|
1577
|
+
price: 889750
|
|
1578
|
+
},
|
|
1579
|
+
qris: {
|
|
1580
|
+
family_name: "",
|
|
1581
|
+
family_code: "580c1f94-7dc4-416e-96f6-8faf26567516",
|
|
1582
|
+
is_enterprise: false,
|
|
1583
|
+
migration_type: "NONE",
|
|
1584
|
+
variant_code: "b50f954a-696e-46d0-8700-8e4d38521525",
|
|
1585
|
+
option_name: "",
|
|
1586
|
+
order: 27,
|
|
1587
|
+
price: 1000
|
|
1588
|
+
},
|
|
1589
|
+
qris0: {
|
|
1590
|
+
family_name: "Kuota Aplikasi BIZ 2GB",
|
|
1591
|
+
family_code: "c6f2cd72-8b21-420a-b8d5-e0186afe5be6",
|
|
1592
|
+
is_enterprise: true,
|
|
1593
|
+
migration_type: "NONE",
|
|
1594
|
+
variant_code: "b7cf278e-c989-4760-8a26-0a20c1a47a40",
|
|
1595
|
+
option_name: "Vidio 2GB",
|
|
1596
|
+
order: 11,
|
|
1597
|
+
price: 0
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
};
|
|
1601
|
+
|
|
1602
|
+
// src/lib/decoy.ts
|
|
1603
|
+
var needPrioDecoys = ["PRIORITAS", "PRIOHYBRID", "GO"];
|
|
1512
1604
|
var getDecoyName = (paymentMethod) => {
|
|
1513
1605
|
switch (paymentMethod) {
|
|
1514
1606
|
case "BALANCE_DECOY" /* PulsaDecoy */:
|
|
1607
|
+
return "balance";
|
|
1515
1608
|
case "BALANCE_DECOY_V2" /* PulsaDecoyV2 */:
|
|
1516
1609
|
return "balance";
|
|
1517
1610
|
case "QRIS_DECOY" /* QRISDecoy */:
|
|
@@ -1522,7 +1615,7 @@ var getDecoyName = (paymentMethod) => {
|
|
|
1522
1615
|
return "balance";
|
|
1523
1616
|
}
|
|
1524
1617
|
};
|
|
1525
|
-
var
|
|
1618
|
+
var decoyIsExits = (paymentMethod) => {
|
|
1526
1619
|
return [
|
|
1527
1620
|
"BALANCE_DECOY" /* PulsaDecoy */,
|
|
1528
1621
|
"BALANCE_DECOY_V2" /* PulsaDecoyV2 */,
|
|
@@ -1530,22 +1623,39 @@ var decoyExists = (paymentMethod) => {
|
|
|
1530
1623
|
"QRIS_DECOY_V2" /* QRISDecoyV2 */
|
|
1531
1624
|
].includes(paymentMethod);
|
|
1532
1625
|
};
|
|
1626
|
+
var decoyMap = decoys_default;
|
|
1533
1627
|
var getDecoyData = ({
|
|
1534
1628
|
subscriptionType,
|
|
1535
|
-
|
|
1536
|
-
decoyMap
|
|
1629
|
+
decoy
|
|
1537
1630
|
}) => {
|
|
1538
|
-
const isPrio =
|
|
1631
|
+
const isPrio = needPrioDecoys.includes(subscriptionType);
|
|
1539
1632
|
const group = isPrio ? "prio" : "default";
|
|
1540
|
-
return decoyMap[group][
|
|
1633
|
+
return decoyMap[group][decoy];
|
|
1634
|
+
};
|
|
1635
|
+
var fetchDecoy = async ({
|
|
1636
|
+
idToken,
|
|
1637
|
+
decoynName,
|
|
1638
|
+
subscriptionType
|
|
1639
|
+
}) => {
|
|
1640
|
+
const decoyData = getDecoyData({
|
|
1641
|
+
decoy: decoynName,
|
|
1642
|
+
subscriptionType
|
|
1643
|
+
});
|
|
1644
|
+
const data = await exports_package.getPackageByOrderId({
|
|
1645
|
+
idToken,
|
|
1646
|
+
order: decoyData.order,
|
|
1647
|
+
packageFamilyCode: decoyData.family_code,
|
|
1648
|
+
packageVariantCode: decoyData.variant_code
|
|
1649
|
+
});
|
|
1650
|
+
return data;
|
|
1541
1651
|
};
|
|
1542
1652
|
export {
|
|
1543
1653
|
exports_verification as Verification,
|
|
1544
1654
|
exports_utils as Utils,
|
|
1545
|
-
|
|
1655
|
+
exports_payment2 as Settlement,
|
|
1546
1656
|
exports_profile as Profile,
|
|
1547
1657
|
exports_payments as Payments,
|
|
1548
|
-
|
|
1658
|
+
exports_payment as PaymentTypes,
|
|
1549
1659
|
exports_package as Package,
|
|
1550
1660
|
exports_notification as Notification,
|
|
1551
1661
|
exports_family_plan as FamilyPlan,
|
package/dist/lib/decoy.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Package } from '..';
|
|
1
2
|
export type DecoyType = 'balance' | 'qris' | 'qris0';
|
|
2
3
|
export type DecoyDataType = {
|
|
3
4
|
family_name: string;
|
|
@@ -9,13 +10,14 @@ export type DecoyDataType = {
|
|
|
9
10
|
order: number;
|
|
10
11
|
price: number;
|
|
11
12
|
};
|
|
12
|
-
type DecoyGroup = 'prio' | 'default';
|
|
13
|
-
type DecoyMap = Record<DecoyGroup, Record<DecoyType, DecoyDataType>>;
|
|
14
13
|
export declare const getDecoyName: (paymentMethod: string) => DecoyType;
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const getDecoyData: ({ subscriptionType,
|
|
14
|
+
export declare const decoyIsExits: (paymentMethod: string) => boolean;
|
|
15
|
+
export declare const getDecoyData: ({ subscriptionType, decoy, }: {
|
|
17
16
|
subscriptionType: string;
|
|
18
|
-
|
|
19
|
-
decoyMap: DecoyMap;
|
|
17
|
+
decoy: DecoyType;
|
|
20
18
|
}) => DecoyDataType;
|
|
21
|
-
export {}
|
|
19
|
+
export declare const fetchDecoy: ({ idToken, decoynName, subscriptionType, }: {
|
|
20
|
+
idToken: string;
|
|
21
|
+
decoynName: DecoyType;
|
|
22
|
+
subscriptionType: string;
|
|
23
|
+
}) => Promise<Package.PackageDetailData>;
|