Skip to main content

Handling responses from ASPSP

Maxime avatar
Written by Maxime
Updated over 4 months ago

Handling responses from ASPSP

We are parsing every response we receive from ASPSP. We use a dedicated mechanism composed by a configurable set of:

  • conditions

  • handlers

Conditions are responsible for checking the response, in particular, HTTP code, response message. Every condition is built with 3 elements:

  • eventName - name of the PSD2Hub event that triggered the call/response interaction with ASPSP (e.g. IRefreshAispAccessToken)

  • regex on content - a regular expression for analyzing response code

  • HTTP status - trigger on HTTP response code

For each condition, we can define the set of triggers (called handlers) that are responsible for different tasks within PSD2Hub.

Example handlers:

  • invalidate session - the AIS/PIS session status will change if the condition is met/handler is triggered (e.g. error response for getting a list of accounts will end the session with failed status)

  • invalidate consent status- the AIS/PIS session status will change if the condition is met/handler is triggered (e.g. error response when PSD2Hub uses refresh token to get new access token)

  • save error message as a session failed reason - the message from ASPSP should be presented to PSU (front-end) (e.g. information from ASPSP that provided IBAN does not belong to this bank)


This mechanism allows PSD2Hub to react to different types of messages received from ASPSPS. Those are parametrized separated for each bank.

Example configuration

ErrorHandlingConfig: [

{

condition:{

requestName: "IRefreshAispAccessToken",

httpStatus:"Unahtorized",

contentMask: ""

} ,

handlers: [{

name: "failsSession"

},

{

name: "invalidateConsent"

},

{

name: 'fetchMessage',

mask: /costam{errorMessage}/

}]

}]

Did this answer your question?