private createRows()

in src/app/customers/cases/payments/payments.component.ts [61:88]


  private createRows(plannedPayments: PlannedPayment[]): PaymentRow[] {
    const rows: PaymentRow[] = [];

    plannedPayments.forEach((plannedPayment, index) => {
      const interest = this.getChargeAmount(plannedPayment.payment.costComponents, 'repay-interest');
      const principal = this.getChargeAmount(plannedPayment.payment.costComponents, 'repay-principal');
      const payment = plannedPayment.payment.balanceAdjustments.ey * -1;
      const balance = plannedPayment.balances.clp;

      if (index === 0) {
        rows.push({
          balance
        });

        return;
      }

      rows.push({
        date: plannedPayment.payment.date,
        payment,
        interest,
        principal,
        balance
      });
    });

    return rows;
  }