@tomei/finance 0.6.25 → 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.25",
3
+ "version": "0.6.27",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -307,7 +307,7 @@ export default class FinanceCompany extends ObjectBase {
307
307
  // const customerId = await this.AccountingSystem.createCustomer({
308
308
  // customer,
309
309
  // });
310
- const customerId = "REF"
310
+ const customerId = 'REF';
311
311
 
312
312
  customer.CompanyId = this._CompanyId;
313
313
 
@@ -450,7 +450,7 @@ export default class FinanceCompany extends ObjectBase {
450
450
  // createAccountPayload,
451
451
  // );
452
452
 
453
- const accSystemAccountId = "REF"
453
+ const accSystemAccountId = 'REF';
454
454
 
455
455
  console.log(
456
456
  'Finance Company Create Account: After accSystemAccountId Create',
@@ -1932,48 +1932,39 @@ export default class FinanceCompany extends ObjectBase {
1932
1932
  const journalEntry = new JournalEntry(dbTransaction);
1933
1933
 
1934
1934
  // For each Payment.PaymentPaidWith:
1935
- paymentPaidWithItems.forEach(async (paymentPaidWithItem) => {
1936
- // check if its payment method type is valid.
1937
- try {
1938
- const paymentMethodType = await PaymentMethodType.initMethodType(
1939
- dbTransaction,
1940
- paymentPaidWithItem.MethodTypeId,
1941
- );
1935
+ for (const paymentPaidWithItem of paymentPaidWithItems) {
1936
+ const paymentMethodType = await PaymentMethodType.initMethodType(
1937
+ dbTransaction,
1938
+ paymentPaidWithItem.MethodTypeId,
1939
+ );
1942
1940
 
1943
- //Initialise new Debit LedgerTransaction by calling JournalEntry.newLedgerTransaction() method and set below attributes:
1944
- const debitLT = await journalEntry.newLedgerTransaction(
1945
- TransactionTypeOptions.DEBIT,
1946
- );
1947
- debitLT.AccountNo = paymentMethodType.AccountNo;
1948
- debitLT.Currency = paymentPaidWithItem.Currency;
1949
- debitLT.DebitAmount = paymentPaidWithItem.Amount;
1950
- debitLT.Date = transactionDate;
1951
- debitLT.Description = 'Payment Received';
1952
- debitLT.RelatedPaymentId = payment.PaymentId;
1953
- } catch (error) {
1954
- if (error instanceof RecordNotFoundError) {
1955
- throw new Error('Invalid Payment Method Type Id');
1956
- } else {
1957
- throw error;
1958
- }
1959
- }
1960
- });
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;
1951
+ }
1961
1952
 
1962
1953
  //For each creditTransactions, Initialise new Credit LedgerTransaction by calling JournalEntry.newLedgerTransaction() method
1963
- creditTransaction.forEach(async (creditTransaction) => {
1954
+ for (const ct of creditTransaction) {
1964
1955
  const creditLT = await journalEntry.newLedgerTransaction(
1965
1956
  TransactionTypeOptions.CREDIT,
1966
1957
  );
1967
- creditLT.AccountNo = creditTransaction.AccountNo;
1968
- creditLT.Currency = creditTransaction.Currency;
1969
- creditLT.CreditAmount = creditTransaction.Amount;
1958
+ creditLT.AccountNo = ct.AccountNo;
1959
+ creditLT.Currency = ct.Currency;
1960
+ creditLT.CreditAmount = ct.Amount;
1970
1961
  creditLT.Date = transactionDate;
1971
1962
  creditLT.Description = 'Payment Received';
1972
1963
  creditLT.RelatedPaymentId = payment.PaymentId;
1973
- });
1964
+ }
1974
1965
 
1975
1966
  // Call this.postJournal()
1976
- this.postJournal(dbTransaction, journalEntry, loginUser);
1967
+ await this.postJournal(dbTransaction, journalEntry, loginUser);
1977
1968
 
1978
1969
  return payment;
1979
1970
  } catch (error) {
@@ -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
  *