Manual-Repayment Queries & Mutations
To Make Manual Repayment
The makeManualRepayment
mutation is used to manually record a repayment made by a user for a portfolio in the system. This mutation allows users to log repayments for loans.
mutation makeManualRepayment($input: MakeManualRepaymentInput!) {
makeManualRepayment(input: $input){
success
portfolio {
id
}
}
}
{
"input": {
"portfolioId": "ck1xcu4by6let0842lecvvrlv",
"amount": 5000,
"bankId": "ck1xcu4by6",
"accountNumber": "1234567868",
"reference": "reference"
}
}
{
"data": {
"makeManualRepayment": {
"success": true,
"portfolio": {
"id": "ck1xcu4by6let0842lecvvrlv"
}
}
}
}
To Notify Offline Repayment
The notifyOfflineRepayment
mutation is used to notify the system about an offline repayment made by a user. Offline repayments typically include methods such as cheque payments. The mutation allows the user to provide details about the offline repayment, such as the portfolio ID, service used for repayment, the amount, bank ID, cheque number, and account name.
mutation notifyOfflineRepayment($input: NotifyOfflineRepaymentInput!) {
notifyOfflineRepayment(input: $input){
id
portfolio {
id
}
}
}
{
"input": {
"portfolioId": "ck1xcu4by6let0842lecvvrlv",
"service": "Cheque",
"amount": 5000,
"bankId": "ck1xcu4by6",
"chequeNo": "1234567899",
"accountName": "accountName"
}
}
{
"data": {
"notifyOfflineRepayment": {
"id": "ck1xcu4by6let0842lecvvrlv", // ID of the repayment transaction
"portfolio": {
"id": "ck1xcu4by6let0842lecvvrlv" // ID of the portfolio associated with the repayment
}
}
}
}
Response Explanation
Upon successful execution of the notifyOfflineRepayment
mutation with the given input, the API returns a response containing the ID of the repayment transaction and the ID of the portfolio associated with the repayment. This information can be used to track the repayment status and link it back to the appropriate portfolio.
OfflineRepayments
Retrieves a list of offline repayments based on the provided criteria.
Input Variables
after
: Cursor to paginate after.before
: Cursor to paginate before.first
: Number of items to retrieve from the beginning.last
: Number of items to retrieve from the end.orderBy
: Sorting criteria for the results.where
: Filtering criteria for the results.
query OfflineRepayments(
$after: ConnectionCursor,
$before: ConnectionCursor,
$first: ConnectionLimitInt,
$last: ConnectionLimitInt,
$orderBy: OfflineRepaymentOrderByInput,
$where: OfflineRepaymentWhereInput
) {
offlineRepayments(
after: $after,
before: $before,
first: $first,
last: $last,
orderBy: $orderBy,
where: $where
) {
nodes {
amount
bank {
id
name
}
id
service
status
}
}
}
{
"after": null,
"before": null,
"first": null,
"last": null,
"orderBy": null,
"where": {
"amount": 1000.00,
"createdAt": "12-12-2022",
"id": "hgde56rgvut76"
}
}
{
"data": {
"offlineRepayments": {
"nodes": [
{
"amount": 1000.00,
"bank": {
"id": "bank123",
"name": "Example Bank"
},
"id": "repayment123",
"service": "Utility Payment",
"status": "Completed"
}
]
}
}
}
In the Sample Response, the query returned one offline repayment record that matches the provided filtering criteria. The details of the repayment, including the amount, bank information, ID, service, and status, are included in the response.
ApproveOfflineRepayment
This mutation approves an offline repayment with the provided input parameters.
Input Variable
You need to provide the following input variables for the mutation to execute successfully:
comment
(String): A comment or note related to the offline repayment approval.id
(String): The unique identifier of the offline repayment to be approved.
mutation ApproveOfflineRepayment($input: MutateOfflineRepaymentInput) {
approveOfflineRepayment(input: $input) {
amount
bank {
id
name
}
id
}
}
{
"input": {
"comment": "sample comment",
"id": "jdvshbe8f7348ey9dhibqd"
}
}
{
"data": {
"approveOfflineRepayment": {
"amount": 500.0,
"bank": {
"id": "bank123",
"name": "Sample Bank"
},
"id": "repayment456"
}
}
}
Sample Response
The mutation will return an object with the following fields:
amount
(Float): The amount of the approved repayment.bank
(Object): The bank details associated with the repayment.id
(String): The unique identifier of the bank.name
(String): The name of the bank.
id
(String): The unique identifier of the approved offline repayment.
To Decline Offline Repayment
This mutation allows you to decline an offline repayment for a specific portfolio. Once declined, the repayment will not be processed.
mutation declineOfflineRepayment($input: MutateOfflineRepaymentInput!) {
declineOfflineRepayment(input: $input){
id
portfolio {
id
}
}
}
{
"input": {
"id": "ck1xcu4by6let0842lecvvrlv",
"comment": "This repayment is incomplete and cannot be processed."
}
}
{
"data": {
"declineOfflineRepayment": {
"id": "ck1xcu4by6let0842lecvvrlv",
"portfolio": {
"id": "ck1xcu4by6let0842lecvvrlv"
}
}
}
}
The mutation declineOfflineRepayment
returns the ID of the declined repayment as well as the ID of the associated portfolio. The comment
field in the input variable is optional and can be used to provide additional context or reasons for declining the repayment.