@ripwords/myinvois-client 0.3.7 → 0.4.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 (395) hide show
  1. package/README.md +27 -0
  2. package/dist/{apiQueue-DgKWaQDS.cjs → apiQueue-C45w-ymm.cjs} +1 -1
  3. package/dist/{apiQueue-DgKWaQDS.cjs.map → apiQueue-C45w-ymm.cjs.map} +1 -1
  4. package/dist/{certificate-CWmfCPdt.cjs → certificate-Dw46fkYv.cjs} +5 -31
  5. package/dist/certificate-Dw46fkYv.cjs.map +1 -0
  6. package/dist/{document-B6ab06s1.cjs → document-B11B5lqd.cjs} +75 -21
  7. package/dist/document-B11B5lqd.cjs.map +1 -0
  8. package/dist/{documentManagement-BviJDtf2.cjs → documentManagement-qJnd0l1z.cjs} +3 -2
  9. package/dist/documentManagement-qJnd0l1z.cjs.map +1 -0
  10. package/dist/{documentSubmission-C-v4_4-x.cjs → documentSubmission-BaPECvYU.cjs} +5 -5
  11. package/dist/{documentSubmission-C-v4_4-x.cjs.map → documentSubmission-BaPECvYU.cjs.map} +1 -1
  12. package/dist/{documentTypeManagement-D_-LiQVg.cjs → documentTypeManagement-DXRLfTsW.cjs} +1 -1
  13. package/dist/{documentTypeManagement-D_-LiQVg.cjs.map → documentTypeManagement-DXRLfTsW.cjs.map} +1 -1
  14. package/dist/{getBaseUrl-D0G4GZmp.cjs → getBaseUrl-D2iJdUGL.cjs} +1 -1
  15. package/dist/{getBaseUrl-D0G4GZmp.cjs.map → getBaseUrl-D2iJdUGL.cjs.map} +1 -1
  16. package/dist/index.cjs +14 -12
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index10.cjs +4 -2
  19. package/dist/index11.cjs +1 -1
  20. package/dist/index13.cjs +1 -1
  21. package/dist/index14.cjs +2 -329
  22. package/dist/index15.cjs +308 -172
  23. package/dist/index15.cjs.map +1 -1
  24. package/dist/index16.cjs +187 -56
  25. package/dist/index16.cjs.map +1 -1
  26. package/dist/index17.cjs +53 -523
  27. package/dist/index17.cjs.map +1 -1
  28. package/dist/index18.cjs +523 -187
  29. package/dist/index18.cjs.map +1 -1
  30. package/dist/index19.cjs +196 -0
  31. package/dist/index19.cjs.map +1 -0
  32. package/dist/index2.cjs +1 -1
  33. package/dist/index20.cjs +0 -25
  34. package/dist/index21.cjs +25 -0
  35. package/dist/{index20.cjs.map → index21.cjs.map} +1 -1
  36. package/dist/index23.cjs +0 -29
  37. package/dist/index24.cjs +24 -20
  38. package/dist/index24.cjs.map +1 -1
  39. package/dist/index25.cjs +25 -0
  40. package/dist/index25.cjs.map +1 -0
  41. package/dist/index26.cjs +0 -34
  42. package/dist/index27.cjs +25 -15
  43. package/dist/index27.cjs.map +1 -1
  44. package/dist/index28.cjs +24 -0
  45. package/dist/index28.cjs.map +1 -0
  46. package/dist/index3.cjs +2 -2
  47. package/dist/index31.cjs +0 -208
  48. package/dist/index32.cjs +203 -104
  49. package/dist/index32.cjs.map +1 -1
  50. package/dist/index33.cjs +104 -132
  51. package/dist/index33.cjs.map +1 -1
  52. package/dist/index34.cjs +132 -59
  53. package/dist/index34.cjs.map +1 -1
  54. package/dist/index35.cjs +59 -262
  55. package/dist/index35.cjs.map +1 -1
  56. package/dist/index36.cjs +262 -74
  57. package/dist/index36.cjs.map +1 -1
  58. package/dist/index37.cjs +74 -102
  59. package/dist/index37.cjs.map +1 -1
  60. package/dist/index38.cjs +102 -68
  61. package/dist/index38.cjs.map +1 -1
  62. package/dist/index39.cjs +68 -107
  63. package/dist/index39.cjs.map +1 -1
  64. package/dist/index4.cjs +1 -1
  65. package/dist/index40.cjs +107 -95
  66. package/dist/index40.cjs.map +1 -1
  67. package/dist/index41.cjs +95 -13
  68. package/dist/index41.cjs.map +1 -1
  69. package/dist/index42.cjs +11 -31
  70. package/dist/index42.cjs.map +1 -1
  71. package/dist/index43.cjs +31 -12
  72. package/dist/index43.cjs.map +1 -1
  73. package/dist/index44.cjs +12 -22
  74. package/dist/index44.cjs.map +1 -1
  75. package/dist/index45.cjs +22 -13
  76. package/dist/index45.cjs.map +1 -1
  77. package/dist/index46.cjs +13 -7
  78. package/dist/index46.cjs.map +1 -1
  79. package/dist/index47.cjs +7 -7
  80. package/dist/index47.cjs.map +1 -1
  81. package/dist/index48.cjs +7 -10
  82. package/dist/index48.cjs.map +1 -1
  83. package/dist/index49.cjs +10 -6
  84. package/dist/index49.cjs.map +1 -1
  85. package/dist/index5.cjs +1 -1
  86. package/dist/index50.cjs +6 -101
  87. package/dist/index50.cjs.map +1 -1
  88. package/dist/index51.cjs +101 -106
  89. package/dist/index51.cjs.map +1 -1
  90. package/dist/index52.cjs +106 -119
  91. package/dist/index52.cjs.map +1 -1
  92. package/dist/index53.cjs +119 -106
  93. package/dist/index53.cjs.map +1 -1
  94. package/dist/index54.cjs +106 -98
  95. package/dist/index54.cjs.map +1 -1
  96. package/dist/index55.cjs +98 -118
  97. package/dist/index55.cjs.map +1 -1
  98. package/dist/index56.cjs +118 -127
  99. package/dist/index56.cjs.map +1 -1
  100. package/dist/index57.cjs +127 -117
  101. package/dist/index57.cjs.map +1 -1
  102. package/dist/index58.cjs +117 -14
  103. package/dist/index58.cjs.map +1 -1
  104. package/dist/index59.cjs +14 -95
  105. package/dist/index59.cjs.map +1 -1
  106. package/dist/index6.cjs +1 -1
  107. package/dist/index60.cjs +95 -142
  108. package/dist/index60.cjs.map +1 -1
  109. package/dist/index61.cjs +142 -114
  110. package/dist/index61.cjs.map +1 -1
  111. package/dist/index62.cjs +114 -144
  112. package/dist/index62.cjs.map +1 -1
  113. package/dist/index63.cjs +144 -113
  114. package/dist/index63.cjs.map +1 -1
  115. package/dist/index64.cjs +113 -17
  116. package/dist/index64.cjs.map +1 -1
  117. package/dist/index65.cjs +17 -112
  118. package/dist/index65.cjs.map +1 -1
  119. package/dist/index66.cjs +112 -47
  120. package/dist/index66.cjs.map +1 -1
  121. package/dist/index67.cjs +47 -14
  122. package/dist/index67.cjs.map +1 -1
  123. package/dist/index68.cjs +14 -28
  124. package/dist/index68.cjs.map +1 -1
  125. package/dist/index69.cjs +28 -22
  126. package/dist/index69.cjs.map +1 -1
  127. package/dist/index7.cjs +1 -1
  128. package/dist/index70.cjs +22 -9
  129. package/dist/index70.cjs.map +1 -1
  130. package/dist/index71.cjs +9 -8
  131. package/dist/index71.cjs.map +1 -1
  132. package/dist/index72.cjs +8 -17
  133. package/dist/index72.cjs.map +1 -1
  134. package/dist/index73.cjs +17 -412
  135. package/dist/index73.cjs.map +1 -1
  136. package/dist/index74.cjs +412 -8
  137. package/dist/index74.cjs.map +1 -1
  138. package/dist/index75.cjs +8 -9
  139. package/dist/index75.cjs.map +1 -1
  140. package/dist/index76.cjs +16 -0
  141. package/dist/index76.cjs.map +1 -0
  142. package/dist/index8.cjs +1 -1
  143. package/dist/lineItems-C8iT0OL1.cjs +64 -0
  144. package/dist/lineItems-C8iT0OL1.cjs.map +1 -0
  145. package/dist/{notificationManagement-DLBDn77E.cjs → notificationManagement-C_qrFwWL.cjs} +1 -1
  146. package/dist/{notificationManagement-DLBDn77E.cjs.map → notificationManagement-C_qrFwWL.cjs.map} +1 -1
  147. package/dist/{platformLogin-Ch6hFKoU.cjs → platformLogin-DC4s6Qpv.cjs} +1 -1
  148. package/dist/{platformLogin-Ch6hFKoU.cjs.map → platformLogin-DC4s6Qpv.cjs.map} +1 -1
  149. package/dist/{taxpayerValidation-j8s6YGED.cjs → taxpayerValidation-DzCJROgP.cjs} +1 -1
  150. package/dist/{taxpayerValidation-j8s6YGED.cjs.map → taxpayerValidation-DzCJROgP.cjs.map} +1 -1
  151. package/package.json +1 -1
  152. package/dist/0X-Cr3M7hci.d.cts +0 -211
  153. package/dist/0X-qj3c_vAo.d.ts +0 -210
  154. package/dist/1X-B-lyAVC4.d.ts +0 -111
  155. package/dist/1X-C72Wa4pk.d.ts +0 -19
  156. package/dist/1X-CWwmfCzo.d.cts +0 -112
  157. package/dist/1X-DYw2tURz.d.cts +0 -20
  158. package/dist/2X-BfCK614i.d.ts +0 -139
  159. package/dist/2X-CH89y3Af.d.ts +0 -39
  160. package/dist/2X-CXtqiwRg.d.cts +0 -40
  161. package/dist/2X-DNtkJ0tj.d.cts +0 -140
  162. package/dist/3X-BOxfatu3.d.cts +0 -62
  163. package/dist/3X-Bk_fUIAk.d.cts +0 -21
  164. package/dist/3X-DryrwYRf.d.ts +0 -20
  165. package/dist/3X-Du10Ix_V.d.ts +0 -61
  166. package/dist/4X-BPMLRoDv.d.ts +0 -30
  167. package/dist/4X-C7fzDWJ_.d.cts +0 -265
  168. package/dist/4X-CK9rj5qd.d.cts +0 -31
  169. package/dist/4X-x3cRFuSM.d.ts +0 -264
  170. package/dist/5X-B52AKeTz.d.ts +0 -76
  171. package/dist/5X-Bv7M6KyG.d.ts +0 -21
  172. package/dist/5X-CNAFsDm2.d.cts +0 -77
  173. package/dist/5X-CpAvNxvd.d.cts +0 -22
  174. package/dist/6X-DBwpWPQ6.d.ts +0 -104
  175. package/dist/6X-ZeZ8OB57.d.ts +0 -15
  176. package/dist/6X-bXWr_7xY.d.cts +0 -16
  177. package/dist/6X-uObUP4VG.d.cts +0 -105
  178. package/dist/7X-BJBOlWhV.d.cts +0 -16
  179. package/dist/7X-BifJnY24.d.cts +0 -71
  180. package/dist/7X-C_XGDSpE.d.ts +0 -70
  181. package/dist/7X-Dvw2Z2VN.d.ts +0 -15
  182. package/dist/8X-BkgoX8dg.d.ts +0 -18
  183. package/dist/8X-Di_0wuRX.d.ts +0 -109
  184. package/dist/8X-DioBXCJ0.d.cts +0 -110
  185. package/dist/8X-dshwiOxU.d.cts +0 -19
  186. package/dist/9X-8ZnvvViY.d.ts +0 -97
  187. package/dist/9X-9j2Djy4W.d.cts +0 -15
  188. package/dist/9X-BjffnXuq.d.cts +0 -98
  189. package/dist/9X-Du0e44cq.d.ts +0 -14
  190. package/dist/AX-BSPLpkVT.d.ts +0 -110
  191. package/dist/AX-CWCopjCC.d.cts +0 -111
  192. package/dist/BX-Cq7WdhD3.d.cts +0 -115
  193. package/dist/BX-u4yMaIkz.d.ts +0 -114
  194. package/dist/CX-BKZG0pVE.d.ts +0 -127
  195. package/dist/CX-DlcVZfxx.d.cts +0 -128
  196. package/dist/DX-CwA9WJAf.d.ts +0 -114
  197. package/dist/DX-DLdv-Nxj.d.cts +0 -115
  198. package/dist/EX-BRNu1Ooi.d.ts +0 -106
  199. package/dist/EX-CIJv8-Lw.d.cts +0 -107
  200. package/dist/FX-DBxjq6xY.d.ts +0 -126
  201. package/dist/FX-DlDM_Zea.d.cts +0 -127
  202. package/dist/GX-B3CvWNrP.d.ts +0 -135
  203. package/dist/GX-BFGNX6Jy.d.cts +0 -136
  204. package/dist/HX-D7FABgTv.d.ts +0 -125
  205. package/dist/HX-D7Y9qRSm.d.cts +0 -126
  206. package/dist/IX-D3ZknsAB.d.ts +0 -22
  207. package/dist/IX-DPTrbhgX.d.cts +0 -23
  208. package/dist/JX-BRaZM3Gc.d.ts +0 -103
  209. package/dist/JX-D8JmtNpo.d.cts +0 -104
  210. package/dist/KX-B1K0OWoi.d.ts +0 -150
  211. package/dist/KX-B46KJZrH.d.cts +0 -151
  212. package/dist/LX-CKRefinL.d.ts +0 -122
  213. package/dist/LX-CfTKy8Sx.d.cts +0 -123
  214. package/dist/MX-BKJ4gNvV.d.cts +0 -153
  215. package/dist/MX-DKmaeO9r.d.ts +0 -152
  216. package/dist/NX-CJL2Gn1U.d.ts +0 -121
  217. package/dist/NX-CSdLIFqU.d.cts +0 -122
  218. package/dist/OX-BwqOsulT.d.cts +0 -26
  219. package/dist/OX-Do2ap5v_.d.ts +0 -25
  220. package/dist/PX-BTx0TXsJ.d.cts +0 -121
  221. package/dist/PX-_DOr_rm9.d.ts +0 -120
  222. package/dist/QX-BUXR8RJL.d.cts +0 -59
  223. package/dist/QX-HlXLkIki.d.ts +0 -58
  224. package/dist/RX-CZ8HiH37.d.cts +0 -23
  225. package/dist/RX-DVPGOVES.d.ts +0 -22
  226. package/dist/SX-CLxsqiQk.d.cts +0 -40
  227. package/dist/SX-OGT3qwlS.d.ts +0 -39
  228. package/dist/TX-DKc8hLc4.d.cts +0 -31
  229. package/dist/TX-cPDINmZ5.d.ts +0 -30
  230. package/dist/UX-Be3sqvPV.d.ts +0 -17
  231. package/dist/UX-bc7xDnZI.d.cts +0 -18
  232. package/dist/VX-CIHTFyoC.d.cts +0 -17
  233. package/dist/VX-CoEuBNDK.d.ts +0 -16
  234. package/dist/WX-BHvlq7Jx.d.cts +0 -26
  235. package/dist/WX-DMvw__jH.d.ts +0 -25
  236. package/dist/XX-DOA-10JW.d.ts +0 -827
  237. package/dist/XX-DztQxYHJ.d.cts +0 -828
  238. package/dist/YX-CkxLeFb4.d.cts +0 -20
  239. package/dist/YX-F34sJ7Ik.d.ts +0 -19
  240. package/dist/ZX-CDQOfsHh.d.ts +0 -21
  241. package/dist/ZX-DVb_buNI.d.cts +0 -22
  242. package/dist/api/documentManagement.d.ts +0 -89
  243. package/dist/api/documentManagement.js +0 -3
  244. package/dist/api/documentSubmission.d.ts +0 -92
  245. package/dist/api/documentSubmission.js +0 -5
  246. package/dist/api/documentTypeManagement.d.ts +0 -70
  247. package/dist/api/documentTypeManagement.js +0 -3
  248. package/dist/api/notificationManagement.d.ts +0 -68
  249. package/dist/api/notificationManagement.js +0 -3
  250. package/dist/api/platformLogin.d.ts +0 -68
  251. package/dist/api/platformLogin.js +0 -3
  252. package/dist/api/taxpayerValidation.d.ts +0 -71
  253. package/dist/api/taxpayerValidation.js +0 -4
  254. package/dist/apiQueue-B6Q644Bz.js +0 -201
  255. package/dist/certificate-COwqszxD.js +0 -71
  256. package/dist/certificate-CWmfCPdt.cjs.map +0 -1
  257. package/dist/chunk-CUT6urMc.cjs +0 -30
  258. package/dist/classification-codes-B15PbWxz.d.cts +0 -118
  259. package/dist/classification-codes-C2X4xW5-.d.ts +0 -117
  260. package/dist/country-code-DPeNFMMi.d.cts +0 -543
  261. package/dist/country-code-DsI8Mbzx.d.ts +0 -542
  262. package/dist/currencies-DKuDflOO.d.ts +0 -207
  263. package/dist/currencies-S5g1gzBU.d.cts +0 -208
  264. package/dist/document-B6ab06s1.cjs.map +0 -1
  265. package/dist/document-Bb5WkhRe.js +0 -626
  266. package/dist/documentManagement-BviJDtf2.cjs.map +0 -1
  267. package/dist/documentManagement-lPm8Gziu.js +0 -49
  268. package/dist/documentSubmission-igf605QK.js +0 -135
  269. package/dist/documentTypeManagement-cBtVCOY3.js +0 -22
  270. package/dist/documents-BYV12TVt.d.ts +0 -1196
  271. package/dist/documents-D_V38Q_U.d.cts +0 -1197
  272. package/dist/e-invoice-BuwtFnlI.d.cts +0 -44
  273. package/dist/e-invoice-C2TxhyrK.d.ts +0 -43
  274. package/dist/formatIdValue-qTxJqj9o.js +0 -7
  275. package/dist/getBaseUrl-D7nUmoYb.js +0 -7
  276. package/dist/index-CygwSf0x.d.ts +0 -15
  277. package/dist/index-Yr1QAbIF.d.cts +0 -16
  278. package/dist/index.d.ts +0 -614
  279. package/dist/index.js +0 -627
  280. package/dist/index14.cjs.map +0 -1
  281. package/dist/index23.cjs.map +0 -1
  282. package/dist/index26.cjs.map +0 -1
  283. package/dist/index31.cjs.map +0 -1
  284. package/dist/index61.cts.map +0 -1
  285. package/dist/index62.cts.map +0 -1
  286. package/dist/index63.cts.map +0 -1
  287. package/dist/index64.cts.map +0 -1
  288. package/dist/index65.cts.map +0 -1
  289. package/dist/index66.cts.map +0 -1
  290. package/dist/index67.cts.map +0 -1
  291. package/dist/index68.cts.map +0 -1
  292. package/dist/index69.cts.map +0 -1
  293. package/dist/index70.cts.map +0 -1
  294. package/dist/index71.cts.map +0 -1
  295. package/dist/index72.cts.map +0 -1
  296. package/dist/index73.cts.map +0 -1
  297. package/dist/index74.cts.map +0 -1
  298. package/dist/index75.cts.map +0 -1
  299. package/dist/msic-codes-CIKdPqag.d.cts +0 -26
  300. package/dist/msic-codes-CjrrJmzb.d.ts +0 -25
  301. package/dist/notificationManagement-n4Z5e-My.js +0 -19
  302. package/dist/notifications-DdlEkprb.d.cts +0 -63
  303. package/dist/notifications-sFhgh3rJ.d.ts +0 -62
  304. package/dist/payment-modes-7c1lWlIr.d.cts +0 -44
  305. package/dist/payment-modes-g3DzLmWb.d.ts +0 -43
  306. package/dist/platformLogin-CqI9OLYP.js +0 -39
  307. package/dist/signatures-CerHUrj3.d.ts +0 -172
  308. package/dist/signatures-CyDSZr_e.d.cts +0 -173
  309. package/dist/state-codes-Ow4oehYT.d.ts +0 -61
  310. package/dist/state-codes-u3ppueWo.d.cts +0 -62
  311. package/dist/tax-types-ClyLgydM.d.ts +0 -41
  312. package/dist/tax-types-fu5Q6dic.d.cts +0 -42
  313. package/dist/taxpayer-BAoT73gg.d.ts +0 -35
  314. package/dist/taxpayer-DwGzY1IL.d.cts +0 -36
  315. package/dist/taxpayerValidation-Xd_EHDvk.js +0 -47
  316. package/dist/types/classification-codes.d.ts +0 -2
  317. package/dist/types/country-code.d.ts +0 -2
  318. package/dist/types/currencies.d.ts +0 -2
  319. package/dist/types/documents.d.ts +0 -55
  320. package/dist/types/e-invoice.d.ts +0 -2
  321. package/dist/types/index.d.ts +0 -61
  322. package/dist/types/msic/0X.d.ts +0 -2
  323. package/dist/types/msic/1X.d.ts +0 -2
  324. package/dist/types/msic/2X.d.ts +0 -2
  325. package/dist/types/msic/3X.d.ts +0 -2
  326. package/dist/types/msic/4X.d.ts +0 -2
  327. package/dist/types/msic/5X.d.ts +0 -2
  328. package/dist/types/msic/6X.d.ts +0 -2
  329. package/dist/types/msic/7X.d.ts +0 -2
  330. package/dist/types/msic/8X.d.ts +0 -2
  331. package/dist/types/msic/9X.d.ts +0 -2
  332. package/dist/types/msic-codes.d.ts +0 -12
  333. package/dist/types/notifications.d.ts +0 -2
  334. package/dist/types/payment-modes.d.ts +0 -2
  335. package/dist/types/signatures.d.ts +0 -2
  336. package/dist/types/state-codes.d.ts +0 -2
  337. package/dist/types/tax-types.d.ts +0 -2
  338. package/dist/types/taxpayer.d.ts +0 -56
  339. package/dist/types/unit/1X.d.ts +0 -2
  340. package/dist/types/unit/2X.d.ts +0 -2
  341. package/dist/types/unit/3X.d.ts +0 -2
  342. package/dist/types/unit/4X.d.ts +0 -2
  343. package/dist/types/unit/5X.d.ts +0 -2
  344. package/dist/types/unit/6X.d.ts +0 -2
  345. package/dist/types/unit/7X.d.ts +0 -2
  346. package/dist/types/unit/8X.d.ts +0 -2
  347. package/dist/types/unit/9X.d.ts +0 -2
  348. package/dist/types/unit/AX.d.ts +0 -2
  349. package/dist/types/unit/BX.d.ts +0 -2
  350. package/dist/types/unit/CX.d.ts +0 -2
  351. package/dist/types/unit/DX.d.ts +0 -2
  352. package/dist/types/unit/EX.d.ts +0 -2
  353. package/dist/types/unit/FX.d.ts +0 -2
  354. package/dist/types/unit/GX.d.ts +0 -2
  355. package/dist/types/unit/HX.d.ts +0 -2
  356. package/dist/types/unit/IX.d.ts +0 -2
  357. package/dist/types/unit/JX.d.ts +0 -2
  358. package/dist/types/unit/KX.d.ts +0 -2
  359. package/dist/types/unit/LX.d.ts +0 -2
  360. package/dist/types/unit/MX.d.ts +0 -2
  361. package/dist/types/unit/NX.d.ts +0 -2
  362. package/dist/types/unit/OX.d.ts +0 -2
  363. package/dist/types/unit/PX.d.ts +0 -2
  364. package/dist/types/unit/QX.d.ts +0 -2
  365. package/dist/types/unit/RX.d.ts +0 -2
  366. package/dist/types/unit/SX.d.ts +0 -2
  367. package/dist/types/unit/TX.d.ts +0 -2
  368. package/dist/types/unit/UX.d.ts +0 -2
  369. package/dist/types/unit/VX.d.ts +0 -2
  370. package/dist/types/unit/WX.d.ts +0 -2
  371. package/dist/types/unit/XX.d.ts +0 -2
  372. package/dist/types/unit/YX.d.ts +0 -2
  373. package/dist/types/unit/ZX.d.ts +0 -2
  374. package/dist/types/unit-types.d.ts +0 -37
  375. package/dist/types/utils.d.ts +0 -2
  376. package/dist/unit-types-BXdufGWm.d.cts +0 -56
  377. package/dist/unit-types-VgYXIwTT.d.ts +0 -55
  378. package/dist/utils/apiQueue.d.ts +0 -45
  379. package/dist/utils/apiQueue.js +0 -3
  380. package/dist/utils/base64.d.ts +0 -5
  381. package/dist/utils/base64.js +0 -10
  382. package/dist/utils/certificate.d.ts +0 -26
  383. package/dist/utils/certificate.js +0 -3
  384. package/dist/utils/document.d.ts +0 -211
  385. package/dist/utils/document.js +0 -4
  386. package/dist/utils/formatIdValue.d.ts +0 -4
  387. package/dist/utils/formatIdValue.js +0 -3
  388. package/dist/utils/getBaseUrl.d.ts +0 -4
  389. package/dist/utils/getBaseUrl.js +0 -3
  390. package/dist/utils/signature-diagnostics.d.ts +0 -96
  391. package/dist/utils/signature-diagnostics.js +0 -327
  392. package/dist/utils/validation.d.ts +0 -108
  393. package/dist/utils/validation.js +0 -186
  394. package/dist/utils-C4FoVKLq.d.ts +0 -4
  395. package/dist/utils-Cdqbbzca.d.cts +0 -5
@@ -1,327 +0,0 @@
1
- import "../formatIdValue-qTxJqj9o.js";
2
- import { calculateCertificateDigest, calculateDocumentDigest, calculateSignedPropertiesDigest, createSignedProperties, extractCertificateInfo } from "../document-Bb5WkhRe.js";
3
- import crypto from "crypto";
4
-
5
- //#region src/utils/signature-diagnostics.ts
6
- /**
7
- * Analyzes certificate for MyInvois compatibility issues
8
- */
9
- function analyzeCertificateForDiagnostics(certificatePem) {
10
- const issues = [];
11
- const recommendations = [];
12
- try {
13
- const cert = new crypto.X509Certificate(certificatePem);
14
- const certInfo = extractCertificateInfo(certificatePem);
15
- const parseSubjectFields = (dn) => {
16
- const fields = {};
17
- dn.split("\n").forEach((line) => {
18
- const trimmed = line.trim();
19
- if (trimmed.includes("=")) {
20
- const [key, ...valueParts] = trimmed.split("=");
21
- if (key) fields[key.trim()] = valueParts.join("=").trim();
22
- }
23
- });
24
- return fields;
25
- };
26
- const subjectFields = parseSubjectFields(cert.subject);
27
- const organizationIdentifier = subjectFields["organizationIdentifier"] || subjectFields["2.5.4.97"];
28
- const serialNumber = subjectFields["serialNumber"];
29
- if (!organizationIdentifier) {
30
- issues.push("DS311: Certificate missing organizationIdentifier field (TIN)");
31
- recommendations.push("CRITICAL: Generate new certificate with organizationIdentifier matching your MyInvois TIN");
32
- recommendations.push("Portal Error: \"Signer of invoice doesn't match the submitter of document. TIN doesn't match with the OI.\"");
33
- } else if (organizationIdentifier.length < 10) {
34
- issues.push("DS311: OrganizationIdentifier (TIN) appears too short - may cause submission rejection");
35
- recommendations.push("Verify TIN format matches exactly what is registered in MyInvois");
36
- }
37
- if (!serialNumber) {
38
- issues.push("DS312: Certificate missing serialNumber field (business registration)");
39
- recommendations.push("CRITICAL: Generate new certificate with serialNumber matching your business registration");
40
- recommendations.push("Portal Error: \"Submitter registration/identity number doesn't match with the certificate SERIALNUMBER.\"");
41
- }
42
- if (cert.issuer === cert.subject) {
43
- issues.push("DS329: Self-signed certificate detected - will fail chain of trust validation");
44
- recommendations.push("BLOCKING: Obtain certificate from MyInvois-approved CA:");
45
- recommendations.push("• MSC Trustgate Sdn Bhd");
46
- recommendations.push("• DigiCert Sdn Bhd");
47
- recommendations.push("• Cybersign Asia Sdn Bhd");
48
- recommendations.push("Portal Error: \"Certificate is not valid according to the chain of trust validation or has been issued by an untrusted certificate authority.\"");
49
- } else {
50
- const issuerName = cert.issuer.toLowerCase();
51
- const approvedCAs = [
52
- "msc trustgate",
53
- "digicert",
54
- "cybersign"
55
- ];
56
- const isFromApprovedCA = approvedCAs.some((ca) => issuerName.includes(ca));
57
- if (!isFromApprovedCA) {
58
- issues.push("DS329: Certificate may not be from MyInvois-approved CA");
59
- recommendations.push("Verify certificate was issued by an approved CA for MyInvois");
60
- }
61
- }
62
- const rawIssuer = cert.issuer;
63
- const normalizedIssuer = certInfo.issuerName;
64
- const normalizedIssuerIssues = [
65
- {
66
- check: normalizedIssuer.includes("\n"),
67
- issue: "Normalized issuer still contains newlines"
68
- },
69
- {
70
- check: normalizedIssuer.includes(" "),
71
- issue: "Normalized issuer contains double spaces"
72
- },
73
- {
74
- check: /=\s+/.test(normalizedIssuer),
75
- issue: "Normalized issuer has spaces after equals"
76
- },
77
- {
78
- check: /\s+=/.test(normalizedIssuer),
79
- issue: "Normalized issuer has spaces before equals"
80
- },
81
- {
82
- check: normalizedIssuer.includes("\r"),
83
- issue: "Normalized issuer contains carriage returns"
84
- }
85
- ];
86
- const hasActualFormatIssues = normalizedIssuerIssues.some(({ check, issue }) => {
87
- if (check) {
88
- issues.push(`DS326: ${issue} - will cause X509IssuerName mismatch`);
89
- return true;
90
- }
91
- return false;
92
- });
93
- const hasRawIssuesButNormalizedOk = rawIssuer.includes("\n") && !normalizedIssuer.includes("\n");
94
- if (hasActualFormatIssues) {
95
- recommendations.push("CRITICAL: Fix issuer name normalization in signature generation");
96
- recommendations.push("Portal Error: \"Certificate X509IssuerName doesn't match the X509IssuerName value provided in the signed properties section.\"");
97
- recommendations.push("The normalization function is not properly formatting the issuer name");
98
- recommendations.push("Debug: Check document.ts extractCertificateInfo() normalization logic");
99
- } else if (hasRawIssuesButNormalizedOk) console.log("ℹ️ Note: Raw certificate issuer has newlines but normalization is handling them correctly");
100
- const now = /* @__PURE__ */ new Date();
101
- const validFrom = new Date(cert.validFrom);
102
- const validTo = new Date(cert.validTo);
103
- if (now < validFrom) {
104
- issues.push("DS329: Certificate not yet valid (future start date)");
105
- recommendations.push("Wait until certificate validity period begins");
106
- }
107
- if (now > validTo) {
108
- issues.push("DS329: Certificate has expired");
109
- recommendations.push("BLOCKING: Renew certificate - expired certificates are rejected");
110
- }
111
- try {
112
- if (cert.keyUsage && !cert.keyUsage.includes("digital signature")) {
113
- issues.push("DS333: Certificate lacks digitalSignature key usage");
114
- recommendations.push("Generate new certificate with digitalSignature key usage enabled");
115
- }
116
- } catch {
117
- console.log("Note: Could not check key usage extensions");
118
- }
119
- return {
120
- organizationIdentifier,
121
- serialNumber,
122
- issuerName: certInfo.issuerName,
123
- subjectName: certInfo.subjectName,
124
- issues,
125
- recommendations
126
- };
127
- } catch (error) {
128
- issues.push(`Certificate parsing failed: ${error}`);
129
- recommendations.push("Verify certificate format and validity");
130
- return {
131
- issuerName: "",
132
- subjectName: "",
133
- issues,
134
- recommendations
135
- };
136
- }
137
- }
138
- /**
139
- * Analyzes signature generation for potential issues
140
- */
141
- function analyzeSignatureForDiagnostics(invoices, certificatePem) {
142
- const issues = [];
143
- const recommendations = [];
144
- try {
145
- const documentDigest = calculateDocumentDigest(invoices);
146
- const certificateDigest = calculateCertificateDigest(certificatePem);
147
- const certInfo = extractCertificateInfo(certificatePem);
148
- const signingTime = (/* @__PURE__ */ new Date()).toISOString();
149
- const signedProperties = createSignedProperties(certificateDigest, signingTime, certInfo.issuerName, certInfo.serialNumber);
150
- const signedPropertiesDigest = calculateSignedPropertiesDigest(signedProperties);
151
- if (documentDigest.length === 0) {
152
- issues.push("DS333: Document digest generation failed");
153
- recommendations.push("CRITICAL: Verify document serialization excludes UBLExtensions/Signature");
154
- recommendations.push("Portal Error: \"Document signature value is not a valid signature of the document digest using the public key of the certificate provided.\"");
155
- }
156
- if (certificateDigest.length === 0) {
157
- issues.push("DS333: Certificate digest generation failed");
158
- recommendations.push("CRITICAL: Verify certificate format and encoding");
159
- recommendations.push("Certificate must be properly base64 encoded without headers/footers");
160
- }
161
- if (signedPropertiesDigest.length === 0) {
162
- issues.push("DS333: Signed properties digest generation failed");
163
- recommendations.push("CRITICAL: Verify signed properties structure and canonicalization");
164
- recommendations.push("Check XML canonicalization (C14N) is applied correctly");
165
- }
166
- try {
167
- const cert = new crypto.X509Certificate(certificatePem);
168
- const publicKey = cert.publicKey;
169
- const keyDetails = publicKey.asymmetricKeyDetails;
170
- if (keyDetails) {
171
- if (publicKey.asymmetricKeyType === "rsa" && keyDetails.modulusLength && keyDetails.modulusLength < 2048) {
172
- issues.push("DS333: RSA key size too small (minimum 2048 bits required)");
173
- recommendations.push("CRITICAL: Generate new certificate with RSA 2048+ bits");
174
- }
175
- const supportedKeyTypes = ["rsa", "ec"];
176
- if (!supportedKeyTypes.includes(publicKey.asymmetricKeyType || "")) {
177
- issues.push(`DS333: Unsupported key type: ${publicKey.asymmetricKeyType}`);
178
- recommendations.push("CRITICAL: Use RSA or EC key types for MyInvois compatibility");
179
- }
180
- }
181
- const certBuffer = Buffer.from(certificatePem.replace(/-----[^-]+-----/g, "").replace(/\s/g, ""), "base64");
182
- if (certBuffer.length === 0) {
183
- issues.push("DS333: Certificate encoding appears invalid");
184
- recommendations.push("CRITICAL: Verify certificate is properly PEM encoded");
185
- }
186
- } catch (error) {
187
- issues.push(`DS333: Certificate validation failed - ${error}`);
188
- recommendations.push("CRITICAL: Verify certificate format and structure are valid");
189
- }
190
- const isValidBase64 = (str) => {
191
- try {
192
- return Buffer.from(str, "base64").toString("base64") === str;
193
- } catch {
194
- return false;
195
- }
196
- };
197
- if (documentDigest && !isValidBase64(documentDigest)) {
198
- issues.push("DS333: Document digest is not valid base64 format");
199
- recommendations.push("Ensure digest is properly base64 encoded");
200
- }
201
- if (certificateDigest && !isValidBase64(certificateDigest)) {
202
- issues.push("DS333: Certificate digest is not valid base64 format");
203
- recommendations.push("Ensure certificate digest is properly base64 encoded");
204
- }
205
- if (signedPropertiesDigest && !isValidBase64(signedPropertiesDigest)) {
206
- issues.push("DS333: Signed properties digest is not valid base64 format");
207
- recommendations.push("Ensure signed properties digest is properly base64 encoded");
208
- }
209
- return {
210
- documentDigest,
211
- certificateDigest,
212
- signedPropertiesDigest,
213
- issues,
214
- recommendations
215
- };
216
- } catch (error) {
217
- issues.push(`Signature analysis failed: ${error}`);
218
- recommendations.push("Review signature generation implementation");
219
- return {
220
- documentDigest: "",
221
- certificateDigest: "",
222
- signedPropertiesDigest: "",
223
- issues,
224
- recommendations
225
- };
226
- }
227
- }
228
- /**
229
- * Comprehensive signature diagnostics
230
- */
231
- function diagnoseSignatureIssues(invoices, certificatePem) {
232
- const certificateAnalysis = analyzeCertificateForDiagnostics(certificatePem);
233
- const signatureAnalysis = analyzeSignatureForDiagnostics(invoices, certificatePem);
234
- const certificateIssues = certificateAnalysis.issues.length;
235
- const signatureIssues = signatureAnalysis.issues.length;
236
- return {
237
- certificateAnalysis,
238
- signatureAnalysis,
239
- summary: {
240
- totalIssues: certificateIssues + signatureIssues,
241
- certificateIssues,
242
- signatureIssues
243
- }
244
- };
245
- }
246
- /**
247
- * Prints diagnostic results in a formatted way
248
- */
249
- function printDiagnostics(result) {
250
- console.log("\n🔍 MyInvois Signature Diagnostics Report");
251
- console.log("=".repeat(60));
252
- console.log("\n📜 CERTIFICATE ANALYSIS");
253
- console.log("-".repeat(30));
254
- console.log(` Issuer: ${result.certificateAnalysis.issuerName}`);
255
- console.log(` Subject: ${result.certificateAnalysis.subjectName}`);
256
- if (result.certificateAnalysis.organizationIdentifier) console.log(` Organization ID (TIN): ${result.certificateAnalysis.organizationIdentifier}`);
257
- if (result.certificateAnalysis.serialNumber) console.log(` Serial Number: ${result.certificateAnalysis.serialNumber}`);
258
- if (result.certificateAnalysis.issues.length > 0) {
259
- console.log("\n 🚨 Certificate Issues:");
260
- result.certificateAnalysis.issues.forEach((issue, index) => {
261
- console.log(` ${index + 1}. ${issue}`);
262
- });
263
- }
264
- if (result.certificateAnalysis.recommendations.length > 0) {
265
- console.log("\n 💡 Certificate Recommendations:");
266
- result.certificateAnalysis.recommendations.forEach((rec, index) => {
267
- console.log(` ${index + 1}. ${rec}`);
268
- });
269
- }
270
- console.log("\n🔐 SIGNATURE ANALYSIS");
271
- console.log("-".repeat(30));
272
- console.log(` Document Digest: ${result.signatureAnalysis.documentDigest.substring(0, 32)}...`);
273
- console.log(` Certificate Digest: ${result.signatureAnalysis.certificateDigest.substring(0, 32)}...`);
274
- console.log(` Signed Properties Digest: ${result.signatureAnalysis.signedPropertiesDigest.substring(0, 32)}...`);
275
- if (result.signatureAnalysis.issues.length > 0) {
276
- console.log("\n 🚨 Signature Issues:");
277
- result.signatureAnalysis.issues.forEach((issue, index) => {
278
- console.log(` ${index + 1}. ${issue}`);
279
- });
280
- }
281
- if (result.signatureAnalysis.recommendations.length > 0) {
282
- console.log("\n 💡 Signature Recommendations:");
283
- result.signatureAnalysis.recommendations.forEach((rec, index) => {
284
- console.log(` ${index + 1}. ${rec}`);
285
- });
286
- }
287
- console.log("\n📊 SUMMARY");
288
- console.log("-".repeat(30));
289
- console.log(` Total Issues Found: ${result.summary.totalIssues}`);
290
- console.log(` Certificate Issues: ${result.summary.certificateIssues}`);
291
- console.log(` Signature Issues: ${result.summary.signatureIssues}`);
292
- if (result.summary.totalIssues === 0) {
293
- console.log("\n ✅ No issues detected in current analysis");
294
- console.log(" 🎉 Certificate and signature implementation appear valid");
295
- } else {
296
- console.log("\n ⚠️ Issues detected - review recommendations above");
297
- const hasDS311 = result.certificateAnalysis.issues.some((issue) => issue.includes("DS311"));
298
- const hasDS312 = result.certificateAnalysis.issues.some((issue) => issue.includes("DS312"));
299
- const hasDS326 = result.certificateAnalysis.issues.some((issue) => issue.includes("DS326"));
300
- const hasDS329 = result.certificateAnalysis.issues.some((issue) => issue.includes("DS329"));
301
- const hasDS333 = result.signatureAnalysis.issues.some((issue) => issue.includes("DS333"));
302
- console.log("\n 🎯 MYINVOIS PORTAL ERROR ANALYSIS:");
303
- if (hasDS311) console.log(" ❌ DS311 - TIN mismatch between certificate and submitter");
304
- if (hasDS312) console.log(" ❌ DS312 - Registration number mismatch with certificate");
305
- if (hasDS326) console.log(" ❌ DS326 - X509IssuerName format inconsistency");
306
- if (hasDS329) console.log(" ❌ DS329 - Certificate trust chain validation failure");
307
- if (hasDS333) console.log(" ❌ DS333 - Document signature validation failure");
308
- if (result.summary.certificateIssues > 0) {
309
- console.log("\n 🚨 PRIMARY ACTION REQUIRED:");
310
- console.log(" Certificate issues must be resolved first");
311
- console.log(" Self-generated certificates cannot pass MyInvois validation");
312
- }
313
- if (result.summary.signatureIssues > 0) {
314
- console.log("\n ⚙️ SECONDARY ACTION:");
315
- console.log(" Review and optimize signature implementation");
316
- }
317
- console.log("\n 📋 NEXT STEPS:");
318
- console.log(" 1. Address BLOCKING/CRITICAL issues first");
319
- console.log(" 2. Test with updated certificate/implementation");
320
- console.log(" 3. Re-run diagnostics to verify fixes");
321
- console.log(" 4. Submit test document to MyInvois portal");
322
- }
323
- console.log("\n" + "=".repeat(60));
324
- }
325
-
326
- //#endregion
327
- export { diagnoseSignatureIssues, printDiagnostics };
@@ -1,108 +0,0 @@
1
- import "../classification-codes-C2X4xW5-.js";
2
- import "../country-code-DsI8Mbzx.js";
3
- import "../currencies-DKuDflOO.js";
4
- import "../e-invoice-C2TxhyrK.js";
5
- import "../0X-qj3c_vAo.js";
6
- import "../1X-B-lyAVC4.js";
7
- import "../2X-BfCK614i.js";
8
- import "../3X-Du10Ix_V.js";
9
- import "../4X-x3cRFuSM.js";
10
- import "../5X-B52AKeTz.js";
11
- import "../6X-DBwpWPQ6.js";
12
- import "../7X-C_XGDSpE.js";
13
- import "../8X-Di_0wuRX.js";
14
- import "../9X-8ZnvvViY.js";
15
- import "../msic-codes-CjrrJmzb.js";
16
- import "../tax-types-ClyLgydM.js";
17
- import "../state-codes-Ow4oehYT.js";
18
- import "../1X-C72Wa4pk.js";
19
- import "../2X-CH89y3Af.js";
20
- import "../3X-DryrwYRf.js";
21
- import "../4X-BPMLRoDv.js";
22
- import "../5X-Bv7M6KyG.js";
23
- import "../6X-ZeZ8OB57.js";
24
- import "../7X-Dvw2Z2VN.js";
25
- import "../8X-BkgoX8dg.js";
26
- import "../9X-Du0e44cq.js";
27
- import "../AX-BSPLpkVT.js";
28
- import "../BX-u4yMaIkz.js";
29
- import "../CX-BKZG0pVE.js";
30
- import "../DX-CwA9WJAf.js";
31
- import "../EX-BRNu1Ooi.js";
32
- import "../FX-DBxjq6xY.js";
33
- import "../GX-B3CvWNrP.js";
34
- import "../HX-D7FABgTv.js";
35
- import "../IX-D3ZknsAB.js";
36
- import "../JX-BRaZM3Gc.js";
37
- import "../KX-B1K0OWoi.js";
38
- import "../LX-CKRefinL.js";
39
- import "../MX-DKmaeO9r.js";
40
- import "../NX-CJL2Gn1U.js";
41
- import "../OX-Do2ap5v_.js";
42
- import "../PX-_DOr_rm9.js";
43
- import "../QX-HlXLkIki.js";
44
- import "../RX-DVPGOVES.js";
45
- import "../SX-OGT3qwlS.js";
46
- import "../TX-cPDINmZ5.js";
47
- import "../UX-Be3sqvPV.js";
48
- import "../VX-CoEuBNDK.js";
49
- import "../WX-DMvw__jH.js";
50
- import "../YX-F34sJ7Ik.js";
51
- import "../ZX-CDQOfsHh.js";
52
- import "../XX-DOA-10JW.js";
53
- import "../unit-types-VgYXIwTT.js";
54
- import { InvoiceLineItem, InvoiceV1_1 } from "../documents-BYV12TVt.js";
55
- import "../payment-modes-g3DzLmWb.js";
56
- import "../signatures-CerHUrj3.js";
57
- import "../notifications-sFhgh3rJ.js";
58
- import "../taxpayer-BAoT73gg.js";
59
- import "../utils-C4FoVKLq.js";
60
- import "../index-CygwSf0x.js";
61
-
62
- //#region src/utils/validation.d.ts
63
- /**
64
- * MyInvois Invoice Validation Utilities
65
- *
66
- * Provides comprehensive validation for invoice data before document generation
67
- * and submission to ensure compliance with MyInvois business rules and format requirements.
68
- */
69
- interface ValidationResult {
70
- isValid: boolean;
71
- errors: ValidationError[];
72
- warnings: ValidationWarning[];
73
- }
74
- interface ValidationError {
75
- field: string;
76
- code: string;
77
- message: string;
78
- severity: "error" | "warning";
79
- }
80
- interface ValidationWarning extends ValidationError {
81
- severity: "warning";
82
- }
83
- /**
84
- * Validates TIN format based on registration type
85
- */
86
- declare const validateTIN: (tin: string, registrationType?: string) => ValidationError[];
87
- /**
88
- * Validates contact number format (E.164 standard)
89
- */
90
- declare const validateContactNumber: (contactNumber: string) => ValidationError[];
91
- /**
92
- * Validates monetary amounts
93
- */
94
- declare const validateMonetaryAmount: (amount: number, fieldName: string, maxDigits?: number, maxDecimals?: number) => ValidationError[];
95
- /**
96
- * Validates line item tax calculation consistency for both fixed rate and percentage taxation
97
- */
98
- declare const validateLineItemTax: (item: InvoiceLineItem, index: number) => ValidationError[];
99
- /**
100
- * Validates tax calculation consistency
101
- */
102
- declare const validateTaxCalculations: (invoice: InvoiceV1_1) => ValidationError[];
103
- /**
104
- * Main validation function for complete invoice
105
- */
106
- declare const validateInvoice: (invoice: InvoiceV1_1) => ValidationResult;
107
- //#endregion
108
- export { ValidationError, ValidationResult, ValidationWarning, validateContactNumber, validateInvoice, validateLineItemTax, validateMonetaryAmount, validateTIN, validateTaxCalculations };
@@ -1,186 +0,0 @@
1
- //#region src/utils/validation.ts
2
- /**
3
- * Validates TIN format based on registration type
4
- */
5
- const validateTIN = (tin, registrationType) => {
6
- const errors = [];
7
- if (!tin) {
8
- errors.push({
9
- field: "tin",
10
- code: "TIN_REQUIRED",
11
- message: "TIN is required",
12
- severity: "error"
13
- });
14
- return errors;
15
- }
16
- if (registrationType === "BRN" && !tin.startsWith("C")) errors.push({
17
- field: "tin",
18
- code: "TIN_FORMAT_INVALID",
19
- message: "Company TIN should start with \"C\" for BRN registration",
20
- severity: "warning"
21
- });
22
- if (registrationType === "NRIC" && !tin.startsWith("IG")) errors.push({
23
- field: "tin",
24
- code: "TIN_FORMAT_INVALID",
25
- message: "Individual TIN should start with \"IG\" for NRIC registration",
26
- severity: "warning"
27
- });
28
- if (tin.length > 14) errors.push({
29
- field: "tin",
30
- code: "TIN_LENGTH_INVALID",
31
- message: "TIN cannot exceed 14 characters",
32
- severity: "error"
33
- });
34
- return errors;
35
- };
36
- /**
37
- * Validates contact number format (E.164 standard)
38
- */
39
- const validateContactNumber = (contactNumber) => {
40
- const errors = [];
41
- if (!contactNumber || contactNumber === "NA") return errors;
42
- const e164Regex = /^\+[1-9]\d{1,14}$/;
43
- if (!e164Regex.test(contactNumber)) errors.push({
44
- field: "contactNumber",
45
- code: "CONTACT_FORMAT_INVALID",
46
- message: "Contact number must be in E.164 format (e.g., +60123456789)",
47
- severity: "error"
48
- });
49
- if (contactNumber.length < 8) errors.push({
50
- field: "contactNumber",
51
- code: "CONTACT_LENGTH_INVALID",
52
- message: "Contact number must be at least 8 characters",
53
- severity: "error"
54
- });
55
- return errors;
56
- };
57
- /**
58
- * Validates monetary amounts
59
- */
60
- const validateMonetaryAmount = (amount, fieldName, maxDigits = 18, maxDecimals = 2) => {
61
- const errors = [];
62
- if (amount < 0) errors.push({
63
- field: fieldName,
64
- code: "AMOUNT_NEGATIVE",
65
- message: `${fieldName} cannot be negative`,
66
- severity: "error"
67
- });
68
- const amountStr = amount.toString();
69
- const [integerPart, decimalPart] = amountStr.split(".");
70
- if (integerPart && integerPart.length > maxDigits - maxDecimals) errors.push({
71
- field: fieldName,
72
- code: "AMOUNT_DIGITS_EXCEEDED",
73
- message: `${fieldName} exceeds maximum ${maxDigits} digits`,
74
- severity: "error"
75
- });
76
- if (decimalPart && decimalPart.length > maxDecimals) errors.push({
77
- field: fieldName,
78
- code: "AMOUNT_DECIMALS_EXCEEDED",
79
- message: `${fieldName} exceeds maximum ${maxDecimals} decimal places`,
80
- severity: "error"
81
- });
82
- return errors;
83
- };
84
- /**
85
- * Validates line item tax calculation consistency for both fixed rate and percentage taxation
86
- */
87
- const validateLineItemTax = (item, index) => {
88
- const errors = [];
89
- const tolerance = .01;
90
- const hasFixedRate = item.taxPerUnitAmount !== void 0 && item.baseUnitMeasure !== void 0;
91
- const hasPercentageRate = item.taxRate !== void 0;
92
- if (!hasFixedRate && !hasPercentageRate) {
93
- errors.push({
94
- field: `lineItem[${index}]`,
95
- code: "TAX_METHOD_MISSING",
96
- message: `Line item ${index + 1} must specify either taxRate (for percentage) or taxPerUnitAmount + baseUnitMeasure (for fixed rate)`,
97
- severity: "error"
98
- });
99
- return errors;
100
- }
101
- if (hasFixedRate && hasPercentageRate) errors.push({
102
- field: `lineItem[${index}]`,
103
- code: "TAX_METHOD_CONFLICT",
104
- message: `Line item ${index + 1} cannot have both percentage and fixed rate tax methods`,
105
- severity: "error"
106
- });
107
- if (hasFixedRate) {
108
- if (item.baseUnitMeasureCode === void 0) errors.push({
109
- field: `lineItem[${index}].baseUnitMeasureCode`,
110
- code: "UNIT_CODE_MISSING",
111
- message: `Line item ${index + 1} with fixed rate tax must specify baseUnitMeasureCode`,
112
- severity: "error"
113
- });
114
- const expectedTaxAmount = item.taxPerUnitAmount * item.baseUnitMeasure;
115
- if (Math.abs(item.taxAmount - expectedTaxAmount) > tolerance) errors.push({
116
- field: `lineItem[${index}].taxAmount`,
117
- code: "FIXED_TAX_CALCULATION_MISMATCH",
118
- message: `Line item ${index + 1} tax amount (${item.taxAmount}) doesn't match fixed rate calculation (${item.taxPerUnitAmount} × ${item.baseUnitMeasure} = ${expectedTaxAmount})`,
119
- severity: "error"
120
- });
121
- }
122
- if (hasPercentageRate && !hasFixedRate) {
123
- const expectedTaxAmount = item.totalTaxableAmountPerLine * item.taxRate / 100;
124
- if (Math.abs(item.taxAmount - expectedTaxAmount) > tolerance) errors.push({
125
- field: `lineItem[${index}].taxAmount`,
126
- code: "PERCENTAGE_TAX_CALCULATION_MISMATCH",
127
- message: `Line item ${index + 1} tax amount (${item.taxAmount}) doesn't match percentage calculation (${item.totalTaxableAmountPerLine} × ${item.taxRate}% = ${expectedTaxAmount})`,
128
- severity: "error"
129
- });
130
- }
131
- return errors;
132
- };
133
- /**
134
- * Validates tax calculation consistency
135
- */
136
- const validateTaxCalculations = (invoice) => {
137
- const errors = [];
138
- invoice.invoiceLineItems.forEach((item, index) => {
139
- errors.push(...validateLineItemTax(item, index));
140
- });
141
- const expectedTaxExclusive = invoice.invoiceLineItems.reduce((sum, item) => sum + item.totalTaxableAmountPerLine, 0);
142
- const expectedTaxAmount = invoice.invoiceLineItems.reduce((sum, item) => sum + item.taxAmount, 0);
143
- const tolerance = .01;
144
- if (Math.abs(invoice.legalMonetaryTotal.taxExclusiveAmount - expectedTaxExclusive) > tolerance) errors.push({
145
- field: "legalMonetaryTotal.taxExclusiveAmount",
146
- code: "TAX_EXCLUSIVE_MISMATCH",
147
- message: `Tax exclusive amount (${invoice.legalMonetaryTotal.taxExclusiveAmount}) doesn't match sum of line items (${expectedTaxExclusive})`,
148
- severity: "error"
149
- });
150
- if (Math.abs(invoice.taxTotal.taxAmount - expectedTaxAmount) > tolerance) errors.push({
151
- field: "taxTotal.taxAmount",
152
- code: "TAX_AMOUNT_MISMATCH",
153
- message: `Tax amount (${invoice.taxTotal.taxAmount}) doesn't match sum of line item taxes (${expectedTaxAmount})`,
154
- severity: "error"
155
- });
156
- return errors;
157
- };
158
- /**
159
- * Main validation function for complete invoice
160
- */
161
- const validateInvoice = (invoice) => {
162
- const allErrors = [];
163
- allErrors.push(...validateTIN(invoice.supplier.tin, invoice.supplier.registrationType));
164
- allErrors.push(...validateTIN(invoice.buyer.tin, invoice.buyer.registrationType));
165
- allErrors.push(...validateContactNumber(invoice.supplier.contactNumber));
166
- allErrors.push(...validateContactNumber(invoice.buyer.contactNumber));
167
- allErrors.push(...validateMonetaryAmount(invoice.legalMonetaryTotal.taxExclusiveAmount, "taxExclusiveAmount"));
168
- allErrors.push(...validateMonetaryAmount(invoice.legalMonetaryTotal.payableAmount, "payableAmount"));
169
- allErrors.push(...validateMonetaryAmount(invoice.taxTotal.taxAmount, "taxAmount"));
170
- invoice.invoiceLineItems.forEach((item, index) => {
171
- allErrors.push(...validateMonetaryAmount(item.unitPrice, `lineItem[${index}].unitPrice`));
172
- allErrors.push(...validateMonetaryAmount(item.taxAmount, `lineItem[${index}].taxAmount`));
173
- allErrors.push(...validateMonetaryAmount(item.totalTaxableAmountPerLine, `lineItem[${index}].totalTaxableAmountPerLine`));
174
- });
175
- allErrors.push(...validateTaxCalculations(invoice));
176
- const errors = allErrors.filter((e) => e.severity === "error");
177
- const warnings = allErrors.filter((e) => e.severity === "warning");
178
- return {
179
- isValid: errors.length === 0,
180
- errors,
181
- warnings
182
- };
183
- };
184
-
185
- //#endregion
186
- export { validateContactNumber, validateInvoice, validateLineItemTax, validateMonetaryAmount, validateTIN, validateTaxCalculations };
@@ -1,4 +0,0 @@
1
- //#region src/types/utils.d.ts
2
- type Fetch = (path: string, options?: RequestInit) => Promise<Response>;
3
- //#endregion
4
- export { Fetch };
@@ -1,5 +0,0 @@
1
- //#region src/types/utils.d.ts
2
- type Fetch = (path: string, options?: RequestInit) => Promise<Response>;
3
- //#endregion
4
- export { Fetch };
5
- //# sourceMappingURL=utils-Cdqbbzca.d.cts.map