Dilpreet Singh created FINCN-51:
-----------------------------------

             Summary: Fix: Planned payment fetch more failed
                 Key: FINCN-51
                 URL: https://issues.apache.org/jira/browse/FINCN-51
             Project: Fineract Cloud Native
          Issue Type: Improvement
          Components: fineract-cn-mobile
            Reporter: Dilpreet Singh


initially, we are fetching the 50 planned payments at the page 0 and getting 
the planned payments as a response

{
  "chargeNames": [
    {
      "identifier": "processing-fee",
      "name": "Processing fee"
    },
    {
      "identifier": "loan-origination-fee",
      "name": "Loan origination fee"
    },
    {
      "identifier": "disburse-payment",
      "name": "Disburse payment"
    },
    {
      "identifier": "return-disbursement",
      "name": "Return disbursement"
    },
    {
      "identifier": "disbursement-fee",
      "name": "Disbursement fee"
    },
    {
      "identifier": "track-return-principal",
      "name": "Track return principal"
    },
    {
      "identifier": "loan-funds-allocation",
      "name": "loan-funds-allocation"
    },
    {
      "identifier": "track-disburse-payment",
      "name": "Track disburse payment"
    },
    {
      "identifier": "repayment",
      "name": "Repayment"
    },
    {
      "identifier": "interest",
      "name": "Interest"
    }
  ],
  "elements": [
    {
      "interestRate": null,
      "costComponents": [
        {
          "chargeIdentifier": "loan-funds-allocation",
          "amount": 1500
        },
        {
          "chargeIdentifier": "processing-fee",
          "amount": 15
        },
        {
          "chargeIdentifier": "disbursement-fee",
          "amount": 1.5
        },
        {
          "chargeIdentifier": "loan-origination-fee",
          "amount": 15
        },
        {
          "chargeIdentifier": "return-disbursement",
          "amount": 1500
        },
        {
          "chargeIdentifier": "track-disburse-payment",
          "amount": 0
        },
        {
          "chargeIdentifier": "disburse-payment",
          "amount": 0
        }
      ],
      "remainingPrincipal": 1500,
      "date": null
    },
    {
      "interestRate": null,
      "costComponents": [
        {
          "chargeIdentifier": "repayment",
          "amount": 752.7
        },
        {
          "chargeIdentifier": "interest",
          "amount": 1.03
        },
        {
          "chargeIdentifier": "track-return-principal",
          "amount": 751.67
        }
      ],
      "remainingPrincipal": 748.33,
      "date": "2017-09-01Z"
    },
    {
      "interestRate": null,
      "costComponents": [
        {
          "chargeIdentifier": "repayment",
          "amount": 755.7
        },
        {
          "chargeIdentifier": "interest",
          "amount": 3.08
        },
        {
          "chargeIdentifier": "track-return-principal",
          "amount": 748.33
        }
      ],
      "remainingPrincipal": 0,
      "date": "2017-10-01Z"
    }
  ],
  "totalPages": 1,
  "totalElements": 3
}

You can see in response we are getting totalPages and totalElements. We need to 
refactor our current load more REST API call according to these two parameter 
otherwise server is giving this error.

{
  "timestamp": 1503811590076,
  "status": 500,
  "error": "Internal Server Error",
  "exception": "java.lang.IllegalArgumentException",
  "message": "org.springframework.web.util.NestedServletException: Request 
processing failed; nested exception is java.lang.IllegalArgumentException: 
fromIndex(50) > toIndex(3)",
  "path": 
"/portfolio/v1/individuallending/products/lending/cases/lending_loan_001/plannedpayments"
}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to