@feedmepos/mf-payment 0.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/AdminLayout.vue_vue_type_script_setup_true_lang-oPYFBeEo.js +42 -0
- package/dist/App.vue.d.ts +2 -0
- package/dist/AppSidebar.vue.d.ts +2 -0
- package/dist/Entry.vue.d.ts +2 -0
- package/dist/Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js +45 -0
- package/dist/PayoutAccount-CNFysD5Y.js +25270 -0
- package/dist/PayoutAccount-D4_KKT6o.js +266 -0
- package/dist/Settlement-C4IEccV6.js +136 -0
- package/dist/Settlement-D4gdbOE0.js +132 -0
- package/dist/SettlementTransactions-C3dnWHkD.js +297 -0
- package/dist/SettlementTransactions-DYelInkD.js +351 -0
- package/dist/Terminal-Co7KPrrb.js +204 -0
- package/dist/TerminalTransaction-CtVBUTMg.js +240 -0
- package/dist/Transaction-CvDEP2Uq.js +242 -0
- package/dist/Transaction-Rk0g5_Gn.js +241 -0
- package/dist/api/auth/index.d.ts +7 -0
- package/dist/api/index.d.ts +34 -0
- package/dist/api/payout/index.d.ts +15 -0
- package/dist/api/settlement/index.d.ts +31 -0
- package/dist/api/terminal/index.d.ts +10 -0
- package/dist/api/terminal-transaction/index.d.ts +11 -0
- package/dist/api/transaction/index.d.ts +20 -0
- package/dist/app.js +194 -0
- package/dist/assets/icons/index.d.ts +23 -0
- package/dist/assets-CZ2m5tCN.js +43 -0
- package/dist/components/AdminLayout.vue.d.ts +26 -0
- package/dist/components/CursorTable/FmTableSelection.vue.d.ts +13 -0
- package/dist/components/CursorTable/index.vue.d.ts +45 -0
- package/dist/components/Layout.vue.d.ts +26 -0
- package/dist/components/Modal.d.ts +3 -0
- package/dist/components/PDFViewer.vue.d.ts +27 -0
- package/dist/composable/loading/index.d.ts +8 -0
- package/dist/composable/query/index.d.ts +2 -0
- package/dist/dinero-CIVmXLL-.js +1255 -0
- package/dist/favicon.ico +0 -0
- package/dist/helpers/assets.d.ts +3 -0
- package/dist/helpers/clipboard.d.ts +1 -0
- package/dist/helpers/date.d.ts +22 -0
- package/dist/helpers/db.d.ts +2 -0
- package/dist/helpers/dinero.d.ts +2 -0
- package/dist/helpers/error.d.ts +1 -0
- package/dist/helpers/export.d.ts +12 -0
- package/dist/helpers/idToDate.d.ts +1 -0
- package/dist/helpers/iteration.d.ts +15 -0
- package/dist/helpers/number.d.ts +22 -0
- package/dist/helpers/object.d.ts +1 -0
- package/dist/helpers/string.d.ts +12 -0
- package/dist/helpers/time.d.ts +7 -0
- package/dist/helpers/validator.d.ts +4 -0
- package/dist/i18n.d.ts +10 -0
- package/dist/icons/anydesk.svg +1 -0
- package/dist/icons/sort.svg +3 -0
- package/dist/images/gateway/ccdc.svg +44 -0
- package/dist/images/gateway/fiuu.jpg +0 -0
- package/dist/images/gateway/fm.svg +44 -0
- package/dist/images/gateway/rm.jpg +0 -0
- package/dist/images/method/BNPL/Ablr/Ablr_SVG.svg +7 -0
- package/dist/images/method/BNPL/Ablr/Ablr_V1_ROU.svg +4 -0
- package/dist/images/method/BNPL/Ablr/Ablr_V1_SQU.svg +4 -0
- package/dist/images/method/BNPL/Ablr/Ablr_V2_ROU.svg +7 -0
- package/dist/images/method/BNPL/Ablr/Ablr_V2_SQU.svg +7 -0
- package/dist/images/method/BNPL/Atome/Atome_SVG.svg +4 -0
- package/dist/images/method/BNPL/Atome/Atome_V1_ROU.svg +4 -0
- package/dist/images/method/BNPL/Atome/Atome_V1_SQU.svg +4 -0
- package/dist/images/method/BNPL/Atome/Atome_V2_ROU.svg +4 -0
- package/dist/images/method/BNPL/Atome/Atome_V2_SQU.svg +4 -0
- package/dist/images/method/BNPL/Atome/Atome_V3_ROU.svg +5 -0
- package/dist/images/method/BNPL/Atome/Atome_V3_SQU.svg +5 -0
- package/dist/images/method/BNPL/IOUPay/IOUPay_SVG.svg +12 -0
- package/dist/images/method/BNPL/IOUPay/IOUPay_V1_ROU.svg +7 -0
- package/dist/images/method/BNPL/IOUPay/IOUPay_V1_SQU.svg +7 -0
- package/dist/images/method/BNPL/IOUPay/IOUPay_V2_ROU.svg +13 -0
- package/dist/images/method/BNPL/IOUPay/IOUPay_V2_SQU.svg +13 -0
- package/dist/images/method/BNPL/ShopBack/ShopBack_SVG.svg +6 -0
- package/dist/images/method/BNPL/ShopBack/ShopBack_V1_ROU.svg +6 -0
- package/dist/images/method/BNPL/ShopBack/ShopBack_V1_SQU.svg +6 -0
- package/dist/images/method/BNPL/ShopBack/ShopBack_V2_ROU.svg +4 -0
- package/dist/images/method/BNPL/ShopBack/ShopBack_V2_SQU.svg +4 -0
- package/dist/images/method/BNPL/Split/Split_SVG.svg +4 -0
- package/dist/images/method/BNPL/Split/Split_V1_ROU.svg +5 -0
- package/dist/images/method/BNPL/Split/Split_V1_SQU.svg +5 -0
- package/dist/images/method/BNPL/Split/Split_V2_ROU.svg +5 -0
- package/dist/images/method/BNPL/Split/Split_V2_SQU.svg +5 -0
- package/dist/images/method/BNPL/Split/Split_V3_ROU.svg +4 -0
- package/dist/images/method/BNPL/Split/Split_V3_SQU.svg +4 -0
- package/dist/images/method/BNPL/Split/Split_V4_ROU.svg +4 -0
- package/dist/images/method/BNPL/Split/Split_V4_SQU.svg +4 -0
- package/dist/images/method/Banks/AEONBank/AEONBank_SVG.svg +16 -0
- package/dist/images/method/Banks/AEONBank/AEONBank_V1_BSQU.svg +17 -0
- package/dist/images/method/Banks/AEONBank/AEONBank_V1_LG.svg +17 -0
- package/dist/images/method/Banks/AEONBank/AEONBank_V1_ROU.svg +6 -0
- package/dist/images/method/Banks/AEONBank/AEONBank_V1_SQU.svg +6 -0
- package/dist/images/method/Banks/AEONBank/AEONBank_V2_BSQU.svg +17 -0
- package/dist/images/method/Banks/AEONBank/AEONBank_V2_LG.svg +17 -0
- package/dist/images/method/Banks/AEONBank/AEONBank_V2_ROU.svg +6 -0
- package/dist/images/method/Banks/AEONBank/AEONBank_V2_SQU.svg +6 -0
- package/dist/images/method/Banks/AffinBank/AffinBank_SVG.svg +56 -0
- package/dist/images/method/Banks/AffinBank/AffinBank_V1_BSQU.svg +57 -0
- package/dist/images/method/Banks/AffinBank/AffinBank_V1_LG.svg +57 -0
- package/dist/images/method/Banks/AffinBank/AffinBank_V1_ROU.svg +10 -0
- package/dist/images/method/Banks/AffinBank/AffinBank_V1_SQU.svg +10 -0
- package/dist/images/method/Banks/AffinBank/AffinBank_V2_BSQU.svg +57 -0
- package/dist/images/method/Banks/AffinBank/AffinBank_V2_LG.svg +57 -0
- package/dist/images/method/Banks/AffinBank/AffinBank_V2_ROU.svg +10 -0
- package/dist/images/method/Banks/AffinBank/AffinBank_V2_SQU.svg +10 -0
- package/dist/images/method/Banks/AllianceBank/AllianceBank_SVG.svg +45 -0
- package/dist/images/method/Banks/AllianceBank/AllianceBank_V1_BSQU.svg +46 -0
- package/dist/images/method/Banks/AllianceBank/AllianceBank_V1_LG.svg +46 -0
- package/dist/images/method/Banks/AllianceBank/AllianceBank_V1_ROU.svg +34 -0
- package/dist/images/method/Banks/AllianceBank/AllianceBank_V1_SQU.svg +34 -0
- package/dist/images/method/Banks/AmBank/AmBank_SVG.svg +18 -0
- package/dist/images/method/Banks/AmBank/AmBank_V1_BSQU.svg +13 -0
- package/dist/images/method/Banks/AmBank/AmBank_V1_LG.svg +13 -0
- package/dist/images/method/Banks/AmBank/AmBank_V1_ROU.svg +7 -0
- package/dist/images/method/Banks/AmBank/AmBank_V1_SQU.svg +7 -0
- package/dist/images/method/Banks/AmBank/AmBank_V2_BSQU.svg +13 -0
- package/dist/images/method/Banks/AmBank/AmBank_V2_LG.svg +13 -0
- package/dist/images/method/Banks/AmBank/AmBank_V2_ROU.svg +7 -0
- package/dist/images/method/Banks/AmBank/AmBank_V2_SQU.svg +7 -0
- package/dist/images/method/Banks/AmBank/AmBank_V3_BSQU.svg +13 -0
- package/dist/images/method/Banks/AmBank/AmBank_V3_LG.svg +13 -0
- package/dist/images/method/Banks/AmBank/AmBank_V3_ROU.svg +7 -0
- package/dist/images/method/Banks/AmBank/AmBank_V3_SQU.svg +7 -0
- package/dist/images/method/Banks/AmBank/AmBank_V4_BSQU.svg +18 -0
- package/dist/images/method/Banks/AmBank/AmBank_V4_LG.svg +18 -0
- package/dist/images/method/Banks/AmBank/AmBank_V5_BSQU.svg +18 -0
- package/dist/images/method/Banks/AmBank/AmBank_V5_LG.svg +18 -0
- package/dist/images/method/Banks/ArgoBank/ArgoBank_SVG.svg +12 -0
- package/dist/images/method/Banks/ArgoBank/ArgoBank_V1_BSQU.svg +13 -0
- package/dist/images/method/Banks/ArgoBank/ArgoBank_V1_LG.svg +13 -0
- package/dist/images/method/Banks/ArgoBank/ArgoBank_V1_ROU.svg +4 -0
- package/dist/images/method/Banks/ArgoBank/ArgoBank_V1_SQU.svg +4 -0
- package/dist/images/method/Banks/BSN/BSN_SVG.svg +7 -0
- package/dist/images/method/Banks/BSN/BSN_V1_BSQU.svg +7 -0
- package/dist/images/method/Banks/BSN/BSN_V1_LG.svg +7 -0
- package/dist/images/method/Banks/BSN/BSN_V1_ROU.svg +4 -0
- package/dist/images/method/Banks/BSN/BSN_V1_SQU.svg +4 -0
- package/dist/images/method/Banks/BankIslam/BankIslam_SVG.svg +13 -0
- package/dist/images/method/Banks/BankIslam/BankIslam_V1_BSQU.svg +14 -0
- package/dist/images/method/Banks/BankIslam/BankIslam_V1_LG.svg +14 -0
- package/dist/images/method/Banks/BankIslam/BankIslam_V1_ROU.svg +14 -0
- package/dist/images/method/Banks/BankIslam/BankIslam_V1_SQU.svg +14 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_SVG.svg +26 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V1_BSQU.svg +24 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V1_LG.svg +24 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V1_ROU.svg +12 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V1_SQU.svg +12 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V2_BSQU.svg +26 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V2_LG.svg +27 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V2_ROU.svg +14 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V2_SQU.svg +14 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V3_ROU.svg +12 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V3_SQU.svg +12 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V4_ROU.svg +4 -0
- package/dist/images/method/Banks/BankMuamalat/BankMuamalat_V4_SQU.svg +4 -0
- package/dist/images/method/Banks/BankRakyat/BankRakyat_SVG.svg +18 -0
- package/dist/images/method/Banks/BankRakyat/BankRakyat_V1_BSQU.svg +18 -0
- package/dist/images/method/Banks/BankRakyat/BankRakyat_V1_LG.svg +18 -0
- package/dist/images/method/Banks/BankRakyat/BankRakyat_V1_ROU.svg +6 -0
- package/dist/images/method/Banks/BankRakyat/BankRakyat_V1_SQU.svg +6 -0
- package/dist/images/method/Banks/BankRakyat/BankRakyat_V2_BSQU.svg +18 -0
- package/dist/images/method/Banks/BankRakyat/BankRakyat_V2_LG.svg +18 -0
- package/dist/images/method/Banks/BankRakyat/BankRakyat_V2_ROU.svg +6 -0
- package/dist/images/method/Banks/BankRakyat/BankRakyat_V2_SQU.svg +6 -0
- package/dist/images/method/Banks/Cimb/Cimb_SVG.svg +16 -0
- package/dist/images/method/Banks/Cimb/Cimb_V1_BSQU.svg +13 -0
- package/dist/images/method/Banks/Cimb/Cimb_V1_LG.svg +13 -0
- package/dist/images/method/Banks/Cimb/Cimb_V1_ROU.svg +5 -0
- package/dist/images/method/Banks/Cimb/Cimb_V1_SQU.svg +5 -0
- package/dist/images/method/Banks/Cimb/Cimb_V2_BSQU.svg +13 -0
- package/dist/images/method/Banks/Cimb/Cimb_V2_LG.svg +13 -0
- package/dist/images/method/Banks/Cimb/Cimb_V2_ROU.svg +5 -0
- package/dist/images/method/Banks/Cimb/Cimb_V2_SQU.svg +5 -0
- package/dist/images/method/Banks/Cimb/Cimb_V3_BSQU.svg +19 -0
- package/dist/images/method/Banks/Cimb/Cimb_V3_LG.svg +19 -0
- package/dist/images/method/Banks/Cimb/Cimb_V3_ROU.svg +11 -0
- package/dist/images/method/Banks/Cimb/Cimb_V3_SQU.svg +11 -0
- package/dist/images/method/Banks/Cimb/Cimb_V4_BSQU.svg +14 -0
- package/dist/images/method/Banks/Cimb/Cimb_V4_LG.svg +14 -0
- package/dist/images/method/Banks/Cimb/Cimb_V5_LG.svg +14 -0
- package/dist/images/method/Banks/CitiBank/CitiBank_SVG.svg +4 -0
- package/dist/images/method/Banks/CitiBank/CitiBank_V1_BSQU.svg +5 -0
- package/dist/images/method/Banks/CitiBank/CitiBank_V1_LG.svg +5 -0
- package/dist/images/method/Banks/CitiBank/CitiBank_V1_ROU.svg +5 -0
- package/dist/images/method/Banks/CitiBank/CitiBank_V1_SQU.svg +5 -0
- package/dist/images/method/Banks/CitiBank/CitiBank_V2_BSQU.svg +5 -0
- package/dist/images/method/Banks/CitiBank/CitiBank_V2_LG.svg +5 -0
- package/dist/images/method/Banks/CitiBank/CitiBank_V2_ROU.svg +5 -0
- package/dist/images/method/Banks/CitiBank/CitiBank_V2_SQU.svg +5 -0
- package/dist/images/method/Banks/GXBank/GXBank_SVG.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V1_BSQU.svg +4 -0
- package/dist/images/method/Banks/GXBank/GXBank_V1_LG.svg +4 -0
- package/dist/images/method/Banks/GXBank/GXBank_V1_ROU.svg +4 -0
- package/dist/images/method/Banks/GXBank/GXBank_V1_SQU.svg +4 -0
- package/dist/images/method/Banks/GXBank/GXBank_V2_BSQU.svg +4 -0
- package/dist/images/method/Banks/GXBank/GXBank_V2_LG.svg +4 -0
- package/dist/images/method/Banks/GXBank/GXBank_V2_ROU.svg +4 -0
- package/dist/images/method/Banks/GXBank/GXBank_V2_SQU.svg +4 -0
- package/dist/images/method/Banks/GXBank/GXBank_V3_BSQU.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V3_LG.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V3_ROU.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V3_SQU.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V4_BSQU.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V4_LG.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V4_ROU.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V4_SQU.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V5_BSQU.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V5_LG.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V5_ROU.svg +10 -0
- package/dist/images/method/Banks/GXBank/GXBank_V5_SQU.svg +10 -0
- package/dist/images/method/Banks/HSBC/HSBC_SVG.svg +11 -0
- package/dist/images/method/Banks/HSBC/HSBC_V1_BSQU.svg +12 -0
- package/dist/images/method/Banks/HSBC/HSBC_V1_LG.svg +12 -0
- package/dist/images/method/Banks/HSBC/HSBC_V1_ROU.svg +8 -0
- package/dist/images/method/Banks/HSBC/HSBC_V1_SQU.svg +8 -0
- package/dist/images/method/Banks/HongLeongBank/HongLeongBank_SVG.svg +27 -0
- package/dist/images/method/Banks/HongLeongBank/HongLeongBank_V1_BSQU.svg +22 -0
- package/dist/images/method/Banks/HongLeongBank/HongLeongBank_V1_LG.svg +22 -0
- package/dist/images/method/Banks/HongLeongBank/HongLeongBank_V1_ROU.svg +9 -0
- package/dist/images/method/Banks/HongLeongBank/HongLeongBank_V1_SQU.svg +9 -0
- package/dist/images/method/Banks/HongLeongBank/HongLeongBank_V2_BSQU.svg +18 -0
- package/dist/images/method/Banks/HongLeongBank/HongLeongBank_V2_LG.svg +18 -0
- package/dist/images/method/Banks/KuwaitFinanceHouse/KuwaitFinanceHouse_SVG.svg +5 -0
- package/dist/images/method/Banks/KuwaitFinanceHouse/KuwaitFinanceHouse_V1_BSQU.svg +5 -0
- package/dist/images/method/Banks/KuwaitFinanceHouse/KuwaitFinanceHouse_V1_LG.svg +5 -0
- package/dist/images/method/Banks/KuwaitFinanceHouse/KuwaitFinanceHouse_V1_ROU.svg +4 -0
- package/dist/images/method/Banks/KuwaitFinanceHouse/KuwaitFinanceHouse_V1_SQU.svg +4 -0
- package/dist/images/method/Banks/KuwaitFinanceHouse/KuwaitFinanceHouse_V2_BSQU.svg +5 -0
- package/dist/images/method/Banks/KuwaitFinanceHouse/KuwaitFinanceHouse_V2_LG.svg +5 -0
- package/dist/images/method/Banks/KuwaitFinanceHouse/KuwaitFinanceHouse_V2_ROU.svg +4 -0
- package/dist/images/method/Banks/KuwaitFinanceHouse/KuwaitFinanceHouse_V2_SQU.svg +4 -0
- package/dist/images/method/Banks/Maybank/MayBank_SVG.svg +22 -0
- package/dist/images/method/Banks/Maybank/MayBank_V1_BSQU.svg +22 -0
- package/dist/images/method/Banks/Maybank/MayBank_V1_LG.svg +22 -0
- package/dist/images/method/Banks/Maybank/MayBank_V1_ROU.svg +15 -0
- package/dist/images/method/Banks/Maybank/MayBank_V1_SQU.svg +15 -0
- package/dist/images/method/Banks/OCBC/OCBC_SVG.svg +11 -0
- package/dist/images/method/Banks/OCBC/OCBC_V1_BSQU.svg +12 -0
- package/dist/images/method/Banks/OCBC/OCBC_V1_LG.svg +12 -0
- package/dist/images/method/Banks/OCBC/OCBC_V1_ROU.svg +4 -0
- package/dist/images/method/Banks/OCBC/OCBC_V1_SQU.svg +4 -0
- package/dist/images/method/Banks/OCBC/OCBC_V2_BSQU.svg +12 -0
- package/dist/images/method/Banks/OCBC/OCBC_V2_LG.svg +12 -0
- package/dist/images/method/Banks/OCBC/OCBC_V2_ROU.svg +4 -0
- package/dist/images/method/Banks/OCBC/OCBC_V2_SQU.svg +4 -0
- package/dist/images/method/Banks/PublicBank/PublicBank_SVG.svg +13 -0
- package/dist/images/method/Banks/PublicBank/PublicBank_V1_BSQU.svg +14 -0
- package/dist/images/method/Banks/PublicBank/PublicBank_V1_LG.svg +14 -0
- package/dist/images/method/Banks/PublicBank/PublicBank_V1_ROU.svg +4 -0
- package/dist/images/method/Banks/PublicBank/PublicBank_V1_SQU.svg +4 -0
- package/dist/images/method/Banks/RHB/RHB_SVG.svg +4 -0
- package/dist/images/method/Banks/RHB/RHB_V1_BSQU.svg +5 -0
- package/dist/images/method/Banks/RHB/RHB_V1_LG.svg +5 -0
- package/dist/images/method/Banks/RHB/RHB_V1_ROU.svg +5 -0
- package/dist/images/method/Banks/RHB/RHB_V1_SQU.svg +5 -0
- package/dist/images/method/Banks/RHB/RHB_V2_BSQU.svg +5 -0
- package/dist/images/method/Banks/RHB/RHB_V2_LG.svg +5 -0
- package/dist/images/method/Banks/RHB/RHB_V2_ROU.svg +5 -0
- package/dist/images/method/Banks/RHB/RHB_V2_SQU.svg +5 -0
- package/dist/images/method/Banks/StandardChartered/StandardChartered_SVG.svg +26 -0
- package/dist/images/method/Banks/StandardChartered/StandardChartered_V1_BSQU.svg +27 -0
- package/dist/images/method/Banks/StandardChartered/StandardChartered_V1_LG.svg +27 -0
- package/dist/images/method/Banks/StandardChartered/StandardChartered_V1_ROU.svg +10 -0
- package/dist/images/method/Banks/StandardChartered/StandardChartered_V1_SQU.svg +10 -0
- package/dist/images/method/Banks/UOB/UOB_SVG.svg +15 -0
- package/dist/images/method/Banks/UOB/UOB_V1_BSQU.svg +16 -0
- package/dist/images/method/Banks/UOB/UOB_V1_LG.svg +16 -0
- package/dist/images/method/Banks/UOB/UOB_V1_ROU.svg +4 -0
- package/dist/images/method/Banks/UOB/UOB_V1_SQU.svg +4 -0
- package/dist/images/method/Banks/UOB/UOB_V2_BSQU.svg +16 -0
- package/dist/images/method/Banks/UOB/UOB_V2_LG.svg +16 -0
- package/dist/images/method/Banks/UOB/UOB_V2_ROU.svg +4 -0
- package/dist/images/method/Banks/UOB/UOB_V2_SQU.svg +4 -0
- package/dist/images/method/Banks/UOB/UOB_V3_ROU.svg +5 -0
- package/dist/images/method/Banks/UOB/UOB_V3_SQU.svg +5 -0
- package/dist/images/method/Banks/UOB/UOB_V4_ROU.svg +5 -0
- package/dist/images/method/Banks/UOB/UOB_V4_SQU.svg +5 -0
- package/dist/images/method/Card/Gobiz/Gobiz_SVG.svg +10 -0
- package/dist/images/method/Card/Gobiz/Gobiz_V1_ROU.svg +11 -0
- package/dist/images/method/Card/Gobiz/Gobiz_V1_SQU.svg +11 -0
- package/dist/images/method/Card/Gobiz/Gobiz_V2_ROU.svg +11 -0
- package/dist/images/method/Card/Gobiz/Gobiz_V2_SQU.svg +11 -0
- package/dist/images/method/Card/Master/MASTER_SVG.svg +6 -0
- package/dist/images/method/Card/Master/MASTER_V1_ROU.svg +7 -0
- package/dist/images/method/Card/Master/MASTER_V1_SQU.svg +7 -0
- package/dist/images/method/Card/Master/MASTER_V1_TRSP.svg +6 -0
- package/dist/images/method/Card/Master/MASTER_V2_ROU.svg +7 -0
- package/dist/images/method/Card/Master/MASTER_V2_SQU.svg +7 -0
- package/dist/images/method/Card/Paydee/Paydee_SVG.svg +8 -0
- package/dist/images/method/Card/Paydee/Paydee_V1_ROU.svg +9 -0
- package/dist/images/method/Card/Paydee/Paydee_V1_SQU.svg +9 -0
- package/dist/images/method/Card/Paydee/Paydee_V2_ROU.svg +9 -0
- package/dist/images/method/Card/Paydee/Paydee_V2_SQU.svg +9 -0
- package/dist/images/method/Card/UnionPay/UNIONPAY_SVG.svg +17 -0
- package/dist/images/method/Card/UnionPay/UNIONPAY_V1_ROU.svg +18 -0
- package/dist/images/method/Card/UnionPay/UNIONPAY_V1_SQU.svg +18 -0
- package/dist/images/method/Card/UnionPay/UNIONPAY_V1_TRSP.svg +17 -0
- package/dist/images/method/Card/Visa/VISA_SVG.svg +3 -0
- package/dist/images/method/Card/Visa/VISA_V1_ROU.svg +4 -0
- package/dist/images/method/Card/Visa/VISA_V1_SQU.svg +4 -0
- package/dist/images/method/Card/Visa/VISA_V1_TRSP.svg +3 -0
- package/dist/images/method/Card/Visa/VISA_V2_ROU.svg +4 -0
- package/dist/images/method/Card/Visa/VISA_V2_SQU.svg +4 -0
- package/dist/images/method/Card/Visa/VISA_V2_TRSP.svg +3 -0
- package/dist/images/method/Mobile/ApplePay/ApplePay_SVG.svg +3 -0
- package/dist/images/method/Mobile/ApplePay/ApplePay_V1_ROU.svg +4 -0
- package/dist/images/method/Mobile/ApplePay/ApplePay_V1_SQU.svg +4 -0
- package/dist/images/method/Mobile/ApplePay/ApplePay_V1_TRSP.svg +3 -0
- package/dist/images/method/Mobile/ApplePay/ApplePay_V2_ROU.svg +4 -0
- package/dist/images/method/Mobile/ApplePay/ApplePay_V2_SQU.svg +4 -0
- package/dist/images/method/Mobile/ApplePay/ApplePay_V2_TRSP.svg +3 -0
- package/dist/images/method/Mobile/GooglePay/GooglePay_SVG.svg +7 -0
- package/dist/images/method/Mobile/GooglePay/GooglePay_V1_ROU.svg +8 -0
- package/dist/images/method/Mobile/GooglePay/GooglePay_V1_SQU.svg +8 -0
- package/dist/images/method/Mobile/GooglePay/GooglePay_V1_TRSP.svg +7 -0
- package/dist/images/method/Mobile/GooglePay/GooglePay_V2_ROU.svg +8 -0
- package/dist/images/method/Mobile/GooglePay/GooglePay_V2_SQU.svg +8 -0
- package/dist/images/method/Mobile/GooglePay/GooglePay_V2_TRSP.svg +7 -0
- package/dist/images/method/Mobile/GooglePay/GooglePay_V3_ROU.svg +7 -0
- package/dist/images/method/Mobile/GooglePay/GooglePay_V3_SQU.svg +7 -0
- package/dist/images/method/Mobile/GooglePay/GooglePay_V3_TRSP.svg +6 -0
- package/dist/images/method/Mobile/SamsungPay/SamsungPay_SVG.svg +12 -0
- package/dist/images/method/Mobile/SamsungPay/SamsungPay_V1_ROU.svg +13 -0
- package/dist/images/method/Mobile/SamsungPay/SamsungPay_V1_SQU.svg +13 -0
- package/dist/images/method/Mobile/SamsungPay/SamsungPay_V2_ROU.svg +13 -0
- package/dist/images/method/Mobile/SamsungPay/SamsungPay_V2_SQU.svg +13 -0
- package/dist/images/method/Mobile/SamsungPay/SamsungPay_V3_ROU.svg +6 -0
- package/dist/images/method/Mobile/SamsungPay/SamsungPay_V3_SQU.svg +6 -0
- package/dist/images/method/Other/DuitNow/DuitNow_SVG.svg +11 -0
- package/dist/images/method/Other/DuitNow/DuitNow_V1_ROU.svg +12 -0
- package/dist/images/method/Other/DuitNow/DuitNow_V1_SQU.svg +12 -0
- package/dist/images/method/Other/DuitNow/DuitNow_V2_ROU.svg +12 -0
- package/dist/images/method/Other/DuitNow/DuitNow_V2_SQU.svg +12 -0
- package/dist/images/method/Other/DuitNow/DuitNow_V3_ROU.svg +5 -0
- package/dist/images/method/Other/DuitNow/DuitNow_V3_SQU.svg +5 -0
- package/dist/images/method/Other/DuitNow/DuitNow_V4_ROU.svg +5 -0
- package/dist/images/method/Other/DuitNow/DuitNow_V4_SQU.svg +5 -0
- package/dist/images/method/Other/FPX/FPX_SVG.svg +28 -0
- package/dist/images/method/Other/FPX/FPX_V1_ROU.svg +29 -0
- package/dist/images/method/Other/FPX/FPX_V1_SQU.svg +29 -0
- package/dist/images/method/Other/FPX/FPX_V2_ROU.svg +8 -0
- package/dist/images/method/Other/FPX/FPX_V2_SQU.svg +8 -0
- package/dist/images/method/Other/FPX/FPX_V3_ROU.svg +5 -0
- package/dist/images/method/Other/FPX/FPX_V3_SQU.svg +5 -0
- package/dist/images/method/Other/MaybankQR/MaybankQR_V1_ROU.svg +35 -0
- package/dist/images/method/Other/MaybankQR/MaybankQR_V1_SQU.svg +35 -0
- package/dist/images/method/Other/MaybankQR/Maybank_SVG.svg +49 -0
- package/dist/images/method/Other/NetsPay/NetsPay_SVG.svg +5 -0
- package/dist/images/method/Other/NetsPay/NetsPay_V1_ROU.svg +6 -0
- package/dist/images/method/Other/NetsPay/NetsPay_V1_SQU.svg +6 -0
- package/dist/images/method/Wallet/Alipay/Alipay_SVG.svg +4 -0
- package/dist/images/method/Wallet/Alipay/Alipay_V1_ROU.svg +6 -0
- package/dist/images/method/Wallet/Alipay/Alipay_V1_SQU.svg +5 -0
- package/dist/images/method/Wallet/Alipay/Alipay_V2_ROU.svg +6 -0
- package/dist/images/method/Wallet/Alipay/Alipay_V2_SQU.svg +5 -0
- package/dist/images/method/Wallet/AlipayPlus/AlipayPlus_SVG.svg +7 -0
- package/dist/images/method/Wallet/AlipayPlus/AlipayPlus_V1_ROU.svg +8 -0
- package/dist/images/method/Wallet/AlipayPlus/AlipayPlus_V1_SQU.svg +8 -0
- package/dist/images/method/Wallet/AlipayPlus/AlipayPlus_V2_ROU.svg +6 -0
- package/dist/images/method/Wallet/AlipayPlus/AlipayPlus_V2_SQU.svg +6 -0
- package/dist/images/method/Wallet/Binfinite/Binfinite_SVG.svg +14 -0
- package/dist/images/method/Wallet/Binfinite/Binfinite_V1_ROU.svg +7 -0
- package/dist/images/method/Wallet/Binfinite/Binfinite_V1_SQU.svg +7 -0
- package/dist/images/method/Wallet/Binfinite/Binfinite_V2_ROU.svg +15 -0
- package/dist/images/method/Wallet/Binfinite/Binfinite_V2_SQU.svg +15 -0
- package/dist/images/method/Wallet/Binfinite/Binfinite_V3_ROU.svg +15 -0
- package/dist/images/method/Wallet/Binfinite/Binfinite_V3_SQU.svg +15 -0
- package/dist/images/method/Wallet/Boost/Boost_SVG.svg +10 -0
- package/dist/images/method/Wallet/Boost/Boost_V1_ROU.svg +6 -0
- package/dist/images/method/Wallet/Boost/Boost_V1_SQU.svg +6 -0
- package/dist/images/method/Wallet/Boost/Boost_V2_ROU.svg +11 -0
- package/dist/images/method/Wallet/Boost/Boost_V2_SQU.svg +11 -0
- package/dist/images/method/Wallet/Boost/Boost_V3_ROU.svg +11 -0
- package/dist/images/method/Wallet/Boost/Boost_V3_SQU.svg +11 -0
- package/dist/images/method/Wallet/FavePay/FavePay_SVG.svg +12 -0
- package/dist/images/method/Wallet/FavePay/FavePay_V1_ROU.svg +16 -0
- package/dist/images/method/Wallet/FavePay/FavePay_V1_SQU.svg +16 -0
- package/dist/images/method/Wallet/FavePay/FavePay_V2_ROU.svg +13 -0
- package/dist/images/method/Wallet/FavePay/FavePay_V2_SQU.svg +13 -0
- package/dist/images/method/Wallet/GoPayz/GoPayz_SVG.svg +12 -0
- package/dist/images/method/Wallet/GoPayz/GoPayz_V1_ROU.svg +11 -0
- package/dist/images/method/Wallet/GoPayz/GoPayz_V1_SQU.svg +11 -0
- package/dist/images/method/Wallet/GoPayz/GoPayz_V2_ROU.svg +5 -0
- package/dist/images/method/Wallet/GoPayz/GoPayz_V2_SQU.svg +5 -0
- package/dist/images/method/Wallet/GrabPay/GrabPay_SVG.svg +15 -0
- package/dist/images/method/Wallet/GrabPay/GrabPay_V1_ROU.svg +13 -0
- package/dist/images/method/Wallet/GrabPay/GrabPay_V1_SQU.svg +13 -0
- package/dist/images/method/Wallet/GrabPay/GrabPay_V2_ROU.svg +13 -0
- package/dist/images/method/Wallet/GrabPay/GrabPay_V2_SQU.svg +13 -0
- package/dist/images/method/Wallet/GrabPay/GrabPay_V3_ROU.svg +16 -0
- package/dist/images/method/Wallet/GrabPay/GrabPay_V3_SQU.svg +16 -0
- package/dist/images/method/Wallet/GrabPay/GrabPay_V4_ROU.svg +16 -0
- package/dist/images/method/Wallet/GrabPay/GrabPay_V4_SQU.svg +16 -0
- package/dist/images/method/Wallet/Lazada/Lazada_SVG.svg +44 -0
- package/dist/images/method/Wallet/Lazada/Lazada_V1_ROU.svg +39 -0
- package/dist/images/method/Wallet/Lazada/Lazada_V1_SQU.svg +39 -0
- package/dist/images/method/Wallet/Lazada/Lazada_V2_ROU.svg +45 -0
- package/dist/images/method/Wallet/Lazada/Lazada_V2_SQU.svg +45 -0
- package/dist/images/method/Wallet/MAE/MAE_SVG.svg +4 -0
- package/dist/images/method/Wallet/MAE/MAE_V1_ROU.svg +11 -0
- package/dist/images/method/Wallet/MAE/MAE_V1_SQU.svg +11 -0
- package/dist/images/method/Wallet/MCash/MCash_SVG.svg +7 -0
- package/dist/images/method/Wallet/MCash/MCash_V1_ROU.svg +8 -0
- package/dist/images/method/Wallet/MCash/MCash_V1_SQU.svg +8 -0
- package/dist/images/method/Wallet/MCash/MCash_V2_ROU.svg +8 -0
- package/dist/images/method/Wallet/MCash/MCash_V2_SQU.svg +8 -0
- package/dist/images/method/Wallet/Presto/Presto_SVG.svg +10 -0
- package/dist/images/method/Wallet/Presto/Presto_V1_ROU.svg +11 -0
- package/dist/images/method/Wallet/Presto/Presto_V1_SQU.svg +11 -0
- package/dist/images/method/Wallet/Presto/Presto_V2_ROU.svg +11 -0
- package/dist/images/method/Wallet/Presto/Presto_V2_SQU.svg +11 -0
- package/dist/images/method/Wallet/Presto/Presto_V3_ROU.svg +11 -0
- package/dist/images/method/Wallet/Presto/Presto_V3_SQU.svg +11 -0
- package/dist/images/method/Wallet/Presto/Presto_V4_ROU.svg +5 -0
- package/dist/images/method/Wallet/Presto/Presto_V4_SQU.svg +5 -0
- package/dist/images/method/Wallet/Presto/Presto_V5_ROU.svg +5 -0
- package/dist/images/method/Wallet/Presto/Presto_V5_SQU.svg +5 -0
- package/dist/images/method/Wallet/Razer/RazerPay_SVG.svg +11 -0
- package/dist/images/method/Wallet/Razer/RazerPay_V1_ROU.svg +12 -0
- package/dist/images/method/Wallet/Razer/RazerPay_V1_SQU.svg +12 -0
- package/dist/images/method/Wallet/SarawakPay/SarawakPay_SVG.svg +9 -0
- package/dist/images/method/Wallet/SarawakPay/SarawakPay_V1_ROU.svg +10 -0
- package/dist/images/method/Wallet/SarawakPay/SarawakPay_V1_SQU.svg +11 -0
- package/dist/images/method/Wallet/SarawakPay/SarawakPay_V2_ROU.svg +4 -0
- package/dist/images/method/Wallet/SarawakPay/SarawakPay_V2_SQU.svg +4 -0
- package/dist/images/method/Wallet/Senheng/Senheng_SVG.svg +9 -0
- package/dist/images/method/Wallet/Senheng/Senheng_V1_ROU.svg +4 -0
- package/dist/images/method/Wallet/Senheng/Senheng_V1_SQU.svg +4 -0
- package/dist/images/method/Wallet/Senheng/Senheng_V2_ROU.svg +4 -0
- package/dist/images/method/Wallet/Senheng/Senheng_V2_SQU.svg +4 -0
- package/dist/images/method/Wallet/Setel/Setel_SVG.svg +10 -0
- package/dist/images/method/Wallet/Setel/Setel_V1_ROU.svg +11 -0
- package/dist/images/method/Wallet/Setel/Setel_V1_SQU.svg +11 -0
- package/dist/images/method/Wallet/Setel/Setel_V2_ROU.svg +6 -0
- package/dist/images/method/Wallet/Setel/Setel_V2_SQU.svg +6 -0
- package/dist/images/method/Wallet/ShopeePay/ShopeePay_SVG.svg +13 -0
- package/dist/images/method/Wallet/ShopeePay/ShopeePay_V1_ROU.svg +14 -0
- package/dist/images/method/Wallet/ShopeePay/ShopeePay_V1_SQU.svg +14 -0
- package/dist/images/method/Wallet/ShopeePay/ShopeePay_V2_ROU.svg +12 -0
- package/dist/images/method/Wallet/ShopeePay/ShopeePay_V2_SQU.svg +12 -0
- package/dist/images/method/Wallet/ShopeePay/ShopeePay_V3_ROU.svg +5 -0
- package/dist/images/method/Wallet/ShopeePay/ShopeePay_V3_SQU.svg +5 -0
- package/dist/images/method/Wallet/ShopeePay/ShopeePay_V4_ROU.svg +5 -0
- package/dist/images/method/Wallet/ShopeePay/ShopeePay_V4_SQU.svg +5 -0
- package/dist/images/method/Wallet/TNG/TNG_SVG.svg +27 -0
- package/dist/images/method/Wallet/TNG/TNG_V1_ROU.svg +27 -0
- package/dist/images/method/Wallet/TNG/TNG_V1_SQU.svg +27 -0
- package/dist/images/method/Wallet/TaPay/TaPay_SVG.svg +25 -0
- package/dist/images/method/Wallet/TaPay/TaPay_V1_ROU.svg +25 -0
- package/dist/images/method/Wallet/TaPay/TaPay_V1_SQU.svg +25 -0
- package/dist/images/method/Wallet/TaPay/TaPay_V2_ROU.svg +25 -0
- package/dist/images/method/Wallet/TaPay/TaPay_V2_SQU.svg +25 -0
- package/dist/images/method/Wallet/Truemoney/Truemoney_SVG.svg +42 -0
- package/dist/images/method/Wallet/Truemoney/Truemoney_V1_ROU.svg +8 -0
- package/dist/images/method/Wallet/Truemoney/Truemoney_V1_SQU.svg +8 -0
- package/dist/images/method/Wallet/Truemoney/Truemoney_V2_ROU.svg +17 -0
- package/dist/images/method/Wallet/Truemoney/Truemoney_V2_SQU.svg +17 -0
- package/dist/images/method/Wallet/WechatPay/WeChat_SVG.svg +4 -0
- package/dist/images/method/Wallet/WechatPay/WeChat_V1_ROU.svg +4 -0
- package/dist/images/method/Wallet/WechatPay/WeChat_V1_SQU.svg +4 -0
- package/dist/images/method/Wallet/WechatPay/WeChat_V2_ROU.svg +4 -0
- package/dist/images/method/Wallet/WechatPay/WeChat_V2_SQU.svg +4 -0
- package/dist/images/method/Wallet/WechatPay/WeChat_V3_ROU.svg +5 -0
- package/dist/images/method/Wallet/WechatPay/WeChat_V3_SQU.svg +5 -0
- package/dist/images/method/Wallet/Zapp/Zapp_SVG.svg +6 -0
- package/dist/images/method/Wallet/Zapp/Zapp_V1_ROU.svg +7 -0
- package/dist/images/method/Wallet/Zapp/Zapp_V1_SQU.svg +7 -0
- package/dist/index-B8_4waUa.js +131 -0
- package/dist/index-CjCiGW2Y.js +61 -0
- package/dist/index-CkSi8Gnc.js +3348 -0
- package/dist/index-DvzXwr90.js +40075 -0
- package/dist/index.vue_vue_type_script_setup_true_lang-y4tchjya.js +150 -0
- package/dist/locales/en/business.json +4 -0
- package/dist/locales/en/common.json +272 -0
- package/dist/locales/en/country.json +4 -0
- package/dist/locales/en/payment.json +27 -0
- package/dist/locales/en/transaction.json +25 -0
- package/dist/locales/en/user.json +61 -0
- package/dist/locales/zh/business.json +4 -0
- package/dist/locales/zh/common.json +272 -0
- package/dist/locales/zh/country.json +6 -0
- package/dist/locales/zh/payment.json +27 -0
- package/dist/locales/zh/transaction.json +25 -0
- package/dist/locales/zh/user.json +61 -0
- package/dist/main.d.ts +1 -0
- package/dist/model/payout-account.d.ts +44 -0
- package/dist/model/transaction.d.ts +16 -0
- package/dist/moment-h96o7c8I.js +2578 -0
- package/dist/package.json +101 -0
- package/dist/plugins.d.ts +37 -0
- package/dist/router/admin.d.ts +3 -0
- package/dist/router/index.d.ts +9 -0
- package/dist/router/merchant.d.ts +3 -0
- package/dist/stores/iframe.d.ts +14 -0
- package/dist/stores/payoutAccount.d.ts +82 -0
- package/dist/style.css +1 -0
- package/dist/transaction-fdJNol6A.js +64 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -0
- package/dist/views/admin/payout-account/PayoutAccount.vue.d.ts +2 -0
- package/dist/views/admin/payout-account/PayoutAccountSetting.vue.d.ts +2 -0
- package/dist/views/admin/payout-account/cell/Bank.vue.d.ts +9 -0
- package/dist/views/admin/payout-account/cell/IsActive.vue.d.ts +9 -0
- package/dist/views/admin/payout-account/cell/PersonInCharge.vue.d.ts +9 -0
- package/dist/views/admin/payout-account/cell/Status.vue.d.ts +9 -0
- package/dist/views/admin/settlement/Settlement.vue.d.ts +2 -0
- package/dist/views/admin/settlement/SettlementTable.vue.d.ts +141 -0
- package/dist/views/admin/settlement/SettlementTransactions.vue.d.ts +12 -0
- package/dist/views/admin/settlement/cell/Actions.vue.d.ts +13 -0
- package/dist/views/admin/settlement/cell/Gateway.vue.d.ts +9 -0
- package/dist/views/admin/settlement/cell/Method.vue.d.ts +9 -0
- package/dist/views/admin/settlement/cell/Status.vue.d.ts +9 -0
- package/dist/views/admin/terminal/Terminal.vue.d.ts +2 -0
- package/dist/views/admin/terminal/TerminalBindCodeDialog.vue.d.ts +12 -0
- package/dist/views/admin/terminal/cell/Actions.vue.d.ts +15 -0
- package/dist/views/admin/terminal/cell/ID.vue.d.ts +9 -0
- package/dist/views/admin/terminal-transaction/TerminalTransaction.vue.d.ts +2 -0
- package/dist/views/admin/terminal-transaction/cell/Gateway.vue.d.ts +9 -0
- package/dist/views/admin/terminal-transaction/cell/Status.vue.d.ts +9 -0
- package/dist/views/admin/transaction/Transaction.vue.d.ts +2 -0
- package/dist/views/admin/transaction/TransactionTable.vue.d.ts +26 -0
- package/dist/views/admin/transaction/cell/Gateway.vue.d.ts +9 -0
- package/dist/views/admin/transaction/cell/Method.vue.d.ts +9 -0
- package/dist/views/admin/transaction/cell/Status.vue.d.ts +9 -0
- package/dist/views/payout-account/PayoutAccount.vue.d.ts +2 -0
- package/dist/views/payout-account/PayoutAccountDialog.vue.d.ts +92 -0
- package/dist/views/payout-account/PayoutAccountTable.vue.d.ts +161 -0
- package/dist/views/payout-account/cell/Bank.vue.d.ts +9 -0
- package/dist/views/payout-account/cell/IsActive.vue.d.ts +9 -0
- package/dist/views/payout-account/cell/PersonInCharge.vue.d.ts +9 -0
- package/dist/views/payout-account/cell/Status.vue.d.ts +9 -0
- package/dist/views/settlement/Settlement.vue.d.ts +2 -0
- package/dist/views/settlement/SettlementTable.vue.d.ts +141 -0
- package/dist/views/settlement/SettlementTransactions.vue.d.ts +12 -0
- package/dist/views/settlement/cell/Actions.vue.d.ts +13 -0
- package/dist/views/settlement/cell/Gateway.vue.d.ts +9 -0
- package/dist/views/settlement/cell/Method.vue.d.ts +9 -0
- package/dist/views/settlement/cell/Status.vue.d.ts +9 -0
- package/dist/views/transaction/Transaction.vue.d.ts +2 -0
- package/dist/views/transaction/TransactionTable.vue.d.ts +26 -0
- package/dist/views/transaction/cell/Gateway.vue.d.ts +9 -0
- package/dist/views/transaction/cell/Method.vue.d.ts +9 -0
- package/dist/views/transaction/cell/Status.vue.d.ts +9 -0
- package/package.json +101 -0
|
@@ -0,0 +1,1255 @@
|
|
|
1
|
+
var I = {
|
|
2
|
+
defaultAmount: 0,
|
|
3
|
+
defaultCurrency: "USD",
|
|
4
|
+
defaultPrecision: 2
|
|
5
|
+
}, W = {
|
|
6
|
+
globalLocale: "en-US",
|
|
7
|
+
globalFormat: "$0,0.00",
|
|
8
|
+
globalRoundingMode: "HALF_EVEN",
|
|
9
|
+
globalFormatRoundingMode: "HALF_AWAY_FROM_ZERO",
|
|
10
|
+
globalExchangeRatesApi: {
|
|
11
|
+
endpoint: void 0,
|
|
12
|
+
headers: void 0,
|
|
13
|
+
propertyPath: void 0
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
function O(t) {
|
|
17
|
+
"@babel/helpers - typeof";
|
|
18
|
+
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? O = function(i) {
|
|
19
|
+
return typeof i;
|
|
20
|
+
} : O = function(i) {
|
|
21
|
+
return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
|
|
22
|
+
}, O(t);
|
|
23
|
+
}
|
|
24
|
+
function L(t) {
|
|
25
|
+
return q(t) || z(t) || Y(t) || Z();
|
|
26
|
+
}
|
|
27
|
+
function q(t) {
|
|
28
|
+
if (Array.isArray(t)) return t;
|
|
29
|
+
}
|
|
30
|
+
function z(t) {
|
|
31
|
+
if (typeof Symbol < "u" && Symbol.iterator in Object(t)) return Array.from(t);
|
|
32
|
+
}
|
|
33
|
+
function Y(t, i) {
|
|
34
|
+
if (t) {
|
|
35
|
+
if (typeof t == "string") return C(t, i);
|
|
36
|
+
var r = Object.prototype.toString.call(t).slice(8, -1);
|
|
37
|
+
if (r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set") return Array.from(t);
|
|
38
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return C(t, i);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function C(t, i) {
|
|
42
|
+
(i == null || i > t.length) && (i = t.length);
|
|
43
|
+
for (var r = 0, n = new Array(i); r < i; r++) n[r] = t[r];
|
|
44
|
+
return n;
|
|
45
|
+
}
|
|
46
|
+
function Z() {
|
|
47
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
48
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
49
|
+
}
|
|
50
|
+
var G = {
|
|
51
|
+
/**
|
|
52
|
+
* Returns an array of Dinero objects, normalized to the same precision (the highest).
|
|
53
|
+
*
|
|
54
|
+
* @memberof module:Dinero
|
|
55
|
+
* @method
|
|
56
|
+
*
|
|
57
|
+
* @param {Dinero[]} objects - An array of Dinero objects
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // returns an array of Dinero objects
|
|
61
|
+
* // both with a precision of 3
|
|
62
|
+
* // and an amount of 1000
|
|
63
|
+
* Dinero.normalizePrecision([
|
|
64
|
+
* Dinero({ amount: 100, precision: 2 }),
|
|
65
|
+
* Dinero({ amount: 1000, precision: 3 })
|
|
66
|
+
* ])
|
|
67
|
+
*
|
|
68
|
+
* @return {Dinero[]}
|
|
69
|
+
*/
|
|
70
|
+
normalizePrecision: function(i) {
|
|
71
|
+
var r = i.reduce(function(n, e) {
|
|
72
|
+
return Math.max(n.getPrecision(), e.getPrecision());
|
|
73
|
+
});
|
|
74
|
+
return i.map(function(n) {
|
|
75
|
+
return n.getPrecision() !== r ? n.convertPrecision(r) : n;
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* Returns the smallest Dinero object from an array of Dinero objects
|
|
80
|
+
*
|
|
81
|
+
* @memberof module:Dinero
|
|
82
|
+
* @method
|
|
83
|
+
*
|
|
84
|
+
* @param {Dinero[]} objects - An array of Dinero objects
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* // returns the smallest Dinero object with amount of 500 from an array of Dinero objects with different precisions
|
|
88
|
+
* Dinero.minimum([
|
|
89
|
+
* Dinero({ amount: 500, precision: 3 }),
|
|
90
|
+
* Dinero({ amount: 100, precision: 2 })
|
|
91
|
+
* ])
|
|
92
|
+
* @example
|
|
93
|
+
* // returns the smallest Dinero object with amount of 50 from an array of Dinero objects
|
|
94
|
+
* Dinero.minimum([
|
|
95
|
+
* Dinero({ amount: 50 }),
|
|
96
|
+
* Dinero({ amount: 100 })
|
|
97
|
+
* ])
|
|
98
|
+
*
|
|
99
|
+
* @return {Dinero[]}
|
|
100
|
+
*/
|
|
101
|
+
minimum: function(i) {
|
|
102
|
+
var r = L(i), n = r[0], e = r.slice(1), u = n;
|
|
103
|
+
return e.forEach(function(g) {
|
|
104
|
+
u = u.lessThan(g) ? u : g;
|
|
105
|
+
}), u;
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* Returns the biggest Dinero object from an array of Dinero objects
|
|
109
|
+
*
|
|
110
|
+
* @memberof module:Dinero
|
|
111
|
+
* @method
|
|
112
|
+
*
|
|
113
|
+
* @param {Dinero[]} objects - An array of Dinero objects
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* // returns the biggest Dinero object with amount of 20, from an array of Dinero objects with different precisions
|
|
117
|
+
* Dinero.maximum([
|
|
118
|
+
* Dinero({ amount: 20, precision: 2 }),
|
|
119
|
+
* Dinero({ amount: 150, precision: 3 })
|
|
120
|
+
* ])
|
|
121
|
+
* @example
|
|
122
|
+
* // returns the biggest Dinero object with amount of 100, from an array of Dinero objects
|
|
123
|
+
* Dinero.maximum([
|
|
124
|
+
* Dinero({ amount: 100 }),
|
|
125
|
+
* Dinero({ amount: 50 })
|
|
126
|
+
* ])
|
|
127
|
+
*
|
|
128
|
+
* @return {Dinero[]}
|
|
129
|
+
*/
|
|
130
|
+
maximum: function(i) {
|
|
131
|
+
var r = L(i), n = r[0], e = r.slice(1), u = n;
|
|
132
|
+
return e.forEach(function(g) {
|
|
133
|
+
u = u.greaterThan(g) ? u : g;
|
|
134
|
+
}), u;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
function H(t) {
|
|
138
|
+
return !isNaN(parseInt(t)) && isFinite(t);
|
|
139
|
+
}
|
|
140
|
+
function V(t) {
|
|
141
|
+
return H(t) && t <= 100 && t >= 0;
|
|
142
|
+
}
|
|
143
|
+
function J(t) {
|
|
144
|
+
return t.length > 0 && t.every(function(i) {
|
|
145
|
+
return i >= 0;
|
|
146
|
+
}) && t.some(function(i) {
|
|
147
|
+
return i > 0;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function N(t) {
|
|
151
|
+
return t % 2 === 0;
|
|
152
|
+
}
|
|
153
|
+
function j(t) {
|
|
154
|
+
return H(t) && !Number.isInteger(t);
|
|
155
|
+
}
|
|
156
|
+
function k() {
|
|
157
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, i = t.toString();
|
|
158
|
+
if (i.indexOf("e-") > 0)
|
|
159
|
+
return parseInt(i.split("e-")[1]);
|
|
160
|
+
var r = i.split(".")[1];
|
|
161
|
+
return r ? r.length : 0;
|
|
162
|
+
}
|
|
163
|
+
function M(t) {
|
|
164
|
+
return Math.abs(t) % 1 === 0.5;
|
|
165
|
+
}
|
|
166
|
+
function X(t) {
|
|
167
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
168
|
+
return new Promise(function(r, n) {
|
|
169
|
+
var e = Object.assign(new XMLHttpRequest(), {
|
|
170
|
+
onreadystatechange: function() {
|
|
171
|
+
e.readyState === 4 && (e.status >= 200 && e.status < 400 ? r(JSON.parse(e.responseText)) : n(new Error(e.statusText)));
|
|
172
|
+
},
|
|
173
|
+
onerror: function() {
|
|
174
|
+
n(new Error("Network error"));
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
e.open("GET", t, !0), B(e, i.headers), e.send();
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function B(t) {
|
|
181
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
182
|
+
for (var r in i)
|
|
183
|
+
t.setRequestHeader(r, i[r]);
|
|
184
|
+
return t;
|
|
185
|
+
}
|
|
186
|
+
function b(t) {
|
|
187
|
+
return typeof t > "u";
|
|
188
|
+
}
|
|
189
|
+
function U(t) {
|
|
190
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ".", r = {};
|
|
191
|
+
return Object.entries(t).forEach(function(n) {
|
|
192
|
+
if (O(n[1]) === "object") {
|
|
193
|
+
var e = U(n[1]);
|
|
194
|
+
Object.entries(e).forEach(function(u) {
|
|
195
|
+
r[n[0] + i + u[0]] = u[1];
|
|
196
|
+
});
|
|
197
|
+
} else
|
|
198
|
+
r[n[0]] = n[1];
|
|
199
|
+
}), r;
|
|
200
|
+
}
|
|
201
|
+
function K(t) {
|
|
202
|
+
return !!t && (O(t) === "object" || typeof t == "function") && typeof t.then == "function";
|
|
203
|
+
}
|
|
204
|
+
function w() {
|
|
205
|
+
var t = function(n, e) {
|
|
206
|
+
var u = function(v) {
|
|
207
|
+
return Math.pow(10, k(v));
|
|
208
|
+
}, g = Math.max(u(n), u(e));
|
|
209
|
+
return Math.round(n * g) * Math.round(e * g) / (g * g);
|
|
210
|
+
}, i = {
|
|
211
|
+
HALF_ODD: function(n) {
|
|
212
|
+
var e = Math.round(n);
|
|
213
|
+
return M(n) && N(e) ? e - 1 : e;
|
|
214
|
+
},
|
|
215
|
+
HALF_EVEN: function(n) {
|
|
216
|
+
var e = Math.round(n);
|
|
217
|
+
return M(n) ? N(e) ? e : e - 1 : e;
|
|
218
|
+
},
|
|
219
|
+
HALF_UP: function(n) {
|
|
220
|
+
return Math.round(n);
|
|
221
|
+
},
|
|
222
|
+
HALF_DOWN: function(n) {
|
|
223
|
+
return M(n) ? Math.floor(n) : Math.round(n);
|
|
224
|
+
},
|
|
225
|
+
HALF_TOWARDS_ZERO: function(n) {
|
|
226
|
+
return M(n) ? Math.sign(n) * Math.floor(Math.abs(n)) : Math.round(n);
|
|
227
|
+
},
|
|
228
|
+
HALF_AWAY_FROM_ZERO: function(n) {
|
|
229
|
+
return M(n) ? Math.sign(n) * Math.ceil(Math.abs(n)) : Math.round(n);
|
|
230
|
+
},
|
|
231
|
+
DOWN: function(n) {
|
|
232
|
+
return Math.floor(n);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
return {
|
|
236
|
+
/**
|
|
237
|
+
* Returns the sum of two numbers.
|
|
238
|
+
* @ignore
|
|
239
|
+
*
|
|
240
|
+
* @param {Number} a - The first number to add.
|
|
241
|
+
* @param {Number} b - The second number to add.
|
|
242
|
+
*
|
|
243
|
+
* @return {Number}
|
|
244
|
+
*/
|
|
245
|
+
add: function(n, e) {
|
|
246
|
+
return n + e;
|
|
247
|
+
},
|
|
248
|
+
/**
|
|
249
|
+
* Returns the difference of two numbers.
|
|
250
|
+
* @ignore
|
|
251
|
+
*
|
|
252
|
+
* @param {Number} a - The first number to subtract.
|
|
253
|
+
* @param {Number} b - The second number to subtract.
|
|
254
|
+
*
|
|
255
|
+
* @return {Number}
|
|
256
|
+
*/
|
|
257
|
+
subtract: function(n, e) {
|
|
258
|
+
return n - e;
|
|
259
|
+
},
|
|
260
|
+
/**
|
|
261
|
+
* Returns the product of two numbers.
|
|
262
|
+
* @ignore
|
|
263
|
+
*
|
|
264
|
+
* @param {Number} a - The first number to multiply.
|
|
265
|
+
* @param {Number} b - The second number to multiply.
|
|
266
|
+
*
|
|
267
|
+
* @return {Number}
|
|
268
|
+
*/
|
|
269
|
+
multiply: function(n, e) {
|
|
270
|
+
return j(n) || j(e) ? t(n, e) : n * e;
|
|
271
|
+
},
|
|
272
|
+
/**
|
|
273
|
+
* Returns the quotient of two numbers.
|
|
274
|
+
* @ignore
|
|
275
|
+
*
|
|
276
|
+
* @param {Number} a - The first number to divide.
|
|
277
|
+
* @param {Number} b - The second number to divide.
|
|
278
|
+
*
|
|
279
|
+
* @return {Number}
|
|
280
|
+
*/
|
|
281
|
+
divide: function(n, e) {
|
|
282
|
+
return n / e;
|
|
283
|
+
},
|
|
284
|
+
/**
|
|
285
|
+
* Returns the remainder of two numbers.
|
|
286
|
+
* @ignore
|
|
287
|
+
*
|
|
288
|
+
* @param {Number} a - The first number to divide.
|
|
289
|
+
* @param {Number} b - The second number to divide.
|
|
290
|
+
*
|
|
291
|
+
* @return {Number}
|
|
292
|
+
*/
|
|
293
|
+
modulo: function(n, e) {
|
|
294
|
+
return n % e;
|
|
295
|
+
},
|
|
296
|
+
/**
|
|
297
|
+
* Returns a rounded number based off a specific rounding mode.
|
|
298
|
+
* @ignore
|
|
299
|
+
*
|
|
300
|
+
* @param {Number} number - The number to round.
|
|
301
|
+
* @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use.
|
|
302
|
+
*
|
|
303
|
+
* @returns {Number}
|
|
304
|
+
*/
|
|
305
|
+
round: function(n) {
|
|
306
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "HALF_EVEN";
|
|
307
|
+
return i[e](n);
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
var Q = w();
|
|
312
|
+
function tt(t) {
|
|
313
|
+
var i = /^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(t);
|
|
314
|
+
return {
|
|
315
|
+
/**
|
|
316
|
+
* Returns the matches.
|
|
317
|
+
* @ignore
|
|
318
|
+
*
|
|
319
|
+
* @return {Array}
|
|
320
|
+
*/
|
|
321
|
+
getMatches: function() {
|
|
322
|
+
return i !== null ? i.slice(1).filter(function(n) {
|
|
323
|
+
return !b(n);
|
|
324
|
+
}) : [];
|
|
325
|
+
},
|
|
326
|
+
/**
|
|
327
|
+
* Returns the amount of fraction digits to display.
|
|
328
|
+
* @ignore
|
|
329
|
+
*
|
|
330
|
+
* @return {Number}
|
|
331
|
+
*/
|
|
332
|
+
getMinimumFractionDigits: function() {
|
|
333
|
+
var n = function(u) {
|
|
334
|
+
return u === ".";
|
|
335
|
+
};
|
|
336
|
+
return b(this.getMatches().find(n)) ? 0 : this.getMatches()[Q.add(this.getMatches().findIndex(n), 1)].split("").length;
|
|
337
|
+
},
|
|
338
|
+
/**
|
|
339
|
+
* Returns the currency display mode.
|
|
340
|
+
* @ignore
|
|
341
|
+
*
|
|
342
|
+
* @return {String}
|
|
343
|
+
*/
|
|
344
|
+
getCurrencyDisplay: function() {
|
|
345
|
+
var n = {
|
|
346
|
+
USD: "code",
|
|
347
|
+
dollar: "name",
|
|
348
|
+
$: "symbol"
|
|
349
|
+
};
|
|
350
|
+
return n[this.getMatches().find(function(e) {
|
|
351
|
+
return e === "USD" || e === "dollar" || e === "$";
|
|
352
|
+
})];
|
|
353
|
+
},
|
|
354
|
+
/**
|
|
355
|
+
* Returns the formatting style.
|
|
356
|
+
* @ignore
|
|
357
|
+
*
|
|
358
|
+
* @return {String}
|
|
359
|
+
*/
|
|
360
|
+
getStyle: function() {
|
|
361
|
+
return b(this.getCurrencyDisplay(this.getMatches())) ? "decimal" : "currency";
|
|
362
|
+
},
|
|
363
|
+
/**
|
|
364
|
+
* Returns whether grouping should be used or not.
|
|
365
|
+
* @ignore
|
|
366
|
+
*
|
|
367
|
+
* @return {Boolean}
|
|
368
|
+
*/
|
|
369
|
+
getUseGrouping: function() {
|
|
370
|
+
return !b(this.getMatches().find(function(n) {
|
|
371
|
+
return n === ",";
|
|
372
|
+
}));
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
function nt(t) {
|
|
377
|
+
var i = function() {
|
|
378
|
+
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", u = arguments.length > 1 ? arguments[1] : void 0;
|
|
379
|
+
for (var g in u)
|
|
380
|
+
e = e.replace("{{".concat(g, "}}"), u[g]);
|
|
381
|
+
return e;
|
|
382
|
+
}, r = function(e, u) {
|
|
383
|
+
return X(i(t.endpoint, {
|
|
384
|
+
from: e,
|
|
385
|
+
to: u
|
|
386
|
+
}), {
|
|
387
|
+
headers: t.headers
|
|
388
|
+
});
|
|
389
|
+
};
|
|
390
|
+
return {
|
|
391
|
+
/**
|
|
392
|
+
* Returns the exchange rate.
|
|
393
|
+
* @ignore
|
|
394
|
+
*
|
|
395
|
+
* @param {String} from - The base currency.
|
|
396
|
+
* @param {String} to - The destination currency.
|
|
397
|
+
*
|
|
398
|
+
* @return {Promise}
|
|
399
|
+
*/
|
|
400
|
+
getExchangeRate: function(e, u) {
|
|
401
|
+
return (K(t.endpoint) ? t.endpoint : r(e, u)).then(function(g) {
|
|
402
|
+
return U(g)[i(t.propertyPath, {
|
|
403
|
+
from: e,
|
|
404
|
+
to: u
|
|
405
|
+
})];
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function F(t, i) {
|
|
411
|
+
var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Error;
|
|
412
|
+
if (!t) throw new r(i);
|
|
413
|
+
}
|
|
414
|
+
function et(t) {
|
|
415
|
+
F(V(t), "You must provide a numeric value between 0 and 100.", RangeError);
|
|
416
|
+
}
|
|
417
|
+
function rt(t) {
|
|
418
|
+
F(J(t), "You must provide a non-empty array of numeric values greater than 0.", TypeError);
|
|
419
|
+
}
|
|
420
|
+
function _(t) {
|
|
421
|
+
F(Number.isInteger(t), "You must provide an integer.", TypeError);
|
|
422
|
+
}
|
|
423
|
+
var c = w(), ot = function t(i) {
|
|
424
|
+
var r = Object.assign({}, {
|
|
425
|
+
amount: t.defaultAmount,
|
|
426
|
+
currency: t.defaultCurrency,
|
|
427
|
+
precision: t.defaultPrecision
|
|
428
|
+
}, i), n = r.amount, e = r.currency, u = r.precision;
|
|
429
|
+
_(n), _(u);
|
|
430
|
+
var g = t.globalLocale, R = t.globalFormat, v = t.globalRoundingMode, E = t.globalFormatRoundingMode, S = Object.assign({}, t.globalExchangeRatesApi), f = function(o) {
|
|
431
|
+
var a = Object.assign({}, Object.assign({}, {
|
|
432
|
+
amount: n,
|
|
433
|
+
currency: e,
|
|
434
|
+
precision: u
|
|
435
|
+
}, o), Object.assign({}, {
|
|
436
|
+
locale: this.locale
|
|
437
|
+
}, o));
|
|
438
|
+
return Object.assign(t({
|
|
439
|
+
amount: a.amount,
|
|
440
|
+
currency: a.currency,
|
|
441
|
+
precision: a.precision
|
|
442
|
+
}), {
|
|
443
|
+
locale: a.locale
|
|
444
|
+
});
|
|
445
|
+
}, A = function(o) {
|
|
446
|
+
F(this.hasSameCurrency(o), "You must provide a Dinero instance with the same currency.", TypeError);
|
|
447
|
+
};
|
|
448
|
+
return {
|
|
449
|
+
/**
|
|
450
|
+
* Returns the amount.
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* // returns 500
|
|
454
|
+
* Dinero({ amount: 500 }).getAmount()
|
|
455
|
+
*
|
|
456
|
+
* @return {Number}
|
|
457
|
+
*/
|
|
458
|
+
getAmount: function() {
|
|
459
|
+
return n;
|
|
460
|
+
},
|
|
461
|
+
/**
|
|
462
|
+
* Returns the currency.
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* // returns 'EUR'
|
|
466
|
+
* Dinero({ currency: 'EUR' }).getCurrency()
|
|
467
|
+
*
|
|
468
|
+
* @return {String}
|
|
469
|
+
*/
|
|
470
|
+
getCurrency: function() {
|
|
471
|
+
return e;
|
|
472
|
+
},
|
|
473
|
+
/**
|
|
474
|
+
* Returns the locale.
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* // returns 'fr-FR'
|
|
478
|
+
* Dinero().setLocale('fr-FR').getLocale()
|
|
479
|
+
*
|
|
480
|
+
* @return {String}
|
|
481
|
+
*/
|
|
482
|
+
getLocale: function() {
|
|
483
|
+
return this.locale || g;
|
|
484
|
+
},
|
|
485
|
+
/**
|
|
486
|
+
* Returns a new Dinero object with an embedded locale.
|
|
487
|
+
*
|
|
488
|
+
* @param {String} newLocale - The new locale as an {@link http://tools.ietf.org/html/rfc5646 BCP 47 language tag}.
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* // Returns a Dinero object with locale 'ja-JP'
|
|
492
|
+
* Dinero().setLocale('ja-JP')
|
|
493
|
+
*
|
|
494
|
+
* @return {Dinero}
|
|
495
|
+
*/
|
|
496
|
+
setLocale: function(o) {
|
|
497
|
+
return f.call(this, {
|
|
498
|
+
locale: o
|
|
499
|
+
});
|
|
500
|
+
},
|
|
501
|
+
/**
|
|
502
|
+
* Returns the precision.
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* // returns 3
|
|
506
|
+
* Dinero({ precision: 3 }).getPrecision()
|
|
507
|
+
*
|
|
508
|
+
* @return {Number}
|
|
509
|
+
*/
|
|
510
|
+
getPrecision: function() {
|
|
511
|
+
return u;
|
|
512
|
+
},
|
|
513
|
+
/**
|
|
514
|
+
* Returns a new Dinero object with a new precision and a converted amount.
|
|
515
|
+
*
|
|
516
|
+
* By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
|
|
517
|
+
* This can be necessary when you need to convert objects to a smaller precision.
|
|
518
|
+
*
|
|
519
|
+
* Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent conversions for safer results.
|
|
520
|
+
* You can also specify a different `roundingMode` to better fit your needs.
|
|
521
|
+
*
|
|
522
|
+
* @param {Number} newPrecision - The new precision.
|
|
523
|
+
* @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* // Returns a Dinero object with precision 3 and amount 1000
|
|
527
|
+
* Dinero({ amount: 100, precision: 2 }).convertPrecision(3)
|
|
528
|
+
*
|
|
529
|
+
* @throws {TypeError} If `newPrecision` is invalid.
|
|
530
|
+
*
|
|
531
|
+
* @return {Dinero}
|
|
532
|
+
*/
|
|
533
|
+
convertPrecision: function(o) {
|
|
534
|
+
var a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : E;
|
|
535
|
+
_(o);
|
|
536
|
+
var l = this.getPrecision(), d = o > l, h = d ? c.multiply : c.divide, m = d ? [o, l] : [l, o], p = Math.pow(10, c.subtract.apply(c, m));
|
|
537
|
+
return f.call(this, {
|
|
538
|
+
amount: c.round(h(this.getAmount(), p), a),
|
|
539
|
+
precision: o
|
|
540
|
+
});
|
|
541
|
+
},
|
|
542
|
+
/**
|
|
543
|
+
* Returns a new Dinero object that represents the sum of this and an other Dinero object.
|
|
544
|
+
*
|
|
545
|
+
* If Dinero objects have a different `precision`, they will be first converted to the highest.
|
|
546
|
+
*
|
|
547
|
+
* @param {Dinero} addend - The Dinero object to add.
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* // returns a Dinero object with amount 600
|
|
551
|
+
* Dinero({ amount: 400 }).add(Dinero({ amount: 200 }))
|
|
552
|
+
* @example
|
|
553
|
+
* // returns a Dinero object with amount 144545 and precision 4
|
|
554
|
+
* Dinero({ amount: 400 }).add(Dinero({ amount: 104545, precision: 4 }))
|
|
555
|
+
*
|
|
556
|
+
* @throws {TypeError} If `addend` has a different currency.
|
|
557
|
+
*
|
|
558
|
+
* @return {Dinero}
|
|
559
|
+
*/
|
|
560
|
+
add: function(o) {
|
|
561
|
+
A.call(this, o);
|
|
562
|
+
var a = t.normalizePrecision([this, o]);
|
|
563
|
+
return f.call(this, {
|
|
564
|
+
amount: c.add(a[0].getAmount(), a[1].getAmount()),
|
|
565
|
+
precision: a[0].getPrecision()
|
|
566
|
+
});
|
|
567
|
+
},
|
|
568
|
+
/**
|
|
569
|
+
* Returns a new Dinero object that represents the difference of this and an other Dinero object.
|
|
570
|
+
*
|
|
571
|
+
* If Dinero objects have a different `precision`, they will be first converted to the highest.
|
|
572
|
+
*
|
|
573
|
+
* @param {Dinero} subtrahend - The Dinero object to subtract.
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* // returns a Dinero object with amount 200
|
|
577
|
+
* Dinero({ amount: 400 }).subtract(Dinero({ amount: 200 }))
|
|
578
|
+
* @example
|
|
579
|
+
* // returns a Dinero object with amount 64545 and precision 4
|
|
580
|
+
* Dinero({ amount: 104545, precision: 4 }).subtract(Dinero({ amount: 400 }))
|
|
581
|
+
*
|
|
582
|
+
* @throws {TypeError} If `subtrahend` has a different currency.
|
|
583
|
+
*
|
|
584
|
+
* @return {Dinero}
|
|
585
|
+
*/
|
|
586
|
+
subtract: function(o) {
|
|
587
|
+
A.call(this, o);
|
|
588
|
+
var a = t.normalizePrecision([this, o]);
|
|
589
|
+
return f.call(this, {
|
|
590
|
+
amount: c.subtract(a[0].getAmount(), a[1].getAmount()),
|
|
591
|
+
precision: a[0].getPrecision()
|
|
592
|
+
});
|
|
593
|
+
},
|
|
594
|
+
/**
|
|
595
|
+
* Returns a new Dinero object that represents the multiplied value by the given factor.
|
|
596
|
+
*
|
|
597
|
+
* By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
|
|
598
|
+
*
|
|
599
|
+
* Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.
|
|
600
|
+
* You can also specify a different `roundingMode` to better fit your needs.
|
|
601
|
+
*
|
|
602
|
+
* @param {Number} multiplier - The factor to multiply by.
|
|
603
|
+
* @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
|
|
604
|
+
*
|
|
605
|
+
* @example
|
|
606
|
+
* // returns a Dinero object with amount 1600
|
|
607
|
+
* Dinero({ amount: 400 }).multiply(4)
|
|
608
|
+
* @example
|
|
609
|
+
* // returns a Dinero object with amount 800
|
|
610
|
+
* Dinero({ amount: 400 }).multiply(2.001)
|
|
611
|
+
* @example
|
|
612
|
+
* // returns a Dinero object with amount 801
|
|
613
|
+
* Dinero({ amount: 400 }).multiply(2.00125, 'HALF_UP')
|
|
614
|
+
*
|
|
615
|
+
* @return {Dinero}
|
|
616
|
+
*/
|
|
617
|
+
multiply: function(o) {
|
|
618
|
+
var a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : v;
|
|
619
|
+
return f.call(this, {
|
|
620
|
+
amount: c.round(c.multiply(this.getAmount(), o), a)
|
|
621
|
+
});
|
|
622
|
+
},
|
|
623
|
+
/**
|
|
624
|
+
* Returns a new Dinero object that represents the divided value by the given factor.
|
|
625
|
+
*
|
|
626
|
+
* By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
|
|
627
|
+
*
|
|
628
|
+
* Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.
|
|
629
|
+
* You can also specify a different `roundingMode` to better fit your needs.
|
|
630
|
+
*
|
|
631
|
+
* As rounding is applied, precision may be lost in the process. If you want to accurately split a Dinero object, use {@link module:Dinero~allocate allocate} instead.
|
|
632
|
+
*
|
|
633
|
+
* @param {Number} divisor - The factor to divide by.
|
|
634
|
+
* @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
|
|
635
|
+
*
|
|
636
|
+
* @example
|
|
637
|
+
* // returns a Dinero object with amount 100
|
|
638
|
+
* Dinero({ amount: 400 }).divide(4)
|
|
639
|
+
* @example
|
|
640
|
+
* // returns a Dinero object with amount 52
|
|
641
|
+
* Dinero({ amount: 105 }).divide(2)
|
|
642
|
+
* @example
|
|
643
|
+
* // returns a Dinero object with amount 53
|
|
644
|
+
* Dinero({ amount: 105 }).divide(2, 'HALF_UP')
|
|
645
|
+
*
|
|
646
|
+
* @return {Dinero}
|
|
647
|
+
*/
|
|
648
|
+
divide: function(o) {
|
|
649
|
+
var a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : v;
|
|
650
|
+
return f.call(this, {
|
|
651
|
+
amount: c.round(c.divide(this.getAmount(), o), a)
|
|
652
|
+
});
|
|
653
|
+
},
|
|
654
|
+
/**
|
|
655
|
+
* Returns a new Dinero object that represents a percentage of this.
|
|
656
|
+
*
|
|
657
|
+
* As rounding is applied, precision may be lost in the process. If you want to accurately split a Dinero object, use {@link module:Dinero~allocate allocate} instead.
|
|
658
|
+
*
|
|
659
|
+
* @param {Number} percentage - The percentage to extract (between 0 and 100).
|
|
660
|
+
* @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
|
|
661
|
+
*
|
|
662
|
+
* @example
|
|
663
|
+
* // returns a Dinero object with amount 5000
|
|
664
|
+
* Dinero({ amount: 10000 }).percentage(50)
|
|
665
|
+
* @example
|
|
666
|
+
* // returns a Dinero object with amount 29
|
|
667
|
+
* Dinero({ amount: 57 }).percentage(50, "HALF_ODD")
|
|
668
|
+
*
|
|
669
|
+
* @throws {RangeError} If `percentage` is out of range.
|
|
670
|
+
*
|
|
671
|
+
* @return {Dinero}
|
|
672
|
+
*/
|
|
673
|
+
percentage: function(o) {
|
|
674
|
+
var a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : v;
|
|
675
|
+
return et(o), this.multiply(c.divide(o, 100), a);
|
|
676
|
+
},
|
|
677
|
+
/**
|
|
678
|
+
* Allocates the amount of a Dinero object according to a list of ratios.
|
|
679
|
+
*
|
|
680
|
+
* Sometimes you need to split monetary values but percentages can't cut it without adding or losing pennies.
|
|
681
|
+
* A good example is invoicing: let's say you need to bill $1,000.03 and you want a 50% downpayment.
|
|
682
|
+
* If you use {@link module:Dinero~percentage percentage}, you'll get an accurate Dinero object but the amount won't be billable: you can't split a penny.
|
|
683
|
+
* If you round it, you'll bill a penny extra.
|
|
684
|
+
* With {@link module:Dinero~allocate allocate}, you can split a monetary amount then distribute the remainder as evenly as possible.
|
|
685
|
+
*
|
|
686
|
+
* You can use percentage style or ratio style for `ratios`: `[25, 75]` and `[1, 3]` will do the same thing.
|
|
687
|
+
*
|
|
688
|
+
* Since v1.8.0, you can use zero ratios (such as [0, 50, 50]). If there's a remainder to distribute, zero ratios are skipped and return a Dinero object with amount zero.
|
|
689
|
+
*
|
|
690
|
+
* @param {Number[]} ratios - The ratios to allocate the money to.
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* // returns an array of two Dinero objects
|
|
694
|
+
* // the first one with an amount of 502
|
|
695
|
+
* // the second one with an amount of 501
|
|
696
|
+
* Dinero({ amount: 1003 }).allocate([50, 50])
|
|
697
|
+
* @example
|
|
698
|
+
* // returns an array of two Dinero objects
|
|
699
|
+
* // the first one with an amount of 25
|
|
700
|
+
* // the second one with an amount of 75
|
|
701
|
+
* Dinero({ amount: 100 }).allocate([1, 3])
|
|
702
|
+
* @example
|
|
703
|
+
* // since version 1.8.0
|
|
704
|
+
* // returns an array of three Dinero objects
|
|
705
|
+
* // the first one with an amount of 0
|
|
706
|
+
* // the second one with an amount of 502
|
|
707
|
+
* // the third one with an amount of 501
|
|
708
|
+
* Dinero({ amount: 1003 }).allocate([0, 50, 50])
|
|
709
|
+
*
|
|
710
|
+
* @throws {TypeError} If ratios are invalid.
|
|
711
|
+
*
|
|
712
|
+
* @return {Dinero[]}
|
|
713
|
+
*/
|
|
714
|
+
allocate: function(o) {
|
|
715
|
+
var a = this;
|
|
716
|
+
rt(o);
|
|
717
|
+
for (var l = o.reduce(function(p, y) {
|
|
718
|
+
return c.add(p, y);
|
|
719
|
+
}), d = this.getAmount(), h = o.map(function(p) {
|
|
720
|
+
var y = Math.floor(c.divide(c.multiply(a.getAmount(), p), l));
|
|
721
|
+
return d = c.subtract(d, y), f.call(a, {
|
|
722
|
+
amount: y
|
|
723
|
+
});
|
|
724
|
+
}), m = 0; d > 0; )
|
|
725
|
+
o[m] > 0 && (h[m] = h[m].add(f.call(this, {
|
|
726
|
+
amount: 1
|
|
727
|
+
})), d = c.subtract(d, 1)), m += 1;
|
|
728
|
+
return h;
|
|
729
|
+
},
|
|
730
|
+
/**
|
|
731
|
+
* Returns a Promise containing a new Dinero object converted to another currency.
|
|
732
|
+
*
|
|
733
|
+
* You have two options to provide the exchange rates:
|
|
734
|
+
*
|
|
735
|
+
* 1. **Use an exchange rate REST API, and let Dinero handle the fetching and conversion.**
|
|
736
|
+
* This is a simple option if you have access to an exchange rate REST API and want Dinero to do the rest.
|
|
737
|
+
* 2. **Fetch the exchange rates on your own and provide them directly.**
|
|
738
|
+
* This is useful if you're fetching your rates from somewhere else (a file, a database), use a different protocol or query language than REST (SOAP, GraphQL) or want to fetch rates once and cache them instead of making new requests every time.
|
|
739
|
+
*
|
|
740
|
+
* **If you want to use a REST API**, you must provide a third-party endpoint yourself. Dinero doesn't come bundled with an exchange rates endpoint.
|
|
741
|
+
*
|
|
742
|
+
* Here are some exchange rate APIs you can use:
|
|
743
|
+
*
|
|
744
|
+
* * [Fixer](https://fixer.io)
|
|
745
|
+
* * [Open Exchange Rates](https://openexchangerates.org)
|
|
746
|
+
* * [Coinbase](https://api.coinbase.com/v2/exchange-rates)
|
|
747
|
+
* * More [foreign](https://github.com/toddmotto/public-apis#currency-exchange) and [crypto](https://github.com/toddmotto/public-apis#cryptocurrency) exchange rate APIs.
|
|
748
|
+
*
|
|
749
|
+
* **If you want to fetch your own rates and provide them directly**, you need to pass a promise that resolves to the exchanges rates.
|
|
750
|
+
*
|
|
751
|
+
* In both cases, you need to specify at least:
|
|
752
|
+
*
|
|
753
|
+
* * a **destination currency**: the currency in which you want to convert your Dinero object. You can specify it with `currency`.
|
|
754
|
+
* * an **endpoint**: the API URL to query exchange rates, with parameters, or a promise that resolves to the exchange rates. You can specify it with `options.endpoint`.
|
|
755
|
+
* * a **property path**: the path to access the wanted rate in your API's JSON response (or the custom promise's payload). For example, with a response of:
|
|
756
|
+
* ```json
|
|
757
|
+
* {
|
|
758
|
+
* "data": {
|
|
759
|
+
* "base": "USD",
|
|
760
|
+
* "destination": "EUR",
|
|
761
|
+
* "rate": "0.827728919"
|
|
762
|
+
* }
|
|
763
|
+
* }
|
|
764
|
+
* ```
|
|
765
|
+
* Then the property path is `'data.rate'`. You can specify it with `options.propertyPath`.
|
|
766
|
+
*
|
|
767
|
+
* The base currency (the one of your Dinero object) and the destination currency can be used as "merge tags" with the mustache syntax, respectively `{{from}}` and `{{to}}`.
|
|
768
|
+
* You can use these tags to refer to these values in `options.endpoint` and `options.propertyPath`.
|
|
769
|
+
*
|
|
770
|
+
* For example, if you need to specify the base currency as a query parameter, you can do the following:
|
|
771
|
+
*
|
|
772
|
+
* ```js
|
|
773
|
+
* {
|
|
774
|
+
* endpoint: 'https://yourexchangerates.api/latest?base={{from}}'
|
|
775
|
+
* }
|
|
776
|
+
* ```
|
|
777
|
+
*
|
|
778
|
+
* @param {String} currency - The destination currency, expressed as an {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes ISO 4217 currency code}.
|
|
779
|
+
* @param {(String|Promise)} options.endpoint - The API endpoint to retrieve exchange rates. You can substitute this with a promise that resolves to the exchanges rates if you already have them.
|
|
780
|
+
* @param {String} [options.propertyPath='rates.{{to}}'] - The property path to the rate.
|
|
781
|
+
* @param {Object} [options.headers] - The HTTP headers to provide, if needed.
|
|
782
|
+
* @param {String} [options.roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* // your global API parameters
|
|
786
|
+
* Dinero.globalExchangeRatesApi = { ... }
|
|
787
|
+
*
|
|
788
|
+
* // returns a Promise containing a Dinero object with the destination currency
|
|
789
|
+
* // and the initial amount converted to the new currency.
|
|
790
|
+
* Dinero({ amount: 500 }).convert('EUR')
|
|
791
|
+
* @example
|
|
792
|
+
* // returns a Promise containing a Dinero object,
|
|
793
|
+
* // with specific API parameters and rounding mode for this specific instance.
|
|
794
|
+
* Dinero({ amount: 500 })
|
|
795
|
+
* .convert('XBT', {
|
|
796
|
+
* endpoint: 'https://yourexchangerates.api/latest?base={{from}}',
|
|
797
|
+
* propertyPath: 'data.rates.{{to}}',
|
|
798
|
+
* headers: {
|
|
799
|
+
* 'user-key': 'xxxxxxxxx'
|
|
800
|
+
* },
|
|
801
|
+
* roundingMode: 'HALF_UP'
|
|
802
|
+
* })
|
|
803
|
+
* @example
|
|
804
|
+
* // usage with exchange rates provided as a custom promise
|
|
805
|
+
* // using the default `propertyPath` format (so it doesn't have to be specified)
|
|
806
|
+
* const rates = {
|
|
807
|
+
* rates: {
|
|
808
|
+
* EUR: 0.81162
|
|
809
|
+
* }
|
|
810
|
+
* }
|
|
811
|
+
*
|
|
812
|
+
* Dinero({ amount: 500 })
|
|
813
|
+
* .convert('EUR', {
|
|
814
|
+
* endpoint: new Promise(resolve => resolve(rates))
|
|
815
|
+
* })
|
|
816
|
+
* @example
|
|
817
|
+
* // usage with Promise.prototype.then and Promise.prototype.catch
|
|
818
|
+
* Dinero({ amount: 500 })
|
|
819
|
+
* .convert('EUR')
|
|
820
|
+
* .then(dinero => {
|
|
821
|
+
* dinero.getCurrency() // returns 'EUR'
|
|
822
|
+
* })
|
|
823
|
+
* .catch(err => {
|
|
824
|
+
* // handle errors
|
|
825
|
+
* })
|
|
826
|
+
* @example
|
|
827
|
+
* // usage with async/await
|
|
828
|
+
* (async () => {
|
|
829
|
+
* const price = await Dinero({ amount: 500 }).convert('EUR')
|
|
830
|
+
* price.getCurrency() // returns 'EUR'
|
|
831
|
+
* })()
|
|
832
|
+
*
|
|
833
|
+
* @return {Promise}
|
|
834
|
+
*/
|
|
835
|
+
convert: function(o) {
|
|
836
|
+
var a = this, l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, d = l.endpoint, h = d === void 0 ? S.endpoint : d, m = l.propertyPath, p = m === void 0 ? S.propertyPath || "rates.{{to}}" : m, y = l.headers, x = y === void 0 ? S.headers : y, P = l.roundingMode, $ = P === void 0 ? v : P, T = Object.assign({}, {
|
|
837
|
+
endpoint: h,
|
|
838
|
+
propertyPath: p,
|
|
839
|
+
headers: x,
|
|
840
|
+
roundingMode: $
|
|
841
|
+
});
|
|
842
|
+
return nt(T).getExchangeRate(this.getCurrency(), o).then(function(D) {
|
|
843
|
+
return F(!b(D), 'No rate was found for the destination currency "'.concat(o, '".'), TypeError), f.call(a, {
|
|
844
|
+
amount: c.round(c.multiply(a.getAmount(), parseFloat(D)), T.roundingMode),
|
|
845
|
+
currency: o
|
|
846
|
+
});
|
|
847
|
+
});
|
|
848
|
+
},
|
|
849
|
+
/**
|
|
850
|
+
* Checks whether the value represented by this object equals to the other.
|
|
851
|
+
*
|
|
852
|
+
* @param {Dinero} comparator - The Dinero object to compare to.
|
|
853
|
+
*
|
|
854
|
+
* @example
|
|
855
|
+
* // returns true
|
|
856
|
+
* Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))
|
|
857
|
+
* @example
|
|
858
|
+
* // returns false
|
|
859
|
+
* Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))
|
|
860
|
+
* @example
|
|
861
|
+
* // returns false
|
|
862
|
+
* Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))
|
|
863
|
+
* @example
|
|
864
|
+
* // returns false
|
|
865
|
+
* Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))
|
|
866
|
+
* @example
|
|
867
|
+
* // returns true
|
|
868
|
+
* Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))
|
|
869
|
+
* @example
|
|
870
|
+
* // returns false
|
|
871
|
+
* Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))
|
|
872
|
+
*
|
|
873
|
+
* @return {Boolean}
|
|
874
|
+
*/
|
|
875
|
+
equalsTo: function(o) {
|
|
876
|
+
return this.hasSameAmount(o) && this.hasSameCurrency(o);
|
|
877
|
+
},
|
|
878
|
+
/**
|
|
879
|
+
* Checks whether the value represented by this object is less than the other.
|
|
880
|
+
*
|
|
881
|
+
* @param {Dinero} comparator - The Dinero object to compare to.
|
|
882
|
+
*
|
|
883
|
+
* @example
|
|
884
|
+
* // returns true
|
|
885
|
+
* Dinero({ amount: 500 }).lessThan(Dinero({ amount: 800 }))
|
|
886
|
+
* @example
|
|
887
|
+
* // returns false
|
|
888
|
+
* Dinero({ amount: 800 }).lessThan(Dinero({ amount: 500 }))
|
|
889
|
+
* @example
|
|
890
|
+
* // returns true
|
|
891
|
+
* Dinero({ amount: 5000, precision: 3 }).lessThan(Dinero({ amount: 800 }))
|
|
892
|
+
* @example
|
|
893
|
+
* // returns false
|
|
894
|
+
* Dinero({ amount: 800 }).lessThan(Dinero({ amount: 5000, precision: 3 }))
|
|
895
|
+
*
|
|
896
|
+
* @throws {TypeError} If `comparator` has a different currency.
|
|
897
|
+
*
|
|
898
|
+
* @return {Boolean}
|
|
899
|
+
*/
|
|
900
|
+
lessThan: function(o) {
|
|
901
|
+
A.call(this, o);
|
|
902
|
+
var a = t.normalizePrecision([this, o]);
|
|
903
|
+
return a[0].getAmount() < a[1].getAmount();
|
|
904
|
+
},
|
|
905
|
+
/**
|
|
906
|
+
* Checks whether the value represented by this object is less than or equal to the other.
|
|
907
|
+
*
|
|
908
|
+
* @param {Dinero} comparator - The Dinero object to compare to.
|
|
909
|
+
*
|
|
910
|
+
* @example
|
|
911
|
+
* // returns true
|
|
912
|
+
* Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 800 }))
|
|
913
|
+
* @example
|
|
914
|
+
* // returns true
|
|
915
|
+
* Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 500 }))
|
|
916
|
+
* @example
|
|
917
|
+
* // returns false
|
|
918
|
+
* Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 300 }))
|
|
919
|
+
* @example
|
|
920
|
+
* // returns true
|
|
921
|
+
* Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 800 }))
|
|
922
|
+
* @example
|
|
923
|
+
* // returns true
|
|
924
|
+
* Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 500 }))
|
|
925
|
+
* @example
|
|
926
|
+
* // returns false
|
|
927
|
+
* Dinero({ amount: 800 }).lessThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
|
|
928
|
+
*
|
|
929
|
+
* @throws {TypeError} If `comparator` has a different currency.
|
|
930
|
+
*
|
|
931
|
+
* @return {Boolean}
|
|
932
|
+
*/
|
|
933
|
+
lessThanOrEqual: function(o) {
|
|
934
|
+
A.call(this, o);
|
|
935
|
+
var a = t.normalizePrecision([this, o]);
|
|
936
|
+
return a[0].getAmount() <= a[1].getAmount();
|
|
937
|
+
},
|
|
938
|
+
/**
|
|
939
|
+
* Checks whether the value represented by this object is greater than the other.
|
|
940
|
+
*
|
|
941
|
+
* @param {Dinero} comparator - The Dinero object to compare to.
|
|
942
|
+
*
|
|
943
|
+
* @example
|
|
944
|
+
* // returns false
|
|
945
|
+
* Dinero({ amount: 500 }).greaterThan(Dinero({ amount: 800 }))
|
|
946
|
+
* @example
|
|
947
|
+
* // returns true
|
|
948
|
+
* Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 500 }))
|
|
949
|
+
* @example
|
|
950
|
+
* // returns true
|
|
951
|
+
* Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 5000, precision: 3 }))
|
|
952
|
+
* @example
|
|
953
|
+
* // returns false
|
|
954
|
+
* Dinero({ amount: 5000, precision: 3 }).greaterThan(Dinero({ amount: 800 }))
|
|
955
|
+
*
|
|
956
|
+
* @throws {TypeError} If `comparator` has a different currency.
|
|
957
|
+
*
|
|
958
|
+
* @return {Boolean}
|
|
959
|
+
*/
|
|
960
|
+
greaterThan: function(o) {
|
|
961
|
+
A.call(this, o);
|
|
962
|
+
var a = t.normalizePrecision([this, o]);
|
|
963
|
+
return a[0].getAmount() > a[1].getAmount();
|
|
964
|
+
},
|
|
965
|
+
/**
|
|
966
|
+
* Checks whether the value represented by this object is greater than or equal to the other.
|
|
967
|
+
*
|
|
968
|
+
* @param {Dinero} comparator - The Dinero object to compare to.
|
|
969
|
+
*
|
|
970
|
+
* @example
|
|
971
|
+
* // returns true
|
|
972
|
+
* Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 300 }))
|
|
973
|
+
* @example
|
|
974
|
+
* // returns true
|
|
975
|
+
* Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 500 }))
|
|
976
|
+
* @example
|
|
977
|
+
* // returns false
|
|
978
|
+
* Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 800 }))
|
|
979
|
+
* @example
|
|
980
|
+
* // returns true
|
|
981
|
+
* Dinero({ amount: 800 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
|
|
982
|
+
* @example
|
|
983
|
+
* // returns true
|
|
984
|
+
* Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
|
|
985
|
+
* @example
|
|
986
|
+
* // returns false
|
|
987
|
+
* Dinero({ amount: 5000, precision: 3 }).greaterThanOrEqual(Dinero({ amount: 800 }))
|
|
988
|
+
*
|
|
989
|
+
* @throws {TypeError} If `comparator` has a different currency.
|
|
990
|
+
*
|
|
991
|
+
* @return {Boolean}
|
|
992
|
+
*/
|
|
993
|
+
greaterThanOrEqual: function(o) {
|
|
994
|
+
A.call(this, o);
|
|
995
|
+
var a = t.normalizePrecision([this, o]);
|
|
996
|
+
return a[0].getAmount() >= a[1].getAmount();
|
|
997
|
+
},
|
|
998
|
+
/**
|
|
999
|
+
* Checks if the value represented by this object is zero.
|
|
1000
|
+
*
|
|
1001
|
+
* @example
|
|
1002
|
+
* // returns true
|
|
1003
|
+
* Dinero({ amount: 0 }).isZero()
|
|
1004
|
+
* @example
|
|
1005
|
+
* // returns false
|
|
1006
|
+
* Dinero({ amount: 100 }).isZero()
|
|
1007
|
+
*
|
|
1008
|
+
* @return {Boolean}
|
|
1009
|
+
*/
|
|
1010
|
+
isZero: function() {
|
|
1011
|
+
return this.getAmount() === 0;
|
|
1012
|
+
},
|
|
1013
|
+
/**
|
|
1014
|
+
* Checks if the value represented by this object is positive.
|
|
1015
|
+
*
|
|
1016
|
+
* @example
|
|
1017
|
+
* // returns false
|
|
1018
|
+
* Dinero({ amount: -10 }).isPositive()
|
|
1019
|
+
* @example
|
|
1020
|
+
* // returns true
|
|
1021
|
+
* Dinero({ amount: 10 }).isPositive()
|
|
1022
|
+
* @example
|
|
1023
|
+
* // returns true
|
|
1024
|
+
* Dinero({ amount: 0 }).isPositive()
|
|
1025
|
+
*
|
|
1026
|
+
* @return {Boolean}
|
|
1027
|
+
*/
|
|
1028
|
+
isPositive: function() {
|
|
1029
|
+
return this.getAmount() >= 0;
|
|
1030
|
+
},
|
|
1031
|
+
/**
|
|
1032
|
+
* Checks if the value represented by this object is negative.
|
|
1033
|
+
*
|
|
1034
|
+
* @example
|
|
1035
|
+
* // returns true
|
|
1036
|
+
* Dinero({ amount: -10 }).isNegative()
|
|
1037
|
+
* @example
|
|
1038
|
+
* // returns false
|
|
1039
|
+
* Dinero({ amount: 10 }).isNegative()
|
|
1040
|
+
* @example
|
|
1041
|
+
* // returns false
|
|
1042
|
+
* Dinero({ amount: 0 }).isNegative()
|
|
1043
|
+
*
|
|
1044
|
+
* @return {Boolean}
|
|
1045
|
+
*/
|
|
1046
|
+
isNegative: function() {
|
|
1047
|
+
return this.getAmount() < 0;
|
|
1048
|
+
},
|
|
1049
|
+
/**
|
|
1050
|
+
* Checks if this has minor currency units.
|
|
1051
|
+
* Deprecates {@link module:Dinero~hasCents hasCents}.
|
|
1052
|
+
*
|
|
1053
|
+
* @example
|
|
1054
|
+
* // returns false
|
|
1055
|
+
* Dinero({ amount: 1100 }).hasSubUnits()
|
|
1056
|
+
* @example
|
|
1057
|
+
* // returns true
|
|
1058
|
+
* Dinero({ amount: 1150 }).hasSubUnits()
|
|
1059
|
+
*
|
|
1060
|
+
* @return {Boolean}
|
|
1061
|
+
*/
|
|
1062
|
+
hasSubUnits: function() {
|
|
1063
|
+
return c.modulo(this.getAmount(), Math.pow(10, u)) !== 0;
|
|
1064
|
+
},
|
|
1065
|
+
/**
|
|
1066
|
+
* Checks if this has minor currency units.
|
|
1067
|
+
*
|
|
1068
|
+
* @deprecated since version 1.4.0, will be removed in 2.0.0
|
|
1069
|
+
* Use {@link module:Dinero~hasSubUnits hasSubUnits} instead.
|
|
1070
|
+
*
|
|
1071
|
+
* @example
|
|
1072
|
+
* // returns false
|
|
1073
|
+
* Dinero({ amount: 1100 }).hasCents()
|
|
1074
|
+
* @example
|
|
1075
|
+
* // returns true
|
|
1076
|
+
* Dinero({ amount: 1150 }).hasCents()
|
|
1077
|
+
*
|
|
1078
|
+
* @return {Boolean}
|
|
1079
|
+
*/
|
|
1080
|
+
hasCents: function() {
|
|
1081
|
+
return c.modulo(this.getAmount(), Math.pow(10, u)) !== 0;
|
|
1082
|
+
},
|
|
1083
|
+
/**
|
|
1084
|
+
* Checks whether the currency represented by this object equals to the other.
|
|
1085
|
+
*
|
|
1086
|
+
* @param {Dinero} comparator - The Dinero object to compare to.
|
|
1087
|
+
*
|
|
1088
|
+
* @example
|
|
1089
|
+
* // returns true
|
|
1090
|
+
* Dinero({ amount: 2000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'EUR' }))
|
|
1091
|
+
* @example
|
|
1092
|
+
* // returns false
|
|
1093
|
+
* Dinero({ amount: 1000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'USD' }))
|
|
1094
|
+
*
|
|
1095
|
+
* @return {Boolean}
|
|
1096
|
+
*/
|
|
1097
|
+
hasSameCurrency: function(o) {
|
|
1098
|
+
return this.getCurrency() === o.getCurrency();
|
|
1099
|
+
},
|
|
1100
|
+
/**
|
|
1101
|
+
* Checks whether the amount represented by this object equals to the other.
|
|
1102
|
+
*
|
|
1103
|
+
* @param {Dinero} comparator - The Dinero object to compare to.
|
|
1104
|
+
*
|
|
1105
|
+
* @example
|
|
1106
|
+
* // returns true
|
|
1107
|
+
* Dinero({ amount: 1000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000 }))
|
|
1108
|
+
* @example
|
|
1109
|
+
* // returns false
|
|
1110
|
+
* Dinero({ amount: 2000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000, currency: 'EUR' }))
|
|
1111
|
+
* @example
|
|
1112
|
+
* // returns true
|
|
1113
|
+
* Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))
|
|
1114
|
+
* @example
|
|
1115
|
+
* // returns false
|
|
1116
|
+
* Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))
|
|
1117
|
+
*
|
|
1118
|
+
* @return {Boolean}
|
|
1119
|
+
*/
|
|
1120
|
+
hasSameAmount: function(o) {
|
|
1121
|
+
var a = t.normalizePrecision([this, o]);
|
|
1122
|
+
return a[0].getAmount() === a[1].getAmount();
|
|
1123
|
+
},
|
|
1124
|
+
/**
|
|
1125
|
+
* Returns this object formatted as a string.
|
|
1126
|
+
*
|
|
1127
|
+
* The format is a mask which defines how the output string will be formatted.
|
|
1128
|
+
* It defines whether to display a currency, in what format, how many fraction digits to display and whether to use grouping separators.
|
|
1129
|
+
* The output is formatted according to the applying locale.
|
|
1130
|
+
*
|
|
1131
|
+
* Object | Format | String
|
|
1132
|
+
* :--------------------------- | :---------------- | :---
|
|
1133
|
+
* `Dinero({ amount: 500050 })` | `'$0,0.00'` | $5,000.50
|
|
1134
|
+
* `Dinero({ amount: 500050 })` | `'$0,0'` | $5,001
|
|
1135
|
+
* `Dinero({ amount: 500050 })` | `'$0'` | $5001
|
|
1136
|
+
* `Dinero({ amount: 500050 })` | `'$0.0'` | $5000.5
|
|
1137
|
+
* `Dinero({ amount: 500050 })` | `'USD0,0.0'` | USD5,000.5
|
|
1138
|
+
* `Dinero({ amount: 500050 })` | `'0,0.0 dollar'` | 5,000.5 dollars
|
|
1139
|
+
*
|
|
1140
|
+
* Don't try to substitute the `$` sign or the `USD` code with your target currency, nor adapt the format string to the exact format you want.
|
|
1141
|
+
* The format is a mask which defines a pattern and returns a valid, localized currency string.
|
|
1142
|
+
* If you want to display the object in a custom way, either use {@link module:Dinero~getAmount getAmount}, {@link module:Dinero~toUnit toUnit} or {@link module:Dinero~toRoundedUnit toRoundedUnit} and manipulate the output string as you wish.
|
|
1143
|
+
*
|
|
1144
|
+
* {@link module:Dinero~toFormat toFormat} wraps around `Number.prototype.toLocaleString`. For that reason, **format will vary depending on how it's implemented in the end user's environment**.
|
|
1145
|
+
*
|
|
1146
|
+
* You can also use `toLocaleString` directly:
|
|
1147
|
+
* `Dinero().toRoundedUnit(digits, roundingMode).toLocaleString(locale, options)`.
|
|
1148
|
+
*
|
|
1149
|
+
* By default, amounts are rounded using the **half away from zero** rule ([commercial rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)).
|
|
1150
|
+
* You can also specify a different `roundingMode` to better fit your needs.
|
|
1151
|
+
*
|
|
1152
|
+
* @param {String} [format='$0,0.00'] - The format mask to format to.
|
|
1153
|
+
* @param {String} [roundingMode='HALF_AWAY_FROM_ZERO'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
|
|
1154
|
+
*
|
|
1155
|
+
* @example
|
|
1156
|
+
* // returns $2,000
|
|
1157
|
+
* Dinero({ amount: 200000 }).toFormat('$0,0')
|
|
1158
|
+
* @example
|
|
1159
|
+
* // returns €50.5
|
|
1160
|
+
* Dinero({ amount: 5050, currency: 'EUR' }).toFormat('$0,0.0')
|
|
1161
|
+
* @example
|
|
1162
|
+
* // returns 100 euros
|
|
1163
|
+
* Dinero({ amount: 10000, currency: 'EUR' }).setLocale('fr-FR').toFormat('0,0 dollar')
|
|
1164
|
+
* @example
|
|
1165
|
+
* // returns 2000
|
|
1166
|
+
* Dinero({ amount: 200000, currency: 'EUR' }).toFormat()
|
|
1167
|
+
* @example
|
|
1168
|
+
* // returns $10
|
|
1169
|
+
* Dinero({ amount: 1050 }).toFormat('$0', 'HALF_EVEN')
|
|
1170
|
+
*
|
|
1171
|
+
* @return {String}
|
|
1172
|
+
*/
|
|
1173
|
+
toFormat: function() {
|
|
1174
|
+
var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : R, a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : E, l = tt(o);
|
|
1175
|
+
return this.toRoundedUnit(l.getMinimumFractionDigits(), a).toLocaleString(this.getLocale(), {
|
|
1176
|
+
currencyDisplay: l.getCurrencyDisplay(),
|
|
1177
|
+
useGrouping: l.getUseGrouping(),
|
|
1178
|
+
minimumFractionDigits: l.getMinimumFractionDigits(),
|
|
1179
|
+
style: l.getStyle(),
|
|
1180
|
+
currency: this.getCurrency()
|
|
1181
|
+
});
|
|
1182
|
+
},
|
|
1183
|
+
/**
|
|
1184
|
+
* Returns the amount represented by this object in units.
|
|
1185
|
+
*
|
|
1186
|
+
* @example
|
|
1187
|
+
* // returns 10.5
|
|
1188
|
+
* Dinero({ amount: 1050 }).toUnit()
|
|
1189
|
+
* @example
|
|
1190
|
+
* // returns 10.545
|
|
1191
|
+
* Dinero({ amount: 10545, precision: 3 }).toUnit()
|
|
1192
|
+
*
|
|
1193
|
+
* @return {Number}
|
|
1194
|
+
*/
|
|
1195
|
+
toUnit: function() {
|
|
1196
|
+
return c.divide(this.getAmount(), Math.pow(10, u));
|
|
1197
|
+
},
|
|
1198
|
+
/**
|
|
1199
|
+
* Returns the amount represented by this object in rounded units.
|
|
1200
|
+
*
|
|
1201
|
+
* By default, the method uses the **half away from zero** rule ([commercial rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)).
|
|
1202
|
+
* You can also specify a different `roundingMode` to better fit your needs.
|
|
1203
|
+
*
|
|
1204
|
+
* @example
|
|
1205
|
+
* // returns 10.6
|
|
1206
|
+
* Dinero({ amount: 1055 }).toRoundedUnit(1)
|
|
1207
|
+
* @example
|
|
1208
|
+
* // returns 10
|
|
1209
|
+
* Dinero({ amount: 1050 }).toRoundedUnit(0, 'HALF_EVEN')
|
|
1210
|
+
*
|
|
1211
|
+
* @param {Number} digits - The number of fraction digits to round to.
|
|
1212
|
+
* @param {String} [roundingMode='HALF_AWAY_FROM_ZERO'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
|
|
1213
|
+
*
|
|
1214
|
+
* @return {Number}
|
|
1215
|
+
*/
|
|
1216
|
+
toRoundedUnit: function(o) {
|
|
1217
|
+
var a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : E, l = Math.pow(10, o);
|
|
1218
|
+
return c.divide(c.round(c.multiply(this.toUnit(), l), a), l);
|
|
1219
|
+
},
|
|
1220
|
+
/**
|
|
1221
|
+
* Returns the object's data as an object literal.
|
|
1222
|
+
*
|
|
1223
|
+
* @example
|
|
1224
|
+
* // returns { amount: 500, currency: 'EUR', precision: 2 }
|
|
1225
|
+
* Dinero({ amount: 500, currency: 'EUR', precision: 2 }).toObject()
|
|
1226
|
+
*
|
|
1227
|
+
* @return {Object}
|
|
1228
|
+
*/
|
|
1229
|
+
toObject: function() {
|
|
1230
|
+
return {
|
|
1231
|
+
amount: n,
|
|
1232
|
+
currency: e,
|
|
1233
|
+
precision: u
|
|
1234
|
+
};
|
|
1235
|
+
},
|
|
1236
|
+
/**
|
|
1237
|
+
* Returns the object's data as an object literal.
|
|
1238
|
+
*
|
|
1239
|
+
* Alias of {@link module:Dinero~toObject toObject}.
|
|
1240
|
+
* It is defined so that calling `JSON.stringify` on a Dinero object will automatically extract the relevant data.
|
|
1241
|
+
*
|
|
1242
|
+
* @example
|
|
1243
|
+
* // returns '{"amount":500,"currency":"EUR","precision":2}'
|
|
1244
|
+
* JSON.stringify(Dinero({ amount: 500, currency: 'EUR', precision: 2 }))
|
|
1245
|
+
*
|
|
1246
|
+
* @return {Object}
|
|
1247
|
+
*/
|
|
1248
|
+
toJSON: function() {
|
|
1249
|
+
return this.toObject();
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
}, it = Object.assign(ot, I, W, G);
|
|
1253
|
+
export {
|
|
1254
|
+
it as d
|
|
1255
|
+
};
|