# Ledger/Sales service

Using Swagger documentation in Postman


You can find instructions on how to convert swagger documentation to Postman collection here.
There is a known problem in Postman with env variables being imported as parameters (:schemaName instead of {{schemaName}}. More info on the issue can be found here.
Possible workaround is to find and replace all parameters with env variables inside Postman. For example search for :schemaName and replace with {{schemaName}}. Instructions how to do it in Postman are here.

Authorization

To obtain a token, start by visiting the identifier service documentation and make a request with your username and password.
Once you receive the response, copy the access_token and use it for making requests to ledger services. Version: 1.0 ## Servers Beta ``` https://ledger.app.beta.insly.training ``` Demo ``` https://ledger.app.demo.insly.com ``` ## Security ### bearerAuth Login with email and password to get the authentication token Type: http In: header Name: Token based Auth Scheme: bearer Bearer Format: JWT ## Quote Create ### Create a new quote - [POST /api/v1/ledger/sales/policies/create](https://ledger.docs.insly.com/apis/ledger/bundled/quote-create/quote-create.md): Create a new quote by schema, you can get schema in Schemes section ### Change policy - [POST /api/v1/ledger/sales/policies/mta](https://ledger.docs.insly.com/apis/ledger/bundled/quote-create/policy-mta.md) ## Quote Data ### Get quote data - [GET /api/v1/ledger/sales/policies/{policyId}](https://ledger.docs.insly.com/apis/ledger/bundled/quote-data/get-quote-data.md) ### Get available actions - [GET /api/v1/ledger/sales/policies/actions/{id}](https://ledger.docs.insly.com/apis/ledger/bundled/quote-data/get-quote-actions.md): Get available actions. This route has to be called after each change quote data to get to know that action is done ### Get quote installments schedule - [GET /api/v1/ledger/sales/policies/{policyId}/installments-schedule](https://ledger.docs.insly.com/apis/ledger/bundled/quote-data/quote-get-installments-schedule.md) ## Quote Edit ### Update quote - [PUT /api/v1/ledger/sales/policies/{policyId}/](https://ledger.docs.insly.com/apis/ledger/bundled/quote-edit/update-quote-data.md) ### Decline policy draft - [POST /api/v1/ledger/sales/policies/{policyId}/decline](https://ledger.docs.insly.com/apis/ledger/bundled/quote-edit/quote-decline.md) ## Quote Calculation ### Calculate quote - [POST /api/v1/ledger/sales/policies/{id}/calculate](https://ledger.docs.insly.com/apis/ledger/bundled/quote-calculation/quote-update-and-calculate.md): Calculate quote ### Get quote financials - [GET /api/v1/ledger/sales/policies/{id}/calculation](https://ledger.docs.insly.com/apis/ledger/bundled/quote-calculation/get-quote-financials.md): Get quote financials by quote id ## Quote Documents ### Generate quote documents - [POST /api/v1/ledger/sales/policies/{id}/generated-documents](https://ledger.docs.insly.com/apis/ledger/bundled/quote-documents/generate-quote-documents.md) ### Download document content - [GET /api/v1/ledger/documents/{id}](https://ledger.docs.insly.com/apis/ledger/bundled/quote-documents/get-document.md) ### Download document content - [GET /api/v1/ledger/documents/{id}](https://ledger.docs.insly.com/apis/ledger/bundled/policy-documents/get-document.md) ## Policy Documents ### Download document content - [GET /api/v1/ledger/documents/{id}](https://ledger.docs.insly.com/apis/ledger/bundled/quote-documents/get-document.md) ### Download document content - [GET /api/v1/ledger/documents/{id}](https://ledger.docs.insly.com/apis/ledger/bundled/policy-documents/get-document.md) ## Quote Referrals ### Send quote to referral - [POST /api/v1/ledger/sales/policies/{policyId}/referrals](https://ledger.docs.insly.com/apis/ledger/bundled/quote-referrals/send-quote-to-referral.md): It's async request, UI sends "actions" endpoint and waits until lock is released ## Quote Binding ### Bind policy draft - [POST /api/v1/ledger/sales/policies/{policyId}/bind](https://ledger.docs.insly.com/apis/ledger/bundled/quote-binding/quote-bind.md) ## Quote Issue ### Issue quote - [POST /api/v1/ledger/sales/policies/{id}/issue](https://ledger.docs.insly.com/apis/ledger/bundled/quote-issue/issue-quote.md): Issue quote, after got success please check process status by /api/v1/ledger/requests/{requestId} you can find it in this doc ## Policy Data ### Preparing data before renewal quote create - [GET /api/v1/ledger/policies/{policyId}/renewal](https://ledger.docs.insly.com/apis/ledger/bundled/policy-data/get-policy-renewal-data.md): Preparing data before renewal quote create ### Get policy data with links - [GET /api/v1/ledger/policies/{policyId}/links](https://ledger.docs.insly.com/apis/ledger/bundled/policy-data/get-policy-with-links.md) ### Return policy invoices data - [GET /api/v1/ledger/policies/{policyId}/invoices](https://ledger.docs.insly.com/apis/ledger/bundled/policy-data/get-policy-invoices.md) ### Return policy total financials. - [GET /api/v1/ledger/policies/{id}/period-totals](https://ledger.docs.insly.com/apis/ledger/bundled/policy-data/get-policy-period-totals.md) ## Policy Termination ### Get termination return premium - [POST /api/v1/ledger/policies/{policyId}/terminate/premiums](https://ledger.docs.insly.com/apis/ledger/bundled/policy-termination/get-policy-termination-premiums.md) ### Terminate policy with manual premium - [POST /api/v1/ledger/policies/{policyId}/terminate](https://ledger.docs.insly.com/apis/ledger/bundled/policy-termination/terminate-policy.md) ## Schemes ### Get schema - [GET /api/v1/ledger/schemes/{type}/regular/{name}](https://ledger.docs.insly.com/apis/ledger/bundled/schemes/get-schema-regular.md): Json schema specification. * Get schema according to your rights, you can use React jsonschema form builder to create payload for quote create ## Customers by identity ### Get customer policy custom view installments. Query params must match tenant feature customer_identity - [GET /api/v1/ledger/customers/policies/{policyId}/custom-view/installments](https://ledger.docs.insly.com/apis/ledger/bundled/customers-by-identity/get-customer-policies-installments-by-identity.md) ## Payments ### Insert payment - [POST /api/v1/ledger/brokerpayments](https://ledger.docs.insly.com/apis/ledger/bundled/payments/insert-payment.md) ### Allocate payment - [POST /api/v1/ledger/brokerpayments/allocate](https://ledger.docs.insly.com/apis/ledger/bundled/payments/allocate-payment.md) ## Invoice ### Credit invoice by allocation eventId. - [POST /api/v1/ledger/broker-payments/{eventId}/credit](https://ledger.docs.insly.com/apis/ledger/bundled/invoice/credit-invoice.md): Tool for removing (edit) incorrect added invoice into payment bdx. ## Policy Technical MTA ### Edit non-financial information for policy. Instead of MTA process, do not create a quote and documents. * Used to edit information, not affecting the insured coverage, financials and legal related into. * For some products its only about policy documents changing. - [PUT /api/v1/ledger/policies/{id}/data-change](https://ledger.docs.insly.com/apis/ledger/bundled/policy-technical-mta/policy-technical-mta-data-change.md) ## Async Request ### Async request status - [GET /api/v1/ledger/requests/{requestId}](https://ledger.docs.insly.com/apis/ledger/bundled/async-request/get-quote-issue-status.md): Policy issuing happens asynchronously. Call current endpoint to validate, if policy has been issued before requesting policy data. The endpoint needs to be called until the or status is returned. In case of status, please repeat the call again with some delay. The means its still processing.