@tomei/finance 0.6.112 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/dist/account/account.d.ts +2 -2
  2. package/dist/account/account.d.ts.map +1 -0
  3. package/dist/account/account.js +1 -1
  4. package/dist/account/account.js.map +1 -1
  5. package/dist/account/account.repository.d.ts +1 -0
  6. package/dist/account/account.repository.d.ts.map +1 -0
  7. package/dist/account/account.repository.js +4 -1
  8. package/dist/account/account.repository.js.map +1 -1
  9. package/dist/account/interfaces/account-attr.interface.d.ts +1 -0
  10. package/dist/account/interfaces/account-attr.interface.d.ts.map +1 -0
  11. package/dist/account-system-entity/account-system-entity.d.ts +1 -0
  12. package/dist/account-system-entity/account-system-entity.d.ts.map +1 -0
  13. package/dist/account-system-entity/account-system-entity.js +4 -1
  14. package/dist/account-system-entity/account-system-entity.js.map +1 -1
  15. package/dist/account-system-entity/post-history.repository.d.ts +1 -0
  16. package/dist/account-system-entity/post-history.repository.d.ts.map +1 -0
  17. package/dist/account-system-entity/post-history.repository.js +4 -1
  18. package/dist/account-system-entity/post-history.repository.js.map +1 -1
  19. package/dist/config.d.ts +1 -0
  20. package/dist/config.d.ts.map +1 -0
  21. package/dist/config.js +17 -4
  22. package/dist/config.js.map +1 -1
  23. package/dist/customer/customer.d.ts +1 -0
  24. package/dist/customer/customer.d.ts.map +1 -0
  25. package/dist/customer/customer.js +38 -2
  26. package/dist/customer/customer.js.map +1 -1
  27. package/dist/customer/finance-customer.repository.d.ts +1 -0
  28. package/dist/customer/finance-customer.repository.d.ts.map +1 -0
  29. package/dist/customer/finance-customer.repository.js +4 -1
  30. package/dist/customer/finance-customer.repository.js.map +1 -1
  31. package/dist/customer/interfaces/customer.repository.interface.d.ts +1 -0
  32. package/dist/customer/interfaces/customer.repository.interface.d.ts.map +1 -0
  33. package/dist/customer/interfaces/finance-customer-attr.interface.d.ts +1 -0
  34. package/dist/customer/interfaces/finance-customer-attr.interface.d.ts.map +1 -0
  35. package/dist/customer/interfaces/finance-customer.repository.interface.d.ts +1 -0
  36. package/dist/customer/interfaces/finance-customer.repository.interface.d.ts.map +1 -0
  37. package/dist/database.d.ts +1 -0
  38. package/dist/database.d.ts.map +1 -0
  39. package/dist/database.js +18 -15
  40. package/dist/database.js.map +1 -1
  41. package/dist/document/document-item.d.ts +3 -2
  42. package/dist/document/document-item.d.ts.map +1 -0
  43. package/dist/document/document-item.js +1 -1
  44. package/dist/document/document-item.js.map +1 -1
  45. package/dist/document/document-item.repository.d.ts +1 -0
  46. package/dist/document/document-item.repository.d.ts.map +1 -0
  47. package/dist/document/document-item.repository.js +4 -1
  48. package/dist/document/document-item.repository.js.map +1 -1
  49. package/dist/document/document.d.ts +2 -1
  50. package/dist/document/document.d.ts.map +1 -0
  51. package/dist/document/document.js +242 -191
  52. package/dist/document/document.js.map +1 -1
  53. package/dist/document/document.repository.d.ts +1 -0
  54. package/dist/document/document.repository.d.ts.map +1 -0
  55. package/dist/document/document.repository.js +4 -1
  56. package/dist/document/document.repository.js.map +1 -1
  57. package/dist/document/interfaces/document-attr.interface.d.ts +1 -0
  58. package/dist/document/interfaces/document-attr.interface.d.ts.map +1 -0
  59. package/dist/document/interfaces/document-find-all.interface.d.ts +1 -0
  60. package/dist/document/interfaces/document-find-all.interface.d.ts.map +1 -0
  61. package/dist/document/interfaces/document-item-attr.interface.d.ts +1 -0
  62. package/dist/document/interfaces/document-item-attr.interface.d.ts.map +1 -0
  63. package/dist/document/interfaces/document-item.repository.interface.d.ts +1 -0
  64. package/dist/document/interfaces/document-item.repository.interface.d.ts.map +1 -0
  65. package/dist/document-tag/document-tag.d.ts +19 -0
  66. package/dist/document-tag/document-tag.d.ts.map +1 -0
  67. package/dist/document-tag/document-tag.js +68 -0
  68. package/dist/document-tag/document-tag.js.map +1 -0
  69. package/dist/document-tag/document-tag.repository.d.ts +6 -0
  70. package/dist/document-tag/document-tag.repository.d.ts.map +1 -0
  71. package/dist/document-tag/document-tag.repository.js +15 -0
  72. package/dist/document-tag/document-tag.repository.js.map +1 -0
  73. package/dist/document-tag/interfaces/document-tag-attr.interface.d.ts +8 -0
  74. package/dist/document-tag/interfaces/document-tag-attr.interface.d.ts.map +1 -0
  75. package/dist/document-tag/interfaces/document-tag-attr.interface.js +3 -0
  76. package/dist/document-tag/interfaces/document-tag-attr.interface.js.map +1 -0
  77. package/dist/enum/collect-payment-type.d.ts +1 -0
  78. package/dist/enum/collect-payment-type.d.ts.map +1 -0
  79. package/dist/enum/doc-type.enum.d.ts +1 -0
  80. package/dist/enum/doc-type.enum.d.ts.map +1 -0
  81. package/dist/enum/document-status.enum.d.ts +1 -0
  82. package/dist/enum/document-status.enum.d.ts.map +1 -0
  83. package/dist/enum/index.d.ts +2 -2
  84. package/dist/enum/index.d.ts.map +1 -0
  85. package/dist/enum/index.js +1 -3
  86. package/dist/enum/index.js.map +1 -1
  87. package/dist/enum/payment-method.enum.d.ts +1 -0
  88. package/dist/enum/payment-method.enum.d.ts.map +1 -0
  89. package/dist/enum/payment-status.enum.d.ts +1 -0
  90. package/dist/enum/payment-status.enum.d.ts.map +1 -0
  91. package/dist/enum/payment-type.enum.d.ts +1 -0
  92. package/dist/enum/payment-type.enum.d.ts.map +1 -0
  93. package/dist/enum/quick-book-client-scopes.enum.d.ts +1 -0
  94. package/dist/enum/quick-book-client-scopes.enum.d.ts.map +1 -0
  95. package/dist/enum/quick-book-client-scopes.enum.js +34 -1
  96. package/dist/enum/quick-book-client-scopes.enum.js.map +1 -1
  97. package/dist/enum/transaction-type.enum.d.ts +1 -0
  98. package/dist/enum/transaction-type.enum.d.ts.map +1 -0
  99. package/dist/finance-company/finance-company.d.ts +21 -18
  100. package/dist/finance-company/finance-company.d.ts.map +1 -0
  101. package/dist/finance-company/finance-company.js +89 -23
  102. package/dist/finance-company/finance-company.js.map +1 -1
  103. package/dist/finance-company/finance-company.repository.d.ts +1 -0
  104. package/dist/finance-company/finance-company.repository.d.ts.map +1 -0
  105. package/dist/finance-company/finance-company.repository.js +4 -1
  106. package/dist/finance-company/finance-company.repository.js.map +1 -1
  107. package/dist/helpers/login-user.d.ts +1 -0
  108. package/dist/helpers/login-user.d.ts.map +1 -0
  109. package/dist/helpers/typeof.d.ts +1 -0
  110. package/dist/helpers/typeof.d.ts.map +1 -0
  111. package/dist/index.d.ts +1 -0
  112. package/dist/index.d.ts.map +1 -0
  113. package/dist/index.js +51 -15
  114. package/dist/index.js.map +1 -1
  115. package/dist/interfaces/account-system.interface.d.ts +4 -0
  116. package/dist/interfaces/account-system.interface.d.ts.map +1 -0
  117. package/dist/interfaces/index.d.ts +1 -0
  118. package/dist/interfaces/index.d.ts.map +1 -0
  119. package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts +1 -0
  120. package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts.map +1 -0
  121. package/dist/journal-entry/journal-entry.d.ts +1 -0
  122. package/dist/journal-entry/journal-entry.d.ts.map +1 -0
  123. package/dist/journal-entry/journal-entry.js +4 -1
  124. package/dist/journal-entry/journal-entry.js.map +1 -1
  125. package/dist/journal-entry/journal-entry.repository.d.ts +1 -0
  126. package/dist/journal-entry/journal-entry.repository.d.ts.map +1 -0
  127. package/dist/journal-entry/journal-entry.repository.js +4 -1
  128. package/dist/journal-entry/journal-entry.repository.js.map +1 -1
  129. package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +1 -0
  130. package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts.map +1 -0
  131. package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts +1 -0
  132. package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts.map +1 -0
  133. package/dist/ledger-transaction/ledger-transaction.d.ts +1 -0
  134. package/dist/ledger-transaction/ledger-transaction.d.ts.map +1 -0
  135. package/dist/ledger-transaction/ledger-transaction.repository.d.ts +1 -0
  136. package/dist/ledger-transaction/ledger-transaction.repository.d.ts.map +1 -0
  137. package/dist/ledger-transaction/ledger-transaction.repository.js +4 -1
  138. package/dist/ledger-transaction/ledger-transaction.repository.js.map +1 -1
  139. package/dist/models/account.entity.d.ts +1 -0
  140. package/dist/models/account.entity.d.ts.map +1 -0
  141. package/dist/models/account.entity.js +7 -4
  142. package/dist/models/account.entity.js.map +1 -1
  143. package/dist/models/customer.entity.d.ts +1 -0
  144. package/dist/models/customer.entity.d.ts.map +1 -0
  145. package/dist/models/customer.entity.js +4 -1
  146. package/dist/models/customer.entity.js.map +1 -1
  147. package/dist/models/document-item.entity.d.ts +1 -0
  148. package/dist/models/document-item.entity.d.ts.map +1 -0
  149. package/dist/models/document-item.entity.js +5 -2
  150. package/dist/models/document-item.entity.js.map +1 -1
  151. package/dist/models/document-tag.entity.d.ts +14 -0
  152. package/dist/models/document-tag.entity.d.ts.map +1 -0
  153. package/dist/models/document-tag.entity.js +64 -0
  154. package/dist/models/document-tag.entity.js.map +1 -0
  155. package/dist/models/document.entity.d.ts +3 -0
  156. package/dist/models/document.entity.d.ts.map +1 -0
  157. package/dist/models/document.entity.js +12 -4
  158. package/dist/models/document.entity.js.map +1 -1
  159. package/dist/models/finance-company.entity.d.ts +1 -0
  160. package/dist/models/finance-company.entity.d.ts.map +1 -0
  161. package/dist/models/finance-company.entity.js +5 -2
  162. package/dist/models/finance-company.entity.js.map +1 -1
  163. package/dist/models/journal-entry.entity.d.ts +1 -0
  164. package/dist/models/journal-entry.entity.d.ts.map +1 -0
  165. package/dist/models/journal-entry.entity.js +5 -2
  166. package/dist/models/journal-entry.entity.js.map +1 -1
  167. package/dist/models/ledger-transaction.entity.d.ts +1 -0
  168. package/dist/models/ledger-transaction.entity.d.ts.map +1 -0
  169. package/dist/models/ledger-transaction.entity.js +7 -4
  170. package/dist/models/ledger-transaction.entity.js.map +1 -1
  171. package/dist/models/payment-item.entity.d.ts +1 -0
  172. package/dist/models/payment-item.entity.d.ts.map +1 -0
  173. package/dist/models/payment-item.entity.js +4 -1
  174. package/dist/models/payment-item.entity.js.map +1 -1
  175. package/dist/models/payment-method-type.entity.d.ts +1 -0
  176. package/dist/models/payment-method-type.entity.d.ts.map +1 -0
  177. package/dist/models/payment-method-type.entity.js +5 -2
  178. package/dist/models/payment-method-type.entity.js.map +1 -1
  179. package/dist/models/payment-method.entity.d.ts +1 -0
  180. package/dist/models/payment-method.entity.d.ts.map +1 -0
  181. package/dist/models/payment-method.entity.js +5 -2
  182. package/dist/models/payment-method.entity.js.map +1 -1
  183. package/dist/models/payment-paid-with.entity.d.ts +1 -0
  184. package/dist/models/payment-paid-with.entity.d.ts.map +1 -0
  185. package/dist/models/payment-paid-with.entity.js +5 -2
  186. package/dist/models/payment-paid-with.entity.js.map +1 -1
  187. package/dist/models/payment.entity.d.ts +1 -0
  188. package/dist/models/payment.entity.d.ts.map +1 -0
  189. package/dist/models/payment.entity.js +6 -3
  190. package/dist/models/payment.entity.js.map +1 -1
  191. package/dist/models/post-history.entity.d.ts +1 -0
  192. package/dist/models/post-history.entity.d.ts.map +1 -0
  193. package/dist/models/tag-group.entity.d.ts +16 -0
  194. package/dist/models/tag-group.entity.d.ts.map +1 -0
  195. package/dist/models/tag-group.entity.js +95 -0
  196. package/dist/models/tag-group.entity.js.map +1 -0
  197. package/dist/models/tag.entity.d.ts +17 -0
  198. package/dist/models/tag.entity.d.ts.map +1 -0
  199. package/dist/models/tag.entity.js +100 -0
  200. package/dist/models/tag.entity.js.map +1 -0
  201. package/dist/models/tax.entity.d.ts +1 -0
  202. package/dist/models/tax.entity.d.ts.map +1 -0
  203. package/dist/models/tax.entity.js +4 -1
  204. package/dist/models/tax.entity.js.map +1 -1
  205. package/dist/payment/interfaces/payment-attr.interface.d.ts +1 -0
  206. package/dist/payment/interfaces/payment-attr.interface.d.ts.map +1 -0
  207. package/dist/payment/interfaces/payment-params.interface.d.ts +1 -0
  208. package/dist/payment/interfaces/payment-params.interface.d.ts.map +1 -0
  209. package/dist/payment/payment.d.ts +1 -0
  210. package/dist/payment/payment.d.ts.map +1 -0
  211. package/dist/payment/payment.js +5 -2
  212. package/dist/payment/payment.js.map +1 -1
  213. package/dist/payment/payment.repository.d.ts +1 -0
  214. package/dist/payment/payment.repository.d.ts.map +1 -0
  215. package/dist/payment/payment.repository.js +4 -1
  216. package/dist/payment/payment.repository.js.map +1 -1
  217. package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts +1 -0
  218. package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts.map +1 -0
  219. package/dist/payment-item/payment-item.d.ts +1 -0
  220. package/dist/payment-item/payment-item.d.ts.map +1 -0
  221. package/dist/payment-item/payment-item.js +4 -4
  222. package/dist/payment-item/payment-item.repository.d.ts +1 -0
  223. package/dist/payment-item/payment-item.repository.d.ts.map +1 -0
  224. package/dist/payment-item/payment-item.repository.js +4 -1
  225. package/dist/payment-item/payment-item.repository.js.map +1 -1
  226. package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts +1 -0
  227. package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts.map +1 -0
  228. package/dist/payment-method/payment-method.d.ts +1 -0
  229. package/dist/payment-method/payment-method.d.ts.map +1 -0
  230. package/dist/payment-method/payment-method.js +4 -1
  231. package/dist/payment-method/payment-method.js.map +1 -1
  232. package/dist/payment-method/payment-method.repository.d.ts +1 -0
  233. package/dist/payment-method/payment-method.repository.d.ts.map +1 -0
  234. package/dist/payment-method/payment-method.repository.js +4 -1
  235. package/dist/payment-method/payment-method.repository.js.map +1 -1
  236. package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.d.ts +1 -0
  237. package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.d.ts.map +1 -0
  238. package/dist/payment-method-type/payment-method-type.d.ts +1 -0
  239. package/dist/payment-method-type/payment-method-type.d.ts.map +1 -0
  240. package/dist/payment-method-type/payment-method-type.repository.d.ts +1 -0
  241. package/dist/payment-method-type/payment-method-type.repository.d.ts.map +1 -0
  242. package/dist/payment-method-type/payment-method-type.repository.js +4 -1
  243. package/dist/payment-method-type/payment-method-type.repository.js.map +1 -1
  244. package/dist/payment-paid-with/interfaces/payment-paid-with.interface.d.ts +1 -0
  245. package/dist/payment-paid-with/interfaces/payment-paid-with.interface.d.ts.map +1 -0
  246. package/dist/payment-paid-with/payment-paid-with.d.ts +1 -0
  247. package/dist/payment-paid-with/payment-paid-with.d.ts.map +1 -0
  248. package/dist/payment-paid-with/payment-paid-with.repository.d.ts +1 -0
  249. package/dist/payment-paid-with/payment-paid-with.repository.d.ts.map +1 -0
  250. package/dist/payment-paid-with/payment-paid-with.repository.js +4 -1
  251. package/dist/payment-paid-with/payment-paid-with.repository.js.map +1 -1
  252. package/dist/tag/interfaces/tag-attr.interface.d.ts +14 -0
  253. package/dist/tag/interfaces/tag-attr.interface.d.ts.map +1 -0
  254. package/dist/tag/interfaces/tag-attr.interface.js +3 -0
  255. package/dist/tag/interfaces/tag-attr.interface.js.map +1 -0
  256. package/dist/tag/tag.d.ts +26 -0
  257. package/dist/tag/tag.d.ts.map +1 -0
  258. package/dist/tag/tag.js +110 -0
  259. package/dist/tag/tag.js.map +1 -0
  260. package/dist/tag/tag.repository.d.ts +6 -0
  261. package/dist/tag/tag.repository.d.ts.map +1 -0
  262. package/dist/tag/tag.repository.js +15 -0
  263. package/dist/tag/tag.repository.js.map +1 -0
  264. package/dist/tag-group/interfaces/tag-group-attr.interface.d.ts +13 -0
  265. package/dist/tag-group/interfaces/tag-group-attr.interface.d.ts.map +1 -0
  266. package/dist/tag-group/interfaces/tag-group-attr.interface.js +3 -0
  267. package/dist/tag-group/interfaces/tag-group-attr.interface.js.map +1 -0
  268. package/dist/tag-group/tag-group.d.ts +24 -0
  269. package/dist/tag-group/tag-group.d.ts.map +1 -0
  270. package/dist/tag-group/tag-group.js +82 -0
  271. package/dist/tag-group/tag-group.js.map +1 -0
  272. package/dist/tag-group/tag-group.repository.d.ts +6 -0
  273. package/dist/tag-group/tag-group.repository.d.ts.map +1 -0
  274. package/dist/tag-group/tag-group.repository.js +15 -0
  275. package/dist/tag-group/tag-group.repository.js.map +1 -0
  276. package/dist/tax/interfaces/tax-attr.interface.d.ts +1 -0
  277. package/dist/tax/interfaces/tax-attr.interface.d.ts.map +1 -0
  278. package/dist/tax/tax.d.ts +1 -0
  279. package/dist/tax/tax.d.ts.map +1 -0
  280. package/dist/tax/tax.repository.d.ts +1 -0
  281. package/dist/tax/tax.repository.d.ts.map +1 -0
  282. package/dist/tax/tax.repository.js +4 -1
  283. package/dist/tax/tax.repository.js.map +1 -1
  284. package/dist/test-document.d.ts +1 -0
  285. package/dist/test-document.d.ts.map +1 -0
  286. package/dist/test.d.ts +1 -0
  287. package/dist/test.d.ts.map +1 -0
  288. package/dist/tsconfig.tsbuildinfo +1 -1
  289. package/migrations/finance-document-tag-migration.js +46 -0
  290. package/migrations/finance-tag-group-migration.js +53 -0
  291. package/migrations/finance-tag-migration.js +63 -0
  292. package/package.json +18 -18
  293. package/.gitlab-ci.yml +0 -16
  294. package/.husky/commit-msg +0 -13
  295. package/.husky/pre-commit +0 -4
  296. package/.prettierrc +0 -5
  297. package/CONTRIBUTING.md +0 -31
  298. package/README.md +0 -13
  299. package/eslint.config.mjs +0 -58
  300. package/nest-cli.json +0 -19
  301. package/sonar-project.properties +0 -13
  302. package/src/account/account.repository.ts +0 -11
  303. package/src/account/account.ts +0 -307
  304. package/src/account/interfaces/account-attr.interface.ts +0 -31
  305. package/src/account-system-entity/account-system-entity.ts +0 -66
  306. package/src/account-system-entity/post-history.repository.ts +0 -11
  307. package/src/config.ts +0 -382
  308. package/src/customer/customer.ts +0 -311
  309. package/src/customer/finance-customer.repository.ts +0 -13
  310. package/src/customer/interfaces/customer.repository.interface.ts +0 -3
  311. package/src/customer/interfaces/finance-customer-attr.interface.ts +0 -10
  312. package/src/customer/interfaces/finance-customer.repository.interface.ts +0 -4
  313. package/src/database.ts +0 -48
  314. package/src/document/document-item.repository.ts +0 -11
  315. package/src/document/document-item.ts +0 -146
  316. package/src/document/document.repository.ts +0 -11
  317. package/src/document/document.ts +0 -1328
  318. package/src/document/interfaces/document-attr.interface.ts +0 -28
  319. package/src/document/interfaces/document-find-all.interface.ts +0 -14
  320. package/src/document/interfaces/document-item-attr.interface.ts +0 -26
  321. package/src/document/interfaces/document-item.repository.interface.ts +0 -4
  322. package/src/enum/collect-payment-type.ts +0 -4
  323. package/src/enum/doc-type.enum.ts +0 -8
  324. package/src/enum/document-status.enum.ts +0 -6
  325. package/src/enum/index.ts +0 -19
  326. package/src/enum/payment-method.enum.ts +0 -3
  327. package/src/enum/payment-status.enum.ts +0 -11
  328. package/src/enum/payment-type.enum.ts +0 -4
  329. package/src/enum/quick-book-client-scopes.enum.ts +0 -14
  330. package/src/enum/transaction-type.enum.ts +0 -4
  331. package/src/finance-company/finance-company.repository.ts +0 -11
  332. package/src/finance-company/finance-company.ts +0 -2434
  333. package/src/helpers/login-user.ts +0 -38
  334. package/src/helpers/typeof.ts +0 -35
  335. package/src/index.ts +0 -32
  336. package/src/interfaces/account-system.interface.ts +0 -51
  337. package/src/interfaces/index.ts +0 -3
  338. package/src/journal-entry/interfaces/journal-entry-attr.interface.ts +0 -12
  339. package/src/journal-entry/journal-entry.repository.ts +0 -17
  340. package/src/journal-entry/journal-entry.ts +0 -264
  341. package/src/ledger-transaction/interfaces/ledger-transaction-attr.interface.ts +0 -18
  342. package/src/ledger-transaction/interfaces/ledger-transaction.repository.interface.ts +0 -7
  343. package/src/ledger-transaction/ledger-transaction.repository.ts +0 -17
  344. package/src/ledger-transaction/ledger-transaction.ts +0 -182
  345. package/src/models/account.entity.ts +0 -206
  346. package/src/models/customer.entity.ts +0 -93
  347. package/src/models/document-item.entity.ts +0 -167
  348. package/src/models/document.entity.ts +0 -211
  349. package/src/models/finance-company.entity.ts +0 -69
  350. package/src/models/journal-entry.entity.ts +0 -110
  351. package/src/models/ledger-transaction.entity.ts +0 -148
  352. package/src/models/payment-item.entity.ts +0 -60
  353. package/src/models/payment-method-type.entity.ts +0 -70
  354. package/src/models/payment-method.entity.ts +0 -51
  355. package/src/models/payment-paid-with.entity.ts +0 -133
  356. package/src/models/payment.entity.ts +0 -165
  357. package/src/models/post-history.entity.ts +0 -41
  358. package/src/models/tax.entity.ts +0 -75
  359. package/src/payment/interfaces/payment-attr.interface.ts +0 -23
  360. package/src/payment/interfaces/payment-params.interface.ts +0 -8
  361. package/src/payment/payment.repository.ts +0 -11
  362. package/src/payment/payment.ts +0 -236
  363. package/src/payment-item/interfaces/payment-item-attr.interface.ts +0 -10
  364. package/src/payment-item/payment-item.repository.ts +0 -11
  365. package/src/payment-item/payment-item.ts +0 -134
  366. package/src/payment-method/interfaces/payment-method-attr.interface.ts +0 -5
  367. package/src/payment-method/payment-method.repository.ts +0 -11
  368. package/src/payment-method/payment-method.ts +0 -146
  369. package/src/payment-method-type/interfaces/payment-method-type-attr.interface.ts +0 -8
  370. package/src/payment-method-type/payment-method-type.repository.ts +0 -11
  371. package/src/payment-method-type/payment-method-type.ts +0 -79
  372. package/src/payment-paid-with/interfaces/payment-paid-with.interface.ts +0 -20
  373. package/src/payment-paid-with/payment-paid-with.repository.ts +0 -11
  374. package/src/payment-paid-with/payment-paid-with.ts +0 -74
  375. package/src/tax/interfaces/tax-attr.interface.ts +0 -10
  376. package/src/tax/tax.repository.ts +0 -11
  377. package/src/tax/tax.ts +0 -68
  378. package/src/test-document.ts +0 -25
  379. package/src/test.ts +0 -3
  380. package/tsconfig.build.json +0 -4
  381. package/tsconfig.json +0 -23
package/src/config.ts DELETED
@@ -1,382 +0,0 @@
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();
@@ -1,311 +0,0 @@
1
- import {
2
- IAddress,
3
- IRepositoryBase,
4
- IPerson,
5
- LoginUserBase,
6
- } from '@tomei/general';
7
- import { RecordNotFoundError } from '@tomei/general/dist/class/exceptions/record-not-found.error';
8
- import FinanceCustomerModel from '../models/customer.entity';
9
- import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
10
- import { FinanceCustomerRepository } from './finance-customer.repository';
11
- import Account from '../account/account';
12
- import { AccountRepository } from '../account/account.repository';
13
- import { type } from '../helpers/typeof';
14
- import * as FinanceDb from '../database';
15
- import { LedgerTransactionRepository } from '../ledger-transaction/ledger-transaction.repository';
16
-
17
- // const AccountSystemEntity = import('../account-system-entity').then(({AccountSystemEntity}) => AccountSystemEntity);
18
- export default abstract class FinanceCustomerBase
19
- extends AccountSystemEntity
20
- implements IPerson
21
- {
22
- CustomerId = 'New';
23
- CustSystemCode = '';
24
- CustSystemRefId = '';
25
-
26
- protected abstract ParentARAccountNo: string;
27
- protected abstract ParentAPAccountNo: string;
28
- protected abstract ARAccountNo: string;
29
- protected abstract APAccountNo: string;
30
- protected abstract _ObjectType: string;
31
-
32
- abstract FullName: string;
33
- abstract IDNo: string;
34
- abstract IDType: string;
35
- abstract ContactNo: string;
36
- abstract Email: string;
37
- abstract DefaultAddress: IAddress;
38
-
39
- private _AccountReceivable: Account;
40
- private _AccountPayable: Account;
41
-
42
- protected _DbTransaction: any;
43
-
44
- private static _AccountRepository = new AccountRepository();
45
- private static _LedgerTransactionRepository =
46
- new LedgerTransactionRepository();
47
-
48
- // note: getDetails from spec is void type. Meaning that this probably needed a fix soon
49
- async getDetails(): Promise<{
50
- FullName: string;
51
- IDNo: string;
52
- IDType: string;
53
- Email: string;
54
- ContactNo: string;
55
- }> {
56
- return {
57
- FullName: this.FullName,
58
- IDNo: this.IDNo,
59
- IDType: this.IDType,
60
- Email: this.Email,
61
- ContactNo: this.ContactNo,
62
- };
63
- }
64
-
65
- protected static _FinanceCustomerRepository = new FinanceCustomerRepository();
66
- RepositoryBase: IRepositoryBase<any>;
67
-
68
- constructor(
69
- custSystemRefId?: string,
70
- custSystemCode?: string,
71
- sFinanceCompanyId?: string,
72
- ) {
73
- super();
74
- if (custSystemRefId && custSystemCode && sFinanceCompanyId) {
75
- this.CustSystemRefId = custSystemRefId;
76
- this.CustSystemCode = custSystemCode;
77
- this.CompanyId = sFinanceCompanyId;
78
- }
79
- }
80
-
81
- public static async initCustomer<C extends FinanceCustomerBase>(
82
- this: new () => C,
83
- custSystemRefId: string,
84
- custSystemCode: string,
85
- sFinanceCompanyId: string,
86
- dbTransaction?: any,
87
- ): Promise<C> {
88
- const financeCustomerData =
89
- await FinanceCustomerBase._FinanceCustomerRepository.findOne({
90
- where: {
91
- CompanyId: sFinanceCompanyId,
92
- CustSystemCode: custSystemCode,
93
- CustSystemRefId: custSystemRefId,
94
- },
95
- transaction: dbTransaction,
96
- });
97
- if (financeCustomerData) {
98
- const self = new this();
99
- self._DbTransaction = dbTransaction;
100
- self.CustomerId = financeCustomerData.CustomerId;
101
- self.CompanyId = sFinanceCompanyId;
102
- self.CustSystemCode = custSystemCode;
103
- self.CustSystemRefId = custSystemRefId;
104
- self.AccSystemRefId = financeCustomerData.AccSystemRefId;
105
- self.PostedToAccSystemYN = financeCustomerData.PostedToAccSystemYN;
106
- self.PostedById = financeCustomerData.PostedById;
107
- self.PostedDateTime = financeCustomerData.PostedDateTime;
108
- return self;
109
- } else {
110
- const notFoundError = new RecordNotFoundError(
111
- 'FinanceCustomerErrMsg',
112
- 'No Record Found',
113
- );
114
- throw notFoundError;
115
- }
116
- }
117
-
118
- async getAccountReceivable(): Promise<Account> {
119
- try {
120
- const transaction = this._DbTransaction;
121
- if (this._AccountReceivable) {
122
- return this._AccountReceivable;
123
- } else {
124
- const accountData =
125
- await FinanceCustomerBase._AccountRepository.findOne({
126
- where: {
127
- AccountNo: this.ARAccountNo,
128
- AccountType: 'Account Receivable',
129
- OwnerId: this.CustomerId,
130
- OwnerType: type(this),
131
- },
132
- transaction,
133
- });
134
- this._AccountReceivable = new Account(transaction);
135
- if (accountData) {
136
- this._AccountReceivable.AccountNo = accountData.AccountNo;
137
- this._AccountReceivable.AccSystemRefId = accountData.AccSystemRefId;
138
- this._AccountReceivable.Name = accountData.Name;
139
- this._AccountReceivable.Description = accountData.Description;
140
- this._AccountReceivable.ParentAccountNo = accountData.ParentAccountNo;
141
- this._AccountReceivable.AccountType = accountData.AccountType;
142
- this._AccountReceivable.OwnerId = accountData.OwnerId;
143
- this._AccountReceivable.OwnerType = accountData.OwnerType;
144
- this._AccountReceivable.RelatedObjectId = accountData.RelatedObjectId;
145
- this._AccountReceivable.RelatedObjectType =
146
- accountData.RelatedObjectType;
147
- this._AccountReceivable.CreatedById = accountData.CreatedById;
148
- this._AccountReceivable.CreatedAt = accountData.CreatedAt;
149
- this._AccountReceivable.UpdatedById = accountData.UpdatedById;
150
- this._AccountReceivable.UpdatedAt = accountData.UpdatedAt;
151
- } else {
152
- // this._AccountReceivable.AccountNo = `${this.CustSystemCode}-AR-123456789`;
153
- // this._AccountReceivable.ParentAccountNo = `${this.CustSystemCode}-AR`;
154
- this._AccountReceivable.AccountNo = this.ARAccountNo; //SystemInfo.SYSTEM_CODE + '-AR-' + '8 digit running no'
155
- this._AccountReceivable.ParentAccountNo = this.ParentARAccountNo; //SystemInfo.SYSTEM_CODE + '-AR'
156
- this._AccountReceivable.AccountType = 'Account Receivable';
157
- this._AccountReceivable.OwnerId = this.CustomerId;
158
- this._AccountReceivable.OwnerType = type(this);
159
- }
160
- return this._AccountReceivable;
161
- }
162
- } catch (error) {
163
- throw error;
164
- }
165
- }
166
-
167
- async getAccountPayable(): Promise<Account> {
168
- try {
169
- const transaction = this._DbTransaction;
170
- if (this._AccountPayable) {
171
- return this._AccountPayable;
172
- } else {
173
- const accountData =
174
- await FinanceCustomerBase._AccountRepository.findOne({
175
- where: {
176
- AccountNo: this.APAccountNo,
177
- AccountType: 'Account Payable',
178
- OwnerId: this.CustomerId,
179
- OwnerType: type(this),
180
- },
181
- transaction,
182
- });
183
-
184
- this._AccountPayable = new Account(transaction);
185
- if (accountData) {
186
- this._AccountPayable.AccountNo = accountData.AccountNo;
187
- this._AccountPayable.ParentAccountNo = accountData.ParentAccountNo;
188
- this._AccountPayable.AccountType = accountData.AccountType;
189
- this._AccountPayable.OwnerId = accountData.OwnerId;
190
- this._AccountPayable.OwnerType = accountData.OwnerType;
191
- } else {
192
- // this._AccountPayable.AccountNo = `${this.CustSystemCode}-AP-123456789`;
193
- // this._AccountPayable.ParentAccountNo = `${this.CustSystemCode}-AP`;
194
- this._AccountPayable.AccountNo = this.APAccountNo; //SystemInfo.SYSTEM_CODE + '-AP-' + '8 digit running no'
195
- this._AccountPayable.ParentAccountNo = this.ParentAPAccountNo; //SystemInfo.SYSTEM_CODE + '-AP'
196
- this._AccountPayable.AccountType = 'Account Payable';
197
- this._AccountPayable.OwnerId = this.CustomerId;
198
- this._AccountPayable.OwnerType = type(this);
199
- }
200
-
201
- return this._AccountPayable;
202
- }
203
- } catch (error) {
204
- throw error;
205
- }
206
- }
207
-
208
- /*
209
- * Get the billing address for a person.
210
- **/
211
- abstract getBillingAddress(params: any): Promise<IAddress>;
212
-
213
- init(person: LoginUserBase) {
214
- this.FullName = person.FullName;
215
- this.IDNo = person.IDNo;
216
- this.IDType = person.IDType;
217
- this.Email = person.Email;
218
- this.ContactNo = person.ContactNo;
219
- this.DefaultAddress = person.DefaultAddress;
220
- }
221
-
222
- async save(
223
- accSystemRefId: string,
224
- custSystemCode: string,
225
- custSystemRefId: string,
226
- dbTransaction?: any,
227
- ): Promise<FinanceCustomerModel> {
228
- this.CustSystemCode = custSystemCode;
229
- this.CustSystemRefId = custSystemRefId;
230
- this.AccSystemRefId = accSystemRefId;
231
- if (accSystemRefId !== 'REF') {
232
- this.PostedToAccSystemYN = 'Y';
233
- this.PostedDateTime = new Date();
234
- } else {
235
- this.PostedToAccSystemYN = 'N';
236
- }
237
- this.CustomerId = this.createId();
238
- const data = await FinanceCustomerBase._FinanceCustomerRepository.create(
239
- {
240
- CompanyId: this.CompanyId,
241
- CustomerId: this.CustomerId,
242
- CustSystemCode: this.CustSystemCode,
243
- CustSystemRefId: this.CustSystemRefId,
244
- AccSystemRefId: this.AccSystemRefId,
245
- PostedToAccSystemYN: this.PostedToAccSystemYN,
246
- },
247
- { transaction: dbTransaction },
248
- );
249
- return data;
250
- }
251
-
252
- static async isFinanceCustomerExist(
253
- custSystemRefId: string,
254
- custSystemCode: string,
255
- sFinanceCompanyId: string,
256
- dbTransaction?: any,
257
- ): Promise<boolean> {
258
- const data = await FinanceCustomerBase._FinanceCustomerRepository.findAll({
259
- where: {
260
- CustSystemRefId: custSystemRefId,
261
- CustSystemCode: custSystemCode,
262
- CompanyId: sFinanceCompanyId,
263
- },
264
- transaction: dbTransaction,
265
- });
266
-
267
- if (data.length > 0) {
268
- return true;
269
- }
270
- return false;
271
- }
272
-
273
- /**
274
- * Method to calculate and return the outstanding balance for customer receivable account
275
- *
276
- * @param dbTransaction
277
- * @returns {number}
278
- */
279
- async getOutstandingBalance(dbTransaction: any): Promise<number> {
280
- if (!dbTransaction) {
281
- dbTransaction = await FinanceDb.getConnection().transaction();
282
- }
283
-
284
- const AR = await this.getAccountReceivable();
285
-
286
- const ledgerTransactions =
287
- await FinanceCustomerBase._LedgerTransactionRepository.findAll({
288
- where: {
289
- AccountNo: AR.AccountNo,
290
- },
291
- transaction: dbTransaction,
292
- });
293
-
294
- const totalDebitAmount = ledgerTransactions.reduce(
295
- (accumulator, currentValue) => accumulator + +currentValue.DebitAmount,
296
- 0,
297
- );
298
-
299
- const totalCreditAmount = ledgerTransactions.reduce(
300
- (accumulator, currentValue) => accumulator + +currentValue.CreditAmount,
301
- 0,
302
- );
303
-
304
- if (totalCreditAmount > totalDebitAmount) {
305
- return 0;
306
- }
307
-
308
- const balance = totalDebitAmount - totalCreditAmount;
309
- return balance;
310
- }
311
- }
@@ -1,13 +0,0 @@
1
- import { Injectable } from '@nestjs/common/decorators';
2
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
3
- import FinanceCustomerModel from '../models/customer.entity';
4
-
5
- @Injectable()
6
- export class FinanceCustomerRepository
7
- extends RepositoryBase<FinanceCustomerModel>
8
- implements IRepositoryBase<FinanceCustomerModel>
9
- {
10
- constructor() {
11
- super(FinanceCustomerModel);
12
- }
13
- }
@@ -1,3 +0,0 @@
1
- export interface ICustomerRepository<T> {
2
- findOne?(options: any): Promise<T>;
3
- }