@ripwords/myinvois-client 0.1.7 → 0.2.0

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 (333) hide show
  1. package/dist/api/documentManagement.d.ts +89 -0
  2. package/dist/api/documentManagement.js +3 -0
  3. package/dist/api/documentSubmission.d.ts +92 -0
  4. package/dist/api/documentSubmission.js +4 -0
  5. package/dist/api/documentTypeManagement.d.ts +70 -0
  6. package/dist/api/documentTypeManagement.js +3 -0
  7. package/dist/api/notificationManagement.d.ts +68 -0
  8. package/dist/api/notificationManagement.js +3 -0
  9. package/dist/api/platformLogin.d.ts +68 -0
  10. package/dist/api/platformLogin.js +3 -0
  11. package/dist/api/taxpayerValidation.d.ts +79 -0
  12. package/dist/api/taxpayerValidation.js +3 -0
  13. package/dist/{certificate-DFK-788s.cjs → certificate-CxsfE91s.cjs} +1 -1
  14. package/dist/{certificate-DFK-788s.cjs.map → certificate-CxsfE91s.cjs.map} +1 -1
  15. package/dist/{document-CARHiGdp.cjs → document-vDphtJTv.cjs} +1 -1
  16. package/dist/{document-CARHiGdp.cjs.map → document-vDphtJTv.cjs.map} +1 -1
  17. package/dist/documentManagement-CIQPkmyb.js +35 -0
  18. package/dist/documentManagement-DQ7JEcBq.cjs +54 -0
  19. package/dist/documentManagement-DQ7JEcBq.cjs.map +1 -0
  20. package/dist/documentSubmission-BdJxIB_I.js +119 -0
  21. package/dist/documentSubmission-D5TC0MPC.cjs +137 -0
  22. package/dist/documentSubmission-D5TC0MPC.cjs.map +1 -0
  23. package/dist/documentTypeManagement-DXRLfTsW.cjs +41 -0
  24. package/dist/documentTypeManagement-DXRLfTsW.cjs.map +1 -0
  25. package/dist/documentTypeManagement-tojgXfm9.js +22 -0
  26. package/dist/{documents-i5EV868Y.d.ts → documents-BgXt86Qp.d.ts} +44 -7
  27. package/dist/{documents-CQy_uB6C.d.cts → documents-BqM9qOnB.d.cts} +39 -2
  28. package/dist/{getBaseUrl-CO7Jp27d.cjs → getBaseUrl-D2iJdUGL.cjs} +1 -1
  29. package/dist/{getBaseUrl-CO7Jp27d.cjs.map → getBaseUrl-D2iJdUGL.cjs.map} +1 -1
  30. package/dist/{index-D2_HVwCz.d.cts → index-Yr1QAbIF.d.cts} +1 -1
  31. package/dist/index.cjs +234 -131
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.ts +250 -60
  34. package/dist/index.js +234 -131
  35. package/dist/index10.cjs +196 -0
  36. package/dist/index10.cjs.map +1 -0
  37. package/dist/index11.cjs +0 -34
  38. package/dist/index12.cjs +16 -15
  39. package/dist/index12.cjs.map +1 -1
  40. package/dist/index14.cjs +0 -13
  41. package/dist/index15.cjs +28 -3
  42. package/dist/index15.cjs.map +1 -0
  43. package/dist/index16.cjs +24 -12
  44. package/dist/index16.cjs.map +1 -0
  45. package/dist/index17.cjs +0 -3
  46. package/dist/index18.cjs +28 -334
  47. package/dist/index18.cjs.map +1 -1
  48. package/dist/index19.cjs +18 -323
  49. package/dist/index19.cjs.map +1 -1
  50. package/dist/index2.cjs +4 -61
  51. package/dist/index20.cjs +0 -140
  52. package/dist/index21.cjs +0 -3
  53. package/dist/index22.cjs +0 -208
  54. package/dist/index23.cjs +9 -105
  55. package/dist/index23.cjs.map +1 -1
  56. package/dist/index24.cjs +3 -136
  57. package/dist/index25.cjs +12 -63
  58. package/dist/index26.cjs +2 -266
  59. package/dist/index27.cjs +325 -75
  60. package/dist/index27.cjs.map +1 -1
  61. package/dist/index28.cjs +136 -103
  62. package/dist/index28.cjs.map +1 -1
  63. package/dist/index29.cjs +203 -68
  64. package/dist/index29.cjs.map +1 -1
  65. package/dist/index3.cjs +5 -531
  66. package/dist/index30.cjs +104 -107
  67. package/dist/index30.cjs.map +1 -1
  68. package/dist/index31.cjs +132 -95
  69. package/dist/index31.cjs.map +1 -1
  70. package/dist/index32.cjs +59 -13
  71. package/dist/index32.cjs.map +1 -1
  72. package/dist/index33.cjs +262 -33
  73. package/dist/index33.cjs.map +1 -1
  74. package/dist/index34.cjs +74 -14
  75. package/dist/index34.cjs.map +1 -1
  76. package/dist/index35.cjs +102 -24
  77. package/dist/index35.cjs.map +1 -1
  78. package/dist/index36.cjs +68 -15
  79. package/dist/index36.cjs.map +1 -1
  80. package/dist/index37.cjs +107 -9
  81. package/dist/index37.cjs.map +1 -1
  82. package/dist/index38.cjs +95 -9
  83. package/dist/index38.cjs.map +1 -1
  84. package/dist/index39.cjs +11 -10
  85. package/dist/index39.cjs.map +1 -1
  86. package/dist/index4.cjs +4 -195
  87. package/dist/index40.cjs +31 -6
  88. package/dist/index40.cjs.map +1 -1
  89. package/dist/index41.cjs +12 -101
  90. package/dist/index41.cjs.map +1 -1
  91. package/dist/index42.cjs +22 -106
  92. package/dist/index42.cjs.map +1 -1
  93. package/dist/index43.cjs +13 -119
  94. package/dist/index43.cjs.map +1 -1
  95. package/dist/index44.cjs +7 -106
  96. package/dist/index44.cjs.map +1 -1
  97. package/dist/index45.cjs +7 -98
  98. package/dist/index45.cjs.map +1 -1
  99. package/dist/index46.cjs +10 -118
  100. package/dist/index46.cjs.map +1 -1
  101. package/dist/index47.cjs +6 -127
  102. package/dist/index47.cjs.map +1 -1
  103. package/dist/index48.cjs +101 -117
  104. package/dist/index48.cjs.map +1 -1
  105. package/dist/index49.cjs +106 -14
  106. package/dist/index49.cjs.map +1 -1
  107. package/dist/index5.cjs +3 -0
  108. package/dist/index50.cjs +119 -95
  109. package/dist/index50.cjs.map +1 -1
  110. package/dist/index51.cjs +106 -142
  111. package/dist/index51.cjs.map +1 -1
  112. package/dist/index52.cjs +98 -114
  113. package/dist/index52.cjs.map +1 -1
  114. package/dist/index53.cjs +118 -144
  115. package/dist/index53.cjs.map +1 -1
  116. package/dist/index54.cjs +127 -113
  117. package/dist/index54.cjs.map +1 -1
  118. package/dist/index55.cjs +117 -17
  119. package/dist/index55.cjs.map +1 -1
  120. package/dist/index56.cjs +14 -112
  121. package/dist/index56.cjs.map +1 -1
  122. package/dist/index57.cjs +95 -47
  123. package/dist/index57.cjs.map +1 -1
  124. package/dist/index58.cjs +142 -14
  125. package/dist/index58.cjs.map +1 -1
  126. package/dist/index59.cjs +114 -28
  127. package/dist/index59.cjs.map +1 -1
  128. package/dist/index6.cjs +2 -24
  129. package/dist/index60.cjs +144 -22
  130. package/dist/index60.cjs.map +1 -1
  131. package/dist/index61.cjs +113 -9
  132. package/dist/index61.cjs.map +1 -1
  133. package/dist/index61.cts.map +1 -1
  134. package/dist/index62.cjs +17 -8
  135. package/dist/index62.cjs.map +1 -1
  136. package/dist/index62.cts.map +1 -1
  137. package/dist/index63.cjs +112 -17
  138. package/dist/index63.cjs.map +1 -1
  139. package/dist/index63.cts.map +1 -1
  140. package/dist/index64.cjs +47 -412
  141. package/dist/index64.cjs.map +1 -1
  142. package/dist/index64.cts.map +1 -1
  143. package/dist/index65.cjs +14 -8
  144. package/dist/index65.cjs.map +1 -1
  145. package/dist/index65.cts.map +1 -1
  146. package/dist/index66.cjs +28 -9
  147. package/dist/index66.cjs.map +1 -1
  148. package/dist/index66.cts.map +1 -1
  149. package/dist/index67.cjs +29 -0
  150. package/dist/index67.cjs.map +1 -0
  151. package/dist/index67.cts.map +1 -0
  152. package/dist/index68.cjs +16 -0
  153. package/dist/index68.cjs.map +1 -0
  154. package/dist/{index60.cts.map → index68.cts.map} +1 -1
  155. package/dist/index69.cjs +15 -0
  156. package/dist/index69.cjs.map +1 -0
  157. package/dist/index69.cts.map +1 -0
  158. package/dist/index7.cjs +5 -0
  159. package/dist/index70.cjs +24 -0
  160. package/dist/index70.cjs.map +1 -0
  161. package/dist/index70.cts.map +1 -0
  162. package/dist/index71.cjs +419 -0
  163. package/dist/index71.cjs.map +1 -0
  164. package/dist/index71.cts.map +1 -0
  165. package/dist/index72.cjs +15 -0
  166. package/dist/index72.cjs.map +1 -0
  167. package/dist/index72.cts.map +1 -0
  168. package/dist/index73.cjs +16 -0
  169. package/dist/index73.cjs.map +1 -0
  170. package/dist/index73.cts.map +1 -0
  171. package/dist/index8.cjs +62 -0
  172. package/dist/{index2.cjs.map → index8.cjs.map} +1 -1
  173. package/dist/index9.cjs +523 -16
  174. package/dist/index9.cjs.map +1 -1
  175. package/dist/{msic-codes-C8PJVOaA.d.ts → msic-codes-CiPeemFK.d.ts} +10 -10
  176. package/dist/notificationManagement-CHDRVy8J.js +19 -0
  177. package/dist/notificationManagement-C_qrFwWL.cjs +26 -0
  178. package/dist/notificationManagement-C_qrFwWL.cjs.map +1 -0
  179. package/dist/notifications-B4l_qRj7.d.ts +62 -0
  180. package/dist/notifications-DdlEkprb.d.cts +63 -0
  181. package/dist/{platformLogin-PGzMhw1X.cjs → platformLogin-CPiPiVUh.cjs} +2 -2
  182. package/dist/platformLogin-CPiPiVUh.cjs.map +1 -0
  183. package/dist/{platformLogin-f0bNAoZI.js → platformLogin-Ck1Fge2n.js} +1 -1
  184. package/dist/taxpayer-D67d2zAC.d.ts +26 -0
  185. package/dist/taxpayer-sGkviG8J.d.cts +27 -0
  186. package/dist/taxpayerValidation-DI4B6kWx.js +54 -0
  187. package/dist/taxpayerValidation-DdeXCvPT.cjs +73 -0
  188. package/dist/taxpayerValidation-DdeXCvPT.cjs.map +1 -0
  189. package/dist/types/classification-codes.d.ts +1 -1
  190. package/dist/types/country-code.d.ts +1 -1
  191. package/dist/types/currencies.d.ts +1 -1
  192. package/dist/types/documents.d.ts +18 -18
  193. package/dist/types/e-invoice.d.ts +1 -1
  194. package/dist/types/index.d.ts +61 -58
  195. package/dist/types/msic/0X.d.ts +1 -1
  196. package/dist/types/msic/1X.d.ts +1 -1
  197. package/dist/types/msic/2X.d.ts +1 -1
  198. package/dist/types/msic/3X.d.ts +1 -1
  199. package/dist/types/msic/4X.d.ts +1 -1
  200. package/dist/types/msic/5X.d.ts +1 -1
  201. package/dist/types/msic/6X.d.ts +1 -1
  202. package/dist/types/msic/7X.d.ts +1 -1
  203. package/dist/types/msic/8X.d.ts +1 -1
  204. package/dist/types/msic/9X.d.ts +1 -1
  205. package/dist/types/msic-codes.d.ts +11 -11
  206. package/dist/types/notifications.d.ts +2 -0
  207. package/dist/types/payment-modes.d.ts +1 -1
  208. package/dist/types/signatures.d.ts +1 -1
  209. package/dist/types/state-codes.d.ts +1 -1
  210. package/dist/types/tax-types.d.ts +1 -1
  211. package/dist/types/taxpayer.d.ts +19 -0
  212. package/dist/types/unit/1X.d.ts +1 -1
  213. package/dist/types/unit/2X.d.ts +1 -1
  214. package/dist/types/unit/3X.d.ts +1 -1
  215. package/dist/types/unit/4X.d.ts +1 -1
  216. package/dist/types/unit/5X.d.ts +1 -1
  217. package/dist/types/unit/6X.d.ts +1 -1
  218. package/dist/types/unit/7X.d.ts +1 -1
  219. package/dist/types/unit/8X.d.ts +1 -1
  220. package/dist/types/unit/9X.d.ts +1 -1
  221. package/dist/types/unit/AX.d.ts +1 -1
  222. package/dist/types/unit/BX.d.ts +1 -1
  223. package/dist/types/unit/CX.d.ts +1 -1
  224. package/dist/types/unit/DX.d.ts +1 -1
  225. package/dist/types/unit/EX.d.ts +1 -1
  226. package/dist/types/unit/FX.d.ts +1 -1
  227. package/dist/types/unit/GX.d.ts +1 -1
  228. package/dist/types/unit/HX.d.ts +1 -1
  229. package/dist/types/unit/IX.d.ts +1 -1
  230. package/dist/types/unit/JX.d.ts +1 -1
  231. package/dist/types/unit/KX.d.ts +1 -1
  232. package/dist/types/unit/LX.d.ts +1 -1
  233. package/dist/types/unit/MX.d.ts +1 -1
  234. package/dist/types/unit/NX.d.ts +1 -1
  235. package/dist/types/unit/OX.d.ts +1 -1
  236. package/dist/types/unit/PX.d.ts +1 -1
  237. package/dist/types/unit/QX.d.ts +1 -1
  238. package/dist/types/unit/RX.d.ts +1 -1
  239. package/dist/types/unit/SX.d.ts +1 -1
  240. package/dist/types/unit/TX.d.ts +1 -1
  241. package/dist/types/unit/UX.d.ts +1 -1
  242. package/dist/types/unit/VX.d.ts +1 -1
  243. package/dist/types/unit/WX.d.ts +1 -1
  244. package/dist/types/unit/XX.d.ts +1 -1
  245. package/dist/types/unit/YX.d.ts +1 -1
  246. package/dist/types/unit/ZX.d.ts +1 -1
  247. package/dist/types/unit-types.d.ts +36 -36
  248. package/dist/types/utils.d.ts +2 -0
  249. package/dist/unit-types-VgYXIwTT.d.ts +55 -0
  250. package/dist/utils/certificate.js +1 -1
  251. package/dist/utils/document.d.ts +60 -57
  252. package/dist/utils/document.js +1 -1
  253. package/dist/utils/getBaseUrl.js +1 -1
  254. package/dist/utils/signature-diagnostics.d.ts +60 -57
  255. package/dist/utils/signature-diagnostics.js +1 -1
  256. package/dist/utils-B3mo51Zp.d.ts +4 -0
  257. package/dist/utils-Cdqbbzca.d.cts +5 -0
  258. package/package.json +1 -1
  259. package/dist/api/platform/platformLogin.d.ts +0 -65
  260. package/dist/api/platform/platformLogin.js +0 -3
  261. package/dist/index11.cjs.map +0 -1
  262. package/dist/index14.cjs.map +0 -1
  263. package/dist/index20.cjs.map +0 -1
  264. package/dist/index22.cjs.map +0 -1
  265. package/dist/index24.cjs.map +0 -1
  266. package/dist/index25.cjs.map +0 -1
  267. package/dist/index26.cjs.map +0 -1
  268. package/dist/index3.cjs.map +0 -1
  269. package/dist/index4.cjs.map +0 -1
  270. package/dist/index58.cts.map +0 -1
  271. package/dist/index59.cts.map +0 -1
  272. package/dist/index6.cjs.map +0 -1
  273. package/dist/platformLogin-PGzMhw1X.cjs.map +0 -1
  274. package/dist/unit-types-B41YFOLT.d.ts +0 -55
  275. package/dist/utils/helpers.d.ts +0 -271
  276. package/dist/utils/helpers.js +0 -330
  277. /package/dist/{0X-CTIq3y3a.d.ts → 0X-DZnB0al0.d.ts} +0 -0
  278. /package/dist/{1X-BywXCqtn.d.ts → 1X-C72Wa4pk.d.ts} +0 -0
  279. /package/dist/{1X-Bu4oiv8D.d.ts → 1X-Dg5J6Bfg.d.ts} +0 -0
  280. /package/dist/{2X-3fSEGIuE.d.ts → 2X-CH89y3Af.d.ts} +0 -0
  281. /package/dist/{2X-DnG3FY1f.d.ts → 2X-D_qwTeDT.d.ts} +0 -0
  282. /package/dist/{3X-CLdmoel1.d.ts → 3X-BJHYxgxa.d.ts} +0 -0
  283. /package/dist/{3X-Ynjfgoll.d.ts → 3X-DryrwYRf.d.ts} +0 -0
  284. /package/dist/{4X-B5ePdMky.d.ts → 4X-BPMLRoDv.d.ts} +0 -0
  285. /package/dist/{4X-BTG6o1Gn.d.ts → 4X-BbZgoRHO.d.ts} +0 -0
  286. /package/dist/{5X-dhP6fyou.d.ts → 5X-Bv7M6KyG.d.ts} +0 -0
  287. /package/dist/{5X-CjSz1zxJ.d.ts → 5X-oQRBnO0f.d.ts} +0 -0
  288. /package/dist/{6X-B9KP_vEn.d.ts → 6X-B9I2XJa4.d.ts} +0 -0
  289. /package/dist/{6X-BHaY0TCf.d.ts → 6X-ZeZ8OB57.d.ts} +0 -0
  290. /package/dist/{7X-DtkQutx2.d.ts → 7X-Ckv9bbzG.d.ts} +0 -0
  291. /package/dist/{7X-C4eX_tAk.d.ts → 7X-Dvw2Z2VN.d.ts} +0 -0
  292. /package/dist/{8X-D6HTLShY.d.ts → 8X-BkgoX8dg.d.ts} +0 -0
  293. /package/dist/{8X-5n9seY3z.d.ts → 8X-C37BJTl6.d.ts} +0 -0
  294. /package/dist/{9X-CHZKsIdD.d.ts → 9X-Du0e44cq.d.ts} +0 -0
  295. /package/dist/{9X-Cpb6V4JC.d.ts → 9X-_XRgT2-_.d.ts} +0 -0
  296. /package/dist/{AX-C0w_r3PA.d.ts → AX-BSPLpkVT.d.ts} +0 -0
  297. /package/dist/{BX-RadlZ-6m.d.ts → BX-u4yMaIkz.d.ts} +0 -0
  298. /package/dist/{CX-CT1Zzb9D.d.ts → CX-BKZG0pVE.d.ts} +0 -0
  299. /package/dist/{DX-CtUeTKMM.d.ts → DX-CwA9WJAf.d.ts} +0 -0
  300. /package/dist/{EX-084Yu7Wt.d.ts → EX-BRNu1Ooi.d.ts} +0 -0
  301. /package/dist/{FX-BrbQM0CW.d.ts → FX-DBxjq6xY.d.ts} +0 -0
  302. /package/dist/{GX-gKj8iAAh.d.ts → GX-B3CvWNrP.d.ts} +0 -0
  303. /package/dist/{HX-9D-ZXTy5.d.ts → HX-D7FABgTv.d.ts} +0 -0
  304. /package/dist/{IX-DR4Fc92A.d.ts → IX-D3ZknsAB.d.ts} +0 -0
  305. /package/dist/{JX-DIKa9ma-.d.ts → JX-BRaZM3Gc.d.ts} +0 -0
  306. /package/dist/{KX-DpsJ_unT.d.ts → KX-B1K0OWoi.d.ts} +0 -0
  307. /package/dist/{LX-DeXPPWUX.d.ts → LX-CKRefinL.d.ts} +0 -0
  308. /package/dist/{MX-CKMjg_zK.d.ts → MX-DKmaeO9r.d.ts} +0 -0
  309. /package/dist/{NX-oYdb4NDo.d.ts → NX-CJL2Gn1U.d.ts} +0 -0
  310. /package/dist/{OX-Bid9es3D.d.ts → OX-Do2ap5v_.d.ts} +0 -0
  311. /package/dist/{PX-D7jy9CFk.d.ts → PX-_DOr_rm9.d.ts} +0 -0
  312. /package/dist/{QX-BFWOR4g3.d.ts → QX-HlXLkIki.d.ts} +0 -0
  313. /package/dist/{RX-XHgCyMV1.d.ts → RX-DVPGOVES.d.ts} +0 -0
  314. /package/dist/{SX-Cl8RN8oH.d.ts → SX-OGT3qwlS.d.ts} +0 -0
  315. /package/dist/{TX-ZymoIbtr.d.ts → TX-cPDINmZ5.d.ts} +0 -0
  316. /package/dist/{UX-D-Ndd1ov.d.ts → UX-Be3sqvPV.d.ts} +0 -0
  317. /package/dist/{VX-B-1b34r7.d.ts → VX-CoEuBNDK.d.ts} +0 -0
  318. /package/dist/{WX-0GuMjPNZ.d.ts → WX-DMvw__jH.d.ts} +0 -0
  319. /package/dist/{XX-CF2NANsy.d.ts → XX-DOA-10JW.d.ts} +0 -0
  320. /package/dist/{YX-B51BbNSg.d.ts → YX-F34sJ7Ik.d.ts} +0 -0
  321. /package/dist/{ZX-BMJS1iAv.d.ts → ZX-CDQOfsHh.d.ts} +0 -0
  322. /package/dist/{certificate-aooIRf9A.js → certificate-BDECQL9C.js} +0 -0
  323. /package/dist/{classification-codes-BKxV-rO9.d.ts → classification-codes-B1D5xbq5.d.ts} +0 -0
  324. /package/dist/{country-code-CQuaiQm2.d.ts → country-code-D42kAyNH.d.ts} +0 -0
  325. /package/dist/{currencies-BYJK-m6v.d.ts → currencies-CDveO_yz.d.ts} +0 -0
  326. /package/dist/{document-D6VKMAtx.js → document-BSuYbfXR.js} +0 -0
  327. /package/dist/{e-invoice-CmbLQkHw.d.ts → e-invoice-BxNC6V_j.d.ts} +0 -0
  328. /package/dist/{getBaseUrl-R3IdgCu3.js → getBaseUrl-BYkBwhQP.js} +0 -0
  329. /package/dist/{index-0-EvC6Nv.d.ts → index-FTgB2nM6.d.ts} +0 -0
  330. /package/dist/{payment-modes-BOTSRC_X.d.ts → payment-modes-NpE3OcCV.d.ts} +0 -0
  331. /package/dist/{signatures-W-_brwdb.d.ts → signatures-DOKNMiZI.d.ts} +0 -0
  332. /package/dist/{state-codes-oeFKlwXZ.d.ts → state-codes-VOFWhHA0.d.ts} +0 -0
  333. /package/dist/{tax-types-CsQ76JMf.d.ts → tax-types-ieqw5Ze7.d.ts} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"index59.cts","names":[],"sources":["../src/index.d.ts"],"sourcesContent":["import { EInvoiceTypeCode } from './types';\nimport type { DocumentStatus, InvoiceV1_1, RegistrationType } from './types/documents';\nimport type { DocumentSummary, DocumentValidationResult, DocumentValidationStepResult, SubmissionResponse, SubmissionStatus } from './types/documents';\nexport declare class MyInvoisClient {\n private readonly baseUrl;\n private readonly clientId;\n private readonly clientSecret;\n private readonly onBehalfOf?;\n private readonly signingCredentials;\n private readonly debug;\n private token;\n private tokenExpiration;\n constructor(clientId: string, clientSecret: string, environment: 'sandbox' | 'production', certificatePem: string, privateKeyPem: string, onBehalfOf?: string, debug?: boolean);\n private refreshToken;\n private getToken;\n private fetch;\n /**\n * Validates a TIN against a NRIC/ARMY/PASSPORT/BRN (Business Registration Number)\n *\n * @param tin - The TIN to validate\n * @param idType - The type of ID to validate against\n * @param idValue - The value of the ID to validate against\n * @returns true if the TIN is valid, false otherwise\n */\n verifyTin(tin: string, idType: RegistrationType, idValue: string): Promise<boolean>;\n /**\n * Submits one or more e-invoice documents to the MyInvois platform for processing.\n *\n * This method digitally signs each document using the provided certificate and private key,\n * generates document hashes, encodes them for submission, and sends them to the platform.\n * The method includes comprehensive validation warnings for document size and count limits.\n *\n * @param documents - Array of InvoiceV1_1 documents to be submitted\n * @returns Promise resolving to submission response containing the submission data and HTTP status\n * @throws {Error} If PRIVATE_KEY or CERTIFICATE environment variables are missing\n * @throws {Error} If document signing, encoding, or API submission fails\n *\n * @example\n * ```typescript\n * // Submit a single invoice\n * const result = await client.submitDocument([invoiceData]);\n * console.log(result.data.submissionUid); // Track submission with this UID\n *\n * // Submit multiple invoices\n * const result = await client.submitDocument([invoice1, invoice2, invoice3]);\n * if (result.status === 202) {\n * console.log('Documents submitted successfully');\n * }\n * ```\n *\n * @remarks\n * - Requires PRIVATE_KEY and CERTIFICATE environment variables for document signing\n * - Each document is digitally signed with XML-DSIG before submission\n * - Documents are base64-encoded for transmission\n * - API limits: Max 100 documents per submission, 5MB total payload, 300KB per document\n * - Debug mode provides detailed logging of payload sizes and validation warnings\n * - Returns HTTP 202 for successful submissions that require processing\n */\n submitDocument(documents: InvoiceV1_1[]): Promise<{\n data: SubmissionResponse;\n status: number;\n }>;\n getSubmissionStatus(submissionUid: string, pollInterval?: number, maxRetries?: number): Promise<{\n status: SubmissionStatus;\n documentSummary?: DocumentSummary[];\n error?: {\n code: string;\n message: string | null;\n target: string;\n details: {\n code: string;\n message: string;\n target: string;\n }[];\n };\n }>;\n /**\n * Retrieves a document by its unique identifier with the raw document content.\n *\n * @param documentUid - The unique identifier of the document to retrieve\n * @returns Promise resolving to document summary with raw document content as a string\n * @throws {Error} If the document is not found or request fails\n *\n * @example\n * ```typescript\n * const document = await client.getDocument('doc-uuid-123');\n * console.log(document.document); // Raw XML/JSON content\n * console.log(document.uuid); // Document UUID\n * ```\n */\n getDocument(documentUid: string): Promise<DocumentSummary & {\n document: string;\n }>;\n /**\n * Retrieves detailed information about a document including validation results.\n *\n * @param documentUid - The unique identifier of the document to get details for\n * @returns Promise resolving to document summary with detailed validation results\n * @throws {Error} If the document is not found or request fails\n *\n * @example\n * ```typescript\n * const details = await client.getDocumentDetails('doc-uuid-123');\n * console.log(details.validationResults.status); // 'Valid' | 'Invalid' | 'Processing'\n * console.log(details.validationResults.validationSteps); // Array of validation step results\n * ```\n */\n getDocumentDetails(documentUid: string): Promise<DocumentSummary & {\n validationResults: {\n status: DocumentValidationResult;\n validationSteps: DocumentValidationStepResult[];\n };\n }>;\n /**\n * Searches for documents based on various filter criteria.\n *\n * @param params - Search parameters object\n * @param params.uuid - Optional specific document UUID to search for\n * @param params.submissionDateFrom - Required start date for submission date range (ISO date string)\n * @param params.submissionDateTo - Optional end date for submission date range (ISO date string)\n * @param params.pageSize - Optional number of results per page (default handled by API)\n * @param params.pageNo - Optional page number for pagination (0-based)\n * @param params.issueDateFrom - Optional start date for issue date range (ISO date string)\n * @param params.issueDateTo - Optional end date for issue date range (ISO date string)\n * @param params.invoiceDirection - Optional filter by invoice direction ('Sent' or 'Received')\n * @param params.status - Optional filter by document status\n * @param params.documentType - Optional filter by e-invoice type code\n * @param params.searchQuery - Optional text search across uuid, buyerTIN, supplierTIN, buyerName, supplierName, internalID, total\n * @returns Promise resolving to array of document summaries matching the search criteria\n * @throws {Error} If the search request fails\n *\n * @example\n * ```typescript\n * // Search for documents submitted in the last 30 days\n * const documents = await client.searchDocuments({\n * submissionDateFrom: '2024-01-01',\n * submissionDateTo: '2024-01-31',\n * status: 'Valid',\n * pageSize: 10\n * });\n *\n * // Search by supplier name\n * const supplierDocs = await client.searchDocuments({\n * submissionDateFrom: '2024-01-01',\n * searchQuery: 'ACME Corp',\n * invoiceDirection: 'Received'\n * });\n * ```\n */\n searchDocuments({ uuid, submissionDateFrom, submissionDateTo, pageSize, pageNo, issueDateFrom, issueDateTo, invoiceDirection, status, documentType, searchQuery, }: {\n uuid?: string;\n submissionDateFrom: string;\n submissionDateTo?: string;\n pageSize?: number;\n pageNo?: number;\n issueDateFrom?: string;\n issueDateTo?: string;\n invoiceDirection?: 'Sent' | 'Received';\n status?: DocumentStatus;\n documentType?: EInvoiceTypeCode;\n searchQuery?: string;\n }): Promise<DocumentSummary[]>;\n}\nexport type * from './types/index.d.ts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAW,iBAAiB;CAAC;CAAK,MAAE;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index6.cjs","names":[],"sources":["../src/types/e-invoice.d.ts"],"sourcesContent":["/**\n * Represents the allowed codes for e-Invoice types.\n * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/e-invoice-types/\n */\nexport type EInvoiceTypeCode =\n | '01' // Invoice\n | '02' // Credit Note\n | '03' // Debit Note\n | '04' // Refund Note\n | '11' // Self-billed Invoice\n | '12' // Self-billed Credit Note\n | '13' // Self-billed Debit Note\n | '14' // Self-billed Refund Note\n\n/**\n * Interface representing an e-Invoice type entry.\n * Contains the code and its corresponding description.\n */\nexport interface EInvoiceType {\n code: EInvoiceTypeCode\n description: string\n}\n\n/**\n * Enum representing the allowed codes for e-Invoice types with descriptive names.\n * Provides a more readable way to reference e-Invoice types compared to using raw codes.\n *\n * @example\n * const invoiceCode = EInvoiceTypeCodeEnum.Invoice;\n * console.log(invoiceCode); // Output: \"01\"\n */\nexport enum EInvoiceTypeCodeEnum {\n Invoice = '01',\n CreditNote = '02',\n DebitNote = '03',\n RefundNote = '04',\n SelfBilledInvoice = '11',\n SelfBilledCreditNote = '12',\n SelfBilledDebitNote = '13',\n SelfBilledRefundNote = '14',\n}\n"],"mappings":";;;;;;;;;;AA+BA,IAAY,wEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"platformLogin-PGzMhw1X.cjs","names":["client: ClientCredentials","tokenResponse: TokenResponse"],"sources":["../src/api/platform/platformLogin.ts"],"sourcesContent":["import type { ClientCredentials, TokenResponse } from '../../types'\n\nexport const platformLogin = async (\n client: ClientCredentials,\n): Promise<{\n token: string\n tokenExpiration: Date\n}> => {\n const { clientId, clientSecret, baseUrl, onBehalfOf, debug } = client\n try {\n const response = await fetch(`${baseUrl}/connect/token`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n ...(onBehalfOf ? { onbehalfof: onBehalfOf } : {}),\n },\n body: new URLSearchParams({\n grant_type: 'client_credentials',\n client_id: clientId,\n client_secret: clientSecret,\n scope: 'InvoicingAPI',\n }),\n })\n\n const tokenResponse: TokenResponse = await response.json()\n return {\n token: tokenResponse.access_token,\n tokenExpiration: new Date(Date.now() + tokenResponse.expires_in * 1000),\n }\n } catch (error) {\n if (debug) console.error(error)\n throw error\n }\n}\n"],"mappings":";;AAEA,MAAa,gBAAgB,OAC3BA,WAII;CACJ,MAAM,EAAE,UAAU,cAAc,SAAS,YAAY,OAAO,GAAG;AAC/D,KAAI;EACF,MAAM,WAAW,MAAM,OAAO,EAAE,QAAQ,iBAAiB;GACvD,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,GAAI,aAAa,EAAE,YAAY,WAAY,IAAG,CAAE;GACjD;GACD,MAAM,IAAI,gBAAgB;IACxB,YAAY;IACZ,WAAW;IACX,eAAe;IACf,OAAO;GACR;EACF,EAAC;EAEF,MAAMC,gBAA+B,MAAM,SAAS,MAAM;AAC1D,SAAO;GACL,OAAO,cAAc;GACrB,iBAAiB,IAAI,KAAK,KAAK,KAAK,GAAG,cAAc,aAAa;EACnE;CACF,SAAQ,OAAO;AACd,MAAI,MAAO,SAAQ,MAAM,MAAM;AAC/B,QAAM;CACP;AACF"}
@@ -1,55 +0,0 @@
1
- import { UnitTypeCode_1X } from "./1X-BywXCqtn.js";
2
- import { UnitTypeCode_2X } from "./2X-3fSEGIuE.js";
3
- import { UnitTypeCode_3X } from "./3X-Ynjfgoll.js";
4
- import { UnitTypeCode_4X } from "./4X-B5ePdMky.js";
5
- import { UnitTypeCode_5X } from "./5X-dhP6fyou.js";
6
- import { UnitTypeCode_6X } from "./6X-BHaY0TCf.js";
7
- import { UnitTypeCode_7X } from "./7X-C4eX_tAk.js";
8
- import { UnitTypeCode_8X } from "./8X-D6HTLShY.js";
9
- import { UnitTypeCode_9X } from "./9X-CHZKsIdD.js";
10
- import { UnitTypeCode_AX } from "./AX-C0w_r3PA.js";
11
- import { UnitTypeCode_BX } from "./BX-RadlZ-6m.js";
12
- import { UnitTypeCode_CX } from "./CX-CT1Zzb9D.js";
13
- import { UnitTypeCode_DX } from "./DX-CtUeTKMM.js";
14
- import { UnitTypeCode_EX } from "./EX-084Yu7Wt.js";
15
- import { UnitTypeCode_FX } from "./FX-BrbQM0CW.js";
16
- import { UnitTypeCode_GX } from "./GX-gKj8iAAh.js";
17
- import { UnitTypeCode_HX } from "./HX-9D-ZXTy5.js";
18
- import { UnitTypeCode_IX } from "./IX-DR4Fc92A.js";
19
- import { UnitTypeCode_JX } from "./JX-DIKa9ma-.js";
20
- import { UnitTypeCode_KX } from "./KX-DpsJ_unT.js";
21
- import { UnitTypeCode_LX } from "./LX-DeXPPWUX.js";
22
- import { UnitTypeCode_MX } from "./MX-CKMjg_zK.js";
23
- import { UnitTypeCode_NX } from "./NX-oYdb4NDo.js";
24
- import { UnitTypeCode_OX } from "./OX-Bid9es3D.js";
25
- import { UnitTypeCode_PX } from "./PX-D7jy9CFk.js";
26
- import { UnitTypeCode_QX } from "./QX-BFWOR4g3.js";
27
- import { UnitTypeCode_RX } from "./RX-XHgCyMV1.js";
28
- import { UnitTypeCode_SX } from "./SX-Cl8RN8oH.js";
29
- import { UnitTypeCode_TX } from "./TX-ZymoIbtr.js";
30
- import { UnitTypeCode_UX } from "./UX-D-Ndd1ov.js";
31
- import { UnitTypeCode_VX } from "./VX-B-1b34r7.js";
32
- import { UnitTypeCode_WX } from "./WX-0GuMjPNZ.js";
33
- import { UnitTypeCode_YX } from "./YX-B51BbNSg.js";
34
- import { UnitTypeCode_ZX } from "./ZX-BMJS1iAv.js";
35
- import { UnitTypeCode_XX } from "./XX-CF2NANsy.js";
36
-
37
- //#region src/types/unit-types.d.ts
38
-
39
- /**
40
- * Represents the allowed codes for Unit of Measurement types.
41
- * Based on UN/ECE Recommendation 20, Revision 17 (2021) as per the documentation:
42
- * https://sdk.myinvois.hasil.gov.my/codes/unit-types/
43
- */
44
- type UnitTypeCode = UnitTypeCode_1X | UnitTypeCode_2X | UnitTypeCode_3X | UnitTypeCode_4X | UnitTypeCode_5X | UnitTypeCode_6X | UnitTypeCode_7X | UnitTypeCode_8X | UnitTypeCode_9X | UnitTypeCode_AX | UnitTypeCode_BX | UnitTypeCode_CX | UnitTypeCode_DX | UnitTypeCode_EX | UnitTypeCode_FX | UnitTypeCode_GX | UnitTypeCode_HX | UnitTypeCode_IX | UnitTypeCode_JX | UnitTypeCode_KX | UnitTypeCode_LX | UnitTypeCode_MX | UnitTypeCode_NX | UnitTypeCode_OX | UnitTypeCode_PX | UnitTypeCode_QX | UnitTypeCode_RX | UnitTypeCode_SX | UnitTypeCode_TX | UnitTypeCode_UX | UnitTypeCode_VX | UnitTypeCode_WX | UnitTypeCode_YX | UnitTypeCode_ZX | UnitTypeCode_XX;
45
-
46
- /**
47
- * Interface representing a Unit of Measurement entry.
48
- * Contains the code and its corresponding name.
49
- */
50
- interface UnitType {
51
- code: UnitTypeCode;
52
- name: string;
53
- }
54
- //#endregion
55
- export { UnitType, UnitTypeCode };
@@ -1,271 +0,0 @@
1
- import { AdditionalDocumentReference, AllowanceCharge, CurrencyExchangeRate, Delivery, InvoiceV1_1, PaymentMeans } from "../types/documents/index.js";
2
-
3
- //#region src/utils/helpers.d.ts
4
-
5
- /**
6
- * MyInvois Invoice Helper Functions
7
- *
8
- * Provides convenient utilities for common invoice scenarios and business patterns.
9
- * These helpers simplify the creation of compliant MyInvois documents.
10
- */
11
- /**
12
- * Payment Method Helpers
13
- */
14
- declare const PaymentHelpers: {
15
- /**
16
- * Creates cash payment means
17
- */
18
- cash(): PaymentMeans;
19
- /**
20
- * Creates cheque payment means
21
- */
22
- cheque(accountId?: string): PaymentMeans;
23
- /**
24
- * Creates bank transfer payment means
25
- */
26
- bankTransfer(accountId: string, dueDate?: string): PaymentMeans;
27
- /**
28
- * Creates credit card payment means
29
- */
30
- creditCard(): PaymentMeans;
31
- /**
32
- * Creates e-wallet payment means
33
- */
34
- eWallet(accountId?: string): PaymentMeans;
35
- /**
36
- * Creates custom payment terms with specific due date
37
- */
38
- net(days: number, accountId?: string): PaymentMeans;
39
- };
40
- /**
41
- * Currency and Exchange Rate Helpers
42
- */
43
- declare const CurrencyHelpers: {
44
- /**
45
- * Creates domestic MYR transaction (no exchange rate needed)
46
- */
47
- domestic(): CurrencyExchangeRate;
48
- /**
49
- * Creates international transaction with exchange rate
50
- */
51
- international(fromCurrency: string, toCurrency: string | undefined, exchangeRate: number, rateDate?: string): CurrencyExchangeRate;
52
- /**
53
- * Common exchange rates (these should be updated with real-time rates)
54
- */
55
- commonRates: {
56
- USD_MYR: number;
57
- SGD_MYR: number;
58
- EUR_MYR: number;
59
- GBP_MYR: number;
60
- JPY_MYR: number;
61
- AUD_MYR: number;
62
- };
63
- };
64
- /**
65
- * Tax Calculation Helpers
66
- */
67
- declare const TaxHelpers: {
68
- /**
69
- * Calculates SST (6%) for goods
70
- */
71
- calculateSST(amount: number, rate?: number): {
72
- taxAmount: number;
73
- totalWithTax: number;
74
- };
75
- /**
76
- * Calculates Service Tax for services
77
- */
78
- calculateServiceTax(amount: number, rate?: number): {
79
- taxAmount: number;
80
- totalWithTax: number;
81
- };
82
- /**
83
- * Zero-rated calculation (0% tax)
84
- */
85
- zeroRated(amount: number): {
86
- taxAmount: number;
87
- totalWithTax: number;
88
- };
89
- /**
90
- * Exempt calculation (no tax)
91
- */
92
- exempt(amount: number): {
93
- taxAmount: number;
94
- totalWithTax: number;
95
- };
96
- };
97
- /**
98
- * Allowance and Charge Helpers
99
- */
100
- declare const AllowanceChargeHelpers: {
101
- /**
102
- * Creates a discount allowance
103
- */
104
- discount(reason: string, amount: number, percentage?: number): AllowanceCharge;
105
- /**
106
- * Creates a shipping charge
107
- */
108
- shipping(amount: number, description?: string): AllowanceCharge;
109
- /**
110
- * Creates an early payment discount
111
- */
112
- earlyPaymentDiscount(percentage: number, baseAmount: number): AllowanceCharge;
113
- /**
114
- * Creates a handling fee charge
115
- */
116
- handlingFee(amount: number): AllowanceCharge;
117
- };
118
- /**
119
- * Delivery Helpers
120
- */
121
- declare const DeliveryHelpers: {
122
- /**
123
- * Creates standard delivery information
124
- */
125
- standard(deliveryDate: string, address: {
126
- addressLine0: string;
127
- cityName: string;
128
- postalZone?: string;
129
- state: string;
130
- country?: string;
131
- }): Delivery;
132
- /**
133
- * Creates pickup delivery (customer pickup)
134
- */
135
- pickup(pickupDate: string): Delivery;
136
- /**
137
- * Creates delivery with freight charges
138
- */
139
- withFreight(deliveryDate: string, address: any, freightAmount: number, freightDescription?: string): Delivery;
140
- };
141
- /**
142
- * Document Reference Helpers
143
- */
144
- declare const DocumentReferenceHelpers: {
145
- /**
146
- * Creates purchase order reference
147
- */
148
- purchaseOrder(poNumber: string): {
149
- purchaseOrderReference: string;
150
- };
151
- /**
152
- * Creates contract reference
153
- */
154
- contract(contractNumber: string): {
155
- contractReference: string;
156
- };
157
- /**
158
- * Creates project reference
159
- */
160
- project(projectNumber: string): {
161
- projectReference: string;
162
- };
163
- /**
164
- * Creates billing reference
165
- */
166
- billing(billingNumber: string): {
167
- billingReference: string;
168
- };
169
- /**
170
- * Creates customs reference
171
- */
172
- customs(customsFormNumber: string): AdditionalDocumentReference;
173
- /**
174
- * Creates free trade agreement reference
175
- */
176
- freeTradeAgreement(ftaNumber: string, country: string): AdditionalDocumentReference;
177
- };
178
- /**
179
- * Industry Classification Helpers
180
- */
181
- declare const IndustryHelpers: {
182
- /**
183
- * Common industry classifications with proper codes and descriptions
184
- */
185
- trading: {
186
- industryClassificationCode: string;
187
- industryClassificationDescription: string;
188
- };
189
- manufacturing: {
190
- industryClassificationCode: string;
191
- industryClassificationDescription: string;
192
- };
193
- software: {
194
- industryClassificationCode: string;
195
- industryClassificationDescription: string;
196
- };
197
- consulting: {
198
- industryClassificationCode: string;
199
- industryClassificationDescription: string;
200
- };
201
- restaurant: {
202
- industryClassificationCode: string;
203
- industryClassificationDescription: string;
204
- };
205
- construction: {
206
- industryClassificationCode: string;
207
- industryClassificationDescription: string;
208
- };
209
- logistics: {
210
- industryClassificationCode: string;
211
- industryClassificationDescription: string;
212
- };
213
- /**
214
- * Creates custom industry classification
215
- */
216
- custom(code: string, description: string): {
217
- industryClassificationCode: string;
218
- industryClassificationDescription: string;
219
- };
220
- };
221
- /**
222
- * Date and Time Helpers
223
- */
224
- declare const DateTimeHelpers: {
225
- /**
226
- * Gets current date in MyInvois format (YYYY-MM-DD)
227
- */
228
- currentDate(): string;
229
- /**
230
- * Gets current time in MyInvois format (HH:mm:ssZ)
231
- */
232
- currentTime(): string;
233
- /**
234
- * Formats date to MyInvois format
235
- */
236
- formatDate(date: Date): string;
237
- /**
238
- * Formats time to MyInvois format
239
- */
240
- formatTime(date: Date): string;
241
- /**
242
- * Adds days to a date
243
- */
244
- addDays(date: Date, days: number): Date;
245
- /**
246
- * Gets billing period for monthly billing
247
- */
248
- monthlyPeriod(year: number, month: number): {
249
- start: string;
250
- end: string;
251
- };
252
- };
253
- /**
254
- * Complete Invoice Builder Helper
255
- */
256
- declare const InvoiceBuilder: {
257
- /**
258
- * Creates a basic cash invoice template
259
- */
260
- basicCash(invoiceNumber: string): Partial<InvoiceV1_1>;
261
- /**
262
- * Creates a business invoice template with bank transfer
263
- */
264
- businessInvoice(invoiceNumber: string, accountId: string, netDays?: number): Partial<InvoiceV1_1>;
265
- /**
266
- * Creates an international invoice template
267
- */
268
- international(invoiceNumber: string, currency: string, exchangeRate: number): Partial<InvoiceV1_1>;
269
- };
270
- //#endregion
271
- export { AllowanceChargeHelpers, CurrencyHelpers, DateTimeHelpers, DeliveryHelpers, DocumentReferenceHelpers, IndustryHelpers, InvoiceBuilder, PaymentHelpers, TaxHelpers };
@@ -1,330 +0,0 @@
1
- //#region src/utils/helpers.ts
2
- /**
3
- * MyInvois Invoice Helper Functions
4
- *
5
- * Provides convenient utilities for common invoice scenarios and business patterns.
6
- * These helpers simplify the creation of compliant MyInvois documents.
7
- */
8
- /**
9
- * Payment Method Helpers
10
- */
11
- const PaymentHelpers = {
12
- cash() {
13
- return {
14
- paymentMeansCode: "01",
15
- paymentTerms: "Cash payment"
16
- };
17
- },
18
- cheque(accountId) {
19
- return {
20
- paymentMeansCode: "02",
21
- payeeFinancialAccountID: accountId,
22
- paymentTerms: "Cheque payment"
23
- };
24
- },
25
- bankTransfer(accountId, dueDate) {
26
- return {
27
- paymentMeansCode: "03",
28
- payeeFinancialAccountID: accountId,
29
- paymentDueDate: dueDate,
30
- paymentTerms: "Bank transfer"
31
- };
32
- },
33
- creditCard() {
34
- return {
35
- paymentMeansCode: "04",
36
- paymentTerms: "Credit card payment"
37
- };
38
- },
39
- eWallet(accountId) {
40
- return {
41
- paymentMeansCode: "05",
42
- payeeFinancialAccountID: accountId,
43
- paymentTerms: "E-wallet payment"
44
- };
45
- },
46
- net(days, accountId) {
47
- const dueDate = /* @__PURE__ */ new Date();
48
- dueDate.setDate(dueDate.getDate() + days);
49
- return {
50
- paymentMeansCode: "03",
51
- payeeFinancialAccountID: accountId,
52
- paymentDueDate: dueDate.toISOString().split("T")[0],
53
- paymentTerms: `Net ${days} days`
54
- };
55
- }
56
- };
57
- /**
58
- * Currency and Exchange Rate Helpers
59
- */
60
- const CurrencyHelpers = {
61
- domestic() {
62
- return {
63
- sourceCurrencyCode: "MYR",
64
- targetCurrencyCode: "MYR",
65
- calculationRate: 1
66
- };
67
- },
68
- international(fromCurrency, toCurrency = "MYR", exchangeRate, rateDate) {
69
- return {
70
- sourceCurrencyCode: fromCurrency,
71
- targetCurrencyCode: toCurrency,
72
- calculationRate: exchangeRate,
73
- exchangeRateDate: rateDate || (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
74
- };
75
- },
76
- commonRates: {
77
- USD_MYR: 4.75,
78
- SGD_MYR: 3.45,
79
- EUR_MYR: 5.1,
80
- GBP_MYR: 5.85,
81
- JPY_MYR: .032,
82
- AUD_MYR: 3.12
83
- }
84
- };
85
- /**
86
- * Tax Calculation Helpers
87
- */
88
- const TaxHelpers = {
89
- calculateSST(amount, rate = 6) {
90
- const taxAmount = amount * rate / 100;
91
- return {
92
- taxAmount: Math.round(taxAmount * 100) / 100,
93
- totalWithTax: Math.round((amount + taxAmount) * 100) / 100
94
- };
95
- },
96
- calculateServiceTax(amount, rate = 6) {
97
- return TaxHelpers.calculateSST(amount, rate);
98
- },
99
- zeroRated(amount) {
100
- return {
101
- taxAmount: 0,
102
- totalWithTax: amount
103
- };
104
- },
105
- exempt(amount) {
106
- return {
107
- taxAmount: 0,
108
- totalWithTax: amount
109
- };
110
- }
111
- };
112
- /**
113
- * Allowance and Charge Helpers
114
- */
115
- const AllowanceChargeHelpers = {
116
- discount(reason, amount, percentage) {
117
- return {
118
- chargeIndicator: false,
119
- reason,
120
- amount,
121
- multiplierFactorNumeric: percentage ? percentage / 100 : void 0
122
- };
123
- },
124
- shipping(amount, description = "Shipping and handling") {
125
- return {
126
- chargeIndicator: true,
127
- reason: description,
128
- amount
129
- };
130
- },
131
- earlyPaymentDiscount(percentage, baseAmount) {
132
- const discountAmount = baseAmount * percentage / 100;
133
- return {
134
- chargeIndicator: false,
135
- reason: `Early payment discount ${percentage}%`,
136
- amount: Math.round(discountAmount * 100) / 100,
137
- multiplierFactorNumeric: percentage / 100,
138
- baseAmount
139
- };
140
- },
141
- handlingFee(amount) {
142
- return {
143
- chargeIndicator: true,
144
- reason: "Handling fee",
145
- amount
146
- };
147
- }
148
- };
149
- /**
150
- * Delivery Helpers
151
- */
152
- const DeliveryHelpers = {
153
- standard(deliveryDate, address) {
154
- return {
155
- actualDeliveryDate: deliveryDate,
156
- deliveryLocation: {
157
- ...address,
158
- country: address.country || "MYS"
159
- }
160
- };
161
- },
162
- pickup(pickupDate) {
163
- return {
164
- actualDeliveryDate: pickupDate,
165
- deliveryLocation: {
166
- addressLine0: "Customer pickup",
167
- cityName: "N/A",
168
- state: "N/A",
169
- country: "MYS"
170
- }
171
- };
172
- },
173
- withFreight(deliveryDate, address, freightAmount, freightDescription = "Freight charges") {
174
- return {
175
- actualDeliveryDate: deliveryDate,
176
- deliveryLocation: address,
177
- shipment: {
178
- id: `SHIP-${Date.now()}`,
179
- freightAllowanceCharge: {
180
- chargeIndicator: true,
181
- reason: freightDescription,
182
- amount: freightAmount
183
- }
184
- }
185
- };
186
- }
187
- };
188
- /**
189
- * Document Reference Helpers
190
- */
191
- const DocumentReferenceHelpers = {
192
- purchaseOrder(poNumber) {
193
- return { purchaseOrderReference: poNumber };
194
- },
195
- contract(contractNumber) {
196
- return { contractReference: contractNumber };
197
- },
198
- project(projectNumber) {
199
- return { projectReference: projectNumber };
200
- },
201
- billing(billingNumber) {
202
- return { billingReference: billingNumber };
203
- },
204
- customs(customsFormNumber) {
205
- return {
206
- id: customsFormNumber,
207
- documentType: "CustomsImportForm",
208
- documentDescription: "Customs import declaration"
209
- };
210
- },
211
- freeTradeAgreement(ftaNumber, country) {
212
- return {
213
- id: ftaNumber,
214
- documentType: "FreeTradeAgreement",
215
- documentDescription: `Free trade agreement with ${country}`
216
- };
217
- }
218
- };
219
- /**
220
- * Industry Classification Helpers
221
- */
222
- const IndustryHelpers = {
223
- trading: {
224
- industryClassificationCode: "47900",
225
- industryClassificationDescription: "Retail sale via mail order houses or via Internet"
226
- },
227
- manufacturing: {
228
- industryClassificationCode: "10131",
229
- industryClassificationDescription: "Processing and preserving of meat"
230
- },
231
- software: {
232
- industryClassificationCode: "62012",
233
- industryClassificationDescription: "Business and domestic software development"
234
- },
235
- consulting: {
236
- industryClassificationCode: "70200",
237
- industryClassificationDescription: "Management consultancy activities"
238
- },
239
- restaurant: {
240
- industryClassificationCode: "56101",
241
- industryClassificationDescription: "Restaurants"
242
- },
243
- construction: {
244
- industryClassificationCode: "41000",
245
- industryClassificationDescription: "Development of building projects"
246
- },
247
- logistics: {
248
- industryClassificationCode: "49301",
249
- industryClassificationDescription: "Land freight transport"
250
- },
251
- custom(code, description) {
252
- return {
253
- industryClassificationCode: code,
254
- industryClassificationDescription: description
255
- };
256
- }
257
- };
258
- /**
259
- * Date and Time Helpers
260
- */
261
- const DateTimeHelpers = {
262
- currentDate() {
263
- return (/* @__PURE__ */ new Date()).toISOString().split("T")[0] || "";
264
- },
265
- currentTime() {
266
- return (/* @__PURE__ */ new Date()).toISOString().split("T")[1]?.split(".")[0] + "Z" || "";
267
- },
268
- formatDate(date) {
269
- return date.toISOString().split("T")[0] || "";
270
- },
271
- formatTime(date) {
272
- return date.toISOString().split("T")[1]?.split(".")[0] + "Z" || "";
273
- },
274
- addDays(date, days) {
275
- const result = new Date(date);
276
- result.setDate(result.getDate() + days);
277
- return result;
278
- },
279
- monthlyPeriod(year, month) {
280
- const start = new Date(Date.UTC(year, month - 1, 1));
281
- const end = new Date(Date.UTC(year, month, 0));
282
- return {
283
- start: DateTimeHelpers.formatDate(start),
284
- end: DateTimeHelpers.formatDate(end)
285
- };
286
- }
287
- };
288
- /**
289
- * Complete Invoice Builder Helper
290
- */
291
- const InvoiceBuilder = {
292
- basicCash(invoiceNumber) {
293
- return {
294
- eInvoiceCodeOrNumber: invoiceNumber,
295
- eInvoiceDate: DateTimeHelpers.currentDate(),
296
- eInvoiceTime: DateTimeHelpers.currentTime(),
297
- eInvoiceTypeCode: "01",
298
- eInvoiceVersion: "1.1",
299
- invoiceCurrencyCode: "MYR",
300
- paymentMeans: [PaymentHelpers.cash()]
301
- };
302
- },
303
- businessInvoice(invoiceNumber, accountId, netDays = 30) {
304
- return {
305
- eInvoiceCodeOrNumber: invoiceNumber,
306
- eInvoiceDate: DateTimeHelpers.currentDate(),
307
- eInvoiceTime: DateTimeHelpers.currentTime(),
308
- eInvoiceTypeCode: "01",
309
- eInvoiceVersion: "1.1",
310
- invoiceCurrencyCode: "MYR",
311
- paymentMeans: [PaymentHelpers.net(netDays, accountId)]
312
- };
313
- },
314
- international(invoiceNumber, currency, exchangeRate) {
315
- return {
316
- eInvoiceCodeOrNumber: invoiceNumber,
317
- eInvoiceDate: DateTimeHelpers.currentDate(),
318
- eInvoiceTime: DateTimeHelpers.currentTime(),
319
- eInvoiceTypeCode: "01",
320
- eInvoiceVersion: "1.1",
321
- invoiceCurrencyCode: currency,
322
- currencyExchangeRate: exchangeRate,
323
- taxExchangeRate: CurrencyHelpers.international(currency, "MYR", exchangeRate),
324
- paymentMeans: [PaymentHelpers.bankTransfer("")]
325
- };
326
- }
327
- };
328
-
329
- //#endregion
330
- export { AllowanceChargeHelpers, CurrencyHelpers, DateTimeHelpers, DeliveryHelpers, DocumentReferenceHelpers, IndustryHelpers, InvoiceBuilder, PaymentHelpers, TaxHelpers };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes