@crediblemark/buayar 0.8.0 → 0.8.1
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 +76 -16
- package/dist/index.d.ts +76 -16
- package/dist/index.js +191 -228
- package/dist/index.mjs +191 -228
- package/docs/guide.md +19 -19
- package/docs/ipaymu.md +295 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1551,8 +1551,8 @@ var MidtransProvider = class extends BasePaymentProvider {
|
|
|
1551
1551
|
// src/providers/ipaymu/signature.ts
|
|
1552
1552
|
function generateIpaymuSignature(method, va, apiKey, body) {
|
|
1553
1553
|
const timestamp = Date.now().toString();
|
|
1554
|
-
const bodyString = body ? typeof body === "string" ? body : JSON.stringify(body) : "";
|
|
1555
|
-
const bodyHash =
|
|
1554
|
+
const bodyString = body ? typeof body === "string" ? body : JSON.stringify(body) : "{}";
|
|
1555
|
+
const bodyHash = sha256(bodyString).toLowerCase();
|
|
1556
1556
|
const stringToSign = `${method.toUpperCase()}:${va}:${bodyHash}:${apiKey}`;
|
|
1557
1557
|
const signature = hmacSha256(stringToSign, apiKey);
|
|
1558
1558
|
return { signature, timestamp };
|
|
@@ -1587,6 +1587,7 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1587
1587
|
const redirectUrl = returnUrl || config.returnUrl || "https://localhost/return";
|
|
1588
1588
|
const feeDirection = params.feeDirection || params.extra?.feeDirection || config.extra?.feeDirection;
|
|
1589
1589
|
const escrow = params.escrow !== void 0 ? params.escrow : params.extra?.escrow !== void 0 ? params.extra?.escrow : config.extra?.escrow;
|
|
1590
|
+
const subAccount = params.subAccountId || params.extra?.subAccountId || params.extra?.account || params.extra?.childAccount || params.account || config.extra?.account;
|
|
1590
1591
|
let payload;
|
|
1591
1592
|
if (isDirect) {
|
|
1592
1593
|
payload = {
|
|
@@ -1603,6 +1604,7 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1603
1604
|
...ipaymuMethod.paymentChannel ? { paymentChannel: ipaymuMethod.paymentChannel } : {},
|
|
1604
1605
|
...feeDirection ? { feeDirection } : {},
|
|
1605
1606
|
...escrow !== void 0 ? { escrow } : {},
|
|
1607
|
+
...subAccount ? { account: subAccount } : {},
|
|
1606
1608
|
...params.providerParams
|
|
1607
1609
|
};
|
|
1608
1610
|
} else {
|
|
@@ -1625,6 +1627,7 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1625
1627
|
buyerPhone: customer.phone || "081234567890",
|
|
1626
1628
|
...feeDirection ? { feeDirection } : {},
|
|
1627
1629
|
...escrow !== void 0 ? { escrow } : {},
|
|
1630
|
+
...subAccount ? { account: subAccount } : {},
|
|
1628
1631
|
...params.providerParams
|
|
1629
1632
|
};
|
|
1630
1633
|
}
|
|
@@ -1727,221 +1730,106 @@ var IpaymuProvider = class extends BasePaymentProvider {
|
|
|
1727
1730
|
const va = config.merchantCode || config.merchantId || "";
|
|
1728
1731
|
const apiKey = config.apiKey || "";
|
|
1729
1732
|
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
|
-
|
|
1733
|
+
if (!va || !apiKey) {
|
|
1734
|
+
return {
|
|
1735
|
+
success: false,
|
|
1736
|
+
provider: "ipaymu",
|
|
1737
|
+
methods: [],
|
|
1738
|
+
categories: {},
|
|
1739
|
+
error: "Missing iPaymu credentials (BUAYAR_MERCHANT_CODE/VA or BUAYAR_API_KEY)",
|
|
1740
|
+
rawResponse: null
|
|
1741
|
+
};
|
|
1742
|
+
}
|
|
1743
|
+
try {
|
|
1744
|
+
const url = `${this.getBaseUrl(sandbox)}/payment-channels`;
|
|
1745
|
+
const { signature, timestamp } = generateIpaymuSignature("GET", va, apiKey);
|
|
1746
|
+
const response = await fetch(url, {
|
|
1747
|
+
method: "GET",
|
|
1748
|
+
headers: {
|
|
1749
|
+
"Content-Type": "application/json",
|
|
1750
|
+
"Accept": "application/json",
|
|
1751
|
+
"va": va,
|
|
1752
|
+
"signature": signature,
|
|
1753
|
+
"timestamp": timestamp
|
|
1754
|
+
}
|
|
1755
|
+
});
|
|
1756
|
+
const data = await response.json().catch(() => null);
|
|
1757
|
+
if (response.ok && data?.Data && Array.isArray(data.Data)) {
|
|
1758
|
+
const methods = [];
|
|
1759
|
+
const categories = {};
|
|
1760
|
+
for (const group of data.Data) {
|
|
1761
|
+
const groupCode = (group.Code || "").toLowerCase();
|
|
1762
|
+
const groupName = group.Name || group.Description || "Lainnya";
|
|
1763
|
+
const channels = group.Channels || [];
|
|
1764
|
+
let category = "Lainnya";
|
|
1765
|
+
if (groupCode === "va") category = "Virtual Account";
|
|
1766
|
+
else if (groupCode === "cstore") category = "Retail / Gerai";
|
|
1767
|
+
else if (groupCode === "qris") category = "QRIS";
|
|
1768
|
+
else if (groupCode === "cc") category = "Kartu Kredit";
|
|
1769
|
+
else if (groupCode === "paylater") category = "Paylater / Cicilan";
|
|
1770
|
+
else if (groupCode === "cod") category = "COD";
|
|
1771
|
+
else category = groupName;
|
|
1772
|
+
for (const ch of channels) {
|
|
1773
|
+
const chCode = (ch.Code || "").toLowerCase();
|
|
1774
|
+
let canonicalCode = chCode;
|
|
1775
|
+
if (groupCode === "va") {
|
|
1776
|
+
canonicalCode = chCode === "bag" ? "bag_va" : chCode === "bmi" ? "muamalat_va" : `${chCode}_va`;
|
|
1777
|
+
} else if (groupCode === "cc") {
|
|
1778
|
+
canonicalCode = "credit_card";
|
|
1779
|
+
}
|
|
1780
|
+
let totalFee = "-";
|
|
1781
|
+
if (ch.TransactionFee) {
|
|
1782
|
+
if (ch.TransactionFee.ActualFeeType === "PERCENT") {
|
|
1783
|
+
totalFee = `${ch.TransactionFee.ActualFee}%`;
|
|
1784
|
+
} else if (ch.TransactionFee.ActualFee !== void 0) {
|
|
1785
|
+
totalFee = `IDR ${Number(ch.TransactionFee.ActualFee).toLocaleString()}`;
|
|
1777
1786
|
}
|
|
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
1787
|
}
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1788
|
+
const pm = {
|
|
1789
|
+
paymentMethod: canonicalCode,
|
|
1790
|
+
code: canonicalCode,
|
|
1791
|
+
paymentName: ch.Name || ch.Description || canonicalCode,
|
|
1792
|
+
paymentImage: ch.Logo || `https://my.ipaymu.com/images/banks/${chCode}.png`,
|
|
1793
|
+
totalFee,
|
|
1794
|
+
category,
|
|
1795
|
+
extra: {
|
|
1796
|
+
healthStatus: ch.HealthStatus,
|
|
1797
|
+
featureStatus: ch.FeatureStatus,
|
|
1798
|
+
instructionsDoc: ch.PaymentInstructionsDoc,
|
|
1799
|
+
feeDetail: ch.TransactionFee
|
|
1800
|
+
}
|
|
1803
1801
|
};
|
|
1802
|
+
methods.push(pm);
|
|
1803
|
+
if (!categories[category]) categories[category] = [];
|
|
1804
|
+
categories[category].push(pm);
|
|
1804
1805
|
}
|
|
1805
1806
|
}
|
|
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] = [];
|
|
1807
|
+
return {
|
|
1808
|
+
success: true,
|
|
1809
|
+
provider: "ipaymu",
|
|
1810
|
+
methods,
|
|
1811
|
+
categories,
|
|
1812
|
+
rawResponse: data
|
|
1813
|
+
};
|
|
1935
1814
|
}
|
|
1936
|
-
|
|
1815
|
+
return {
|
|
1816
|
+
success: false,
|
|
1817
|
+
provider: "ipaymu",
|
|
1818
|
+
methods: [],
|
|
1819
|
+
categories: {},
|
|
1820
|
+
error: data?.Message || data?.message || `Failed to fetch payment channels (HTTP ${response.status})`,
|
|
1821
|
+
rawResponse: data
|
|
1822
|
+
};
|
|
1823
|
+
} catch (err) {
|
|
1824
|
+
return {
|
|
1825
|
+
success: false,
|
|
1826
|
+
provider: "ipaymu",
|
|
1827
|
+
methods: [],
|
|
1828
|
+
categories: {},
|
|
1829
|
+
error: err.message || "Failed to fetch iPaymu payment channels",
|
|
1830
|
+
rawResponse: null
|
|
1831
|
+
};
|
|
1937
1832
|
}
|
|
1938
|
-
return {
|
|
1939
|
-
success: true,
|
|
1940
|
-
provider: "ipaymu",
|
|
1941
|
-
methods: staticMethods,
|
|
1942
|
-
categories,
|
|
1943
|
-
rawResponse: staticMethods
|
|
1944
|
-
};
|
|
1945
1833
|
}
|
|
1946
1834
|
async checkTransaction(params, config) {
|
|
1947
1835
|
const { merchantOrderId } = params;
|
|
@@ -8212,13 +8100,19 @@ var IpaymuClient = class {
|
|
|
8212
8100
|
return this.request("POST", "/transaction", { transactionId });
|
|
8213
8101
|
}
|
|
8214
8102
|
/**
|
|
8215
|
-
* Ambil daftar channel pembayaran aktif milik merchant
|
|
8103
|
+
* Ambil daftar channel pembayaran aktif milik merchant (Official v2: GET /payment-channels)
|
|
8216
8104
|
*/
|
|
8217
8105
|
async getPaymentMethods() {
|
|
8218
|
-
return this.request("
|
|
8106
|
+
return this.request("GET", "/payment-channels");
|
|
8219
8107
|
}
|
|
8220
8108
|
/**
|
|
8221
|
-
*
|
|
8109
|
+
* Alias untuk getPaymentMethods (Official v2)
|
|
8110
|
+
*/
|
|
8111
|
+
async getPaymentChannels() {
|
|
8112
|
+
return this.request("GET", "/payment-channels");
|
|
8113
|
+
}
|
|
8114
|
+
/**
|
|
8115
|
+
* Ambil riwayat transaksi merchant berpaginasi (Official v2: POST /history)
|
|
8222
8116
|
*/
|
|
8223
8117
|
async getHistory(params) {
|
|
8224
8118
|
const payload = {
|
|
@@ -8230,42 +8124,111 @@ var IpaymuClient = class {
|
|
|
8230
8124
|
return this.request("POST", "/history", payload);
|
|
8231
8125
|
}
|
|
8232
8126
|
/**
|
|
8233
|
-
* Ambil daftar seluruh bank di Indonesia
|
|
8127
|
+
* Ambil daftar seluruh bank di Indonesia (Official v2: POST /banklist)
|
|
8234
8128
|
*/
|
|
8235
8129
|
async getBankList() {
|
|
8236
8130
|
return this.request("POST", "/banklist", { account: this.va });
|
|
8237
8131
|
}
|
|
8238
8132
|
/**
|
|
8239
|
-
*
|
|
8133
|
+
* Cari jangkauan area pengiriman COD (Official v2: GET /cod/area?area=keyword)
|
|
8240
8134
|
*/
|
|
8241
|
-
async getCodArea(
|
|
8242
|
-
const
|
|
8243
|
-
|
|
8244
|
-
return this.request("POST", "/cod/getarea", payload);
|
|
8135
|
+
async getCodArea(area) {
|
|
8136
|
+
const query = { area };
|
|
8137
|
+
return this.request("GET", `/cod/area?area=${encodeURIComponent(area)}`, query);
|
|
8245
8138
|
}
|
|
8246
8139
|
/**
|
|
8247
|
-
* Hitung tarif ongkir pengiriman COD
|
|
8140
|
+
* Hitung tarif ongkir pengiriman COD (Official v2: POST /cod/shipping-calculate)
|
|
8248
8141
|
*/
|
|
8249
8142
|
async getCodRate(params) {
|
|
8250
|
-
|
|
8143
|
+
const { pickupArea, deliveryArea, ...rest } = params;
|
|
8144
|
+
const pickupId = params.pickup_area_id !== void 0 ? params.pickup_area_id : pickupArea;
|
|
8145
|
+
const destId = params.destination_area_id !== void 0 ? params.destination_area_id : deliveryArea;
|
|
8146
|
+
const payload = {
|
|
8147
|
+
...rest,
|
|
8148
|
+
pickup_area_id: pickupId !== void 0 ? String(pickupId) : void 0,
|
|
8149
|
+
destination_area_id: destId !== void 0 ? String(destId) : void 0,
|
|
8150
|
+
amount: params.amount || 0
|
|
8151
|
+
};
|
|
8152
|
+
return this.request("POST", "/cod/shipping-calculate", payload);
|
|
8251
8153
|
}
|
|
8252
8154
|
/**
|
|
8253
|
-
* Request pickup kurir COD
|
|
8155
|
+
* Request pickup kurir COD (Official v2: POST /cod/pickup)
|
|
8254
8156
|
*/
|
|
8255
8157
|
async getCodPickup(params) {
|
|
8256
|
-
|
|
8158
|
+
const { transactionId, ...rest } = params;
|
|
8159
|
+
const payload = {
|
|
8160
|
+
...rest,
|
|
8161
|
+
transaction_id: params.transaction_id || transactionId
|
|
8162
|
+
};
|
|
8163
|
+
return this.request("POST", "/cod/pickup", payload);
|
|
8257
8164
|
}
|
|
8258
8165
|
/**
|
|
8259
|
-
*
|
|
8166
|
+
* Unduh label pengiriman / AWB COD (Official v2: GET /cod/download-label/:transaction_id)
|
|
8260
8167
|
*/
|
|
8261
8168
|
async getCodAwb(transactionId) {
|
|
8262
|
-
return this.request("
|
|
8169
|
+
return this.request("GET", `/cod/download-label/${transactionId}`);
|
|
8170
|
+
}
|
|
8171
|
+
/**
|
|
8172
|
+
* Lacak status pengiriman kurir COD berdasarkan no resi / AWB (Official v2: POST /cod/tracking)
|
|
8173
|
+
*/
|
|
8174
|
+
async getCodTracking(params) {
|
|
8175
|
+
const payload = typeof params === "string" ? { awb: params } : {
|
|
8176
|
+
awb: params.awb,
|
|
8177
|
+
transaction_id: params.transaction_id || params.transactionId
|
|
8178
|
+
};
|
|
8179
|
+
return this.request("POST", "/cod/tracking", payload);
|
|
8180
|
+
}
|
|
8181
|
+
// ==========================================
|
|
8182
|
+
// Public Area Lookup API (docs.ipaymu.com/en/docs/area-api)
|
|
8183
|
+
// Read-only endpoint untuk provinsi, kota/kabupaten, kecamatan, dan kelurahan
|
|
8184
|
+
// ==========================================
|
|
8185
|
+
/**
|
|
8186
|
+
* Ambil daftar seluruh provinsi di Indonesia
|
|
8187
|
+
*/
|
|
8188
|
+
async getAreasProvince() {
|
|
8189
|
+
const res = await fetch("https://my.ipaymu.com/api/areas/province");
|
|
8190
|
+
return res.json();
|
|
8263
8191
|
}
|
|
8264
8192
|
/**
|
|
8265
|
-
*
|
|
8193
|
+
* Ambil daftar kota / kabupaten berdasarkan ID provinsi
|
|
8266
8194
|
*/
|
|
8267
|
-
async
|
|
8268
|
-
|
|
8195
|
+
async getAreasCity(provinceId) {
|
|
8196
|
+
const res = await fetch(`https://my.ipaymu.com/api/areas/city/${provinceId}`);
|
|
8197
|
+
return res.json();
|
|
8198
|
+
}
|
|
8199
|
+
/**
|
|
8200
|
+
* Ambil daftar kecamatan berdasarkan ID kota / kabupaten
|
|
8201
|
+
*/
|
|
8202
|
+
async getAreasDistrict(cityId) {
|
|
8203
|
+
const res = await fetch(`https://my.ipaymu.com/api/areas/district/${cityId}`);
|
|
8204
|
+
return res.json();
|
|
8205
|
+
}
|
|
8206
|
+
/**
|
|
8207
|
+
* Ambil daftar kelurahan berdasarkan ID kecamatan
|
|
8208
|
+
*/
|
|
8209
|
+
async getAreasVillage(districtId) {
|
|
8210
|
+
const res = await fetch(`https://my.ipaymu.com/api/areas/village/${districtId}`);
|
|
8211
|
+
return res.json();
|
|
8212
|
+
}
|
|
8213
|
+
// ==========================================
|
|
8214
|
+
// Split Payment — Single Register API
|
|
8215
|
+
// https://ipaymu.com/en/split-payment/
|
|
8216
|
+
// ==========================================
|
|
8217
|
+
/**
|
|
8218
|
+
* Daftarkan agen / reseller / mitra baru untuk Split Payment (Single Register API: POST /api/v2/register)
|
|
8219
|
+
* Mengembalikan VA child account yang siap digunakan untuk parameter `subAccountId` saat membuat transaksi.
|
|
8220
|
+
*/
|
|
8221
|
+
async registerUser(params) {
|
|
8222
|
+
const { name, email, phone, password, ...rest } = params;
|
|
8223
|
+
const payload = {
|
|
8224
|
+
...rest,
|
|
8225
|
+
account: this.va,
|
|
8226
|
+
name,
|
|
8227
|
+
email,
|
|
8228
|
+
phone,
|
|
8229
|
+
password: password || "Password123!"
|
|
8230
|
+
};
|
|
8231
|
+
return this.request("POST", "/register", payload);
|
|
8269
8232
|
}
|
|
8270
8233
|
};
|
|
8271
8234
|
|
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
|
|