@tomei/finance 0.4.12 → 0.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/.commitlintrc.json +22 -22
  2. package/.eslintrc.js +72 -72
  3. package/.husky/commit-msg +4 -4
  4. package/.husky/pre-commit +4 -4
  5. package/.prettierrc +4 -4
  6. package/CONTRIBUTING.md +30 -30
  7. package/LICENSE +21 -21
  8. package/README.md +13 -13
  9. package/configs/config.js +336 -336
  10. package/dist/config.d.ts +78 -0
  11. package/dist/config.js +13 -0
  12. package/dist/config.js.map +1 -1
  13. package/dist/finance-company/finance-company.js +5 -0
  14. package/dist/finance-company/finance-company.js.map +1 -1
  15. package/dist/tsconfig.tsbuildinfo +1 -1
  16. package/invoice-template/assets/css/style.css.map +12 -12
  17. package/invoice-template/assets/css/style.min.css +1 -1
  18. package/invoice-template/assets/img/arrow_bg.svg +11 -11
  19. package/invoice-template/assets/img/coffy_shop_img.svg +18 -18
  20. package/invoice-template/assets/img/logo_accent.svg +3 -3
  21. package/invoice-template/assets/img/logo_white.svg +4 -4
  22. package/invoice-template/assets/img/sign.svg +12 -12
  23. package/invoice-template/assets/js/html2canvas.min.js +10379 -10379
  24. package/invoice-template/assets/js/jquery.min.js +1 -1
  25. package/invoice-template/assets/sass/common/_color_variable.scss +12 -12
  26. package/invoice-template/assets/sass/common/_typography.scss +178 -178
  27. package/invoice-template/assets/sass/style.scss +12 -12
  28. package/migrations/finance-account-migration.js +97 -97
  29. package/migrations/finance-company-migration.js +29 -29
  30. package/migrations/finance-customer-migration.js +51 -51
  31. package/migrations/finance-document-item-migration.js +111 -111
  32. package/migrations/finance-document-migration.js +116 -116
  33. package/migrations/finance-payment-item-migration.js +52 -52
  34. package/migrations/finance-payment-method-migration.js +31 -31
  35. package/migrations/finance-payment-method-type-migration.js +55 -55
  36. package/migrations/finance-payment-migration.js +86 -86
  37. package/migrations/finance-post-history-migration.js +45 -45
  38. package/nest-cli.json +19 -19
  39. package/package.json +79 -79
  40. package/src/account/account.repository.ts +11 -11
  41. package/src/account/account.ts +264 -264
  42. package/src/account/interfaces/account-attr.interface.ts +31 -31
  43. package/src/account-system-entity/account-system-entity.ts +65 -65
  44. package/src/account-system-entity/post-history.repository.ts +11 -11
  45. package/src/config.ts +382 -369
  46. package/src/customer/customer.ts +276 -276
  47. package/src/customer/finance-customer.repository.ts +13 -13
  48. package/src/customer/interfaces/customer.repository.interface.ts +3 -3
  49. package/src/customer/interfaces/finance-customer-attr.interface.ts +10 -10
  50. package/src/customer/interfaces/finance-customer.repository.interface.ts +4 -4
  51. package/src/database.ts +15 -15
  52. package/src/document/document-item.repository.ts +11 -11
  53. package/src/document/document.repository.ts +11 -11
  54. package/src/document/interfaces/document-attr.interface.ts +28 -28
  55. package/src/document/interfaces/document-item-attr.interface.ts +22 -22
  56. package/src/document/interfaces/document-item.repository.interface.ts +4 -4
  57. package/src/enum/doc-type.enum.ts +8 -8
  58. package/src/enum/index.ts +17 -17
  59. package/src/enum/payment-method.enum.ts +3 -3
  60. package/src/enum/payment-type.enum.ts +4 -4
  61. package/src/finance-company/finance-company.repository.ts +11 -11
  62. package/src/finance-company/finance-company.ts +1622 -1617
  63. package/src/helpers/typeof.ts +29 -29
  64. package/src/index.ts +30 -30
  65. package/src/interfaces/account-system.interface.ts +20 -20
  66. package/src/interfaces/index.ts +3 -3
  67. package/src/models/account.entity.ts +206 -206
  68. package/src/models/customer.entity.ts +93 -93
  69. package/src/models/document-item.entity.ts +143 -143
  70. package/src/models/document.entity.ts +203 -203
  71. package/src/models/finance-company.entity.ts +25 -25
  72. package/src/models/journal-entry.entity.ts +110 -110
  73. package/src/models/ledger-transaction.entity.ts +148 -148
  74. package/src/models/payment-item.entity.ts +60 -60
  75. package/src/models/payment-method-type.entity.ts +70 -70
  76. package/src/models/payment-method.entity.ts +51 -51
  77. package/src/models/payment.entity.ts +147 -147
  78. package/src/models/post-history.entity.ts +41 -41
  79. package/src/payment/interfaces/payment-attr.interface.ts +22 -22
  80. package/src/payment/interfaces/payment-params.interface.ts +8 -8
  81. package/src/payment/payment.repository.ts +11 -11
  82. package/src/payment/payment.ts +211 -211
  83. package/src/payment-item/interfaces/payment-item-attr.interface.ts +10 -10
  84. package/src/payment-item/payment-item.repository.ts +11 -11
  85. package/src/payment-item/payment-item.ts +58 -58
  86. package/src/payment-method/payment-method.repository.ts +11 -11
  87. package/src/payment-method-type/payment-method-type.repository.ts +11 -11
  88. package/tsconfig.build.json +4 -4
  89. package/tsconfig.json +22 -22
  90. package/tslint.json +18 -18
  91. package/dist/account/entities/account.entity.d.ts +0 -26
  92. package/dist/account/entities/account.entity.js +0 -199
  93. package/dist/account/entities/account.entity.js.map +0 -1
  94. package/dist/account/entities/fee-associated-object.entity.d.ts +0 -6
  95. package/dist/account/entities/fee-associated-object.entity.js +0 -52
  96. package/dist/account/entities/fee-associated-object.entity.js.map +0 -1
  97. package/dist/account/index.d.ts +0 -6
  98. package/dist/account/index.js +0 -10
  99. package/dist/account/index.js.map +0 -1
  100. package/dist/account/interfaces/account.repository.interface.d.ts +0 -3
  101. package/dist/account/interfaces/account.repository.interface.js +0 -3
  102. package/dist/account/interfaces/account.repository.interface.js.map +0 -1
  103. package/dist/account-system-entity/index.d.ts +0 -2
  104. package/dist/account-system-entity/index.js +0 -6
  105. package/dist/account-system-entity/index.js.map +0 -1
  106. package/dist/account-system-entity/post-history.entity.d.ts +0 -11
  107. package/dist/account-system-entity/post-history.entity.js +0 -65
  108. package/dist/account-system-entity/post-history.entity.js.map +0 -1
  109. package/dist/base/account-system.interface.d.ts +0 -7
  110. package/dist/base/account-system.interface.js +0 -3
  111. package/dist/base/account-system.interface.js.map +0 -1
  112. package/dist/base/address.base.abstract.d.ts +0 -4
  113. package/dist/base/address.base.abstract.js +0 -10
  114. package/dist/base/address.base.abstract.js.map +0 -1
  115. package/dist/base/base.address.d.ts +0 -8
  116. package/dist/base/base.address.js +0 -15
  117. package/dist/base/base.address.js.map +0 -1
  118. package/dist/base/base.object.d.ts +0 -7
  119. package/dist/base/base.object.js +0 -14
  120. package/dist/base/base.object.js.map +0 -1
  121. package/dist/base/base.owner.d.ts +0 -23
  122. package/dist/base/base.owner.js +0 -34
  123. package/dist/base/base.owner.js.map +0 -1
  124. package/dist/base/base.repository.abstract.d.ts +0 -12
  125. package/dist/base/base.repository.abstract.js +0 -22
  126. package/dist/base/base.repository.abstract.js.map +0 -1
  127. package/dist/base/base.repository.interface.d.ts +0 -9
  128. package/dist/base/base.repository.interface.js +0 -3
  129. package/dist/base/base.repository.interface.js.map +0 -1
  130. package/dist/base/index.d.ts +0 -4
  131. package/dist/base/index.js +0 -10
  132. package/dist/base/index.js.map +0 -1
  133. package/dist/base/object/base.object.abstract.d.ts +0 -5
  134. package/dist/base/object/base.object.abstract.js +0 -7
  135. package/dist/base/object/base.object.abstract.js.map +0 -1
  136. package/dist/base/object/base.object.d.ts +0 -7
  137. package/dist/base/object/base.object.js +0 -14
  138. package/dist/base/object/base.object.js.map +0 -1
  139. package/dist/base/object/object.interface.d.ts +0 -4
  140. package/dist/base/object/object.interface.js +0 -3
  141. package/dist/base/object/object.interface.js.map +0 -1
  142. package/dist/base/object.base.abstract.d.ts +0 -5
  143. package/dist/base/object.base.abstract.js +0 -11
  144. package/dist/base/object.base.abstract.js.map +0 -1
  145. package/dist/base/owner/base.owner.abstract.d.ts +0 -20
  146. package/dist/base/owner/base.owner.abstract.js +0 -8
  147. package/dist/base/owner/base.owner.abstract.js.map +0 -1
  148. package/dist/base/owner/base.owner.d.ts +0 -22
  149. package/dist/base/owner/base.owner.js +0 -31
  150. package/dist/base/owner/base.owner.js.map +0 -1
  151. package/dist/base/owner/owner.interface.d.ts +0 -19
  152. package/dist/base/owner/owner.interface.js +0 -3
  153. package/dist/base/owner/owner.interface.js.map +0 -1
  154. package/dist/base/person.base.abstract.d.ts +0 -21
  155. package/dist/base/person.base.abstract.js +0 -17
  156. package/dist/base/person.base.abstract.js.map +0 -1
  157. package/dist/base/repository/base.repository.abstract.d.ts +0 -12
  158. package/dist/base/repository/base.repository.abstract.js +0 -22
  159. package/dist/base/repository/base.repository.abstract.js.map +0 -1
  160. package/dist/base/repository/base.repository.interface.d.ts +0 -9
  161. package/dist/base/repository/base.repository.interface.js +0 -3
  162. package/dist/base/repository/base.repository.interface.js.map +0 -1
  163. package/dist/customer/customer.repository.d.ts +0 -0
  164. package/dist/customer/customer.repository.js +0 -1
  165. package/dist/customer/customer.repository.js.map +0 -1
  166. package/dist/customer/entities/customer.entity.d.ts +0 -13
  167. package/dist/customer/entities/customer.entity.js +0 -111
  168. package/dist/customer/entities/customer.entity.js.map +0 -1
  169. package/dist/customer/index.d.ts +0 -7
  170. package/dist/customer/index.js +0 -10
  171. package/dist/customer/index.js.map +0 -1
  172. package/dist/document/entities/document-item.entity.d.ts +0 -27
  173. package/dist/document/entities/document-item.entity.js +0 -174
  174. package/dist/document/entities/document-item.entity.js.map +0 -1
  175. package/dist/document/entities/document.entity.d.ts +0 -22
  176. package/dist/document/entities/document.entity.js +0 -139
  177. package/dist/document/entities/document.entity.js.map +0 -1
  178. package/dist/document/index.d.ts +0 -11
  179. package/dist/document/index.js +0 -20
  180. package/dist/document/index.js.map +0 -1
  181. package/dist/document/interfaces/document.repository.interface.d.ts +0 -3
  182. package/dist/document/interfaces/document.repository.interface.js +0 -3
  183. package/dist/document/interfaces/document.repository.interface.js.map +0 -1
  184. package/dist/enum/document-type.enum.d.ts +0 -7
  185. package/dist/enum/document-type.enum.js +0 -12
  186. package/dist/enum/document-type.enum.js.map +0 -1
  187. package/dist/enum/intuit-client.enum.d.ts +0 -13
  188. package/dist/enum/intuit-client.enum.js +0 -19
  189. package/dist/enum/intuit-client.enum.js.map +0 -1
  190. package/dist/finance-company/entities/finance-company.entity.d.ts +0 -13
  191. package/dist/finance-company/entities/finance-company.entity.js +0 -113
  192. package/dist/finance-company/entities/finance-company.entity.js.map +0 -1
  193. package/dist/finance-company/finance-company.entity.d.ts +0 -13
  194. package/dist/finance-company/finance-company.entity.js +0 -66
  195. package/dist/finance-company/finance-company.entity.js.map +0 -1
  196. package/dist/finance-company/index.d.ts +0 -3
  197. package/dist/finance-company/index.js +0 -8
  198. package/dist/finance-company/index.js.map +0 -1
  199. package/dist/finance-company/interfaces/finance-company-attr.interface.d.ts +0 -10
  200. package/dist/finance-company/interfaces/finance-company-attr.interface.js +0 -3
  201. package/dist/finance-company/interfaces/finance-company-attr.interface.js.map +0 -1
  202. package/dist/finance-company/interfaces/finance-company.repository.interface.d.ts +0 -3
  203. package/dist/finance-company/interfaces/finance-company.repository.interface.js +0 -3
  204. package/dist/finance-company/interfaces/finance-company.repository.interface.js.map +0 -1
  205. package/dist/interfaces/account-system-entity.interface.d.ts +0 -7
  206. package/dist/interfaces/account-system-entity.interface.js +0 -3
  207. package/dist/interfaces/account-system-entity.interface.js.map +0 -1
  208. package/dist/interfaces/customer.repository.interface.d.ts +0 -3
  209. package/dist/interfaces/customer.repository.interface.js +0 -3
  210. package/dist/interfaces/customer.repository.interface.js.map +0 -1
  211. package/dist/interfaces/finance-customer.repository.interface.d.ts +0 -3
  212. package/dist/interfaces/finance-customer.repository.interface.js +0 -3
  213. package/dist/interfaces/finance-customer.repository.interface.js.map +0 -1
  214. package/dist/interfaces/systemConfig.interface.d.ts +0 -0
  215. package/dist/interfaces/systemConfig.interface.js +0 -1
  216. package/dist/interfaces/systemConfig.interface.js.map +0 -1
  217. package/dist/intuit-client/client.d.ts +0 -14
  218. package/dist/intuit-client/client.js +0 -44
  219. package/dist/intuit-client/client.js.map +0 -1
  220. package/dist/journal-entry/entities/journal-entry.entity.d.ts +0 -16
  221. package/dist/journal-entry/entities/journal-entry.entity.js +0 -129
  222. package/dist/journal-entry/entities/journal-entry.entity.js.map +0 -1
  223. package/dist/journal-entry/index.d.ts +0 -6
  224. package/dist/journal-entry/index.js +0 -10
  225. package/dist/journal-entry/index.js.map +0 -1
  226. package/dist/journal-entry/interfaces/journal-entry.repository.interface.d.ts +0 -10
  227. package/dist/journal-entry/interfaces/journal-entry.repository.interface.js +0 -3
  228. package/dist/journal-entry/interfaces/journal-entry.repository.interface.js.map +0 -1
  229. package/dist/ledger-transaction/entities/ledger-transaction.entity.d.ts +0 -19
  230. package/dist/ledger-transaction/entities/ledger-transaction.entity.js +0 -157
  231. package/dist/ledger-transaction/entities/ledger-transaction.entity.js.map +0 -1
  232. package/dist/ledger-transaction/index.d.ts +0 -6
  233. package/dist/ledger-transaction/index.js +0 -10
  234. package/dist/ledger-transaction/index.js.map +0 -1
  235. package/dist/payment/entities/payment-item.entity.d.ts +0 -10
  236. package/dist/payment/entities/payment-item.entity.js +0 -62
  237. package/dist/payment/entities/payment-item.entity.js.map +0 -1
  238. package/dist/payment/entities/payment.entity.d.ts +0 -25
  239. package/dist/payment/entities/payment.entity.js +0 -152
  240. package/dist/payment/entities/payment.entity.js.map +0 -1
  241. package/dist/payment/index.d.ts +0 -10
  242. package/dist/payment/index.js +0 -18
  243. package/dist/payment/index.js.map +0 -1
  244. package/dist/payment/interfaces/payment-item-attr.interface.d.ts +0 -8
  245. package/dist/payment/interfaces/payment-item-attr.interface.js +0 -7
  246. package/dist/payment/interfaces/payment-item-attr.interface.js.map +0 -1
  247. package/dist/payment/interfaces/payment-item.repository.interface.d.ts +0 -3
  248. package/dist/payment/interfaces/payment-item.repository.interface.js +0 -3
  249. package/dist/payment/interfaces/payment-item.repository.interface.js.map +0 -1
  250. package/dist/payment/interfaces/payment.repository.interface.d.ts +0 -3
  251. package/dist/payment/interfaces/payment.repository.interface.js +0 -3
  252. package/dist/payment/interfaces/payment.repository.interface.js.map +0 -1
  253. package/dist/payment/payment-item.repository.d.ts +0 -5
  254. package/dist/payment/payment-item.repository.js +0 -12
  255. package/dist/payment/payment-item.repository.js.map +0 -1
  256. package/dist/payment-item/interfaces/payment-item.repository.interface.d.ts +0 -3
  257. package/dist/payment-item/interfaces/payment-item.repository.interface.js +0 -3
  258. package/dist/payment-item/interfaces/payment-item.repository.interface.js.map +0 -1
  259. package/dist/quickbook-client/client.d.ts +0 -39
  260. package/dist/quickbook-client/client.js +0 -205
  261. package/dist/quickbook-client/client.js.map +0 -1
  262. package/dist/quickbook-client/constant.d.ts +0 -1
  263. package/dist/quickbook-client/constant.js +0 -5
  264. package/dist/quickbook-client/constant.js.map +0 -1
  265. package/dist/quickbook-client/index.d.ts +0 -5
  266. package/dist/quickbook-client/index.js +0 -6
  267. package/dist/quickbook-client/index.js.map +0 -1
  268. package/dist/quickbook-client/interfaces/quickbook-client-call-options.interface.d.ts +0 -6
  269. package/dist/quickbook-client/interfaces/quickbook-client-call-options.interface.js +0 -3
  270. package/dist/quickbook-client/interfaces/quickbook-client-call-options.interface.js.map +0 -1
  271. package/dist/quickbook-client/interfaces/quickbook-client-create-account-options.interface.d.ts +0 -9
  272. package/dist/quickbook-client/interfaces/quickbook-client-create-account-options.interface.js +0 -3
  273. package/dist/quickbook-client/interfaces/quickbook-client-create-account-options.interface.js.map +0 -1
  274. package/dist/quickbook-client/interfaces/quickbook-client-create-customer-options.interface.d.ts +0 -7
  275. package/dist/quickbook-client/interfaces/quickbook-client-create-customer-options.interface.js +0 -3
  276. package/dist/quickbook-client/interfaces/quickbook-client-create-customer-options.interface.js.map +0 -1
  277. package/dist/quickbook-client/interfaces/quickbook-client-options.interface.d.ts +0 -8
  278. package/dist/quickbook-client/interfaces/quickbook-client-options.interface.js +0 -3
  279. package/dist/quickbook-client/interfaces/quickbook-client-options.interface.js.map +0 -1
  280. package/dist/quickbook-client/quickbook-client.module-definition.d.ts +0 -2
  281. package/dist/quickbook-client/quickbook-client.module-definition.js +0 -9
  282. package/dist/quickbook-client/quickbook-client.module-definition.js.map +0 -1
  283. package/dist/quickbook-client/quickbook-client.module.d.ts +0 -6
  284. package/dist/quickbook-client/quickbook-client.module.js +0 -34
  285. package/dist/quickbook-client/quickbook-client.module.js.map +0 -1
package/src/config.ts CHANGED
@@ -1,369 +1,382 @@
1
- // eslint-disable-next-line @typescript-eslint/no-var-requires
2
- const dotenv = require('dotenv');
3
-
4
- dotenv.config();
5
-
6
- const defaultConfig = {
7
- commonApiUrl: process.env.COMMON_API_URL,
8
- accountingSystem: {
9
- quickbooks: {
10
- packageName: process.env.PACKAGE_NAME || '',
11
- accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS || '',
12
- apiUrl: process.env.API_URL || '',
13
- },
14
- xero: {
15
- packageName: process.env.PACKAGE_NAME || '',
16
- accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS || '',
17
- apiUrl: process.env.API_URL || '',
18
- },
19
- },
20
- financeCompanies: {
21
- 'TXG-FS': {
22
- companyId: process.env.COMPANYID || 'TXG-FS',
23
- companyName: process.env.COMPANYNAME || 'TXG Financial Solutions Sdn Bhd',
24
- companySystemCode: process.env.COMPSYSTEMCODE || 'Tomei-SSO',
25
- companySystemRefId: process.env.COMPSYSTEMREFID || '',
26
- accountSystemCode: process.env.ACCSYSTEMCODE || '',
27
- accountingSystem: 'quickbooks',
28
- apiKey: process.env.QUICKBOOK_API_KEY,
29
- redirectUrl: process.env.EZGOLD_REDIRECT_URL,
30
- apiSecret: process.env.QUICKBOOK_API_SECRET,
31
- paymentMethods: {
32
- cash: {
33
- id: 'CS',
34
- name: 'Cash',
35
- types: {
36
- cash: {
37
- id: 'CS-CASH',
38
- name: 'Cash',
39
- accountNo: 'CASH',
40
- processingFeeRate: 0.0,
41
- processingFeeAccountNo: 'CASH-FEE',
42
- },
43
- },
44
- },
45
- bankTransfer: {
46
- id: 'BT',
47
- name: 'Bank Transfer',
48
- types: {
49
- bankTransfer: {
50
- id: 'BT-RHB',
51
- name: 'RHB',
52
- accountNo: '19GKBA20900-01',
53
- processingFeeRate: 1.0,
54
- processingFeeAccountNo: 'RHB-FEE',
55
- },
56
- },
57
- },
58
- debitCard: {
59
- id: 'DC',
60
- name: 'Debit Card',
61
- types: {
62
- mastercard: {
63
- id: 'DC-MSC',
64
- name: 'Mastercard',
65
- accountNo: 'CURLEC',
66
- processingFeeRate: 1.5,
67
- processingFeeAccountNo: 'CURLEC-FEE',
68
- },
69
- visa: {
70
- id: 'DC-VISA',
71
- name: 'Visa',
72
- accountNo: 'CURLEC',
73
- processingFeeRate: 1.5,
74
- processingFeeAccountNo: 'CURLEC-FEE',
75
- },
76
- },
77
- },
78
- creditCard: {
79
- id: 'CC',
80
- name: 'Credit Card',
81
- types: {
82
- mastercard: {
83
- id: 'CC-MSC',
84
- name: 'Mastercard',
85
- accountNo: 'CURLEC',
86
- processingFeeRate: 2.5,
87
- processingFeeAccountNo: 'CURLEC-FEE',
88
- },
89
- visa: {
90
- id: 'CC-VISA',
91
- name: 'Visa',
92
- accountNo: 'CURLEC',
93
- processingFeeRate: 2.5,
94
- processingFeeAccountNo: 'CURLEC-FEE',
95
- },
96
- amex: {
97
- id: 'CC-AMEX',
98
- name: 'American Express',
99
- accountNo: 'CURLEC',
100
- processingFeeRate: 3.5,
101
- processingFeeAccountNo: 'CURLEC-FEE',
102
- },
103
- },
104
- },
105
- mandate: {
106
- id: 'MD',
107
- name: 'Mandate',
108
- types: {
109
- RHB: {
110
- id: 'MD-RHB',
111
- name: 'RHB Mandate',
112
- accountNo: '19GKBA20900-01',
113
- processingFeeRate: 1.0,
114
- processingFeeAccountNo: 'RHB-FEE',
115
- },
116
- },
117
- },
118
- },
119
- },
120
- 'TXG-B': {
121
- companyId: 'TXG-B',
122
- companyName: 'TXG Bullion Sdn Bhd',
123
- companySystemCode: 'Tomei-SSO',
124
- companySystemRefId: '',
125
- accountingSystem: 'quickbooks',
126
- accountSystemCode: '',
127
- apiKey: '',
128
- apiSecret: '',
129
- redirectUrl: process.env.EZGOLD_REDIRECT_URL,
130
- paymentMethods: {
131
- cash: {
132
- id: 'CS',
133
- name: 'Cash',
134
- types: {
135
- cash: {
136
- id: 'CS-CASH',
137
- name: 'Cash',
138
- accountno: '',
139
- processingFeeRate: 0.0,
140
- processingFeeAccountNo: '',
141
- },
142
- },
143
- },
144
- bankTransfer: {
145
- id: 'BT',
146
- name: 'Bank Transfer',
147
- types: {
148
- banktransfer: {
149
- id: 'BT-RHB',
150
- name: 'RHB',
151
- accountno: '',
152
- processingFeeRate: 1.0,
153
- processingFeeAccountNo: '',
154
- },
155
- },
156
- },
157
- debitCard: {
158
- id: 'DC',
159
- name: 'Debit Card',
160
- types: {
161
- mastercard: {
162
- id: 'DC-MSC',
163
- name: 'Mastercard',
164
- accountno: '',
165
- processingFeeRate: 1.5,
166
- processingFeeAccountNo: '',
167
- },
168
- visa: {
169
- id: 'DC-VISA',
170
- name: 'Visa',
171
- accountno: '',
172
- processingFeeRate: 1.5,
173
- processingFeeAccountNo: '',
174
- },
175
- },
176
- },
177
- creditCard: {
178
- id: 'CC',
179
- name: 'Credit Card',
180
- types: {
181
- mastercard: {
182
- id: 'CC-MSC',
183
- name: 'Mastercard',
184
- accountno: '',
185
- processingFeeRate: 2.5,
186
- processingFeeAccountNo: '',
187
- },
188
- visa: {
189
- id: 'CC-VISA',
190
- name: 'Visa',
191
- accountno: '',
192
- processingFeeRate: 2.5,
193
- processingFeeAccountNo: '',
194
- },
195
- amex: {
196
- id: 'CC-AMEX',
197
- name: 'American Express',
198
- accountno: '',
199
- processingFeeRate: 3.5,
200
- processingFeeAccountNo: '',
201
- },
202
- },
203
- },
204
- eWallet: {
205
- id: 'EW',
206
- name: 'E-Wallet',
207
- types: {
208
- touchngo: {
209
- id: 'EW-T&G',
210
- name: 'Touch & Go',
211
- accountno: '',
212
- processingFeeRate: 1.5,
213
- processingFeeAccountNo: '',
214
- },
215
- Boost: {
216
- id: 'EW-BOOST',
217
- name: 'Boost',
218
- accountno: '',
219
- processingFeeRate: 2.5,
220
- processingFeeAccountNo: '',
221
- },
222
- GrabPay: {
223
- id: 'EW-GRAB',
224
- name: 'GrabPay',
225
- accountno: '',
226
- processingFeeRate: 2.5,
227
- processingFeeAccountNo: '',
228
- },
229
- ShopeePay: {
230
- id: 'EW-SHOPEE',
231
- name: 'ShopeePay',
232
- accountno: '',
233
- processingFeeRate: 2.5,
234
- processingFeeAccountNo: '',
235
- },
236
- },
237
- },
238
- mandate: {
239
- id: 'MD',
240
- name: 'Mandate',
241
- types: {
242
- RHB: {
243
- id: 'MD-RHB',
244
- name: 'RHB Mandate',
245
- accountno: '',
246
- processingFeeRate: 1.0,
247
- processingFeeAccountNo: '',
248
- },
249
- },
250
- },
251
- storeCredit: {
252
- id: 'SC',
253
- name: 'Store Credit',
254
- types: {
255
- scTomei: {
256
- id: 'SC-TOMEI',
257
- name: 'Tomei Store Credit',
258
- accountno: '',
259
- processingFeeRate: 0.0,
260
- processingFeeAccountNo: '',
261
- },
262
- },
263
- },
264
- pointsRedemption: {
265
- id: 'PR',
266
- name: 'Points Redemption',
267
- types: {
268
- prTomei: {
269
- id: 'PR-TOMEI',
270
- name: 'Tomei Points Redemption',
271
- accountno: '',
272
- processingFeeRate: 0.0,
273
- processingFeeAccountNo: '',
274
- },
275
- },
276
- },
277
- voucher: {
278
- id: 'VC',
279
- name: 'Voucher',
280
- types: {
281
- gift: {
282
- id: 'VC-GF',
283
- name: 'Gift Voucher',
284
- accountno: '',
285
- processingFeeRate: 0.0,
286
- processingFeeAccountNo: '',
287
- },
288
- cash: {
289
- id: 'VC-CS',
290
- name: 'Cash Voucher',
291
- accountno: '',
292
- processingFeeRate: 0.0,
293
- processingFeeAccountNo: '',
294
- },
295
- },
296
- },
297
- },
298
- },
299
- },
300
- };
301
-
302
- const config = {
303
- development: {
304
- environment: 'development',
305
- ...defaultConfig,
306
- },
307
- test: {
308
- environment: 'test',
309
- ...defaultConfig,
310
- },
311
- staging: {
312
- environment: 'staging',
313
- ...defaultConfig,
314
- },
315
- production: {
316
- environment: 'production',
317
- ...defaultConfig,
318
- },
319
- };
320
-
321
- type Config = {
322
- commonApiUrl: string;
323
- environment: string;
324
- accountingSystem: {
325
- quickbooks: {
326
- packageName: string;
327
- accountSystemClass: string;
328
- API_Url: string;
329
- };
330
- xero: {
331
- packageName: string;
332
- accountSystemClass: string;
333
- API_Url: string;
334
- };
335
- };
336
- systemConfig: {
337
- EZC: {
338
- accountingSystem: string;
339
- companyName: string;
340
- API_Key: string;
341
- API_Secret: string;
342
- redirectUrl: string;
343
- };
344
- EZG: {
345
- accountingSystem: string;
346
- companyName: string;
347
- API_Key: string;
348
- API_Secret: string;
349
- redirectUrl: string;
350
- };
351
- };
352
- };
353
-
354
- const getConfig = () => {
355
- switch (process.env.NODE_ENV) {
356
- case 'development':
357
- return config['development'];
358
- case 'test':
359
- return config['test'];
360
- case 'staging':
361
- return config['staging'];
362
- case 'production':
363
- return config['production'];
364
- default:
365
- break;
366
- }
367
- };
368
-
369
- module.exports = () => getConfig();
1
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
2
+ const dotenv = require('dotenv');
3
+
4
+ dotenv.config();
5
+
6
+ const defaultConfig = {
7
+ commonApiUrl: process.env.COMMON_API_URL,
8
+ accountingSystem: {
9
+ quickbooks: {
10
+ packageName: process.env.PACKAGE_NAME || '',
11
+ accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS || '',
12
+ apiUrl: process.env.API_URL || '',
13
+ },
14
+ xero: {
15
+ packageName: process.env.PACKAGE_NAME || '',
16
+ accountSystemClass: process.env.ACCOUNT_SYSTEM_CLASS || '',
17
+ apiUrl: process.env.API_URL || '',
18
+ },
19
+ },
20
+ financeCompanies: {
21
+ 'TXG-FS': {
22
+ companyId: process.env.COMPANYID || 'TXG-FS',
23
+ companyName: process.env.COMPANYNAME || 'TXG Financial Solutions Sdn Bhd',
24
+ companySystemCode: process.env.COMPSYSTEMCODE || 'Tomei-SSO',
25
+ companySystemRefId: process.env.COMPSYSTEMREFID || '',
26
+ accountSystemCode: process.env.ACCSYSTEMCODE || '',
27
+ accountingSystem: 'quickbooks',
28
+ apiKey: process.env.QUICKBOOK_API_KEY,
29
+ redirectUrl: process.env.EZGOLD_REDIRECT_URL,
30
+ apiSecret: process.env.QUICKBOOK_API_SECRET,
31
+ paymentMethods: {
32
+ cash: {
33
+ id: 'CS',
34
+ name: 'Cash',
35
+ types: {
36
+ cash: {
37
+ id: 'CS-CASH',
38
+ name: 'Cash',
39
+ accountNo: 'CASH',
40
+ processingFeeRate: 0.0,
41
+ processingFeeAccountNo: 'CASH-FEE',
42
+ },
43
+ },
44
+ },
45
+ cheque: {
46
+ id: 'CQ',
47
+ name: 'Cheque',
48
+ types: {
49
+ cash: {
50
+ id: 'CQ-Cheque',
51
+ name: 'Cheque',
52
+ accountNo: 'CHEQUE',
53
+ processingFeeRate: 0.0,
54
+ processingFeeAccountNo: 'CASH-FEE',
55
+ },
56
+ },
57
+ },
58
+ bankTransfer: {
59
+ id: 'BT',
60
+ name: 'Bank Transfer',
61
+ types: {
62
+ bankTransfer: {
63
+ id: 'BT-RHB',
64
+ name: 'RHB',
65
+ accountNo: '19GKBA20900-01',
66
+ processingFeeRate: 1.0,
67
+ processingFeeAccountNo: 'RHB-FEE',
68
+ },
69
+ },
70
+ },
71
+ debitCard: {
72
+ id: 'DC',
73
+ name: 'Debit Card',
74
+ types: {
75
+ mastercard: {
76
+ id: 'DC-MSC',
77
+ name: 'Mastercard',
78
+ accountNo: 'CURLEC',
79
+ processingFeeRate: 1.5,
80
+ processingFeeAccountNo: 'CURLEC-FEE',
81
+ },
82
+ visa: {
83
+ id: 'DC-VISA',
84
+ name: 'Visa',
85
+ accountNo: 'CURLEC',
86
+ processingFeeRate: 1.5,
87
+ processingFeeAccountNo: 'CURLEC-FEE',
88
+ },
89
+ },
90
+ },
91
+ creditCard: {
92
+ id: 'CC',
93
+ name: 'Credit Card',
94
+ types: {
95
+ mastercard: {
96
+ id: 'CC-MSC',
97
+ name: 'Mastercard',
98
+ accountNo: 'CURLEC',
99
+ processingFeeRate: 2.5,
100
+ processingFeeAccountNo: 'CURLEC-FEE',
101
+ },
102
+ visa: {
103
+ id: 'CC-VISA',
104
+ name: 'Visa',
105
+ accountNo: 'CURLEC',
106
+ processingFeeRate: 2.5,
107
+ processingFeeAccountNo: 'CURLEC-FEE',
108
+ },
109
+ amex: {
110
+ id: 'CC-AMEX',
111
+ name: 'American Express',
112
+ accountNo: 'CURLEC',
113
+ processingFeeRate: 3.5,
114
+ processingFeeAccountNo: 'CURLEC-FEE',
115
+ },
116
+ },
117
+ },
118
+ mandate: {
119
+ id: 'MD',
120
+ name: 'Mandate',
121
+ types: {
122
+ RHB: {
123
+ id: 'MD-RHB',
124
+ name: 'RHB Mandate',
125
+ accountNo: '19GKBA20900-01',
126
+ processingFeeRate: 1.0,
127
+ processingFeeAccountNo: 'RHB-FEE',
128
+ },
129
+ },
130
+ },
131
+ },
132
+ },
133
+ 'TXG-B': {
134
+ companyId: 'TXG-B',
135
+ companyName: 'TXG Bullion Sdn Bhd',
136
+ companySystemCode: 'Tomei-SSO',
137
+ companySystemRefId: '',
138
+ accountingSystem: 'quickbooks',
139
+ accountSystemCode: '',
140
+ apiKey: '',
141
+ apiSecret: '',
142
+ redirectUrl: process.env.EZGOLD_REDIRECT_URL,
143
+ paymentMethods: {
144
+ cash: {
145
+ id: 'CS',
146
+ name: 'Cash',
147
+ types: {
148
+ cash: {
149
+ id: 'CS-CASH',
150
+ name: 'Cash',
151
+ accountno: '',
152
+ processingFeeRate: 0.0,
153
+ processingFeeAccountNo: '',
154
+ },
155
+ },
156
+ },
157
+ bankTransfer: {
158
+ id: 'BT',
159
+ name: 'Bank Transfer',
160
+ types: {
161
+ banktransfer: {
162
+ id: 'BT-RHB',
163
+ name: 'RHB',
164
+ accountno: '',
165
+ processingFeeRate: 1.0,
166
+ processingFeeAccountNo: '',
167
+ },
168
+ },
169
+ },
170
+ debitCard: {
171
+ id: 'DC',
172
+ name: 'Debit Card',
173
+ types: {
174
+ mastercard: {
175
+ id: 'DC-MSC',
176
+ name: 'Mastercard',
177
+ accountno: '',
178
+ processingFeeRate: 1.5,
179
+ processingFeeAccountNo: '',
180
+ },
181
+ visa: {
182
+ id: 'DC-VISA',
183
+ name: 'Visa',
184
+ accountno: '',
185
+ processingFeeRate: 1.5,
186
+ processingFeeAccountNo: '',
187
+ },
188
+ },
189
+ },
190
+ creditCard: {
191
+ id: 'CC',
192
+ name: 'Credit Card',
193
+ types: {
194
+ mastercard: {
195
+ id: 'CC-MSC',
196
+ name: 'Mastercard',
197
+ accountno: '',
198
+ processingFeeRate: 2.5,
199
+ processingFeeAccountNo: '',
200
+ },
201
+ visa: {
202
+ id: 'CC-VISA',
203
+ name: 'Visa',
204
+ accountno: '',
205
+ processingFeeRate: 2.5,
206
+ processingFeeAccountNo: '',
207
+ },
208
+ amex: {
209
+ id: 'CC-AMEX',
210
+ name: 'American Express',
211
+ accountno: '',
212
+ processingFeeRate: 3.5,
213
+ processingFeeAccountNo: '',
214
+ },
215
+ },
216
+ },
217
+ eWallet: {
218
+ id: 'EW',
219
+ name: 'E-Wallet',
220
+ types: {
221
+ touchngo: {
222
+ id: 'EW-T&G',
223
+ name: 'Touch & Go',
224
+ accountno: '',
225
+ processingFeeRate: 1.5,
226
+ processingFeeAccountNo: '',
227
+ },
228
+ Boost: {
229
+ id: 'EW-BOOST',
230
+ name: 'Boost',
231
+ accountno: '',
232
+ processingFeeRate: 2.5,
233
+ processingFeeAccountNo: '',
234
+ },
235
+ GrabPay: {
236
+ id: 'EW-GRAB',
237
+ name: 'GrabPay',
238
+ accountno: '',
239
+ processingFeeRate: 2.5,
240
+ processingFeeAccountNo: '',
241
+ },
242
+ ShopeePay: {
243
+ id: 'EW-SHOPEE',
244
+ name: 'ShopeePay',
245
+ accountno: '',
246
+ processingFeeRate: 2.5,
247
+ processingFeeAccountNo: '',
248
+ },
249
+ },
250
+ },
251
+ mandate: {
252
+ id: 'MD',
253
+ name: 'Mandate',
254
+ types: {
255
+ RHB: {
256
+ id: 'MD-RHB',
257
+ name: 'RHB Mandate',
258
+ accountno: '',
259
+ processingFeeRate: 1.0,
260
+ processingFeeAccountNo: '',
261
+ },
262
+ },
263
+ },
264
+ storeCredit: {
265
+ id: 'SC',
266
+ name: 'Store Credit',
267
+ types: {
268
+ scTomei: {
269
+ id: 'SC-TOMEI',
270
+ name: 'Tomei Store Credit',
271
+ accountno: '',
272
+ processingFeeRate: 0.0,
273
+ processingFeeAccountNo: '',
274
+ },
275
+ },
276
+ },
277
+ pointsRedemption: {
278
+ id: 'PR',
279
+ name: 'Points Redemption',
280
+ types: {
281
+ prTomei: {
282
+ id: 'PR-TOMEI',
283
+ name: 'Tomei Points Redemption',
284
+ accountno: '',
285
+ processingFeeRate: 0.0,
286
+ processingFeeAccountNo: '',
287
+ },
288
+ },
289
+ },
290
+ voucher: {
291
+ id: 'VC',
292
+ name: 'Voucher',
293
+ types: {
294
+ gift: {
295
+ id: 'VC-GF',
296
+ name: 'Gift Voucher',
297
+ accountno: '',
298
+ processingFeeRate: 0.0,
299
+ processingFeeAccountNo: '',
300
+ },
301
+ cash: {
302
+ id: 'VC-CS',
303
+ name: 'Cash Voucher',
304
+ accountno: '',
305
+ processingFeeRate: 0.0,
306
+ processingFeeAccountNo: '',
307
+ },
308
+ },
309
+ },
310
+ },
311
+ },
312
+ },
313
+ };
314
+
315
+ const config = {
316
+ development: {
317
+ environment: 'development',
318
+ ...defaultConfig,
319
+ },
320
+ test: {
321
+ environment: 'test',
322
+ ...defaultConfig,
323
+ },
324
+ staging: {
325
+ environment: 'staging',
326
+ ...defaultConfig,
327
+ },
328
+ production: {
329
+ environment: 'production',
330
+ ...defaultConfig,
331
+ },
332
+ };
333
+
334
+ type Config = {
335
+ commonApiUrl: string;
336
+ environment: string;
337
+ accountingSystem: {
338
+ quickbooks: {
339
+ packageName: string;
340
+ accountSystemClass: string;
341
+ API_Url: string;
342
+ };
343
+ xero: {
344
+ packageName: string;
345
+ accountSystemClass: string;
346
+ API_Url: string;
347
+ };
348
+ };
349
+ systemConfig: {
350
+ EZC: {
351
+ accountingSystem: string;
352
+ companyName: string;
353
+ API_Key: string;
354
+ API_Secret: string;
355
+ redirectUrl: string;
356
+ };
357
+ EZG: {
358
+ accountingSystem: string;
359
+ companyName: string;
360
+ API_Key: string;
361
+ API_Secret: string;
362
+ redirectUrl: string;
363
+ };
364
+ };
365
+ };
366
+
367
+ const getConfig = () => {
368
+ switch (process.env.NODE_ENV) {
369
+ case 'development':
370
+ return config['development'];
371
+ case 'test':
372
+ return config['test'];
373
+ case 'staging':
374
+ return config['staging'];
375
+ case 'production':
376
+ return config['production'];
377
+ default:
378
+ break;
379
+ }
380
+ };
381
+
382
+ module.exports = () => getConfig();