@tomei/finance 0.6.26 → 0.6.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/finance",
3
- "version": "0.6.26",
3
+ "version": "0.6.27",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1784,7 +1784,7 @@ export default class FinanceCompany extends ObjectBase {
1784
1784
  dbTransaction: any,
1785
1785
  loginUser: LoginUserBase,
1786
1786
  payment: Payment,
1787
- creditTransactions: {
1787
+ creditTransaction: {
1788
1788
  AccountNo: string;
1789
1789
  Currency: string;
1790
1790
  Amount: number;
@@ -1824,7 +1824,7 @@ export default class FinanceCompany extends ObjectBase {
1824
1824
  }
1825
1825
 
1826
1826
  //Make sure the payment items length is equal to creditTransactions length records.
1827
- if (paymentItems.length !== creditTransactions.length) {
1827
+ if (paymentItems.length !== creditTransaction.length) {
1828
1828
  throw new Error(
1829
1829
  'Payment items length is not equal to creditTransaction length',
1830
1830
  );
@@ -1836,7 +1836,7 @@ export default class FinanceCompany extends ObjectBase {
1836
1836
  totalAmount += paymentItem.Amount;
1837
1837
  });
1838
1838
 
1839
- const totalCreditTransactionAmount = creditTransactions.reduce(
1839
+ const totalCreditTransactionAmount = creditTransaction.reduce(
1840
1840
  (accumulator, currentValue) => {
1841
1841
  return accumulator + currentValue.Amount;
1842
1842
  },
@@ -1933,36 +1933,35 @@ export default class FinanceCompany extends ObjectBase {
1933
1933
 
1934
1934
  // For each Payment.PaymentPaidWith:
1935
1935
  for (const paymentPaidWithItem of paymentPaidWithItems) {
1936
- // check if its payment method type is valid.
1937
- const paymentMethodType = await PaymentMethodType.initMethodType(
1938
- dbTransaction,
1939
- paymentPaidWithItem.MethodTypeId,
1940
- );
1936
+ const paymentMethodType = await PaymentMethodType.initMethodType(
1937
+ dbTransaction,
1938
+ paymentPaidWithItem.MethodTypeId,
1939
+ );
1941
1940
 
1942
- //Initialise new Debit LedgerTransaction by calling JournalEntry.newLedgerTransaction() method and set below attributes:
1943
- const debitLT = await journalEntry.newLedgerTransaction(
1944
- TransactionTypeOptions.DEBIT,
1945
- );
1946
- debitLT.AccountNo = paymentMethodType.AccountNo;
1947
- debitLT.Currency = paymentPaidWithItem.Currency;
1948
- debitLT.DebitAmount = paymentPaidWithItem.Amount;
1949
- debitLT.Date = transactionDate;
1950
- debitLT.Description = 'Payment Received';
1951
- debitLT.RelatedPaymentId = payment.PaymentId;
1941
+ //Initialise new Debit LedgerTransaction by calling JournalEntry.newLedgerTransaction() method and set below attributes:
1942
+ const debitLT = await journalEntry.newLedgerTransaction(
1943
+ TransactionTypeOptions.DEBIT,
1944
+ );
1945
+ debitLT.AccountNo = paymentMethodType.AccountNo;
1946
+ debitLT.Currency = paymentPaidWithItem.Currency;
1947
+ debitLT.DebitAmount = paymentPaidWithItem.Amount;
1948
+ debitLT.Date = transactionDate;
1949
+ debitLT.Description = 'Payment Received';
1950
+ debitLT.RelatedPaymentId = payment.PaymentId;
1952
1951
  }
1953
1952
 
1954
1953
  //For each creditTransactions, Initialise new Credit LedgerTransaction by calling JournalEntry.newLedgerTransaction() method
1955
- for (const creditTransaction of creditTransactions) {
1954
+ for (const ct of creditTransaction) {
1956
1955
  const creditLT = await journalEntry.newLedgerTransaction(
1957
1956
  TransactionTypeOptions.CREDIT,
1958
1957
  );
1959
- creditLT.AccountNo = creditTransaction.AccountNo;
1960
- creditLT.Currency = creditTransaction.Currency;
1961
- creditLT.CreditAmount = creditTransaction.Amount;
1958
+ creditLT.AccountNo = ct.AccountNo;
1959
+ creditLT.Currency = ct.Currency;
1960
+ creditLT.CreditAmount = ct.Amount;
1962
1961
  creditLT.Date = transactionDate;
1963
1962
  creditLT.Description = 'Payment Received';
1964
1963
  creditLT.RelatedPaymentId = payment.PaymentId;
1965
- };
1964
+ }
1966
1965
 
1967
1966
  // Call this.postJournal()
1968
1967
  await this.postJournal(dbTransaction, journalEntry, loginUser);
@@ -213,7 +213,6 @@ export default class JournalEntry extends AccountSystemEntity {
213
213
  /**
214
214
  * Create a new LedgerTransaction
215
215
  *
216
- * @see {@link FinanceCompany.issueInvoice} - for implementation
217
216
  *
218
217
  * @param transactionType - Indicating the type of ledger transaction to create
219
218
  *