Portfolio Section Queries & Mutations

To Disburse Loan to Bank

The disburseLoanToBank mutation is used to disburse a loan from a specific portfolio to a bank. The mutation takes an input variable of type DisburseLoanToBankInput. It returns information about the success of the disbursement, the portfolio ID, and a message providing additional context.

mutation disburseLoanToBank($input: DisburseLoanToBankInput!) { disburseLoanToBank(input: $input){ success portfolio { id } message } }
{ "input": { "portfolioId": "ck1xcu4by6let0842lecvvrlv" } }
{ "data": { "disburseLoanToBank": { "success": true, "portfolio": { "id": "ck1xcu4by6let0842lecvvrlv" }, "message": "Loan disbursement to the bank was successful." } } }

EditRepayment

The EditRepayment mutation allows you to edit repayment details for a specific portfolio. It takes an EditRepaymentInput object as its input and returns a response containing validation information and status details.

Input Variables

  • input: The input object containing the information needed to edit the repayment.

    • portfolioId: ID of the portfolio for which repayments are to be edited.

    • repayments: An array of repayment objects with the updated details.

      • newDueDate: New due date for the repayment (formatted as "MM-DD-YYYY").

      • newInterestAmount: New interest amount for the repayment.

      • newLateFee: New late fee for the repayment.

      • newPrincipalAmount: New principal amount for the repayment.

Sample Response
The response of the EditRepayment mutation includes validation information and the status of the operation.

  • repaymentId: The ID of the edited repayment.

  • status: The status of the mutation operation. Possible values: "success" or "error".


To Make Paystack Reference Repayment

This mutation allows you to initiate a repayment using a Paystack reference.


MakePaystackCardRepayment

This mutation allows you to initiate a repayment using a Paystack card for a specified portfolio.

Input Variables

  • input: A required input variable that includes the following fields:

    • accountCardId (String): The ID of the Paystack card associated with the repayment.

    • amount (Float): The amount to be repaid using the Paystack card.

    • portfolioId (String): The ID of the portfolio for which the repayment is being made.

Sample Response
Upon successful execution of the mutation, the API will return a response with the following fields:

  • portfolio (Object): Details of the portfolio for which the repayment was made.

    • id (String): The ID of the portfolio.

  • transaction (Object): Details of the repayment transaction.

    • accountDetails (Object): Bank account details for the transaction.

      • accountName (String): Name of the account holder.

      • accountNumber (String): Account number.

      • bankName (String): Name of the bank.

    • amount (Float): Amount of the repayment.

    • paymentMethod (Object): Payment method used for the repayment.

      • name (String): Name of the payment method.

    • status (String): Status of the transaction.

  • success (Boolean): Indicates whether the repayment was successful.


ManualPaystackReferenceRepayment

This mutation allows you to manually record a repayment using a Paystack reference for a specific portfolio.

Input Variables

  • input: An object containing the necessary information to record the repayment.

    • paystackReference: The Paystack reference associated with the payment.

    • portfolioId: The ID of the portfolio for which the repayment is being recorded.

Sample Response
The mutation response will include details about the recorded repayment transaction and the associated portfolio.


To Update Externally Disbursed Loan

The updateExternallyDisbursedLoan mutation is used to update the status of an externally disbursed loan in the system. This mutation takes an ExternalDisbursementInput object as an input variable, which contains the necessary information to perform the update.

In the sample response, the success field indicates whether the update operation was successful or not. The portfolio field contains the updated portfolio's ID, and the message field provides additional information about the status of the update. If the mutation is successful, the success field will be true, and the message field will contain a success message. If there is an error during the update process, the success field will be false, and the message field will contain an error message explaining the reason for the failure.


To Update Repayment Due Date

The updateRepaymentDueDate mutation allows you to update the due date of a repayment in a portfolio. This mutation takes an input variable of type UpdateRepaymentDueDateInput, which includes the repaymentId identifying the repayment and the newDate specifying the new due date.

In the sample response, your_portfolio_id_here is the ID of the portfolio to which the repayment belongs, and your_updated_repayment_id_here is the ID of the repayment that has been successfully updated with the new due date specified in the input variable.


Getting Repayment Breakdown

getRepaymentBreakdown allows you to retrieve the repayment breakdown details for a specific policy based on the provided input variables. It returns various financial details related to the repayment schedule, such as principal amount, interest, total payment, and repayment frequency.

A successful response to the getRepaymentBreakdown query will return a JSON object.


CloseOutLoanBeforeDisbursement

This mutation allows you to close out a loan before its disbursement within the specified portfolio. This action will mark the loan as closed and provide relevant information in the response.

Input Variables

  • input (required): An object containing the input parameters for the mutation.

    • comment (required, string): A message or comment regarding the loan closure.

    • portfolioId (required, string): The ID of the portfolio containing the loan that needs to be closed out before disbursement.


CloseOutLoan

Close out a loan within a specified portfolio.

Input Variables

  • portfolioId (required): The ID of the portfolio containing the loan to be closed out. (Example: "hceurgv873yrhj")

Sample Response
An example response for the closeOutLoan mutation:

Fields

  • closeOutLoan: The root field for the mutation, representing the result of closing out a loan.

    • message: A message indicating the result of the operation.

    • portfolio: The portfolio associated with the closed-out loan.

      • id: The ID of the portfolio.

    • success: A boolean flag indicating whether the operation was successful.