@crediblemark/buayar 0.8.0 → 0.8.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.
- package/README.md +18 -18
- package/dist/cli/index.js +1 -1
- package/dist/index.d.mts +77 -17
- package/dist/index.d.ts +77 -17
- package/dist/index.js +213 -229
- package/dist/index.mjs +213 -229
- package/docs/guide.md +19 -19
- package/docs/ipaymu.md +295 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -124,16 +124,20 @@ var CANONICAL_TO_IPAYMU = {
|
|
|
124
124
|
danamon_va: { paymentMethod: "va", paymentChannel: "danamon" },
|
|
125
125
|
bsi_va: { paymentMethod: "va", paymentChannel: "bsi" },
|
|
126
126
|
bag_va: { paymentMethod: "va", paymentChannel: "bag" },
|
|
127
|
+
btn_va: { paymentMethod: "va", paymentChannel: "btn" },
|
|
127
128
|
muamalat_va: { paymentMethod: "va", paymentChannel: "bmi" },
|
|
128
129
|
bmi_va: { paymentMethod: "va", paymentChannel: "bmi" },
|
|
129
130
|
qris: { paymentMethod: "qris", paymentChannel: "mpm" },
|
|
130
131
|
gopay_qris: { paymentMethod: "qris", paymentChannel: "mpm" },
|
|
131
132
|
shopeepay_qris: { paymentMethod: "qris", paymentChannel: "mpm" },
|
|
133
|
+
dana: { paymentMethod: "ewallet", paymentChannel: "dana" },
|
|
134
|
+
shopeepay: { paymentMethod: "ewallet", paymentChannel: "shopeepay" },
|
|
132
135
|
alfamart: { paymentMethod: "cstore", paymentChannel: "alfamart" },
|
|
133
136
|
indomaret: { paymentMethod: "cstore", paymentChannel: "indomaret" },
|
|
134
137
|
credit_card: { paymentMethod: "cc", paymentChannel: "cc" },
|
|
135
138
|
akulaku: { paymentMethod: "paylater", paymentChannel: "akulaku" },
|
|
136
|
-
kredivo: { paymentMethod: "paylater", paymentChannel: "kredivo" }
|
|
139
|
+
kredivo: { paymentMethod: "paylater", paymentChannel: "kredivo" },
|
|
140
|
+
cod: { paymentMethod: "cod", paymentChannel: "cod" }
|
|
137
141
|
};
|
|
138
142
|
var CANONICAL_TO_XENDIT = {
|
|
139
143
|
bca_va: { type: "VIRTUAL_ACCOUNT", channel_code: "BCA" },
|
|
@@ -318,6 +322,9 @@ function toIpaymuPaymentMethod(code) {
|
|
|
318
322
|
if (lower.includes("alfa") || lower.includes("indo")) {
|
|
319
323
|
return { paymentMethod: "cstore", paymentChannel: lower };
|
|
320
324
|
}
|
|
325
|
+
if (lower.includes("dana") || lower.includes("shopee") || lower.includes("ovo") || lower.includes("gopay") || lower.includes("linkaja")) {
|
|
326
|
+
return { paymentMethod: "ewallet", paymentChannel: lower };
|
|
327
|
+
}
|
|
321
328
|
return { paymentMethod: lower };
|
|
322
329
|
}
|
|
323
330
|
function toXenditPaymentMethod(code) {
|
|
@@ -1551,8 +1558,8 @@ var MidtransProvider = class extends BasePaymentProvider {
|
|
|
1551
1558
|
// src/providers/ipaymu/signature.ts
|
|
1552
1559
|
function generateIpaymuSignature(method, va, apiKey, body) {
|
|
1553
1560
|
const timestamp = Date.now().toString();
|
|
1554
|
-
const bodyString = body ? typeof body === "string" ? body : JSON.stringify(body) : "";
|
|
1555
|
-
const bodyHash =
|
|
1561
|
+
const bodyString = body ? typeof body === "string" ? body : JSON.stringify(body) : "{}";
|
|
1562
|
+
const bodyHash = sha256(bodyString).toLowerCase();
|
|
1556
1563
|
const stringToSign = `${method.toUpperCase()}:${va}:${bodyHash}:${apiKey}`;
|
|
1557
1564
|
const signature = hmacSha256(stringToSign, apiKey);
|
|
1558
1565
|
return { signature, timestamp };
|
|
@@ -1587,6 +1594,7 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1587
1594
|
const redirectUrl = returnUrl || config.returnUrl || "https://localhost/return";
|
|
1588
1595
|
const feeDirection = params.feeDirection || params.extra?.feeDirection || config.extra?.feeDirection;
|
|
1589
1596
|
const escrow = params.escrow !== void 0 ? params.escrow : params.extra?.escrow !== void 0 ? params.extra?.escrow : config.extra?.escrow;
|
|
1597
|
+
const subAccount = params.subAccountId || params.extra?.subAccountId || params.extra?.account || params.extra?.childAccount || params.account || config.extra?.account;
|
|
1590
1598
|
let payload;
|
|
1591
1599
|
if (isDirect) {
|
|
1592
1600
|
payload = {
|
|
@@ -1603,6 +1611,7 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1603
1611
|
...ipaymuMethod.paymentChannel ? { paymentChannel: ipaymuMethod.paymentChannel } : {},
|
|
1604
1612
|
...feeDirection ? { feeDirection } : {},
|
|
1605
1613
|
...escrow !== void 0 ? { escrow } : {},
|
|
1614
|
+
...subAccount ? { account: subAccount } : {},
|
|
1606
1615
|
...params.providerParams
|
|
1607
1616
|
};
|
|
1608
1617
|
} else {
|
|
@@ -1625,6 +1634,7 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1625
1634
|
buyerPhone: customer.phone || "081234567890",
|
|
1626
1635
|
...feeDirection ? { feeDirection } : {},
|
|
1627
1636
|
...escrow !== void 0 ? { escrow } : {},
|
|
1637
|
+
...subAccount ? { account: subAccount } : {},
|
|
1628
1638
|
...params.providerParams
|
|
1629
1639
|
};
|
|
1630
1640
|
}
|
|
@@ -1672,13 +1682,23 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1672
1682
|
if (ipaymuMethod?.paymentMethod === "va") {
|
|
1673
1683
|
res.vaNumber = resData.PaymentNo;
|
|
1674
1684
|
res.vaBank = ipaymuMethod.paymentChannel;
|
|
1685
|
+
res.mode = "va";
|
|
1675
1686
|
} else if (ipaymuMethod?.paymentMethod === "cstore") {
|
|
1676
1687
|
res.paymentCode = resData.PaymentNo;
|
|
1688
|
+
res.mode = "retail";
|
|
1677
1689
|
}
|
|
1678
1690
|
}
|
|
1679
1691
|
if (resData.QrString || resData.QrImage) {
|
|
1680
1692
|
res.qrString = resData.QrString;
|
|
1681
1693
|
res.qrCodeUrl = resData.QrImage || resData.QrTemplate;
|
|
1694
|
+
res.mode = "qris";
|
|
1695
|
+
}
|
|
1696
|
+
if (ipaymuMethod?.paymentMethod === "ewallet") {
|
|
1697
|
+
res.mode = "ewallet";
|
|
1698
|
+
if (resData.Url) {
|
|
1699
|
+
res.deeplink = resData.Url;
|
|
1700
|
+
res.paymentUrl = resData.Url;
|
|
1701
|
+
}
|
|
1682
1702
|
}
|
|
1683
1703
|
if (resData.Expired) {
|
|
1684
1704
|
res.expiresAt = new Date(resData.Expired);
|
|
@@ -1727,221 +1747,110 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1727
1747
|
const va = config.merchantCode || config.merchantId || "";
|
|
1728
1748
|
const apiKey = config.apiKey || "";
|
|
1729
1749
|
const sandbox = !!config.sandbox;
|
|
1730
|
-
if (va
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1750
|
+
if (!va || !apiKey) {
|
|
1751
|
+
return {
|
|
1752
|
+
success: false,
|
|
1753
|
+
provider: "ipaymu",
|
|
1754
|
+
methods: [],
|
|
1755
|
+
categories: {},
|
|
1756
|
+
error: "Missing iPaymu credentials (BUAYAR_MERCHANT_CODE/VA or BUAYAR_API_KEY)",
|
|
1757
|
+
rawResponse: null
|
|
1758
|
+
};
|
|
1759
|
+
}
|
|
1760
|
+
try {
|
|
1761
|
+
const url = `${this.getBaseUrl(sandbox)}/payment-channels`;
|
|
1762
|
+
const { signature, timestamp } = generateIpaymuSignature("GET", va, apiKey);
|
|
1763
|
+
const response = await fetch(url, {
|
|
1764
|
+
method: "GET",
|
|
1765
|
+
headers: {
|
|
1766
|
+
"Content-Type": "application/json",
|
|
1767
|
+
"Accept": "application/json",
|
|
1768
|
+
"va": va,
|
|
1769
|
+
"signature": signature,
|
|
1770
|
+
"timestamp": timestamp
|
|
1771
|
+
}
|
|
1772
|
+
});
|
|
1773
|
+
const data = await response.json().catch(() => null);
|
|
1774
|
+
if (response.ok && data?.Data && Array.isArray(data.Data)) {
|
|
1775
|
+
const methods = [];
|
|
1776
|
+
const categories = {};
|
|
1777
|
+
for (const group of data.Data) {
|
|
1778
|
+
const groupCode = (group.Code || "").toLowerCase();
|
|
1779
|
+
const groupName = group.Name || group.Description || "Lainnya";
|
|
1780
|
+
const channels = group.Channels || [];
|
|
1781
|
+
let category = "Lainnya";
|
|
1782
|
+
if (groupCode === "va") category = "Virtual Account";
|
|
1783
|
+
else if (groupCode === "cstore") category = "Retail / Gerai";
|
|
1784
|
+
else if (groupCode === "qris") category = "QRIS";
|
|
1785
|
+
else if (groupCode === "cc") category = "Kartu Kredit";
|
|
1786
|
+
else if (groupCode === "paylater") category = "Paylater / Cicilan";
|
|
1787
|
+
else if (groupCode === "cod") category = "COD";
|
|
1788
|
+
else if (groupCode === "ewallet" || groupCode === "ewallet-asia") category = "E-Wallet";
|
|
1789
|
+
else if (groupCode === "debitonline") category = "Debit Online";
|
|
1790
|
+
else category = groupName;
|
|
1791
|
+
for (const ch of channels) {
|
|
1792
|
+
const chCode = (ch.Code || "").toLowerCase();
|
|
1793
|
+
let canonicalCode = chCode;
|
|
1794
|
+
if (groupCode === "va") {
|
|
1795
|
+
canonicalCode = chCode === "bag" ? "bag_va" : chCode === "bmi" ? "muamalat_va" : `${chCode}_va`;
|
|
1796
|
+
} else if (groupCode === "cc") {
|
|
1797
|
+
canonicalCode = "credit_card";
|
|
1798
|
+
} else if (groupCode === "qris") {
|
|
1799
|
+
canonicalCode = "qris";
|
|
1800
|
+
}
|
|
1801
|
+
let totalFee = "-";
|
|
1802
|
+
if (ch.TransactionFee) {
|
|
1803
|
+
if (ch.TransactionFee.ActualFeeType === "PERCENT") {
|
|
1804
|
+
totalFee = `${ch.TransactionFee.ActualFee}%`;
|
|
1805
|
+
} else if (ch.TransactionFee.ActualFee !== void 0) {
|
|
1806
|
+
totalFee = `IDR ${Number(ch.TransactionFee.ActualFee).toLocaleString()}`;
|
|
1777
1807
|
}
|
|
1778
|
-
const pm = {
|
|
1779
|
-
paymentMethod: canonicalCode,
|
|
1780
|
-
code: canonicalCode,
|
|
1781
|
-
paymentName: ch.Name || ch.Description || canonicalCode,
|
|
1782
|
-
paymentImage: `https://my.ipaymu.com/images/banks/${chCode}.png`,
|
|
1783
|
-
totalFee,
|
|
1784
|
-
category,
|
|
1785
|
-
extra: {
|
|
1786
|
-
healthStatus: ch.HealthStatus,
|
|
1787
|
-
instructionsDoc: ch.PaymentInstructionsDoc,
|
|
1788
|
-
feeDetail: ch.TransactionFee
|
|
1789
|
-
}
|
|
1790
|
-
};
|
|
1791
|
-
methods.push(pm);
|
|
1792
|
-
if (!categories2[category]) categories2[category] = [];
|
|
1793
|
-
categories2[category].push(pm);
|
|
1794
1808
|
}
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1809
|
+
const pm = {
|
|
1810
|
+
paymentMethod: canonicalCode,
|
|
1811
|
+
code: canonicalCode,
|
|
1812
|
+
paymentName: ch.Name || ch.Description || canonicalCode,
|
|
1813
|
+
paymentImage: ch.Logo || `https://my.ipaymu.com/images/banks/${chCode}.png`,
|
|
1814
|
+
totalFee,
|
|
1815
|
+
category,
|
|
1816
|
+
extra: {
|
|
1817
|
+
healthStatus: ch.HealthStatus,
|
|
1818
|
+
featureStatus: ch.FeatureStatus,
|
|
1819
|
+
instructionsDoc: ch.PaymentInstructionsDoc,
|
|
1820
|
+
feeDetail: ch.TransactionFee
|
|
1821
|
+
}
|
|
1803
1822
|
};
|
|
1823
|
+
methods.push(pm);
|
|
1824
|
+
if (!categories[category]) categories[category] = [];
|
|
1825
|
+
categories[category].push(pm);
|
|
1804
1826
|
}
|
|
1805
1827
|
}
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
paymentName: "BCA Virtual Account",
|
|
1814
|
-
paymentImage: "https://my.ipaymu.com/images/banks/bca.png",
|
|
1815
|
-
totalFee: "IDR 3,500",
|
|
1816
|
-
category: "Virtual Account"
|
|
1817
|
-
},
|
|
1818
|
-
{
|
|
1819
|
-
paymentMethod: "mandiri_va",
|
|
1820
|
-
code: "mandiri_va",
|
|
1821
|
-
paymentName: "Mandiri Virtual Account",
|
|
1822
|
-
paymentImage: "https://my.ipaymu.com/images/banks/mandiri.png",
|
|
1823
|
-
totalFee: "IDR 3,500",
|
|
1824
|
-
category: "Virtual Account"
|
|
1825
|
-
},
|
|
1826
|
-
{
|
|
1827
|
-
paymentMethod: "bni_va",
|
|
1828
|
-
code: "bni_va",
|
|
1829
|
-
paymentName: "BNI Virtual Account",
|
|
1830
|
-
paymentImage: "https://my.ipaymu.com/images/banks/bni.png",
|
|
1831
|
-
totalFee: "IDR 3,500",
|
|
1832
|
-
category: "Virtual Account"
|
|
1833
|
-
},
|
|
1834
|
-
{
|
|
1835
|
-
paymentMethod: "bri_va",
|
|
1836
|
-
code: "bri_va",
|
|
1837
|
-
paymentName: "BRI Virtual Account",
|
|
1838
|
-
paymentImage: "https://my.ipaymu.com/images/banks/bri.png",
|
|
1839
|
-
totalFee: "IDR 3,500",
|
|
1840
|
-
category: "Virtual Account"
|
|
1841
|
-
},
|
|
1842
|
-
{
|
|
1843
|
-
paymentMethod: "cimb_va",
|
|
1844
|
-
code: "cimb_va",
|
|
1845
|
-
paymentName: "CIMB Niaga Virtual Account",
|
|
1846
|
-
paymentImage: "https://my.ipaymu.com/images/banks/cimb.png",
|
|
1847
|
-
totalFee: "IDR 3,500",
|
|
1848
|
-
category: "Virtual Account"
|
|
1849
|
-
},
|
|
1850
|
-
{
|
|
1851
|
-
paymentMethod: "permata_va",
|
|
1852
|
-
code: "permata_va",
|
|
1853
|
-
paymentName: "Permata Virtual Account",
|
|
1854
|
-
paymentImage: "https://my.ipaymu.com/images/banks/permata.png",
|
|
1855
|
-
totalFee: "IDR 3,500",
|
|
1856
|
-
category: "Virtual Account"
|
|
1857
|
-
},
|
|
1858
|
-
{
|
|
1859
|
-
paymentMethod: "danamon_va",
|
|
1860
|
-
code: "danamon_va",
|
|
1861
|
-
paymentName: "Danamon Virtual Account",
|
|
1862
|
-
paymentImage: "https://my.ipaymu.com/images/banks/danamon.png",
|
|
1863
|
-
totalFee: "IDR 3,500",
|
|
1864
|
-
category: "Virtual Account"
|
|
1865
|
-
},
|
|
1866
|
-
{
|
|
1867
|
-
paymentMethod: "bsi_va",
|
|
1868
|
-
code: "bsi_va",
|
|
1869
|
-
paymentName: "BSI Virtual Account",
|
|
1870
|
-
paymentImage: "https://my.ipaymu.com/images/banks/bsi.png",
|
|
1871
|
-
totalFee: "IDR 3,500",
|
|
1872
|
-
category: "Virtual Account"
|
|
1873
|
-
},
|
|
1874
|
-
{
|
|
1875
|
-
paymentMethod: "bag_va",
|
|
1876
|
-
code: "bag_va",
|
|
1877
|
-
paymentName: "Bank Artha Graha Virtual Account",
|
|
1878
|
-
paymentImage: "https://my.ipaymu.com/images/banks/bag.png",
|
|
1879
|
-
totalFee: "IDR 3,500",
|
|
1880
|
-
category: "Virtual Account"
|
|
1881
|
-
},
|
|
1882
|
-
{
|
|
1883
|
-
paymentMethod: "muamalat_va",
|
|
1884
|
-
code: "muamalat_va",
|
|
1885
|
-
paymentName: "Bank Muamalat Virtual Account",
|
|
1886
|
-
paymentImage: "https://my.ipaymu.com/images/banks/bmi.png",
|
|
1887
|
-
totalFee: "IDR 3,500",
|
|
1888
|
-
category: "Virtual Account"
|
|
1889
|
-
},
|
|
1890
|
-
{
|
|
1891
|
-
paymentMethod: "qris",
|
|
1892
|
-
code: "qris",
|
|
1893
|
-
paymentName: "QRIS (GoPay, ShopeePay, DANA, OVO, LinkAja)",
|
|
1894
|
-
paymentImage: "https://my.ipaymu.com/images/banks/qris.png",
|
|
1895
|
-
totalFee: "0.7%",
|
|
1896
|
-
category: "QRIS"
|
|
1897
|
-
},
|
|
1898
|
-
{
|
|
1899
|
-
paymentMethod: "alfamart",
|
|
1900
|
-
code: "alfamart",
|
|
1901
|
-
paymentName: "Alfamart",
|
|
1902
|
-
paymentImage: "https://my.ipaymu.com/images/banks/alfamart.png",
|
|
1903
|
-
totalFee: "IDR 5,000",
|
|
1904
|
-
category: "Retail / Gerai"
|
|
1905
|
-
},
|
|
1906
|
-
{
|
|
1907
|
-
paymentMethod: "indomaret",
|
|
1908
|
-
code: "indomaret",
|
|
1909
|
-
paymentName: "Indomaret",
|
|
1910
|
-
paymentImage: "https://my.ipaymu.com/images/banks/indomaret.png",
|
|
1911
|
-
totalFee: "IDR 5,000",
|
|
1912
|
-
category: "Retail / Gerai"
|
|
1913
|
-
},
|
|
1914
|
-
{
|
|
1915
|
-
paymentMethod: "credit_card",
|
|
1916
|
-
code: "credit_card",
|
|
1917
|
-
paymentName: "Credit / Debit Card (Visa, Mastercard)",
|
|
1918
|
-
paymentImage: "https://my.ipaymu.com/images/banks/cc.png",
|
|
1919
|
-
totalFee: "2.9% + IDR 2,000",
|
|
1920
|
-
category: "Kartu Kredit"
|
|
1921
|
-
},
|
|
1922
|
-
{
|
|
1923
|
-
paymentMethod: "akulaku",
|
|
1924
|
-
code: "akulaku",
|
|
1925
|
-
paymentName: "Akulaku Paylater",
|
|
1926
|
-
paymentImage: "https://my.ipaymu.com/images/banks/akulaku.png",
|
|
1927
|
-
totalFee: "1.7%",
|
|
1928
|
-
category: "Paylater / Cicilan"
|
|
1929
|
-
}
|
|
1930
|
-
];
|
|
1931
|
-
const categories = {};
|
|
1932
|
-
for (const item of staticMethods) {
|
|
1933
|
-
if (!categories[item.category]) {
|
|
1934
|
-
categories[item.category] = [];
|
|
1828
|
+
return {
|
|
1829
|
+
success: true,
|
|
1830
|
+
provider: "ipaymu",
|
|
1831
|
+
methods,
|
|
1832
|
+
categories,
|
|
1833
|
+
rawResponse: data
|
|
1834
|
+
};
|
|
1935
1835
|
}
|
|
1936
|
-
|
|
1836
|
+
return {
|
|
1837
|
+
success: false,
|
|
1838
|
+
provider: "ipaymu",
|
|
1839
|
+
methods: [],
|
|
1840
|
+
categories: {},
|
|
1841
|
+
error: data?.Message || data?.message || `Failed to fetch payment channels (HTTP ${response.status})`,
|
|
1842
|
+
rawResponse: data
|
|
1843
|
+
};
|
|
1844
|
+
} catch (err) {
|
|
1845
|
+
return {
|
|
1846
|
+
success: false,
|
|
1847
|
+
provider: "ipaymu",
|
|
1848
|
+
methods: [],
|
|
1849
|
+
categories: {},
|
|
1850
|
+
error: err.message || "Failed to fetch iPaymu payment channels",
|
|
1851
|
+
rawResponse: null
|
|
1852
|
+
};
|
|
1937
1853
|
}
|
|
1938
|
-
return {
|
|
1939
|
-
success: true,
|
|
1940
|
-
provider: "ipaymu",
|
|
1941
|
-
methods: staticMethods,
|
|
1942
|
-
categories,
|
|
1943
|
-
rawResponse: staticMethods
|
|
1944
|
-
};
|
|
1945
1854
|
}
|
|
1946
1855
|
async checkTransaction(params, config) {
|
|
1947
1856
|
const { merchantOrderId } = params;
|
|
@@ -8212,13 +8121,19 @@ var IpaymuClient = class {
|
|
|
8212
8121
|
return this.request("POST", "/transaction", { transactionId });
|
|
8213
8122
|
}
|
|
8214
8123
|
/**
|
|
8215
|
-
* Ambil daftar channel pembayaran aktif milik merchant
|
|
8124
|
+
* Ambil daftar channel pembayaran aktif milik merchant (Official v2: GET /payment-channels)
|
|
8216
8125
|
*/
|
|
8217
8126
|
async getPaymentMethods() {
|
|
8218
|
-
return this.request("
|
|
8127
|
+
return this.request("GET", "/payment-channels");
|
|
8128
|
+
}
|
|
8129
|
+
/**
|
|
8130
|
+
* Alias untuk getPaymentMethods (Official v2)
|
|
8131
|
+
*/
|
|
8132
|
+
async getPaymentChannels() {
|
|
8133
|
+
return this.request("GET", "/payment-channels");
|
|
8219
8134
|
}
|
|
8220
8135
|
/**
|
|
8221
|
-
* Ambil riwayat transaksi merchant berpaginasi
|
|
8136
|
+
* Ambil riwayat transaksi merchant berpaginasi (Official v2: POST /history)
|
|
8222
8137
|
*/
|
|
8223
8138
|
async getHistory(params) {
|
|
8224
8139
|
const payload = {
|
|
@@ -8230,42 +8145,111 @@ var IpaymuClient = class {
|
|
|
8230
8145
|
return this.request("POST", "/history", payload);
|
|
8231
8146
|
}
|
|
8232
8147
|
/**
|
|
8233
|
-
* Ambil daftar seluruh bank di Indonesia
|
|
8148
|
+
* Ambil daftar seluruh bank di Indonesia (Official v2: POST /banklist)
|
|
8234
8149
|
*/
|
|
8235
8150
|
async getBankList() {
|
|
8236
8151
|
return this.request("POST", "/banklist", { account: this.va });
|
|
8237
8152
|
}
|
|
8238
8153
|
/**
|
|
8239
|
-
*
|
|
8154
|
+
* Cari jangkauan area pengiriman COD (Official v2: GET /cod/area?area=keyword)
|
|
8240
8155
|
*/
|
|
8241
|
-
async getCodArea(
|
|
8242
|
-
const
|
|
8243
|
-
|
|
8244
|
-
return this.request("POST", "/cod/getarea", payload);
|
|
8156
|
+
async getCodArea(area) {
|
|
8157
|
+
const query = { area };
|
|
8158
|
+
return this.request("GET", `/cod/area?area=${encodeURIComponent(area)}`, query);
|
|
8245
8159
|
}
|
|
8246
8160
|
/**
|
|
8247
|
-
* Hitung tarif ongkir pengiriman COD
|
|
8161
|
+
* Hitung tarif ongkir pengiriman COD (Official v2: POST /cod/shipping-calculate)
|
|
8248
8162
|
*/
|
|
8249
8163
|
async getCodRate(params) {
|
|
8250
|
-
|
|
8164
|
+
const { pickupArea, deliveryArea, ...rest } = params;
|
|
8165
|
+
const pickupId = params.pickup_area_id !== void 0 ? params.pickup_area_id : pickupArea;
|
|
8166
|
+
const destId = params.destination_area_id !== void 0 ? params.destination_area_id : deliveryArea;
|
|
8167
|
+
const payload = {
|
|
8168
|
+
...rest,
|
|
8169
|
+
pickup_area_id: pickupId !== void 0 ? String(pickupId) : void 0,
|
|
8170
|
+
destination_area_id: destId !== void 0 ? String(destId) : void 0,
|
|
8171
|
+
amount: params.amount || 0
|
|
8172
|
+
};
|
|
8173
|
+
return this.request("POST", "/cod/shipping-calculate", payload);
|
|
8251
8174
|
}
|
|
8252
8175
|
/**
|
|
8253
|
-
* Request pickup kurir COD
|
|
8176
|
+
* Request pickup kurir COD (Official v2: POST /cod/pickup)
|
|
8254
8177
|
*/
|
|
8255
8178
|
async getCodPickup(params) {
|
|
8256
|
-
|
|
8179
|
+
const { transactionId, ...rest } = params;
|
|
8180
|
+
const payload = {
|
|
8181
|
+
...rest,
|
|
8182
|
+
transaction_id: params.transaction_id || transactionId
|
|
8183
|
+
};
|
|
8184
|
+
return this.request("POST", "/cod/pickup", payload);
|
|
8257
8185
|
}
|
|
8258
8186
|
/**
|
|
8259
|
-
*
|
|
8187
|
+
* Unduh label pengiriman / AWB COD (Official v2: GET /cod/download-label/:transaction_id)
|
|
8260
8188
|
*/
|
|
8261
8189
|
async getCodAwb(transactionId) {
|
|
8262
|
-
return this.request("
|
|
8190
|
+
return this.request("GET", `/cod/download-label/${transactionId}`);
|
|
8191
|
+
}
|
|
8192
|
+
/**
|
|
8193
|
+
* Lacak status pengiriman kurir COD berdasarkan no resi / AWB (Official v2: POST /cod/tracking)
|
|
8194
|
+
*/
|
|
8195
|
+
async getCodTracking(params) {
|
|
8196
|
+
const payload = typeof params === "string" ? { awb: params } : {
|
|
8197
|
+
awb: params.awb,
|
|
8198
|
+
transaction_id: params.transaction_id || params.transactionId
|
|
8199
|
+
};
|
|
8200
|
+
return this.request("POST", "/cod/tracking", payload);
|
|
8201
|
+
}
|
|
8202
|
+
// ==========================================
|
|
8203
|
+
// Public Area Lookup API (docs.ipaymu.com/en/docs/area-api)
|
|
8204
|
+
// Read-only endpoint untuk provinsi, kota/kabupaten, kecamatan, dan kelurahan
|
|
8205
|
+
// ==========================================
|
|
8206
|
+
/**
|
|
8207
|
+
* Ambil daftar seluruh provinsi di Indonesia
|
|
8208
|
+
*/
|
|
8209
|
+
async getAreasProvince() {
|
|
8210
|
+
const res = await fetch("https://my.ipaymu.com/api/areas/province");
|
|
8211
|
+
return res.json();
|
|
8212
|
+
}
|
|
8213
|
+
/**
|
|
8214
|
+
* Ambil daftar kota / kabupaten berdasarkan ID provinsi
|
|
8215
|
+
*/
|
|
8216
|
+
async getAreasCity(provinceId) {
|
|
8217
|
+
const res = await fetch(`https://my.ipaymu.com/api/areas/city/${provinceId}`);
|
|
8218
|
+
return res.json();
|
|
8219
|
+
}
|
|
8220
|
+
/**
|
|
8221
|
+
* Ambil daftar kecamatan berdasarkan ID kota / kabupaten
|
|
8222
|
+
*/
|
|
8223
|
+
async getAreasDistrict(cityId) {
|
|
8224
|
+
const res = await fetch(`https://my.ipaymu.com/api/areas/district/${cityId}`);
|
|
8225
|
+
return res.json();
|
|
8263
8226
|
}
|
|
8264
8227
|
/**
|
|
8265
|
-
*
|
|
8228
|
+
* Ambil daftar kelurahan berdasarkan ID kecamatan
|
|
8229
|
+
*/
|
|
8230
|
+
async getAreasVillage(districtId) {
|
|
8231
|
+
const res = await fetch(`https://my.ipaymu.com/api/areas/village/${districtId}`);
|
|
8232
|
+
return res.json();
|
|
8233
|
+
}
|
|
8234
|
+
// ==========================================
|
|
8235
|
+
// Split Payment — Single Register API
|
|
8236
|
+
// https://ipaymu.com/en/split-payment/
|
|
8237
|
+
// ==========================================
|
|
8238
|
+
/**
|
|
8239
|
+
* Daftarkan agen / reseller / mitra baru untuk Split Payment (Single Register API: POST /api/v2/register)
|
|
8240
|
+
* Mengembalikan VA child account yang siap digunakan untuk parameter `subAccountId` saat membuat transaksi.
|
|
8266
8241
|
*/
|
|
8267
|
-
async
|
|
8268
|
-
|
|
8242
|
+
async registerUser(params) {
|
|
8243
|
+
const { name, email, phone, password, ...rest } = params;
|
|
8244
|
+
const payload = {
|
|
8245
|
+
...rest,
|
|
8246
|
+
account: this.va,
|
|
8247
|
+
name,
|
|
8248
|
+
email,
|
|
8249
|
+
phone,
|
|
8250
|
+
password: password || "Password123!"
|
|
8251
|
+
};
|
|
8252
|
+
return this.request("POST", "/register", payload);
|
|
8269
8253
|
}
|
|
8270
8254
|
};
|
|
8271
8255
|
|
package/docs/guide.md
CHANGED
|
@@ -373,25 +373,25 @@ Rangkuman kemampuan ekstra tiap provider:
|
|
|
373
373
|
|
|
374
374
|
| Provider | Status | Getter | Kemampuan ekstra |
|
|
375
375
|
| :--- | :---: | :--- | :--- |
|
|
376
|
-
| Midtrans |
|
|
377
|
-
| Duitku |
|
|
378
|
-
| iPaymu | Tested | `getIpaymuClient()` | balance, checkTransaction, getHistory, getBankList, getPaymentMethods, COD logistics (getArea, getRate, getPickup, getAwb, getTracking) |
|
|
379
|
-
| Xendit |
|
|
380
|
-
| DOKU |
|
|
381
|
-
| PrismaLink |
|
|
382
|
-
| Faspay |
|
|
383
|
-
| Finpay |
|
|
384
|
-
| Nicepay |
|
|
385
|
-
| OY! Bisnis |
|
|
386
|
-
| Stripe |
|
|
387
|
-
| PayPal |
|
|
388
|
-
| Adyen |
|
|
389
|
-
| Checkout.com |
|
|
390
|
-
| Razorpay |
|
|
391
|
-
| Square |
|
|
392
|
-
| PayU |
|
|
393
|
-
| Braintree |
|
|
394
|
-
| 2Checkout |
|
|
376
|
+
| Midtrans | - | `getMidtransClient()` | cancel/refund/expire/approve/deny/capture, GoPay tokenization, Subscription, Payment Link, IRIS balance |
|
|
377
|
+
| Duitku | - | `getDuitkuClient()` | balance, listBanks, inquiryBankAccount, disburse, checkDisbursementStatus |
|
|
378
|
+
| [iPaymu](ipaymu.md) | Tested | `getIpaymuClient()` | balance, checkTransaction, getHistory, getBankList, getPaymentMethods/getPaymentChannels, Split Payment (registerUser / subAccountId), COD logistics (getArea, getRate, getPickup, getAwb, getTracking), Public Area API (Province, City, District, Village). *Lihat [panduan lengkap iPaymu](ipaymu.md)* |
|
|
379
|
+
| Xendit | - | `getXenditClient()` | balance, expireInvoice, createDisbursement |
|
|
380
|
+
| DOKU | - | `getDokuClient()` | checkTransaction |
|
|
381
|
+
| PrismaLink | - | `getPrismalinkClient()` | checkTransaction |
|
|
382
|
+
| Faspay | - | `getFaspayClient()` | cancelTransaction, checkTransaction |
|
|
383
|
+
| Finpay | - | `getFinpayClient()` | checkTransaction |
|
|
384
|
+
| Nicepay | - | `getNicepayClient()` | cancelTransaction, checkTransaction |
|
|
385
|
+
| OY! Bisnis | - | `getOyClient()` | checkTransaction, balance, remit (transfer dana) |
|
|
386
|
+
| Stripe | - | `getStripeClient()` | balance, createRefund, retrieveCheckoutSession, retrievePaymentIntent |
|
|
387
|
+
| PayPal | - | `getPaypalClient()` | captureOrder, getOrder, refundCapture, checkBalance, verifyWebhookSignature |
|
|
388
|
+
| Adyen | - | `getAdyenClient()` | capturePayment, cancelPayment, refundPayment, getPaymentDetails, getAvailablePaymentMethods |
|
|
389
|
+
| Checkout.com | - | `getCheckoutComClient()` | balance, refundPayment, voidPayment, getPaymentDetails, listPaymentLinks |
|
|
390
|
+
| Razorpay | - | `getRazorpayClient()` | capturePayment, createRefund, checkBalance, fetchPayment, listPayments |
|
|
391
|
+
| Square | - | `getSquareClient()` | retrieveBalance, refundPayment, cancelPayment, getPayment, listLocations |
|
|
392
|
+
| PayU | - | `getPayuClient()` | cancelOrder, getOrder, refundOrder |
|
|
393
|
+
| Braintree | - | `getBraintreeClient()` | getClientToken, findTransaction, refundTransaction, voidTransaction |
|
|
394
|
+
| 2Checkout | - | `getTwoCheckoutClient()` | getOrder, listOrders, getSubscription, refundOrder |
|
|
395
395
|
|
|
396
396
|
---
|
|
397
397
|
|