@tomei/finance 0.6.114 → 0.8.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.
Files changed (380) hide show
  1. package/dist/account/account.d.ts +1 -0
  2. package/dist/account/account.d.ts.map +1 -0
  3. package/dist/account/account.js.map +1 -1
  4. package/dist/account/account.repository.d.ts +1 -0
  5. package/dist/account/account.repository.d.ts.map +1 -0
  6. package/dist/account/account.repository.js +4 -1
  7. package/dist/account/account.repository.js.map +1 -1
  8. package/dist/account/interfaces/account-attr.interface.d.ts +1 -0
  9. package/dist/account/interfaces/account-attr.interface.d.ts.map +1 -0
  10. package/dist/account-system-entity/account-system-entity.d.ts +1 -0
  11. package/dist/account-system-entity/account-system-entity.d.ts.map +1 -0
  12. package/dist/account-system-entity/account-system-entity.js +4 -1
  13. package/dist/account-system-entity/account-system-entity.js.map +1 -1
  14. package/dist/account-system-entity/post-history.repository.d.ts +1 -0
  15. package/dist/account-system-entity/post-history.repository.d.ts.map +1 -0
  16. package/dist/account-system-entity/post-history.repository.js +4 -1
  17. package/dist/account-system-entity/post-history.repository.js.map +1 -1
  18. package/dist/config.d.ts +1 -0
  19. package/dist/config.d.ts.map +1 -0
  20. package/dist/config.js +17 -4
  21. package/dist/config.js.map +1 -1
  22. package/dist/customer/customer.d.ts +1 -0
  23. package/dist/customer/customer.d.ts.map +1 -0
  24. package/dist/customer/customer.js +38 -2
  25. package/dist/customer/customer.js.map +1 -1
  26. package/dist/customer/finance-customer.repository.d.ts +1 -0
  27. package/dist/customer/finance-customer.repository.d.ts.map +1 -0
  28. package/dist/customer/finance-customer.repository.js +4 -1
  29. package/dist/customer/finance-customer.repository.js.map +1 -1
  30. package/dist/customer/interfaces/customer.repository.interface.d.ts +1 -0
  31. package/dist/customer/interfaces/customer.repository.interface.d.ts.map +1 -0
  32. package/dist/customer/interfaces/finance-customer-attr.interface.d.ts +1 -0
  33. package/dist/customer/interfaces/finance-customer-attr.interface.d.ts.map +1 -0
  34. package/dist/customer/interfaces/finance-customer.repository.interface.d.ts +1 -0
  35. package/dist/customer/interfaces/finance-customer.repository.interface.d.ts.map +1 -0
  36. package/dist/database.d.ts +1 -0
  37. package/dist/database.d.ts.map +1 -0
  38. package/dist/database.js +18 -15
  39. package/dist/database.js.map +1 -1
  40. package/dist/document/document-item.d.ts +3 -2
  41. package/dist/document/document-item.d.ts.map +1 -0
  42. package/dist/document/document-item.js +1 -1
  43. package/dist/document/document-item.js.map +1 -1
  44. package/dist/document/document-item.repository.d.ts +1 -0
  45. package/dist/document/document-item.repository.d.ts.map +1 -0
  46. package/dist/document/document-item.repository.js +4 -1
  47. package/dist/document/document-item.repository.js.map +1 -1
  48. package/dist/document/document.d.ts +2 -1
  49. package/dist/document/document.d.ts.map +1 -0
  50. package/dist/document/document.js +242 -191
  51. package/dist/document/document.js.map +1 -1
  52. package/dist/document/document.repository.d.ts +1 -0
  53. package/dist/document/document.repository.d.ts.map +1 -0
  54. package/dist/document/document.repository.js +4 -1
  55. package/dist/document/document.repository.js.map +1 -1
  56. package/dist/document/interfaces/document-attr.interface.d.ts +1 -0
  57. package/dist/document/interfaces/document-attr.interface.d.ts.map +1 -0
  58. package/dist/document/interfaces/document-find-all.interface.d.ts +1 -0
  59. package/dist/document/interfaces/document-find-all.interface.d.ts.map +1 -0
  60. package/dist/document/interfaces/document-item-attr.interface.d.ts +1 -0
  61. package/dist/document/interfaces/document-item-attr.interface.d.ts.map +1 -0
  62. package/dist/document/interfaces/document-item.repository.interface.d.ts +1 -0
  63. package/dist/document/interfaces/document-item.repository.interface.d.ts.map +1 -0
  64. package/dist/document-tag/document-tag.d.ts +19 -0
  65. package/dist/document-tag/document-tag.d.ts.map +1 -0
  66. package/dist/document-tag/document-tag.js +69 -0
  67. package/dist/document-tag/document-tag.js.map +1 -0
  68. package/dist/document-tag/document-tag.repository.d.ts +6 -0
  69. package/dist/document-tag/document-tag.repository.d.ts.map +1 -0
  70. package/dist/document-tag/document-tag.repository.js +15 -0
  71. package/dist/document-tag/document-tag.repository.js.map +1 -0
  72. package/dist/document-tag/interfaces/document-tag-attr.interface.d.ts +8 -0
  73. package/dist/document-tag/interfaces/document-tag-attr.interface.d.ts.map +1 -0
  74. package/dist/document-tag/interfaces/document-tag-attr.interface.js +3 -0
  75. package/dist/document-tag/interfaces/document-tag-attr.interface.js.map +1 -0
  76. package/dist/enum/collect-payment-type.d.ts +1 -0
  77. package/dist/enum/collect-payment-type.d.ts.map +1 -0
  78. package/dist/enum/doc-type.enum.d.ts +1 -0
  79. package/dist/enum/doc-type.enum.d.ts.map +1 -0
  80. package/dist/enum/document-status.enum.d.ts +1 -0
  81. package/dist/enum/document-status.enum.d.ts.map +1 -0
  82. package/dist/enum/index.d.ts +2 -2
  83. package/dist/enum/index.d.ts.map +1 -0
  84. package/dist/enum/index.js +1 -3
  85. package/dist/enum/index.js.map +1 -1
  86. package/dist/enum/payment-method.enum.d.ts +1 -0
  87. package/dist/enum/payment-method.enum.d.ts.map +1 -0
  88. package/dist/enum/payment-status.enum.d.ts +1 -0
  89. package/dist/enum/payment-status.enum.d.ts.map +1 -0
  90. package/dist/enum/payment-type.enum.d.ts +1 -0
  91. package/dist/enum/payment-type.enum.d.ts.map +1 -0
  92. package/dist/enum/quick-book-client-scopes.enum.d.ts +1 -0
  93. package/dist/enum/quick-book-client-scopes.enum.d.ts.map +1 -0
  94. package/dist/enum/quick-book-client-scopes.enum.js +34 -1
  95. package/dist/enum/quick-book-client-scopes.enum.js.map +1 -1
  96. package/dist/enum/transaction-type.enum.d.ts +1 -0
  97. package/dist/enum/transaction-type.enum.d.ts.map +1 -0
  98. package/dist/finance-company/finance-company.d.ts +20 -17
  99. package/dist/finance-company/finance-company.d.ts.map +1 -0
  100. package/dist/finance-company/finance-company.js +89 -23
  101. package/dist/finance-company/finance-company.js.map +1 -1
  102. package/dist/finance-company/finance-company.repository.d.ts +1 -0
  103. package/dist/finance-company/finance-company.repository.d.ts.map +1 -0
  104. package/dist/finance-company/finance-company.repository.js +4 -1
  105. package/dist/finance-company/finance-company.repository.js.map +1 -1
  106. package/dist/helpers/login-user.d.ts +1 -0
  107. package/dist/helpers/login-user.d.ts.map +1 -0
  108. package/dist/helpers/typeof.d.ts +1 -0
  109. package/dist/helpers/typeof.d.ts.map +1 -0
  110. package/dist/index.d.ts +8 -1
  111. package/dist/index.d.ts.map +1 -0
  112. package/dist/index.js +64 -16
  113. package/dist/index.js.map +1 -1
  114. package/dist/interfaces/account-system.interface.d.ts +4 -0
  115. package/dist/interfaces/account-system.interface.d.ts.map +1 -0
  116. package/dist/interfaces/index.d.ts +1 -0
  117. package/dist/interfaces/index.d.ts.map +1 -0
  118. package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts +1 -0
  119. package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts.map +1 -0
  120. package/dist/journal-entry/journal-entry.d.ts +1 -0
  121. package/dist/journal-entry/journal-entry.d.ts.map +1 -0
  122. package/dist/journal-entry/journal-entry.js +4 -1
  123. package/dist/journal-entry/journal-entry.js.map +1 -1
  124. package/dist/journal-entry/journal-entry.repository.d.ts +1 -0
  125. package/dist/journal-entry/journal-entry.repository.d.ts.map +1 -0
  126. package/dist/journal-entry/journal-entry.repository.js +4 -1
  127. package/dist/journal-entry/journal-entry.repository.js.map +1 -1
  128. package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +1 -0
  129. package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts.map +1 -0
  130. package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts +1 -0
  131. package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts.map +1 -0
  132. package/dist/ledger-transaction/ledger-transaction.d.ts +1 -0
  133. package/dist/ledger-transaction/ledger-transaction.d.ts.map +1 -0
  134. package/dist/ledger-transaction/ledger-transaction.repository.d.ts +1 -0
  135. package/dist/ledger-transaction/ledger-transaction.repository.d.ts.map +1 -0
  136. package/dist/ledger-transaction/ledger-transaction.repository.js +4 -1
  137. package/dist/ledger-transaction/ledger-transaction.repository.js.map +1 -1
  138. package/dist/models/account.entity.d.ts +1 -0
  139. package/dist/models/account.entity.d.ts.map +1 -0
  140. package/dist/models/account.entity.js +7 -4
  141. package/dist/models/account.entity.js.map +1 -1
  142. package/dist/models/customer.entity.d.ts +1 -0
  143. package/dist/models/customer.entity.d.ts.map +1 -0
  144. package/dist/models/customer.entity.js +4 -1
  145. package/dist/models/customer.entity.js.map +1 -1
  146. package/dist/models/document-item.entity.d.ts +1 -0
  147. package/dist/models/document-item.entity.d.ts.map +1 -0
  148. package/dist/models/document-item.entity.js +5 -2
  149. package/dist/models/document-item.entity.js.map +1 -1
  150. package/dist/models/document-tag.entity.d.ts +14 -0
  151. package/dist/models/document-tag.entity.d.ts.map +1 -0
  152. package/dist/models/document-tag.entity.js +64 -0
  153. package/dist/models/document-tag.entity.js.map +1 -0
  154. package/dist/models/document.entity.d.ts +3 -0
  155. package/dist/models/document.entity.d.ts.map +1 -0
  156. package/dist/models/document.entity.js +12 -4
  157. package/dist/models/document.entity.js.map +1 -1
  158. package/dist/models/finance-company.entity.d.ts +1 -0
  159. package/dist/models/finance-company.entity.d.ts.map +1 -0
  160. package/dist/models/finance-company.entity.js +5 -2
  161. package/dist/models/finance-company.entity.js.map +1 -1
  162. package/dist/models/journal-entry.entity.d.ts +1 -0
  163. package/dist/models/journal-entry.entity.d.ts.map +1 -0
  164. package/dist/models/journal-entry.entity.js +5 -2
  165. package/dist/models/journal-entry.entity.js.map +1 -1
  166. package/dist/models/ledger-transaction.entity.d.ts +1 -0
  167. package/dist/models/ledger-transaction.entity.d.ts.map +1 -0
  168. package/dist/models/ledger-transaction.entity.js +7 -4
  169. package/dist/models/ledger-transaction.entity.js.map +1 -1
  170. package/dist/models/payment-item.entity.d.ts +1 -0
  171. package/dist/models/payment-item.entity.d.ts.map +1 -0
  172. package/dist/models/payment-item.entity.js +4 -1
  173. package/dist/models/payment-item.entity.js.map +1 -1
  174. package/dist/models/payment-method-type.entity.d.ts +1 -0
  175. package/dist/models/payment-method-type.entity.d.ts.map +1 -0
  176. package/dist/models/payment-method-type.entity.js +5 -2
  177. package/dist/models/payment-method-type.entity.js.map +1 -1
  178. package/dist/models/payment-method.entity.d.ts +1 -0
  179. package/dist/models/payment-method.entity.d.ts.map +1 -0
  180. package/dist/models/payment-method.entity.js +5 -2
  181. package/dist/models/payment-method.entity.js.map +1 -1
  182. package/dist/models/payment-paid-with.entity.d.ts +1 -0
  183. package/dist/models/payment-paid-with.entity.d.ts.map +1 -0
  184. package/dist/models/payment-paid-with.entity.js +5 -2
  185. package/dist/models/payment-paid-with.entity.js.map +1 -1
  186. package/dist/models/payment.entity.d.ts +1 -0
  187. package/dist/models/payment.entity.d.ts.map +1 -0
  188. package/dist/models/payment.entity.js +6 -3
  189. package/dist/models/payment.entity.js.map +1 -1
  190. package/dist/models/post-history.entity.d.ts +1 -0
  191. package/dist/models/post-history.entity.d.ts.map +1 -0
  192. package/dist/models/tag-group.entity.d.ts +16 -0
  193. package/dist/models/tag-group.entity.d.ts.map +1 -0
  194. package/dist/models/tag-group.entity.js +95 -0
  195. package/dist/models/tag-group.entity.js.map +1 -0
  196. package/dist/models/tag.entity.d.ts +17 -0
  197. package/dist/models/tag.entity.d.ts.map +1 -0
  198. package/dist/models/tag.entity.js +100 -0
  199. package/dist/models/tag.entity.js.map +1 -0
  200. package/dist/models/tax.entity.d.ts +1 -0
  201. package/dist/models/tax.entity.d.ts.map +1 -0
  202. package/dist/models/tax.entity.js +4 -1
  203. package/dist/models/tax.entity.js.map +1 -1
  204. package/dist/payment/interfaces/payment-attr.interface.d.ts +1 -0
  205. package/dist/payment/interfaces/payment-attr.interface.d.ts.map +1 -0
  206. package/dist/payment/interfaces/payment-params.interface.d.ts +1 -0
  207. package/dist/payment/interfaces/payment-params.interface.d.ts.map +1 -0
  208. package/dist/payment/payment.d.ts +1 -0
  209. package/dist/payment/payment.d.ts.map +1 -0
  210. package/dist/payment/payment.js +5 -2
  211. package/dist/payment/payment.js.map +1 -1
  212. package/dist/payment/payment.repository.d.ts +1 -0
  213. package/dist/payment/payment.repository.d.ts.map +1 -0
  214. package/dist/payment/payment.repository.js +4 -1
  215. package/dist/payment/payment.repository.js.map +1 -1
  216. package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts +1 -0
  217. package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts.map +1 -0
  218. package/dist/payment-item/payment-item.d.ts +1 -0
  219. package/dist/payment-item/payment-item.d.ts.map +1 -0
  220. package/dist/payment-item/payment-item.js +4 -4
  221. package/dist/payment-item/payment-item.repository.d.ts +1 -0
  222. package/dist/payment-item/payment-item.repository.d.ts.map +1 -0
  223. package/dist/payment-item/payment-item.repository.js +4 -1
  224. package/dist/payment-item/payment-item.repository.js.map +1 -1
  225. package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts +1 -0
  226. package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts.map +1 -0
  227. package/dist/payment-method/payment-method.d.ts +1 -0
  228. package/dist/payment-method/payment-method.d.ts.map +1 -0
  229. package/dist/payment-method/payment-method.js +4 -1
  230. package/dist/payment-method/payment-method.js.map +1 -1
  231. package/dist/payment-method/payment-method.repository.d.ts +1 -0
  232. package/dist/payment-method/payment-method.repository.d.ts.map +1 -0
  233. package/dist/payment-method/payment-method.repository.js +4 -1
  234. package/dist/payment-method/payment-method.repository.js.map +1 -1
  235. package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.d.ts +1 -0
  236. package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.d.ts.map +1 -0
  237. package/dist/payment-method-type/payment-method-type.d.ts +1 -0
  238. package/dist/payment-method-type/payment-method-type.d.ts.map +1 -0
  239. package/dist/payment-method-type/payment-method-type.repository.d.ts +1 -0
  240. package/dist/payment-method-type/payment-method-type.repository.d.ts.map +1 -0
  241. package/dist/payment-method-type/payment-method-type.repository.js +4 -1
  242. package/dist/payment-method-type/payment-method-type.repository.js.map +1 -1
  243. package/dist/payment-paid-with/interfaces/payment-paid-with.interface.d.ts +1 -0
  244. package/dist/payment-paid-with/interfaces/payment-paid-with.interface.d.ts.map +1 -0
  245. package/dist/payment-paid-with/payment-paid-with.d.ts +1 -0
  246. package/dist/payment-paid-with/payment-paid-with.d.ts.map +1 -0
  247. package/dist/payment-paid-with/payment-paid-with.repository.d.ts +1 -0
  248. package/dist/payment-paid-with/payment-paid-with.repository.d.ts.map +1 -0
  249. package/dist/payment-paid-with/payment-paid-with.repository.js +4 -1
  250. package/dist/payment-paid-with/payment-paid-with.repository.js.map +1 -1
  251. package/dist/tag/interfaces/tag-attr.interface.d.ts +14 -0
  252. package/dist/tag/interfaces/tag-attr.interface.d.ts.map +1 -0
  253. package/dist/tag/interfaces/tag-attr.interface.js +3 -0
  254. package/dist/tag/interfaces/tag-attr.interface.js.map +1 -0
  255. package/dist/tag/tag.d.ts +26 -0
  256. package/dist/tag/tag.d.ts.map +1 -0
  257. package/dist/tag/tag.js +110 -0
  258. package/dist/tag/tag.js.map +1 -0
  259. package/dist/tag/tag.repository.d.ts +6 -0
  260. package/dist/tag/tag.repository.d.ts.map +1 -0
  261. package/dist/tag/tag.repository.js +15 -0
  262. package/dist/tag/tag.repository.js.map +1 -0
  263. package/dist/tag-group/interfaces/tag-group-attr.interface.d.ts +13 -0
  264. package/dist/tag-group/interfaces/tag-group-attr.interface.d.ts.map +1 -0
  265. package/dist/tag-group/interfaces/tag-group-attr.interface.js +3 -0
  266. package/dist/tag-group/interfaces/tag-group-attr.interface.js.map +1 -0
  267. package/dist/tag-group/tag-group.d.ts +25 -0
  268. package/dist/tag-group/tag-group.d.ts.map +1 -0
  269. package/dist/tag-group/tag-group.js +98 -0
  270. package/dist/tag-group/tag-group.js.map +1 -0
  271. package/dist/tag-group/tag-group.repository.d.ts +6 -0
  272. package/dist/tag-group/tag-group.repository.d.ts.map +1 -0
  273. package/dist/tag-group/tag-group.repository.js +15 -0
  274. package/dist/tag-group/tag-group.repository.js.map +1 -0
  275. package/dist/tax/interfaces/tax-attr.interface.d.ts +1 -0
  276. package/dist/tax/interfaces/tax-attr.interface.d.ts.map +1 -0
  277. package/dist/tax/tax.d.ts +1 -0
  278. package/dist/tax/tax.d.ts.map +1 -0
  279. package/dist/tax/tax.repository.d.ts +1 -0
  280. package/dist/tax/tax.repository.d.ts.map +1 -0
  281. package/dist/tax/tax.repository.js +4 -1
  282. package/dist/tax/tax.repository.js.map +1 -1
  283. package/dist/test-document.d.ts +1 -0
  284. package/dist/test-document.d.ts.map +1 -0
  285. package/dist/test.d.ts +1 -0
  286. package/dist/test.d.ts.map +1 -0
  287. package/dist/tsconfig.tsbuildinfo +1 -1
  288. package/migrations/finance-document-tag-migration.js +46 -0
  289. package/migrations/finance-tag-group-migration.js +53 -0
  290. package/migrations/finance-tag-migration.js +63 -0
  291. package/package.json +18 -18
  292. package/.gitlab-ci.yml +0 -16
  293. package/.husky/commit-msg +0 -13
  294. package/.husky/pre-commit +0 -4
  295. package/.prettierrc +0 -5
  296. package/CONTRIBUTING.md +0 -31
  297. package/README.md +0 -13
  298. package/eslint.config.mjs +0 -58
  299. package/nest-cli.json +0 -19
  300. package/sonar-project.properties +0 -13
  301. package/src/account/account.repository.ts +0 -11
  302. package/src/account/account.ts +0 -307
  303. package/src/account/interfaces/account-attr.interface.ts +0 -31
  304. package/src/account-system-entity/account-system-entity.ts +0 -66
  305. package/src/account-system-entity/post-history.repository.ts +0 -11
  306. package/src/config.ts +0 -382
  307. package/src/customer/customer.ts +0 -311
  308. package/src/customer/finance-customer.repository.ts +0 -13
  309. package/src/customer/interfaces/customer.repository.interface.ts +0 -3
  310. package/src/customer/interfaces/finance-customer-attr.interface.ts +0 -10
  311. package/src/customer/interfaces/finance-customer.repository.interface.ts +0 -4
  312. package/src/database.ts +0 -48
  313. package/src/document/document-item.repository.ts +0 -11
  314. package/src/document/document-item.ts +0 -146
  315. package/src/document/document.repository.ts +0 -11
  316. package/src/document/document.ts +0 -1328
  317. package/src/document/interfaces/document-attr.interface.ts +0 -28
  318. package/src/document/interfaces/document-find-all.interface.ts +0 -14
  319. package/src/document/interfaces/document-item-attr.interface.ts +0 -26
  320. package/src/document/interfaces/document-item.repository.interface.ts +0 -4
  321. package/src/enum/collect-payment-type.ts +0 -4
  322. package/src/enum/doc-type.enum.ts +0 -8
  323. package/src/enum/document-status.enum.ts +0 -6
  324. package/src/enum/index.ts +0 -19
  325. package/src/enum/payment-method.enum.ts +0 -3
  326. package/src/enum/payment-status.enum.ts +0 -11
  327. package/src/enum/payment-type.enum.ts +0 -4
  328. package/src/enum/quick-book-client-scopes.enum.ts +0 -14
  329. package/src/enum/transaction-type.enum.ts +0 -4
  330. package/src/finance-company/finance-company.repository.ts +0 -11
  331. package/src/finance-company/finance-company.ts +0 -2434
  332. package/src/helpers/login-user.ts +0 -38
  333. package/src/helpers/typeof.ts +0 -35
  334. package/src/index.ts +0 -32
  335. package/src/interfaces/account-system.interface.ts +0 -51
  336. package/src/interfaces/index.ts +0 -3
  337. package/src/journal-entry/interfaces/journal-entry-attr.interface.ts +0 -12
  338. package/src/journal-entry/journal-entry.repository.ts +0 -17
  339. package/src/journal-entry/journal-entry.ts +0 -264
  340. package/src/ledger-transaction/interfaces/ledger-transaction-attr.interface.ts +0 -18
  341. package/src/ledger-transaction/interfaces/ledger-transaction.repository.interface.ts +0 -7
  342. package/src/ledger-transaction/ledger-transaction.repository.ts +0 -17
  343. package/src/ledger-transaction/ledger-transaction.ts +0 -182
  344. package/src/models/account.entity.ts +0 -206
  345. package/src/models/customer.entity.ts +0 -93
  346. package/src/models/document-item.entity.ts +0 -167
  347. package/src/models/document.entity.ts +0 -211
  348. package/src/models/finance-company.entity.ts +0 -69
  349. package/src/models/journal-entry.entity.ts +0 -110
  350. package/src/models/ledger-transaction.entity.ts +0 -148
  351. package/src/models/payment-item.entity.ts +0 -60
  352. package/src/models/payment-method-type.entity.ts +0 -70
  353. package/src/models/payment-method.entity.ts +0 -51
  354. package/src/models/payment-paid-with.entity.ts +0 -133
  355. package/src/models/payment.entity.ts +0 -165
  356. package/src/models/post-history.entity.ts +0 -41
  357. package/src/models/tax.entity.ts +0 -75
  358. package/src/payment/interfaces/payment-attr.interface.ts +0 -23
  359. package/src/payment/interfaces/payment-params.interface.ts +0 -8
  360. package/src/payment/payment.repository.ts +0 -11
  361. package/src/payment/payment.ts +0 -236
  362. package/src/payment-item/interfaces/payment-item-attr.interface.ts +0 -10
  363. package/src/payment-item/payment-item.repository.ts +0 -11
  364. package/src/payment-item/payment-item.ts +0 -134
  365. package/src/payment-method/interfaces/payment-method-attr.interface.ts +0 -5
  366. package/src/payment-method/payment-method.repository.ts +0 -11
  367. package/src/payment-method/payment-method.ts +0 -146
  368. package/src/payment-method-type/interfaces/payment-method-type-attr.interface.ts +0 -8
  369. package/src/payment-method-type/payment-method-type.repository.ts +0 -11
  370. package/src/payment-method-type/payment-method-type.ts +0 -79
  371. package/src/payment-paid-with/interfaces/payment-paid-with.interface.ts +0 -20
  372. package/src/payment-paid-with/payment-paid-with.repository.ts +0 -11
  373. package/src/payment-paid-with/payment-paid-with.ts +0 -74
  374. package/src/tax/interfaces/tax-attr.interface.ts +0 -10
  375. package/src/tax/tax.repository.ts +0 -11
  376. package/src/tax/tax.ts +0 -68
  377. package/src/test-document.ts +0 -25
  378. package/src/test.ts +0 -3
  379. package/tsconfig.build.json +0 -4
  380. package/tsconfig.json +0 -23
@@ -1,134 +0,0 @@
1
- import { ObjectBase } from '@tomei/general';
2
- import Payment from '../payment/payment';
3
- import { type } from '../helpers/typeof';
4
- import { QueryTypes } from 'sequelize';
5
- import { FinanceDb } from '../';
6
- import { Next } from '@nestjs/common/decorators';
7
- import { DocumentStatus } from '../enum/document-status.enum';
8
-
9
- export default class PaymentItem extends ObjectBase {
10
- private _PaymentId = '';
11
- private _PayForObjectId = '';
12
- private _PayForObjectType = '';
13
- Currency = 'MYR';
14
- Amount = 0;
15
- Name = '';
16
- Description = '';
17
- Remarks = '';
18
- private _ObjectType = 'PaymentItem';
19
-
20
- get PaymentId() {
21
- return this._PaymentId;
22
- }
23
-
24
- private set PaymentId(id: string) {
25
- this._PaymentId = id;
26
- }
27
-
28
- get ObjectType() {
29
- return this._ObjectType;
30
- }
31
-
32
- get PayForObjectId() {
33
- return this._PayForObjectId;
34
- }
35
-
36
- set PayForObjectId(id: string) {
37
- this._PayForObjectId = id;
38
- }
39
-
40
- get PayForObjectType(): string {
41
- return this._PayForObjectType;
42
- }
43
-
44
- set PayForObjectType(type: string) {
45
- this._PayForObjectType = type;
46
- }
47
-
48
- /* ObjectBase Implementation */
49
- get ObjectId() {
50
- return '';
51
- }
52
-
53
- get ObjectName() {
54
- return '';
55
- }
56
-
57
- get TableName() {
58
- return 'finance_PaymentItem';
59
- }
60
-
61
- constructor(payment: Payment, objectBeingPaidFor: ObjectBase) {
62
- super();
63
- this.PaymentId = payment.PaymentId;
64
- this.PayForObjectId = objectBeingPaidFor.ObjectId;
65
- this.PayForObjectType = type(objectBeingPaidFor);
66
- }
67
-
68
- async paid(dbTransaction: any) {
69
- const sequelize = FinanceDb.getConnection();
70
- if (
71
- this.PayForObjectType === 'Document' ||
72
- this.PayForObjectType === 'FinanceDocument'
73
- ) {
74
- const selectQuery = `SELECT Amount FROM finance_Document WHERE DocNo = '${this.PayForObjectId}'`;
75
- const invoice: any[] = await sequelize.query(selectQuery, {
76
- type: QueryTypes.SELECT,
77
- raw: true,
78
- transaction: dbTransaction,
79
- });
80
-
81
- let paidStatus = '';
82
- if (invoice[0].Amount > this.Amount) {
83
- const selectPaymentItem = `SELECT * FROM finance_PaymentItem WHERE PayForObjectId = '${this.PayForObjectId}' AND PayForObjectType = 'Document'`;
84
- const documentPaymentItems: any[] = await sequelize.query(
85
- selectPaymentItem,
86
- {
87
- type: QueryTypes.SELECT,
88
- raw: true,
89
- transaction: dbTransaction,
90
- },
91
- );
92
- let amountPreviouslyPaid = 0;
93
- documentPaymentItems.forEach((paymentItem) => {
94
- const amount =
95
- typeof paymentItem.Amount === 'string'
96
- ? parseFloat(paymentItem.Amount).toFixed(2)
97
- : paymentItem.Amount;
98
- amountPreviouslyPaid += amount;
99
- });
100
- if (invoice[0].Amount == amountPreviouslyPaid) {
101
- paidStatus = DocumentStatus.SETTLED;
102
- } else {
103
- paidStatus = DocumentStatus.PARTIALSETTLED;
104
- }
105
- } else if (invoice[0].Amount == this.Amount) {
106
- paidStatus = DocumentStatus.SETTLED;
107
- } else {
108
- throw new Error(
109
- 'Payment Item amount cannot be greater than its PayForObject amount.',
110
- );
111
- }
112
-
113
- const updateQuery = `
114
- UPDATE finance_Document
115
- SET Status = '${paidStatus}'
116
- WHERE DocNo = '${this.PayForObjectId}'
117
- `;
118
- // const replacements = { docNo: this.PayForObjectId };
119
- await sequelize.query(updateQuery, {
120
- type: QueryTypes.UPDATE,
121
- raw: true,
122
- transaction: dbTransaction,
123
- });
124
- } else if (
125
- this.PayForObjectType === 'LoanSchedule' ||
126
- this.PayForObjectType === 'SimpleLoans' ||
127
- this.PayForObjectType === 'Loans'
128
- ) {
129
- Next();
130
- } else {
131
- throw new Error('Unknown type');
132
- }
133
- }
134
- }
@@ -1,5 +0,0 @@
1
- export interface IPaymentMethodAttr {
2
- MethodId: string;
3
- Name: string;
4
- CompanyId: string;
5
- }
@@ -1,11 +0,0 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import PaymentMethodModel from '../models/payment-method.entity';
3
-
4
- export class PaymentMethodRepository
5
- extends RepositoryBase<PaymentMethodModel>
6
- implements IRepositoryBase<PaymentMethodModel>
7
- {
8
- constructor() {
9
- super(PaymentMethodModel);
10
- }
11
- }
@@ -1,146 +0,0 @@
1
- import { ObjectBase } from '@tomei/general';
2
- import { RecordNotFoundError } from '@tomei/general/dist/class/exceptions/record-not-found.error';
3
- import { PaymentMethodRepository } from './payment-method.repository';
4
- import PaymentMethodType from '../payment-method-type/payment-method-type';
5
- import { PaymentMethodTypeRepository } from '../payment-method-type/payment-method-type.repository';
6
- import { IPaymentMethodTypeAttr } from '../payment-method-type/interfaces/payment-method-type-attr.interface';
7
-
8
- export default class PaymentMethod extends ObjectBase {
9
- MethodId = 'New';
10
- Name = '';
11
- CompanyId = '';
12
- private _ObjectType = 'PaymentMethod';
13
-
14
- get ObjectType() {
15
- return this._ObjectType;
16
- }
17
-
18
- private static _RepositoryBase = new PaymentMethodRepository();
19
- private static _PaymentMethodTypeRepository =
20
- new PaymentMethodTypeRepository();
21
-
22
- private _DbTransaction: any;
23
- private _PaymentMethodTypes = [];
24
-
25
- constructor(
26
- dbTransaction?: any,
27
- methodId?: string,
28
- companyId?: string,
29
- name?: string,
30
- ) {
31
- super();
32
- if (dbTransaction) {
33
- this._DbTransaction = dbTransaction;
34
- }
35
- if (methodId) {
36
- this.MethodId = methodId;
37
- }
38
- if (companyId) {
39
- this.CompanyId = companyId;
40
- }
41
- if (name) {
42
- this.Name = name;
43
- }
44
- }
45
-
46
- static async initPaymentMethod(dbTransaction?: any, methodId?: string) {
47
- try {
48
- if (methodId) {
49
- const methodData = await PaymentMethod._RepositoryBase.findOne({
50
- where: {
51
- MethodId: methodId,
52
- },
53
- transaction: dbTransaction,
54
- });
55
-
56
- if (methodData) {
57
- return new PaymentMethod(
58
- dbTransaction,
59
- methodData.MethodId,
60
- methodData.CompanyId,
61
- methodData.Name,
62
- );
63
- } else {
64
- throw new RecordNotFoundError(
65
- 'PaymentMethodErrMsg',
66
- 'No record found.',
67
- );
68
- }
69
- }
70
- return new PaymentMethod(dbTransaction);
71
- } catch (error) {
72
- error;
73
- }
74
- }
75
-
76
- get ObjectId() {
77
- return this.MethodId;
78
- }
79
-
80
- get ObjectName() {
81
- return this.Name;
82
- }
83
-
84
- get TableName() {
85
- return 'finance_PaymentMethod';
86
- }
87
-
88
- get PaymentMethodTypes(): Promise<PaymentMethodType[]> {
89
- return new Promise((resolve, reject) => {
90
- if (this.MethodId !== 'New') {
91
- PaymentMethod._PaymentMethodTypeRepository
92
- .findAll({
93
- where: {
94
- MethodId: this.MethodId,
95
- },
96
- transaction: this._DbTransaction,
97
- })
98
- .then((paymentMethodTypes) => {
99
- const paymentMethodTypeObjects = paymentMethodTypes.map(
100
- (paymentMethodTypeData) =>
101
- new PaymentMethodType(
102
- this._DbTransaction,
103
- paymentMethodTypeData.MethodTypeId,
104
- ),
105
- );
106
- return Promise.all(paymentMethodTypeObjects);
107
- })
108
- .then((paymentMethodTypeObjects) => {
109
- this._PaymentMethodTypes = paymentMethodTypeObjects;
110
- resolve(this._PaymentMethodTypes);
111
- })
112
- .catch((err) => {
113
- reject(err);
114
- });
115
- } else {
116
- resolve(this._PaymentMethodTypes);
117
- }
118
- });
119
- }
120
-
121
- /**
122
- * Create a new Payment Method Type which is automatically added to the Payment
123
- * Method Type list
124
- *
125
- * @see {@link FinanceCompany.LoadPaymentMethods} - for implementation
126
- *
127
- * @param {IPaymentMethodTypeAttr} paymentMethodTypePayload
128
- *
129
- * @returns {void}
130
- */
131
- async newPaymentMethodType(
132
- payload: IPaymentMethodTypeAttr,
133
- transaction?: any,
134
- ): Promise<any> {
135
- try {
136
- const newPaymentMethodType =
137
- await PaymentMethod._PaymentMethodTypeRepository.create(payload, {
138
- transaction: transaction,
139
- });
140
-
141
- this._PaymentMethodTypes.push(newPaymentMethodType);
142
- } catch (err) {
143
- throw err;
144
- }
145
- }
146
- }
@@ -1,8 +0,0 @@
1
- export interface IPaymentMethodTypeAttr {
2
- MethodTypeId: string;
3
- MethodId: string;
4
- Name: string;
5
- AccountNo: string;
6
- ProcessingFeeRate: number;
7
- ProcessingFeeAccountNo: string;
8
- }
@@ -1,11 +0,0 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import PaymentMethodType from '../models/payment-method-type.entity';
3
-
4
- export class PaymentMethodTypeRepository
5
- extends RepositoryBase<PaymentMethodType>
6
- implements IRepositoryBase<PaymentMethodType>
7
- {
8
- constructor() {
9
- super(PaymentMethodType);
10
- }
11
- }
@@ -1,79 +0,0 @@
1
- import { ObjectBase } from '@tomei/general';
2
- import { RecordNotFoundError } from '@tomei/general/dist/class/exceptions/record-not-found.error';
3
- import { PaymentMethodTypeRepository } from './payment-method-type.repository';
4
-
5
- export default class PaymentMethodType extends ObjectBase {
6
- MethodTypeId = 'New';
7
- MethodId = '';
8
- Name = '';
9
- AccountNo = '';
10
- ProcessingFeeRate = 0.0;
11
- ProcessingFeeAccountNo = '';
12
- private _ObjectType = 'PaymentMethodType';
13
-
14
- get ObjectType() {
15
- return this._ObjectType;
16
- }
17
-
18
- private _DbTransaction: any;
19
-
20
- private static _RepositoryBase = new PaymentMethodTypeRepository();
21
-
22
- constructor(dbTransaction?: any, methodTypeId?: string) {
23
- super();
24
- if (dbTransaction) {
25
- this._DbTransaction = dbTransaction;
26
- }
27
- if (methodTypeId) {
28
- this.MethodTypeId = methodTypeId;
29
- }
30
- }
31
-
32
- static async initMethodType(
33
- dbTransaction: any,
34
- methodTypeId: string,
35
- ): Promise<PaymentMethodType> {
36
- try {
37
- const paymentMethodTypeData = await this._RepositoryBase.findOne({
38
- where: {
39
- MethodTypeId: methodTypeId,
40
- },
41
- transaction: dbTransaction,
42
- });
43
- if (paymentMethodTypeData) {
44
- const paymentMethodType = new PaymentMethodType(
45
- dbTransaction,
46
- methodTypeId,
47
- );
48
- paymentMethodType.MethodId = paymentMethodTypeData.MethodId;
49
- paymentMethodType.Name = paymentMethodTypeData.Name;
50
- paymentMethodType.AccountNo = paymentMethodTypeData.AccountNo;
51
- paymentMethodType.ProcessingFeeRate =
52
- paymentMethodTypeData.ProcessingFeeRate;
53
- paymentMethodType.ProcessingFeeAccountNo =
54
- paymentMethodTypeData.ProcessingFeeAccountNo;
55
- return paymentMethodType;
56
- } else {
57
- const notFoundError = new RecordNotFoundError(
58
- 'PaymentMethodTypeErrMsg',
59
- 'No Record Found.',
60
- );
61
- throw notFoundError;
62
- }
63
- } catch (error) {
64
- console.log('Payment method type constructor err: ', error);
65
- }
66
- }
67
-
68
- get ObjectId() {
69
- return this.MethodTypeId;
70
- }
71
-
72
- get ObjectName() {
73
- return this.Name;
74
- }
75
-
76
- get TableName() {
77
- return 'finance_PaymentMethodType';
78
- }
79
- }
@@ -1,20 +0,0 @@
1
- import { PaymentStatus } from '../../enum';
2
-
3
- export class IPaymentPaidWithAttr {
4
- PaymentId: string;
5
- MethodTypeId: string;
6
- Currency: string;
7
- Amount: number;
8
- Status: PaymentStatus;
9
- TransactionId?: string;
10
- RefBank?: string;
11
- RefName?: string;
12
- RefNo?: string;
13
- RefOther1?: string;
14
- RefOther2?: string;
15
- RefOther3?: string;
16
- RefOther4?: string;
17
- RefOther5?: string;
18
- Remarks?: string;
19
- PaymentMediaId?: string;
20
- }
@@ -1,11 +0,0 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import PaymentPaidWithModel from '../models/payment-paid-with.entity';
3
-
4
- export class PaymentPaidWithRepository
5
- extends RepositoryBase<PaymentPaidWithModel>
6
- implements IRepositoryBase<PaymentPaidWithModel>
7
- {
8
- constructor() {
9
- super(PaymentPaidWithModel);
10
- }
11
- }
@@ -1,74 +0,0 @@
1
- import { ObjectBase } from '@tomei/general';
2
- import Payment from '../payment/payment';
3
- import { PaymentPaidWithRepository } from './payment-paid-with.repository';
4
- import { PaymentPaidWithStatus } from '../enum/payment-status.enum';
5
-
6
- export default class PaymentPaidWith extends ObjectBase {
7
- private _PaymentId = '';
8
- private _MethodTypeId = '';
9
- Currency = 'MYR';
10
- Amount = 0;
11
- Status: PaymentPaidWithStatus;
12
- TransactionId = '';
13
- RefBank = '';
14
- RefName = '';
15
- RefNo = '';
16
- RefOther1 = '';
17
- RefOther2 = '';
18
- RefOther3 = '';
19
- RefOther4 = '';
20
- RefOther5 = '';
21
- Remarks = '';
22
- PaymentMediaId = '';
23
-
24
- private _ObjectType = 'PaymentPaidWith';
25
-
26
- private static _RepositoryBase = new PaymentPaidWithRepository();
27
- private _DbTransaction: any;
28
-
29
- get ObjectType() {
30
- return this._ObjectType;
31
- }
32
-
33
- public get PaymentId() {
34
- return this._PaymentId;
35
- }
36
-
37
- public set PaymentId(id: string) {
38
- this._PaymentId = id;
39
- }
40
-
41
- public get MethodTypeId() {
42
- return this._MethodTypeId;
43
- }
44
-
45
- public set MethodTypeId(id: string) {
46
- this._MethodTypeId = id;
47
- }
48
-
49
- /* ObjectBase Implementation */
50
- get ObjectId() {
51
- return '';
52
- }
53
-
54
- get ObjectName() {
55
- return '';
56
- }
57
-
58
- get TableName() {
59
- return 'finance_PaymentPaidWith';
60
- }
61
-
62
- constructor(
63
- payment: Payment,
64
- paymentMethodTypeId: string,
65
- dbTransaction?: any,
66
- ) {
67
- super();
68
- this.PaymentId = payment.PaymentId;
69
- this.MethodTypeId = paymentMethodTypeId;
70
- if (dbTransaction) {
71
- this._DbTransaction = dbTransaction;
72
- }
73
- }
74
- }
@@ -1,10 +0,0 @@
1
- export interface ITaxAttr {
2
- TaxCode: string;
3
- TaxRate: number;
4
- Description: string;
5
- CompanyId: string;
6
- CreatedById: string;
7
- CreatedAt: Date;
8
- UpdatedById: string;
9
- UpdatedAt: Date;
10
- }
@@ -1,11 +0,0 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import FinanceTaxModel from '../models/tax.entity';
3
-
4
- export class TaxRepository
5
- extends RepositoryBase<FinanceTaxModel>
6
- implements IRepositoryBase<FinanceTaxModel>
7
- {
8
- constructor() {
9
- super(FinanceTaxModel);
10
- }
11
- }
package/src/tax/tax.ts DELETED
@@ -1,68 +0,0 @@
1
- import { ObjectBase } from '@tomei/general';
2
- import { ITaxAttr } from './interfaces/tax-attr.interface';
3
-
4
- export class Tax extends ObjectBase {
5
- ObjectName: string;
6
- TableName: string;
7
- ObjectId = 'New';
8
- private _TaxCode: string;
9
- private _Description: string;
10
- private _CompanyId: string;
11
- private _TaxRate = 0;
12
- private _CreatedById: string;
13
- private _CreatedAt: Date;
14
- private _UpdatedById: string;
15
- private _UpdatedAt: Date;
16
- ObjectType = 'Tax';
17
-
18
- get TaxCode(): string {
19
- return this.ObjectId;
20
- }
21
-
22
- set TaxCode(code: string) {
23
- this._TaxCode = code;
24
- this.ObjectId = code;
25
- }
26
-
27
- constructor(taxAttr?: ITaxAttr) {
28
- super();
29
- if (taxAttr) {
30
- this.TaxCode = taxAttr.TaxCode;
31
- this._Description = taxAttr.Description;
32
- this._CompanyId = taxAttr.CompanyId;
33
- this._TaxRate = taxAttr.TaxRate;
34
- this._CreatedById = taxAttr.CreatedById;
35
- this._CreatedAt = taxAttr.CreatedAt;
36
- this._UpdatedById = taxAttr.UpdatedById;
37
- this._UpdatedAt = taxAttr.UpdatedAt;
38
- }
39
- }
40
-
41
- get Description(): string {
42
- return this._Description;
43
- }
44
-
45
- get CompanyId(): string {
46
- return this._CompanyId;
47
- }
48
-
49
- get TaxRate(): number {
50
- return this._TaxRate;
51
- }
52
-
53
- get CreatedById(): string {
54
- return this._CreatedById;
55
- }
56
-
57
- get CreatedAt(): Date {
58
- return this._CreatedAt;
59
- }
60
-
61
- get UpdatedById(): string {
62
- return this._UpdatedById;
63
- }
64
-
65
- get UpdatedAt(): Date {
66
- return this._UpdatedAt;
67
- }
68
- }
@@ -1,25 +0,0 @@
1
- export class TestDocument {
2
- static test(classPath, className) {
3
- // tslint:disable-next-line:no-console
4
- console.log('inside test() #1');
5
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
- // @ts-ignore
7
- // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unused-vars,
8
- const module = require(classPath);
9
- // tslint:disable-next-line:no-console
10
- console.log('inside test() #1: %o', module);
11
- console.log(`module.${className}`);
12
- // tslint:disable-next-line:no-eval
13
- const classConstructor = eval(`module.${className}`);
14
- // tslint:disable-next-line:no-console
15
- console.log('inside test() #2: %o', classConstructor);
16
-
17
- const docGen = new classConstructor('RECEIPT001');
18
- // tslint:disable-next-line:no-console
19
- console.log('inside test() #3');
20
-
21
- docGen.generateReceipt();
22
- // tslint:disable-next-line:no-console
23
- console.log('inside test() #4');
24
- }
25
- }
package/src/test.ts DELETED
@@ -1,3 +0,0 @@
1
- export function getHello(): string {
2
- return 'Hello from the new package!';
3
- }
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
4
- }
package/tsconfig.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "declaration": true,
5
- "removeComments": true,
6
- "emitDecoratorMetadata": true,
7
- "experimentalDecorators": true,
8
- "allowSyntheticDefaultImports": true,
9
- "moduleResolution": "node",
10
- "target": "es2017",
11
- "sourceMap": true,
12
- "outDir": "./dist",
13
- "baseUrl": "./",
14
- "incremental": true,
15
- "skipLibCheck": true,
16
- "strictNullChecks": false,
17
- "noImplicitAny": false,
18
- "strictBindCallApply": false,
19
- "forceConsistentCasingInFileNames": false,
20
- "noFallthroughCasesInSwitch": false,
21
- },
22
- "exclude": ["node_modules", "dist", "invoice-template", "configs"]
23
- }