Loans
A loan is a revolving facility a borrower draws against and repays. Its balances, the limit, what is used, what is available, what is reserved and what is pending, are always in one currency, so the currency is stated once.
Opening a loan takes two calls. POST with LoanCmdApply and you get an offer: the terms the platform will lend on, signed with an offerToken. Send that offer back with LoanCmdAcceptOffer and the loan opens. The two steps exist because a borrower has to be shown the terms and agree to them, and there is no way to skip the agreement.
Movements are not here a drawdown or a card charge is a /loan-transactions. This collection is the loan itself: its status, its terms, and what it currently owes.
A trading account carries a metadata template, the rules its card transactions' metadata must meet. It is set on the application, comes back in the offer, which signs it, and is read under the loan's specification. LoanUpdateTradingAccount replaces it whole. A template is checked when it is set, and one that fails is refused with 400 naming the path at fault.
A loan's statement settings are a sub-resource. GET /loans/{loanId}/statement-settings reads which documents its statements produce, who they are mailed to and how the attachment is encrypted. PATCH with LoanUpdateStatementSettings replaces them whole, and LoanUpdateClearStatementSettings deletes them. All three need Loans_Update; the transfer secret is write-only.
/loans/{loanId}Get loan/loansList loans/loansCreate loans/loans/{loanId}Update loan/loans/{loanId}/statement-settingsGet loan statement setting/loan-facilities/{loanFacilityId}Get loan facility/loan-facilitiesList loan facilities/loan-facilitiesCreate loan facilities/loan-facilities/{loanFacilityId}Update loan facility/loan-statements/{loanStatementId}Get loan statement/loan-statementsList loan statements/loan-statementsCreate loan statements/loan-statements/{loanStatementId}Update loan statement/loan-statements/{loanStatementId}/documents/{format}Get loan statement document/loan-statements/{loanStatementId}/documentsList loan statement documents/loan-transactions/{loanTransactionId}Get loan transaction/loan-transactionsList loan transactions/loan-transactionsCreate loan transactions/loan-transactions/{loanTransactionId}Update loan transaction/loan-products/{loanProductId}Get loan product/loan-productsList loan products/loan-productsCreate loan products/loan-products/{loanProductId}Update loan product/loan-agreements/{loanAgreementId}Get loan agreement/loan-agreementsList loan agreements/loan-agreementsCreate loan agreements/loan-agreements/{loanAgreementId}Update loan agreement/statement-receiptsList statement receipts/statement-receiptsCreate statement receipts/statement-receipt-batches/{statementReceiptBatchId}Get statement receipt batch/statement-receipt-batchesList statement receipt batches/statement-receipt-batches/{statementReceiptBatchId}Update statement receipt batch/daily-card-file-runsList daily card file runs/daily-card-file-runs/{dailyCardFileRunId}/files/{format}Get daily card file run file/loan-statement-linesList loan statement lines/statement-dbi-batches/{statementDbiBatchId}Get statement dbi batch/statement-dbi-batches/{statementDbiBatchId}Replace statement dbi batch/statement-dbi-batches/{statementDbiBatchId}Update statement dbi batch