Facade method for launching product returns
A brief description of the logic of the method:
-
Validation for filling in the required fields, the correctness of the amounts of the new schedule and verification of the absence of overdue amounts under the loan contract.
-
Clarification of the type of refund - full or partial (full if the Refund amount coincides with the amount of the current schedule)
-
Launching a customized document Recovery (with a full refund, all repayments are restored except for fines, with a partial refund, only the canceled OS is restored)
-
If the refund is full, we write off all amounts under the contract with the type of movement.
-
If there is a partial refund, the schedule is recalculated according to the transferred new schedule (adjusting the write-off of fixed assets, saving the new schedule, adjusting the issuance of fixed assets to a new schedule - including past tranches)
-
We receive the amount that was restored with the Recovery document above and for this amount we replenish the personal account (share) - a new document for replenishing the share without VAT
-
We launch the document Redemption of all loan contracts of the client at the expense of an additional share - a new document, it also works as a document for repayment of contracts at the expense of a share, it only creates transactions with the type of movement Redemption Recept.
Important - the method creates documents both for a loan contract and for a share-personal account, therefore, if a rollback is necessary, it will be necessary to delete documents for both of these contracts.
Error codes:
-
NO_DATA_ERROR - no data transferred
-
NO_RETURN_AMOUNT_ERROR - Refund amount is not specified
-
CONTRACT_NAME_IS_NOT_SPECIFIED_ERROR - Loan contract number was not transmitted
-
CONTRACT_NOT_FOUND_BY_NAME_ERROR - Loan contract for the transferred number was not found
-
CONTRACT_MUST_BE_ISSUED_ERROR - Loan contract not issued
-
CONTRACT_IS_OVERDUE_ERROR - There are overdue amounts under the contract
-
TRANCHE_TOTAL_PRINCIPAL_NOT_EQUAL_REMAINED_AMOUNT_ERROR - The fixed assets on tranches do not correspond to the remaining fixed assets under the contract after the return
-
Error codes for the transferred schedule (similar checks as for the method of issuing a loan)
Request Body
Contract number
Date in unix timestamp format in milliseconds. The field is optional (if not passed, the current date-time is used)
"date-time"Amount type identifier . This field is conditionally required. If a collection of fees is passed, then this parameter is required
"int64""int64"Identifier when the fee was charged . This field is conditionally required. If a collection of fees is passed, then this parameter is required
"int64"Delay penalty. This field is optional. Its default value is false
Participates in the calculation of the UCS. This field is optional. Its default value is true
Do not charge. This field is optional. Its default value is false
Do not repay. This field is optional. Its default value is false
Value
"double""int64"Tranches
New graph. The newSchedule field can be omitted if a full refund occurs
Tranches
Refund amount
"double"Responses
OK
If the element was successfully removed, then this parameter returns an empty string
Upon successful deletion of an element in the directory, the status "ok" is returned. Otherwise, an error is returned
"error""ok"Returns the date + time (kernel) in unix timestamp format in milliseconds
"int64"