@ripwords/myinvois-client 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/{0X-ChfmeAYF.d.cts → 0X-Cr3M7hci.d.cts} +1 -1
- package/dist/{1X-jFrFCOs0.d.cts → 1X-CWwmfCzo.d.cts} +1 -1
- package/dist/{1X-DFikQbP0.d.cts → 1X-ClnJ79HH.d.cts} +1 -1
- package/dist/{2X-FWZ1rYVt.d.cts → 2X-CV9eYhog.d.cts} +1 -1
- package/dist/{2X-5cE4ojEX.d.cts → 2X-DNtkJ0tj.d.cts} +1 -1
- package/dist/{3X-D9duw0Ro.d.cts → 3X--VWVsC84.d.cts} +1 -1
- package/dist/{3X-r9xbWJ2l.d.cts → 3X-BOxfatu3.d.cts} +1 -1
- package/dist/{4X-1ZkK-uH5.d.cts → 4X-By9PzHaY.d.cts} +1 -1
- package/dist/{4X-CLO9OuKa.d.cts → 4X-C7fzDWJ_.d.cts} +1 -1
- package/dist/{5X-Cfe39fFc.d.cts → 5X-B5M0Cv_K.d.cts} +1 -1
- package/dist/{5X-BziH0a09.d.cts → 5X-CNAFsDm2.d.cts} +1 -1
- package/dist/{6X-DLWEe1bP.d.cts → 6X-C3elgd-n.d.cts} +1 -1
- package/dist/{6X-BceErbps.d.cts → 6X-uObUP4VG.d.cts} +1 -1
- package/dist/{7X-CwPAqozm.d.cts → 7X-BifJnY24.d.cts} +1 -1
- package/dist/{7X-CucHYQsA.d.cts → 7X-D3idQBl9.d.cts} +1 -1
- package/dist/{8X-CJpqd5xp.d.cts → 8X-C6UMFvQW.d.cts} +1 -1
- package/dist/{8X-BIjJ9kaV.d.cts → 8X-DioBXCJ0.d.cts} +1 -1
- package/dist/{9X-CP5Xp6bE.d.cts → 9X-BjffnXuq.d.cts} +1 -1
- package/dist/{9X-D3aOVCnz.d.cts → 9X-CJjPJgIG.d.cts} +1 -1
- package/dist/{AX-DFzpxGOT.d.cts → AX-DrEd2Ov6.d.cts} +1 -1
- package/dist/{BX-CyiqNE6b.d.cts → BX-C5jc6myN.d.cts} +1 -1
- package/dist/{CX-BTPvC3Dv.d.cts → CX-oSgvmn3h.d.cts} +1 -1
- package/dist/{DX-BD4-hTCh.d.cts → DX-ZIG0enmK.d.cts} +1 -1
- package/dist/{EX-mTHCH0Yk.d.cts → EX-BpWZ5ADq.d.cts} +1 -1
- package/dist/{FX-DOOMoQl2.d.cts → FX-CvYBEc51.d.cts} +1 -1
- package/dist/{GX-8URJ7WHz.d.cts → GX-CU8PZy0G.d.cts} +1 -1
- package/dist/{HX-49z8CzsE.d.cts → HX-DoEErDeE.d.cts} +1 -1
- package/dist/{IX-B6kblmBs.d.cts → IX-jLAUHe8i.d.cts} +1 -1
- package/dist/{JX-DMwHLGEE.d.cts → JX-DX8BjYQC.d.cts} +1 -1
- package/dist/{KX-DaJPkefl.d.cts → KX-fZb4_vhw.d.cts} +1 -1
- package/dist/{LX-BnILxjdS.d.cts → LX-D_mI1bk-.d.cts} +1 -1
- package/dist/{MX-BbPO8mTj.d.cts → MX-DlYZhpkT.d.cts} +1 -1
- package/dist/{NX-xy5uw7H3.d.cts → NX-DELEEbad.d.cts} +1 -1
- package/dist/{OX-CIzARbON.d.cts → OX-CKPyrIFf.d.cts} +1 -1
- package/dist/{PX-CL8waFgx.d.cts → PX-SP6NxBtG.d.cts} +1 -1
- package/dist/{QX-BowAYqZb.d.cts → QX-QZA7E2O-.d.cts} +1 -1
- package/dist/{RX-fWoWcHTG.d.cts → RX-DBcgbdeE.d.cts} +1 -1
- package/dist/{SX-CZ3e31OT.d.cts → SX-DmiJeCMN.d.cts} +1 -1
- package/dist/{TX-CJhJ-HYX.d.cts → TX-C1SoDobK.d.cts} +1 -1
- package/dist/{UX-P7-u2y70.d.cts → UX-DFVynFhQ.d.cts} +1 -1
- package/dist/{VX-C8Eu5gQf.d.cts → VX-DsRum5k3.d.cts} +1 -1
- package/dist/{WX-DkiaqB2V.d.cts → WX-VReU5R5M.d.cts} +1 -1
- package/dist/{XX-D4p4iK-a.d.cts → XX-ChAviUMj.d.cts} +1 -1
- package/dist/{YX-Du8zv9qz.d.cts → YX-QfzeMEKx.d.cts} +1 -1
- package/dist/{ZX-B4jFD-21.d.cts → ZX-Ca2E726a.d.cts} +1 -1
- package/dist/api/platform/platformLogin.d.ts +52 -52
- package/dist/{document-DMIMRJV0.cjs → document-CARHiGdp.cjs} +3 -3
- package/dist/document-CARHiGdp.cjs.map +1 -0
- package/dist/{document-NQos5fSr.js → document-D6VKMAtx.js} +2 -2
- package/dist/{documents-BVG7KIKY.d.ts → documents-CJ8hqIGH.d.ts} +14 -3
- package/dist/{documents-C066EC9m.d.cts → documents-MGs0EvXh.d.cts} +15 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +52 -52
- package/dist/index.js +1 -1
- package/dist/index16.cjs +1 -1
- package/dist/index19.cjs +1 -1
- package/dist/index21.cjs +207 -2
- package/dist/index21.cjs.map +1 -0
- package/dist/index22.cjs +104 -203
- package/dist/index22.cjs.map +1 -1
- package/dist/index23.cjs +132 -104
- package/dist/index23.cjs.map +1 -1
- package/dist/index24.cjs +59 -132
- package/dist/index24.cjs.map +1 -1
- package/dist/index25.cjs +262 -59
- package/dist/index25.cjs.map +1 -1
- package/dist/index26.cjs +74 -262
- package/dist/index26.cjs.map +1 -1
- package/dist/index27.cjs +102 -74
- package/dist/index27.cjs.map +1 -1
- package/dist/index28.cjs +68 -102
- package/dist/index28.cjs.map +1 -1
- package/dist/index29.cjs +107 -68
- package/dist/index29.cjs.map +1 -1
- package/dist/index30.cjs +95 -107
- package/dist/index30.cjs.map +1 -1
- package/dist/index31.cjs +13 -95
- package/dist/index31.cjs.map +1 -1
- package/dist/index32.cjs +31 -11
- package/dist/index32.cjs.map +1 -1
- package/dist/index33.cjs +12 -31
- package/dist/index33.cjs.map +1 -1
- package/dist/index34.cjs +22 -12
- package/dist/index34.cjs.map +1 -1
- package/dist/index35.cjs +13 -22
- package/dist/index35.cjs.map +1 -1
- package/dist/index36.cjs +7 -13
- package/dist/index36.cjs.map +1 -1
- package/dist/index37.cjs +7 -7
- package/dist/index37.cjs.map +1 -1
- package/dist/index38.cjs +10 -7
- package/dist/index38.cjs.map +1 -1
- package/dist/index39.cjs +6 -10
- package/dist/index39.cjs.map +1 -1
- package/dist/index40.cjs +101 -6
- package/dist/index40.cjs.map +1 -1
- package/dist/index41.cjs +106 -101
- package/dist/index41.cjs.map +1 -1
- package/dist/index42.cjs +119 -106
- package/dist/index42.cjs.map +1 -1
- package/dist/index43.cjs +106 -119
- package/dist/index43.cjs.map +1 -1
- package/dist/index44.cjs +98 -106
- package/dist/index44.cjs.map +1 -1
- package/dist/index45.cjs +118 -98
- package/dist/index45.cjs.map +1 -1
- package/dist/index46.cjs +127 -118
- package/dist/index46.cjs.map +1 -1
- package/dist/index47.cjs +117 -127
- package/dist/index47.cjs.map +1 -1
- package/dist/index48.cjs +14 -117
- package/dist/index48.cjs.map +1 -1
- package/dist/index49.cjs +95 -14
- package/dist/index49.cjs.map +1 -1
- package/dist/index50.cjs +142 -95
- package/dist/index50.cjs.map +1 -1
- package/dist/index51.cjs +114 -142
- package/dist/index51.cjs.map +1 -1
- package/dist/index52.cjs +144 -114
- package/dist/index52.cjs.map +1 -1
- package/dist/index53.cjs +113 -144
- package/dist/index53.cjs.map +1 -1
- package/dist/index54.cjs +17 -113
- package/dist/index54.cjs.map +1 -1
- package/dist/index55.cjs +112 -17
- package/dist/index55.cjs.map +1 -1
- package/dist/index56.cjs +47 -112
- package/dist/index56.cjs.map +1 -1
- package/dist/index57.cjs +14 -47
- package/dist/index57.cjs.map +1 -1
- package/dist/index58.cjs +28 -14
- package/dist/index58.cjs.map +1 -1
- package/dist/index59.cjs +22 -28
- package/dist/index59.cjs.map +1 -1
- package/dist/index60.cjs +9 -22
- package/dist/index60.cjs.map +1 -1
- package/dist/index61.cjs +8 -9
- package/dist/index61.cjs.map +1 -1
- package/dist/index62.cjs +17 -8
- package/dist/index62.cjs.map +1 -1
- package/dist/index63.cjs +412 -17
- package/dist/index63.cjs.map +1 -1
- package/dist/index64.cjs +8 -412
- package/dist/index64.cjs.map +1 -1
- package/dist/index65.cjs +9 -8
- package/dist/index65.cjs.map +1 -1
- package/dist/index66.cjs +2 -15
- package/dist/{msic-codes-DToUqTI6.d.ts → msic-codes-C8PJVOaA.d.ts} +10 -10
- package/dist/{msic-codes-CPWVNnpq.d.cts → msic-codes-CIKdPqag.d.cts} +11 -11
- package/dist/{payment-modes-FX88uyhP.d.cts → payment-modes-ghFEXnUl.d.cts} +1 -1
- package/dist/{signatures-BKi9DP2K.d.cts → signatures-hFbt_std.d.cts} +1 -1
- package/dist/{state-codes-CNp_6051.d.cts → state-codes-BlILGZ9d.d.cts} +1 -1
- package/dist/{tax-types-CgwxONDS.d.cts → tax-types-B5sQ8UyN.d.cts} +1 -1
- package/dist/types/documents.d.ts +14 -3
- package/dist/types/index.d.ts +52 -52
- package/dist/types/msic/0X.d.ts +1 -1
- package/dist/types/msic/1X.d.ts +1 -1
- package/dist/types/msic/2X.d.ts +1 -1
- package/dist/types/msic/3X.d.ts +1 -1
- package/dist/types/msic/4X.d.ts +1 -1
- package/dist/types/msic/5X.d.ts +1 -1
- package/dist/types/msic/6X.d.ts +1 -1
- package/dist/types/msic/7X.d.ts +1 -1
- package/dist/types/msic/8X.d.ts +1 -1
- package/dist/types/msic/9X.d.ts +1 -1
- package/dist/types/msic-codes.d.ts +11 -11
- package/dist/types/payment-modes.d.ts +1 -1
- package/dist/types/signatures.d.ts +1 -1
- package/dist/types/state-codes.d.ts +1 -1
- package/dist/types/tax-types.d.ts +1 -1
- package/dist/types/unit/1X.d.ts +1 -1
- package/dist/types/unit/2X.d.ts +1 -1
- package/dist/types/unit/3X.d.ts +1 -1
- package/dist/types/unit/4X.d.ts +1 -1
- package/dist/types/unit/5X.d.ts +1 -1
- package/dist/types/unit/6X.d.ts +1 -1
- package/dist/types/unit/7X.d.ts +1 -1
- package/dist/types/unit/8X.d.ts +1 -1
- package/dist/types/unit/9X.d.ts +1 -1
- package/dist/types/unit/AX.d.ts +1 -1
- package/dist/types/unit/BX.d.ts +1 -1
- package/dist/types/unit/CX.d.ts +1 -1
- package/dist/types/unit/DX.d.ts +1 -1
- package/dist/types/unit/EX.d.ts +1 -1
- package/dist/types/unit/FX.d.ts +1 -1
- package/dist/types/unit/GX.d.ts +1 -1
- package/dist/types/unit/HX.d.ts +1 -1
- package/dist/types/unit/IX.d.ts +1 -1
- package/dist/types/unit/JX.d.ts +1 -1
- package/dist/types/unit/KX.d.ts +1 -1
- package/dist/types/unit/LX.d.ts +1 -1
- package/dist/types/unit/MX.d.ts +1 -1
- package/dist/types/unit/NX.d.ts +1 -1
- package/dist/types/unit/OX.d.ts +1 -1
- package/dist/types/unit/PX.d.ts +1 -1
- package/dist/types/unit/QX.d.ts +1 -1
- package/dist/types/unit/RX.d.ts +1 -1
- package/dist/types/unit/SX.d.ts +1 -1
- package/dist/types/unit/TX.d.ts +1 -1
- package/dist/types/unit/UX.d.ts +1 -1
- package/dist/types/unit/VX.d.ts +1 -1
- package/dist/types/unit/WX.d.ts +1 -1
- package/dist/types/unit/XX.d.ts +1 -1
- package/dist/types/unit/YX.d.ts +1 -1
- package/dist/types/unit/ZX.d.ts +1 -1
- package/dist/types/unit-types.d.ts +36 -36
- package/dist/unit-types-B41YFOLT.d.ts +55 -0
- package/dist/unit-types-CjWNk2wS.d.cts +56 -0
- package/dist/utils/document.d.ts +52 -52
- package/dist/utils/document.js +1 -1
- package/dist/utils/signature-diagnostics.d.ts +52 -52
- package/dist/utils/signature-diagnostics.js +1 -1
- package/package.json +1 -1
- package/src/types/documents.d.ts +14 -6
- package/src/utils/document.ts +2 -2
- package/test/dynamicInvoiceFeatures.test.ts +2 -0
- package/test/signAndSubmitInvoice.test.ts +2 -0
- package/test/signature-diagnostics.test.ts +2 -0
- package/dist/document-DMIMRJV0.cjs.map +0 -1
- package/dist/index66.cjs.map +0 -1
- package/dist/unit-types-BKZxwVYQ.d.ts +0 -55
- package/dist/unit-types-CaOA5ZDG.d.cts +0 -56
- /package/dist/{0X-CG1S1WKn.d.ts → 0X-CTIq3y3a.d.ts} +0 -0
- /package/dist/{1X-CmlbG02M.d.ts → 1X-Bu4oiv8D.d.ts} +0 -0
- /package/dist/{1X-DbFshzup.d.ts → 1X-BywXCqtn.d.ts} +0 -0
- /package/dist/{2X-eC_p0QJf.d.ts → 2X-3fSEGIuE.d.ts} +0 -0
- /package/dist/{2X-DA6J6Wd7.d.ts → 2X-DnG3FY1f.d.ts} +0 -0
- /package/dist/{3X-GxuN79Ax.d.ts → 3X-CLdmoel1.d.ts} +0 -0
- /package/dist/{3X-DbfkwdkO.d.ts → 3X-Ynjfgoll.d.ts} +0 -0
- /package/dist/{4X-CnHtgO6u.d.ts → 4X-B5ePdMky.d.ts} +0 -0
- /package/dist/{4X-DYz_nYSD.d.ts → 4X-BTG6o1Gn.d.ts} +0 -0
- /package/dist/{5X-kBF74qx1.d.ts → 5X-CjSz1zxJ.d.ts} +0 -0
- /package/dist/{5X-BzPEdkbC.d.ts → 5X-dhP6fyou.d.ts} +0 -0
- /package/dist/{6X-sQZfT0ZK.d.ts → 6X-B9KP_vEn.d.ts} +0 -0
- /package/dist/{6X-C_xpeu6J.d.ts → 6X-BHaY0TCf.d.ts} +0 -0
- /package/dist/{7X-Bet2agJ6.d.ts → 7X-C4eX_tAk.d.ts} +0 -0
- /package/dist/{7X-BoKQxMoO.d.ts → 7X-DtkQutx2.d.ts} +0 -0
- /package/dist/{8X-BOEWATU3.d.ts → 8X-5n9seY3z.d.ts} +0 -0
- /package/dist/{8X-s5AzkHR-.d.ts → 8X-D6HTLShY.d.ts} +0 -0
- /package/dist/{9X-BBDP1gZ6.d.ts → 9X-CHZKsIdD.d.ts} +0 -0
- /package/dist/{9X-DAAZV4sr.d.ts → 9X-Cpb6V4JC.d.ts} +0 -0
- /package/dist/{AX-CmpMMhII.d.ts → AX-C0w_r3PA.d.ts} +0 -0
- /package/dist/{BX-j78z_ju_.d.ts → BX-RadlZ-6m.d.ts} +0 -0
- /package/dist/{CX-B6rEhQx7.d.ts → CX-CT1Zzb9D.d.ts} +0 -0
- /package/dist/{DX-CAmMnx5a.d.ts → DX-CtUeTKMM.d.ts} +0 -0
- /package/dist/{EX-CXhSC85J.d.ts → EX-084Yu7Wt.d.ts} +0 -0
- /package/dist/{FX-DYVIJ3l0.d.ts → FX-BrbQM0CW.d.ts} +0 -0
- /package/dist/{GX-eBOVHqi6.d.ts → GX-gKj8iAAh.d.ts} +0 -0
- /package/dist/{HX-Dz5T0xXI.d.ts → HX-9D-ZXTy5.d.ts} +0 -0
- /package/dist/{IX-PiKYro5a.d.ts → IX-DR4Fc92A.d.ts} +0 -0
- /package/dist/{JX-Dvnt0mSK.d.ts → JX-DIKa9ma-.d.ts} +0 -0
- /package/dist/{KX-BUb8e0yg.d.ts → KX-DpsJ_unT.d.ts} +0 -0
- /package/dist/{LX-l5ZBaGov.d.ts → LX-DeXPPWUX.d.ts} +0 -0
- /package/dist/{MX-C7C15AWi.d.ts → MX-CKMjg_zK.d.ts} +0 -0
- /package/dist/{NX-C7nFVC-D.d.ts → NX-oYdb4NDo.d.ts} +0 -0
- /package/dist/{OX-Dmkvcaij.d.ts → OX-Bid9es3D.d.ts} +0 -0
- /package/dist/{PX-BKZ14N7N.d.ts → PX-D7jy9CFk.d.ts} +0 -0
- /package/dist/{QX-6xdSNtxZ.d.ts → QX-BFWOR4g3.d.ts} +0 -0
- /package/dist/{RX-DFoiOK5q.d.ts → RX-XHgCyMV1.d.ts} +0 -0
- /package/dist/{SX-D-Szi9wa.d.ts → SX-Cl8RN8oH.d.ts} +0 -0
- /package/dist/{TX-DTfkGsqn.d.ts → TX-ZymoIbtr.d.ts} +0 -0
- /package/dist/{UX-Bw4HHAj4.d.ts → UX-D-Ndd1ov.d.ts} +0 -0
- /package/dist/{VX-DCv5x_hi.d.ts → VX-B-1b34r7.d.ts} +0 -0
- /package/dist/{WX-BYtJ5_if.d.ts → WX-0GuMjPNZ.d.ts} +0 -0
- /package/dist/{XX-Jo1yJO3A.d.ts → XX-CF2NANsy.d.ts} +0 -0
- /package/dist/{YX-BvGmEsVG.d.ts → YX-B51BbNSg.d.ts} +0 -0
- /package/dist/{ZX-B59AJcBY.d.ts → ZX-BMJS1iAv.d.ts} +0 -0
- /package/dist/{payment-modes-DA7uBIGb.d.ts → payment-modes-BOTSRC_X.d.ts} +0 -0
- /package/dist/{signatures-CG175mpg.d.ts → signatures-W-_brwdb.d.ts} +0 -0
- /package/dist/{state-codes-dvoTe5pC.d.ts → state-codes-oeFKlwXZ.d.ts} +0 -0
- /package/dist/{tax-types-tosH5I0q.d.ts → tax-types-CsQ76JMf.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## v0.1.3
|
|
5
|
+
|
|
6
|
+
[compare changes](https://github.com/Ripwords/MyInvoisClient/compare/v0.1.2...v0.1.3)
|
|
7
|
+
|
|
8
|
+
### 💅 Refactors
|
|
9
|
+
|
|
10
|
+
- Add industry classification fields to Supplier interface in documents.d.ts, update invoice generation logic in document.ts, and enhance related tests for improved type safety and clarity ([648858a](https://github.com/Ripwords/MyInvoisClient/commit/648858a))
|
|
11
|
+
|
|
12
|
+
### ❤️ Contributors
|
|
13
|
+
|
|
14
|
+
- JJ <teohjjteoh@gmail.com>
|
|
15
|
+
|
|
4
16
|
## v0.1.2
|
|
5
17
|
|
|
6
18
|
[compare changes](https://github.com/Ripwords/MyInvoisClient/compare/v0.1.1...v0.1.2)
|
|
@@ -2,58 +2,58 @@ import "../../classification-codes-BKxV-rO9.js";
|
|
|
2
2
|
import "../../country-code-CQuaiQm2.js";
|
|
3
3
|
import "../../currencies-BYJK-m6v.js";
|
|
4
4
|
import "../../e-invoice-CmbLQkHw.js";
|
|
5
|
-
import "../../
|
|
6
|
-
import "../../
|
|
7
|
-
import "../../
|
|
8
|
-
import "../../
|
|
9
|
-
import "../../
|
|
10
|
-
import "../../
|
|
11
|
-
import "../../
|
|
12
|
-
import "../../
|
|
13
|
-
import "../../
|
|
14
|
-
import "../../
|
|
15
|
-
import "../../
|
|
16
|
-
import "../../
|
|
17
|
-
import "../../
|
|
18
|
-
import "../../
|
|
19
|
-
import "../../
|
|
20
|
-
import "../../
|
|
21
|
-
import "../../
|
|
22
|
-
import "../../
|
|
23
|
-
import "../../
|
|
24
|
-
import "../../
|
|
25
|
-
import "../../
|
|
26
|
-
import "../../
|
|
27
|
-
import "../../
|
|
28
|
-
import "../../
|
|
29
|
-
import "../../
|
|
30
|
-
import "../../
|
|
31
|
-
import "../../
|
|
32
|
-
import "../../
|
|
33
|
-
import "../../
|
|
34
|
-
import "../../
|
|
35
|
-
import "../../
|
|
36
|
-
import "../../
|
|
37
|
-
import "../../
|
|
38
|
-
import "../../
|
|
39
|
-
import "../../
|
|
40
|
-
import "../../
|
|
41
|
-
import "../../
|
|
42
|
-
import "../../
|
|
43
|
-
import "../../
|
|
44
|
-
import "../../
|
|
45
|
-
import "../../
|
|
46
|
-
import "../../
|
|
47
|
-
import "../../
|
|
48
|
-
import "../../
|
|
49
|
-
import "../../
|
|
50
|
-
import "../../
|
|
51
|
-
import "../../
|
|
52
|
-
import "../../
|
|
53
|
-
import "../../
|
|
54
|
-
import "../../
|
|
55
|
-
import "../../
|
|
56
|
-
import "../../
|
|
5
|
+
import "../../0X-CTIq3y3a.js";
|
|
6
|
+
import "../../1X-Bu4oiv8D.js";
|
|
7
|
+
import "../../2X-DnG3FY1f.js";
|
|
8
|
+
import "../../3X-CLdmoel1.js";
|
|
9
|
+
import "../../4X-BTG6o1Gn.js";
|
|
10
|
+
import "../../5X-CjSz1zxJ.js";
|
|
11
|
+
import "../../6X-B9KP_vEn.js";
|
|
12
|
+
import "../../7X-DtkQutx2.js";
|
|
13
|
+
import "../../8X-5n9seY3z.js";
|
|
14
|
+
import "../../9X-Cpb6V4JC.js";
|
|
15
|
+
import "../../msic-codes-C8PJVOaA.js";
|
|
16
|
+
import "../../signatures-W-_brwdb.js";
|
|
17
|
+
import "../../tax-types-CsQ76JMf.js";
|
|
18
|
+
import "../../documents-CJ8hqIGH.js";
|
|
19
|
+
import "../../payment-modes-BOTSRC_X.js";
|
|
20
|
+
import "../../1X-BywXCqtn.js";
|
|
21
|
+
import "../../2X-3fSEGIuE.js";
|
|
22
|
+
import "../../3X-Ynjfgoll.js";
|
|
23
|
+
import "../../4X-B5ePdMky.js";
|
|
24
|
+
import "../../5X-dhP6fyou.js";
|
|
25
|
+
import "../../6X-BHaY0TCf.js";
|
|
26
|
+
import "../../7X-C4eX_tAk.js";
|
|
27
|
+
import "../../8X-D6HTLShY.js";
|
|
28
|
+
import "../../9X-CHZKsIdD.js";
|
|
29
|
+
import "../../AX-C0w_r3PA.js";
|
|
30
|
+
import "../../BX-RadlZ-6m.js";
|
|
31
|
+
import "../../CX-CT1Zzb9D.js";
|
|
32
|
+
import "../../DX-CtUeTKMM.js";
|
|
33
|
+
import "../../EX-084Yu7Wt.js";
|
|
34
|
+
import "../../FX-BrbQM0CW.js";
|
|
35
|
+
import "../../GX-gKj8iAAh.js";
|
|
36
|
+
import "../../HX-9D-ZXTy5.js";
|
|
37
|
+
import "../../IX-DR4Fc92A.js";
|
|
38
|
+
import "../../JX-DIKa9ma-.js";
|
|
39
|
+
import "../../KX-DpsJ_unT.js";
|
|
40
|
+
import "../../LX-DeXPPWUX.js";
|
|
41
|
+
import "../../MX-CKMjg_zK.js";
|
|
42
|
+
import "../../NX-oYdb4NDo.js";
|
|
43
|
+
import "../../OX-Bid9es3D.js";
|
|
44
|
+
import "../../PX-D7jy9CFk.js";
|
|
45
|
+
import "../../QX-BFWOR4g3.js";
|
|
46
|
+
import "../../RX-XHgCyMV1.js";
|
|
47
|
+
import "../../SX-Cl8RN8oH.js";
|
|
48
|
+
import "../../TX-ZymoIbtr.js";
|
|
49
|
+
import "../../UX-D-Ndd1ov.js";
|
|
50
|
+
import "../../VX-B-1b34r7.js";
|
|
51
|
+
import "../../WX-0GuMjPNZ.js";
|
|
52
|
+
import "../../YX-B51BbNSg.js";
|
|
53
|
+
import "../../ZX-BMJS1iAv.js";
|
|
54
|
+
import "../../XX-CF2NANsy.js";
|
|
55
|
+
import "../../unit-types-B41YFOLT.js";
|
|
56
|
+
import "../../state-codes-oeFKlwXZ.js";
|
|
57
57
|
import { ClientCredentials } from "../../index-0-EvC6Nv.js";
|
|
58
58
|
|
|
59
59
|
//#region src/api/platform/platformLogin.d.ts
|
|
@@ -48,8 +48,8 @@ const generateCleanInvoiceObject = (invoice) => {
|
|
|
48
48
|
DocumentCurrencyCode: [{ _: invoice.invoiceCurrencyCode }],
|
|
49
49
|
AccountingSupplierParty: [{ Party: [{
|
|
50
50
|
IndustryClassificationCode: [{
|
|
51
|
-
_:
|
|
52
|
-
name:
|
|
51
|
+
_: invoice.supplier.industryClassificationCode,
|
|
52
|
+
name: invoice.supplier.industryClassificationDescription
|
|
53
53
|
}],
|
|
54
54
|
PartyIdentification: [{ ID: [{
|
|
55
55
|
_: invoice.supplier.tin,
|
|
@@ -469,4 +469,4 @@ Object.defineProperty(exports, 'sortObjectKeys', {
|
|
|
469
469
|
return sortObjectKeys;
|
|
470
470
|
}
|
|
471
471
|
});
|
|
472
|
-
//# sourceMappingURL=document-
|
|
472
|
+
//# sourceMappingURL=document-CARHiGdp.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-CARHiGdp.cjs","names":["obj: unknown","sortedObj: Record<string, unknown>","invoice: InvoiceV1_1","invoices: InvoiceV1_1[]","invoice: any","certificatePem: string","X509Certificate","dn: string","serialHex: string","error: unknown","certificateDigest: string","signingTime: string","issuerName: string","serialNumber: string","signedProperties: SignedPropertiesObject","docDigest: string","propsDigest: string","privateKeyPem: string","signingCredentials: SigningCredentials"],"sources":["../src/utils/document.ts"],"sourcesContent":["import crypto, { X509Certificate } from 'crypto'\nimport {\n InvoiceSubmission,\n InvoiceV1_1,\n SigningCredentials,\n SignedPropertiesObject,\n UBLDocument,\n CompleteInvoice,\n SignedInfoObject,\n} from '../types'\n\n/**\n * MyInvois v1.1 Document Generation and Signing Utilities\n * Strictly follows: https://sdk.myinvois.hasil.gov.my/documents/invoice-v1-1\n * JSON Signature Guide: https://sdk.myinvois.hasil.gov.my/signature-creation-json/\n */\n\n/**\n * Helper function to recursively sort object keys for JSON canonicalization\n */\nexport function sortObjectKeys(obj: unknown): unknown {\n if (obj === null || typeof obj !== 'object') {\n return obj\n }\n\n if (Array.isArray(obj)) {\n return obj.map(sortObjectKeys)\n }\n\n const sortedObj: Record<string, unknown> = {}\n const keys = Object.keys(obj as Record<string, unknown>).sort()\n\n for (const key of keys) {\n sortedObj[key] = sortObjectKeys((obj as Record<string, unknown>)[key])\n }\n\n return sortedObj\n}\n\n/**\n * Enhanced canonicalization following MyInvois specification exactly\n * Key changes: ensure consistent ordering and formatting\n */\nexport const canonicalizeJSON = (obj: unknown): string => {\n const sortedObj = sortObjectKeys(obj)\n // Use compact JSON with no extra whitespace\n return JSON.stringify(sortedObj, null, 0)\n}\n\n/**\n * Generates a clean invoice object following MyInvois v1.1 specification exactly\n * This is the base invoice structure WITHOUT signature elements (for hash calculation)\n *\n * Key requirements from working documents:\n * - All mandatory fields must be present\n * - Many optional fields must be present even if empty\n * - Specific field ordering and structure\n * - Correct listID values (e.g., \"3166-1\" not \"ISO3166-1\")\n */\nexport const generateCleanInvoiceObject = (\n invoice: InvoiceV1_1,\n): InvoiceSubmission => {\n return {\n // === MANDATORY CORE FIELDS ===\n ID: [{ _: invoice.eInvoiceCodeOrNumber }],\n IssueDate: [{ _: invoice.eInvoiceDate }],\n IssueTime: [{ _: invoice.eInvoiceTime }],\n InvoiceTypeCode: [\n {\n _: invoice.eInvoiceTypeCode,\n listVersionID: invoice.eInvoiceVersion || '1.1',\n },\n ],\n DocumentCurrencyCode: [{ _: invoice.invoiceCurrencyCode }],\n\n // === SUPPLIER PARTY (AccountingSupplierParty) ===\n AccountingSupplierParty: [\n {\n Party: [\n {\n // Industry Classification - required field\n IndustryClassificationCode: [\n {\n _: invoice.supplier.industryClassificationCode,\n name: invoice.supplier.industryClassificationDescription,\n },\n ],\n\n // Party Identifications\n PartyIdentification: [\n {\n ID: [\n {\n _: invoice.supplier.tin,\n schemeID: 'TIN',\n },\n ],\n },\n {\n ID: [\n {\n _: invoice.supplier.registrationNumber,\n schemeID: invoice.supplier.registrationType || 'NRIC',\n },\n ],\n },\n ],\n\n // Postal Address - FIXED listID format\n PostalAddress: [\n {\n CityName: [{ _: invoice.supplier.address.cityName }],\n CountrySubentityCode: [{ _: invoice.supplier.address.state }],\n AddressLine: [\n {\n Line: [{ _: invoice.supplier.address.addressLine0 }],\n },\n ],\n Country: [\n {\n IdentificationCode: [\n {\n _: invoice.supplier.address.country || 'MYS',\n listID: '3166-1', // FIXED: was \"ISO3166-1\"\n listAgencyID: 'ISO',\n },\n ],\n },\n ],\n },\n ],\n\n // Party Legal Entity\n PartyLegalEntity: [\n {\n RegistrationName: [{ _: invoice.supplier.name }],\n },\n ],\n\n // Contact Information\n Contact: [\n {\n Telephone: [{ _: invoice.supplier.contactNumber || '' }],\n },\n ],\n },\n ],\n },\n ],\n\n // === BUYER PARTY (AccountingCustomerParty) ===\n AccountingCustomerParty: [\n {\n Party: [\n {\n // Party Identifications\n PartyIdentification: [\n {\n ID: [\n {\n _: invoice.buyer.tin,\n schemeID: 'TIN',\n },\n ],\n },\n {\n ID: [\n {\n _: invoice.buyer.registrationNumber,\n schemeID: invoice.buyer.registrationType || 'NRIC',\n },\n ],\n },\n {\n ID: [\n {\n _: invoice.buyer.sstRegistrationNumber || 'NA',\n schemeID: 'SST',\n },\n ],\n },\n ],\n\n // Postal Address - FIXED listID format\n PostalAddress: [\n {\n CityName: [{ _: invoice.buyer.address.cityName }],\n CountrySubentityCode: [{ _: invoice.buyer.address.state }],\n AddressLine: [\n {\n Line: [{ _: invoice.buyer.address.addressLine0 }],\n },\n ],\n Country: [\n {\n IdentificationCode: [\n {\n _: invoice.buyer.address.country || 'MYS',\n listID: '3166-1', // FIXED: was \"ISO3166-1\"\n listAgencyID: 'ISO',\n },\n ],\n },\n ],\n },\n ],\n\n // Party Legal Entity\n PartyLegalEntity: [\n {\n RegistrationName: [{ _: invoice.buyer.name }],\n },\n ],\n\n // Contact Information\n Contact: [\n {\n Telephone: [{ _: invoice.buyer.contactNumber || '' }],\n },\n ],\n },\n ],\n },\n ],\n\n // === TAX TOTAL ===\n TaxTotal: [\n {\n TaxAmount: [\n {\n _: invoice.taxTotal.taxAmount,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n TaxSubtotal: [\n // Generate basic tax subtotal from invoice line items\n {\n TaxableAmount: [\n {\n _: invoice.legalMonetaryTotal.taxExclusiveAmount,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n TaxAmount: [\n {\n _: invoice.taxTotal.taxAmount,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n TaxCategory: [\n {\n ID: [{ _: invoice.invoiceLineItems[0]?.taxType || '01' }],\n TaxScheme: [\n {\n ID: [\n {\n _: 'OTH',\n schemeAgencyID: '6',\n schemeID: 'UN/ECE 5153',\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n\n // === LEGAL MONETARY TOTAL ===\n LegalMonetaryTotal: [\n {\n LineExtensionAmount: [\n {\n _: invoice.legalMonetaryTotal.taxExclusiveAmount,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n TaxExclusiveAmount: [\n {\n _: invoice.legalMonetaryTotal.taxExclusiveAmount,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n TaxInclusiveAmount: [\n {\n _: invoice.legalMonetaryTotal.taxInclusiveAmount,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n PayableAmount: [\n {\n _: invoice.legalMonetaryTotal.payableAmount,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n },\n ],\n\n // === INVOICE LINES ===\n InvoiceLine: invoice.invoiceLineItems.map((item, index) => ({\n ID: [{ _: (index + 1).toString() }],\n\n // Item Information\n Item: [\n {\n CommodityClassification: [\n {\n ItemClassificationCode: [\n {\n _: item.itemClassificationCode,\n listID: 'CLASS',\n },\n ],\n },\n ],\n Description: [{ _: item.itemDescription }],\n },\n ],\n\n ItemPriceExtension: [\n {\n Amount: [\n {\n _: item.totalTaxableAmountPerLine,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n },\n ],\n\n LineExtensionAmount: [\n {\n _: item.totalTaxableAmountPerLine,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n\n // Price Information\n Price: [\n {\n PriceAmount: [\n {\n _: item.unitPrice,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n },\n ],\n\n // Tax Information for line\n TaxTotal: [\n {\n TaxAmount: [\n {\n _: item.taxAmount,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n TaxSubtotal: [\n {\n TaxableAmount: [\n {\n _: item.totalTaxableAmountPerLine,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n TaxAmount: [\n {\n _: item.taxAmount,\n currencyID: invoice.invoiceCurrencyCode,\n },\n ],\n TaxCategory: [\n {\n ID: [{ _: item.taxType }],\n TaxScheme: [\n {\n ID: [\n {\n _: 'OTH',\n schemeAgencyID: '6',\n schemeID: 'UN/ECE 5153',\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n })),\n\n // === TAX EXCHANGE RATE (mandatory where applicable) ===\n TaxExchangeRate: invoice.currencyExchangeRate\n ? [\n {\n SourceCurrencyCode: [\n {\n _: invoice.invoiceCurrencyCode,\n },\n ],\n TargetCurrencyCode: [\n {\n _: 'MYR',\n },\n ],\n CalculationRate: [\n {\n _: invoice.currencyExchangeRate,\n },\n ],\n },\n ]\n : undefined,\n }\n}\n\n/**\n * Generates the complete UBL document structure with namespace declarations\n */\nexport const generateCleanUBLDocument = (\n invoices: InvoiceV1_1[],\n): UBLDocument => {\n return {\n _D: 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2',\n _A: 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2',\n _B: 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2',\n Invoice: invoices.map(generateCleanInvoiceObject),\n }\n}\n\n/**\n * Step 2: Calculate Document Digest\n * FIXED: Remove UBLExtensions and Signature before hashing (DS322)\n * Based on working implementation pattern\n */\nexport const calculateDocumentDigest = (invoices: InvoiceV1_1[]): string => {\n // Generate clean UBL document structure\n const cleanDocument = generateCleanUBLDocument(invoices)\n\n // CRITICAL FIX: Remove UBLExtensions and Signature from each invoice before hashing\n const documentForHashing = JSON.parse(JSON.stringify(cleanDocument))\n if (documentForHashing.Invoice && Array.isArray(documentForHashing.Invoice)) {\n documentForHashing.Invoice.forEach((invoice: any) => {\n delete invoice.UBLExtensions\n delete invoice.Signature\n })\n }\n\n // Convert to string for hashing (no canonicalization - use direct JSON.stringify)\n const documentString = JSON.stringify(documentForHashing)\n\n // Calculate SHA-256 hash\n const hash = crypto.createHash('sha256')\n hash.update(documentString, 'utf8')\n\n // Return as Base64 (DocDigest)\n return hash.digest('base64')\n}\n\n/**\n * Step 4: Calculate Certificate Digest\n * Enhanced to handle certificate content properly\n */\nexport const calculateCertificateDigest = (certificatePem: string): string => {\n // Extract certificate content (Base64 without PEM headers/footers)\n const certificateContent = certificatePem\n .replace(/-----BEGIN CERTIFICATE-----/g, '')\n .replace(/-----END CERTIFICATE-----/g, '')\n .replace(/\\s+/g, '') // Remove all whitespace\n\n // Convert Base64 to binary\n const certificateBinary = Buffer.from(certificateContent, 'base64')\n\n // Calculate SHA-256 hash of binary content\n const hash = crypto.createHash('sha256')\n hash.update(certificateBinary)\n\n // Return as Base64\n return hash.digest('base64')\n}\n\n/**\n * Enhanced certificate info extraction with better error handling\n * FIXED: Normalize issuer name format to match MyInvois expectations (DS326)\n */\nexport const extractCertificateInfo = (\n certificatePem: string,\n): {\n issuerName: string\n serialNumber: string\n subjectName: string\n} => {\n try {\n const cert = new X509Certificate(certificatePem)\n\n // Extract serial number and convert to decimal string\n const serialNumberHex = cert.serialNumber\n\n // ENHANCED: Normalize distinguished name format (DS326)\n // Ensures MyInvois portal compatibility for X509IssuerName matching\n const normalizeDistinguishedName = (dn: string): string => {\n // Convert multi-line format to comma-separated RFC2253 format\n const normalized = dn\n .split('\\n')\n .map(line => line.trim())\n .filter(line => line.length > 0)\n .join(', ')\n\n // MyInvois-specific normalization to prevent DS326 errors\n return normalized\n .replace(/\\s*=\\s*/g, '=') // Remove spaces around equals (CRITICAL for portal)\n .replace(/,\\s+/g, ', ') // Ensure single space after commas\n .replace(/\\r/g, '') // Remove any carriage returns\n .replace(/\\s{2,}/g, ' ') // Replace multiple spaces with single space\n .trim() // Remove leading/trailing whitespace\n }\n\n // Enhanced serial number formatting\n const formatSerialNumber = (serialHex: string): string => {\n // Convert hex to decimal and ensure it's a string\n const decimal = BigInt('0x' + serialHex).toString()\n return decimal\n }\n\n return {\n issuerName: normalizeDistinguishedName(cert.issuer),\n serialNumber: formatSerialNumber(serialNumberHex),\n subjectName: normalizeDistinguishedName(cert.subject),\n }\n } catch (error: unknown) {\n throw new Error(\n `Failed to extract certificate info: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n}\n\n/**\n * Step 5: Create SignedProperties with enhanced structure\n * FIXED: Simplified structure to match MyInvois expectations (DS320)\n * Following MyInvois JSON signature specification exactly\n */\nexport const createSignedProperties = (\n certificateDigest: string,\n signingTime: string,\n issuerName: string,\n serialNumber: string,\n): SignedPropertiesObject => {\n return {\n SignedProperties: [\n {\n Id: 'id-xades-signed-props',\n SignedSignatureProperties: [\n {\n SigningTime: [{ _: signingTime }],\n SigningCertificate: [\n {\n Cert: [\n {\n CertDigest: [\n {\n DigestMethod: [\n {\n Algorithm:\n 'http://www.w3.org/2001/04/xmlenc#sha256',\n },\n ],\n DigestValue: [{ _: certificateDigest }],\n },\n ],\n IssuerSerial: [\n {\n X509IssuerName: [{ _: issuerName }],\n X509SerialNumber: [{ _: serialNumber }],\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n }\n}\n\n/**\n * Step 6: Calculate SignedProperties Digest\n * FIXED: Add Target wrapper and use direct JSON stringify (DS320)\n * Based on working implementation pattern\n */\nexport const calculateSignedPropertiesDigest = (\n signedProperties: SignedPropertiesObject,\n): string => {\n // CRITICAL FIX: Wrap with Target as per working implementation\n const signedPropertiesWithTarget = {\n Target: 'signature',\n SignedProperties: signedProperties.SignedProperties,\n }\n\n // Convert to string for hashing (no canonicalization - use direct JSON.stringify)\n const signedPropertiesString = JSON.stringify(signedPropertiesWithTarget)\n\n // Calculate SHA-256 hash\n const hash = crypto.createHash('sha256')\n hash.update(signedPropertiesString, 'utf8')\n\n // Return as Base64 (PropsDigest)\n return hash.digest('base64')\n}\n\n/**\n * Step 3: Create SignedInfo and calculate signature\n * Enhanced with better structure and signature generation\n */\nexport const createSignedInfoAndSign = (\n docDigest: string,\n propsDigest: string,\n privateKeyPem: string,\n): { signedInfo: SignedInfoObject; signatureValue: string } => {\n // Create SignedInfo structure following specification exactly\n const signedInfo = {\n CanonicalizationMethod: [\n {\n _: '',\n Algorithm: 'http://www.w3.org/2006/12/xml-c14n11',\n },\n ],\n SignatureMethod: [\n {\n _: '',\n Algorithm: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',\n },\n ],\n Reference: [\n {\n Id: 'id-doc-signed-data',\n Type: '',\n URI: '',\n DigestMethod: [\n {\n _: '',\n Algorithm: 'http://www.w3.org/2001/04/xmlenc#sha256',\n },\n ],\n DigestValue: [{ _: docDigest }],\n },\n {\n Id: 'id-xades-signed-props',\n Type: 'http://uri.etsi.org/01903/v1.3.2#SignedProperties',\n URI: '#id-xades-signed-props',\n DigestMethod: [\n {\n _: '',\n Algorithm: 'http://www.w3.org/2001/04/xmlenc#sha256',\n },\n ],\n DigestValue: [{ _: propsDigest }],\n },\n ],\n }\n\n // FIXED: Use direct JSON.stringify instead of canonicalization (DS333)\n // Based on working implementation pattern\n const signedInfoString = JSON.stringify(signedInfo)\n\n // Sign with RSA-SHA256 directly (RSA-SHA256 handles hashing internally)\n // FIXED: Removed double-hashing bug that was causing DS333 errors\n try {\n const signer = crypto.createSign('RSA-SHA256')\n signer.update(signedInfoString, 'utf8')\n const signatureValue = signer.sign(privateKeyPem, 'base64')\n\n return { signedInfo, signatureValue }\n } catch (error) {\n throw new Error(\n `Signature generation failed: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n}\n\n/**\n * Complete document generation with signatures\n * Follows the complete MyInvois JSON signature creation process (Steps 1-7)\n */\nexport const generateCompleteDocument = (\n invoices: InvoiceV1_1[],\n signingCredentials: SigningCredentials,\n): CompleteInvoice => {\n try {\n // Step 1: Generate clean document (done in calculateDocumentDigest)\n // Step 2: Calculate document digest\n const docDigest = calculateDocumentDigest(invoices)\n\n // Generate signing time in proper ISO format\n const signingTime = new Date().toISOString()\n\n // Extract certificate information (enhanced)\n const certInfo = extractCertificateInfo(signingCredentials.certificatePem)\n\n // Step 4: Calculate certificate digest\n const certificateDigest = calculateCertificateDigest(\n signingCredentials.certificatePem,\n )\n\n // Step 5: Create SignedProperties using extracted cert info\n const signedProperties = createSignedProperties(\n certificateDigest,\n signingTime,\n certInfo.issuerName,\n certInfo.serialNumber,\n )\n\n // Step 6: Calculate SignedProperties digest\n const propsDigest = calculateSignedPropertiesDigest(signedProperties)\n\n // Step 3: Create SignedInfo and generate signature\n const { signedInfo, signatureValue } = createSignedInfoAndSign(\n docDigest,\n propsDigest,\n signingCredentials.privateKeyPem,\n )\n\n // Extract certificate content (Base64 without PEM headers)\n const certificate = signingCredentials.certificatePem\n .replace(/-----BEGIN CERTIFICATE-----/g, '')\n .replace(/-----END CERTIFICATE-----/g, '')\n .replace(/\\s+/g, '')\n\n // Step 7: Create final signed document\n const signedInvoices = invoices.map(invoice => {\n const cleanInvoice = generateCleanInvoiceObject(invoice)\n\n return {\n ...cleanInvoice,\n\n // Add UBLExtensions with complete signature structure\n UBLExtensions: [\n {\n UBLExtension: [\n {\n ExtensionURI: [\n {\n _: 'urn:oasis:names:specification:ubl:dsig:enveloped:xades',\n },\n ],\n ExtensionContent: [\n {\n UBLDocumentSignatures: [\n {\n SignatureInformation: [\n {\n ID: [\n {\n _: 'urn:oasis:names:specification:ubl:signature:1',\n },\n ],\n ReferencedSignatureID: [\n {\n _: 'urn:oasis:names:specification:ubl:signature:Invoice',\n },\n ],\n Signature: [\n {\n Id: 'signature',\n Object: [\n {\n QualifyingProperties: [\n {\n Target: 'signature',\n SignedProperties:\n signedProperties.SignedProperties,\n },\n ],\n },\n ],\n KeyInfo: [\n {\n X509Data: [\n {\n X509Certificate: [{ _: certificate }],\n X509SubjectName: [\n { _: certInfo.subjectName },\n ],\n X509IssuerSerial: [\n {\n X509IssuerName: [\n {\n _: certInfo.issuerName,\n },\n ],\n X509SerialNumber: [\n {\n _: certInfo.serialNumber,\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n SignatureValue: [{ _: signatureValue }],\n SignedInfo: [signedInfo],\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n\n // Add simple Signature reference\n Signature: [\n {\n ID: [\n {\n _: 'urn:oasis:names:specification:ubl:signature:Invoice',\n },\n ],\n SignatureMethod: [\n {\n _: 'urn:oasis:names:specification:ubl:dsig:enveloped:xades',\n },\n ],\n },\n ],\n }\n })\n\n return {\n _D: 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2',\n _A: 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2',\n _B: 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2',\n Invoice: signedInvoices,\n }\n } catch (error) {\n throw new Error(\n `Document generation failed: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,SAAgB,eAAeA,KAAuB;A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,GAAG,eAAgB,CAAC;OACvC,YAAY,CAAC,UAAW;MACzB,CACF;KACF,CACF,EACF,CACF,EACF,CACF;IACF,CACF,EACF,CACF;IAGD,WAAW,CACT;KACE,IAAI,CACF,EACE,GAAG,sDACJ,CACF;KACD,iBAAiB,CACf,EACE,GAAG,yDACJ,CACF;IACF,CACF;GACF;EACF,EAAC;AAEF,SAAO;GACL,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,SAAS;EACV;CACF,SAAQ,OAAO;AACd,QAAM,IAAI,OACP,8BAA8B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;CAEzF;AACF"}
|
|
@@ -47,8 +47,8 @@ const generateCleanInvoiceObject = (invoice) => {
|
|
|
47
47
|
DocumentCurrencyCode: [{ _: invoice.invoiceCurrencyCode }],
|
|
48
48
|
AccountingSupplierParty: [{ Party: [{
|
|
49
49
|
IndustryClassificationCode: [{
|
|
50
|
-
_:
|
|
51
|
-
name:
|
|
50
|
+
_: invoice.supplier.industryClassificationCode,
|
|
51
|
+
name: invoice.supplier.industryClassificationDescription
|
|
52
52
|
}],
|
|
53
53
|
PartyIdentification: [{ ID: [{
|
|
54
54
|
_: invoice.supplier.tin,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ClassificationCode } from "./classification-codes-BKxV-rO9.js";
|
|
2
2
|
import { CurrencyCode } from "./currencies-BYJK-m6v.js";
|
|
3
3
|
import { EInvoiceTypeCode } from "./e-invoice-CmbLQkHw.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { MSICCode } from "./msic-codes-C8PJVOaA.js";
|
|
5
|
+
import { IssuerDigitalSignature } from "./signatures-W-_brwdb.js";
|
|
6
|
+
import { TaxTypeCode } from "./tax-types-CsQ76JMf.js";
|
|
7
|
+
import { Suggested } from "./utils.js";
|
|
6
8
|
|
|
7
9
|
//#region src/types/documents.d.ts
|
|
8
|
-
|
|
9
10
|
type RegistrationType = 'BRN' | 'NRIC' | 'PASSPORT';
|
|
10
11
|
|
|
11
12
|
// Based on https://sdk.myinvois.hasil.gov.my/documents/invoice-v1-1/
|
|
@@ -57,6 +58,16 @@ interface Supplier {
|
|
|
57
58
|
* @example +60123456789
|
|
58
59
|
*/
|
|
59
60
|
contactNumber: string;
|
|
61
|
+
/**
|
|
62
|
+
* Supplier's industry classification code. Max 10 chars.
|
|
63
|
+
* @example 41001
|
|
64
|
+
*/
|
|
65
|
+
industryClassificationCode: MSICCode['code'];
|
|
66
|
+
/**
|
|
67
|
+
* Supplier's industry classification description. Max 300 chars.
|
|
68
|
+
* @example Other retail sale in non-specialised stores
|
|
69
|
+
*/
|
|
70
|
+
industryClassificationDescription: Suggested<MSICCode['description']>;
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
/**
|