Collaboration starting with requesting purchase contract
This page is for banks that will start the collaboration with the broker by requesting the purchase contract data.
Before you can start
EPS uses Oauth2 Bearer token for authentication.. If you do not have been issued a client_id,
contact Ambita to get one. If you already have a client, the client must be granted access to EPS by Ambita.
Se Token-based authentication - quick start for more information about how to create an access token and use it in requests to EPS.
Terms used in this page
Term | Norwegian | Description |
---|---|---|
Intention Flow | Intensjon Flyt | These two are both used to declare how each party (broker and bank) wants to/is able to do the registration (Paper or Digital) |
Registration | Tinglysing | Having the documents accepted into the official Land Registry |
Mortgage document | Pantedokument |
|
Deed | Skjøte | Document for transfer of ownership |
Settlement | Oppgjør | A representation of the broker’s data in EPS. |
Prerequisite letter | Forutsetningskrav | An attachment to the pantedokument that is sent to the broker stating the bank’s requirement (having first priority, and so on). |
Why request purchase contract data
The bank and broker have to agree on the registration process, whether it is on paper or digital since the deed and mortgage document must be sent together to the registration authority (Statens Kartverk). Both parties must agree on the format. It’s also critical that both parties communicate any changes to each other and all parties must be able to receive such change notifications.
Intentions are the way bank and broker communicates their preferred registration method to each other. Note that both parties must be capable of doing this digitally in order to be a digital registration. If one or both parties reports paper, both parties must proceed in the “old fashion way”.
Why should the bank request the purchase contract data? When an intention is successfully accepted by the broker, the bank will be notified (only) if the registration method changes and the data that is accessible is limited to registration method, buyers and properties. When a request for purchase contract data is successfully accepted by the broker, the bank has access to almost all the data in the purchase contract as structural data (JSon), a pdf rendering of the data and the signed purchase contract (scanned as PDF where available). In addition the bank will be notified if any of the significant data changes or a new version of the signed purchase contract is made available by the broker.
Notification of changes
DSVE has defined which data elements in the purchase contract that are so significant that the bank should be notified of changes. An updated list of these elements can be found at github. When a change occur the bank will receive the event PURCHASE_CONTRACT_CHANGED
. The event will reference the purchase contract request and the changed settlement. In addition the event will have a list of categories describing what the changes are. The categories are:
HANDOVER_DATE,
PAYMENT_INFO,
BUYERS,
PROPERTIES,
BUYER_CONTRACT,
SIGNED_PURCHASE_CONTRACT
About references
As more messages are exchanged between the bank and the broker, it’s getting more important that the bank’s reference should be a persistent value identify a case number or any other text that can identify loan application case in the bank system. It should not be a traceId, correlationId, messageId or similar IDs that just identifies the single request/transaction. This reference should also be given to Ambita in support cases.
Requesting purchase contract data from the broker
Requests are sent to the broker using EPS' purchasecontractrequests
endpoint.
POST /eps/v1/purchasecontractrequests
The basic information you need is:
One or more buyers
The broker’s organization number
A reference that uniquely identifies the loan case in the bank
For a detailed description of required and optional fields in the input and response bodies, see the technical information at https://beta-api.ambita.com/eps/#tag/Purchase-Contract/operation/createRequest.
Response
The http status code of the response will determine the flow:
201 : The request matches one or more settlements at Ambita and the result is included in the response body.
202 : The request is sent to the (non-Ambita) broker and an event (
PURCHASE_CONTRACT_CHANGED
) will be generated when the response is ready.400 : Bad request. Either the data in the request is invalid or the intention data didn’t match any settlements. Se below for error description.
Both 201 and 202 status codes will have a property in the payload named requestUid
identifying your request. The response of the request can be retrieved later by performing a GET /eps/v1/purchasecontractrequests/<requestUid>
. The response will also have an array of references to the settlements that has enough information to be converted to a purchase contract. This array can be empty. In addition the response will have the status
and a boolean field existsSettlementsNotReady
indicating if there exists any settlements that cannot yet be converted to a purchase contract.
Handling 201 status code
A status code of 201 is return when the request matches one or more settlement for an Ambita broker. Since we already have the settlement data, a synchronous response is given. The list of contracts can have zero or more elements, each having:
a settlement unique identifier
The broker’s reference
A link to fetch the settlement/contract data
A link to get a PDF rendering of the contract data
A link to fetch the signed purchase contract as PDF
Address of the real estate in question
See the online API documentation for detailed information: https://beta-api.ambita.com/eps/#tag/Purchase-Contract/operation/createRequest
Handling 202 status code
Receiving a 202 means that EPS has sent the request asynchronously to the broker. The bank receives an immediately response containing the request’s unique identifier for later reference and data retrieval. When the broker’s response is received later on an event (PURCHASE_CONTRACT_RESPONSE_RECEIVED
) is generated referencing this request.
A status
of ACCEPTED
means that the request was accepted by the broker and matched one or more settlements. However, the contracts
array may be empty. The property existsSettlementsNotReady
will indicate if there are additional matching settlements which are not yet ready to be converted into a purchase contract.
Handling 400 status code (bad request)
A bad request signals a failed validation of the input data. The error object returned in EPS all contains a field message
that we work hard on being human understandable. In case of a bad request, this message should be presented to the person in the bank handling the case as either the input must be changed or the broker must be contacted to find out what went wrong.
States and codes
A purchase contract request can have the following states.
State | Description |
---|---|
ACCEPTED | Request was successfully matched with a broker settlement. Response may or may not contain any purchase contract data. |
PENDING | Awaiting response from external broker. Result is available when event |
INVALID_BUYER | Used when request didn’t match any settlements. |
OUTDATED | When a bank requests contract data a again (same broker, same reference) the previous requests are marked as OUTDATED and no more events will be generated on these requests. |
A few more status codes will become available as the whole lifecycle of a request is implemented.
Listening for events
It is essential that the bank has a kind of scheduled batch job that fetches the latest list of events, processes them and takes action on relevant events like PURCHASE_CONTRACT_RESPONSE_RECEIVED
and PURCHASE_CONTRACT_CHANGED
. Unknown or uninteresting events can be ignored.
Note that the event PURCHASE_CONTRACT_RESPONSE_RECEIVED
is the first event that does not have a reference to a settlement (settlementuid
). Not having a settlement uid would be a braking change for the /events
endpoint. In order for the bank to receive this event type, a new request parameter is required (then we know that the bank can handle null in this property). GET /eps/v1/events?contractevents=true
.
Relevant event types are described here: Events for banks.
More information about how to listen to events can be found here: Monitoring settlements
Setting the intention the easy way
When the bank has requested a purchase contract and successfully received a contract in response, the settlement (unique identifier) is a handle to the broker’s data/settlement. Having this handle, setting the bank’s desired registration method i easy using the new endpoint /eps/v1/purchasecontractrequests/{requestuid}/{settlementuid}/intention/
and only add the desired flow (digital or paper). Se OAS documentation for details.
Requesting purchase contract data several times
DSVE has defined a set of properties that are required in order to create a purchase contract. It’s therefore possible to match the request with a settlement, but still not being able to create a purchase contract. The bank can then request the data again at a later point in time by just sending another POST request to the same endpoint. When requesting purchase contract data again, the following rules apply:
All previous requests to the same broker using the same (bank) reference will change status to
OUTDATED
, no further events will be generated for that request and related data such as local (bank) settlements will be cleared.All previous requests to the same broker having a different (bank) reference will be kept alive and the bank will now receive events on both requests.
It is important that the bank’s refernce identifies a specific case in the bank’s system and is not a transaction/correlationId that will change for each request.
The broker doesn’t support purchase contract requests
As purchase contract data request is a rather new message type, it will take some time before all collaborating parties support this message. If the broker in question does not support purchase contract requests, the bank should skip this step and start collaboration by sending a bank intention, se Collaboration starting with bank intention .
See a PDF of the purchase contract data
As an alternative for the bank to fetch and present JSon in the bank system, we offer a PDF rendering of the data as PDF. The PDF is generated using the official XSLT as defined by the DSVE project. For a given settlement/contract related to a purchase contract request, you can get the PDF by using the endpoint https://beta-api.ambita.com/eps/#tag/Purchase-Contract/operation/getPurchaseContractPdf. This is a PDF rendering of the contract data, this is not a copy of the signed purchase contract.
Getting the signed purchase contract
If the signed purchase contract is available (as a PDF) you will find the link to it in the array of contracts as a property named signedPurchaseContractLink
. If a signed purchase contract is added (for the first time) or updated (new version), the event PURCHASE_CONTRACT_CHANGED
. will be generated and the property settlementChanges
will contain the category SIGNED_PURCHASE_CONTRACT
.
Generating pantedokument (digital registration process)
Generating a pantedokument to a broker is pretty similar to generating one that should be sent straight to the Registration authority (Statens kartverk) for registration (tinglysing). The most important difference is that the element <dokumentflyt>
should be changed to <dokumentflyt>DOKUMENT_TIL_OPPGJOER</dokumentflyt>
. Se more details at: Generate pantedokument | How to set document flow
Generating a forutsetningsbrev
If the bank would generate a forutsetningsbrev outlining the requirements to the broker, the new webservice generateForutsetningsbrev
must be used as the old one generatePrerequisite
is deprecated. Se more: Generate forutsetningsbrev
Sending the pantedokument to the broker
After the signed pantedokument is set in Etinglysing.no, the pantedokument (and forutsetningsbrev if any) can be sent to the broker using the webservice in Etinglysing sendToRealEstateBroker
. This webservice method is described in more detail here: Send to real estate broker