Skip to content

Commit

Permalink
feat: implement consentRequests( post and put) endpoints (#80)
Browse files Browse the repository at this point in the history
* feat: implement consentRequests( post and put) endpoints

* chore: fix linting issues

* chore: skip pisp-transaction integration test

* chore: fix linting issues

* chore: address review comments

* chore: address review comments

* chore: fix linting issues

* chore: replace if-else with switch

* chore: address review comments

* chore: throw exception in case of invalid auth channel
  • Loading branch information
sridharvoruganti committed Apr 14, 2021
1 parent 1a0de27 commit a95d6d2
Show file tree
Hide file tree
Showing 45 changed files with 3,654 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1178,10 +1178,6 @@ components:
- QRCODE - QR code used as One Time Password.
- U2F - U2F is a new addition isolated to Thirdparty stream.
This is based on FSPIOP `AuthenticationType` with U2F added.
example: U2F
Integer:
title: Integer
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ paths:
PISP -> Switch
parameters:
- $ref: '#/components/parameters/ID'
- $ref: '#/components/parameters/Accept'
- $ref: '#/components/parameters/Content-Length'
- $ref: '#/components/parameters/Content-Type'
- $ref: '#/components/parameters/Date'
Expand Down Expand Up @@ -521,6 +520,53 @@ paths:
$ref: '#/components/responses/501'
'503':
$ref: '#/components/responses/503'
'/consentRequests/{ID}/error':
put:
tags:
- consentRequests
operationId: NotifyErrorConsentRequests
summary: NotifyErrorConsentRequests
description: >
DFSP responds to the PISP if something went wrong with validating an OTP
or secret.
parameters:
- $ref: '#/components/parameters/ID'
- $ref: '#/components/parameters/Content-Length'
- $ref: '#/components/parameters/Content-Type'
- $ref: '#/components/parameters/Date'
- $ref: '#/components/parameters/X-Forwarded-For'
- $ref: '#/components/parameters/FSPIOP-Source'
- $ref: '#/components/parameters/FSPIOP-Destination'
- $ref: '#/components/parameters/FSPIOP-Encryption'
- $ref: '#/components/parameters/FSPIOP-Signature'
- $ref: '#/components/parameters/FSPIOP-URI'
- $ref: '#/components/parameters/FSPIOP-HTTP-Method'
requestBody:
description: Error information returned.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInformationObject'
responses:
'200':
$ref: '#/components/responses/200'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'405':
$ref: '#/components/responses/405'
'406':
$ref: '#/components/responses/406'
'501':
$ref: '#/components/responses/501'
'503':
$ref: '#/components/responses/503'
/consents:
post:
description: >
Expand Down Expand Up @@ -1795,10 +1841,6 @@ components:
- QRCODE - QR code used as One Time Password.
- U2F - U2F is a new addition isolated to Thirdparty stream.
This is based on FSPIOP `AuthenticationType` with U2F added.
example: U2F
Integer:
title: Integer
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,32 @@
}
}
}
},
"/consentRequests": {
"post": {
"fspid": "{$request.headers.fspiop-source}",
"successCallback": {
"method": "put",
"path": "/consentRequests/{ID}",
"pathPattern": "/consentRequests/{$request.body.id}",
"headerOverride": {
"FSPIOP-Source": "{$config.FSPID}",
"FSPIOP-Destination": "{$request.headers.fspiop-source}",
"Content-Type": "{$session.negotiatedContentType}",
"Date": "{$request.headers.date}"
}
},
"errorCallback": {
"method": "put",
"path": "/consentRequests/{ID}/error",
"pathPattern": "/consentRequests/{$request.body.id}/error",
"headerOverride": {
"FSPIOP-Source": "{$config.FSPID}",
"FSPIOP-Destination": "{$request.headers.fspiop-source}",
"Content-Type": "{$session.negotiatedContentType}",
"Date": "{$request.headers.date}"
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ paths:
#Path
- $ref: '../../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/ID.yaml'
#Headers
- $ref: '../../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/Accept.yaml'
- $ref: '../../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/Content-Length.yaml'
- $ref: '../../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/Content-Type.yaml'
- $ref: '../../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/Date.yaml'
Expand Down Expand Up @@ -516,6 +515,8 @@ paths:
$ref: '../../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/responses/501.yaml'
'503':
$ref: '../../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/responses/503.yaml'
/consentRequests/{ID}/error:
$ref: '../../../../../../node_modules/@mojaloop/api-snippets/thirdparty/openapi3/paths/consentRequests_ID_error.yaml'
/consents:
post:
description: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,5 +271,147 @@
},
"type": "callback",
"version": 1
},
{
"ruleId": 5,
"priority": 1,
"description": "post /consentRequests -WEB",
"apiVersion": {
"minorVersion": 1,
"majorVersion": 0,
"type": "thirdparty_pisp",
"asynchronous": true
},
"conditions": {
"all": [
{
"fact": "body",
"operator": "equal",
"value": "b51ec534-ee48-4575-b6a9-ead2955b8069",
"path": "id"
},
{
"fact": "operationPath",
"operator": "equal",
"value": "/consentRequests"
},
{
"fact": "method",
"operator": "equal",
"value": "post"
}
]
},
"event": {
"method": "put",
"path": "/consentRequests/{ID}",
"params": {
"headers": {
"Accept": "application/vnd.interoperability.thirdparty+json;version=1.0",
"Content-Type": "application/vnd.interoperability.thirdparty+json;version=1.0",
"Date": "Wed, 27 May 2020 11:13:34 GMT",
"FSPIOP-Source": "DFSPA"
},
"body": {
"initiatorId": "pispA",
"authChannels": [
"WEB"
],
"scopes": [
{
"accountId": "dfspa.username.1234",
"actions": [
"accounts.transfer",
"accounts.getBalance"
]
},
{
"accountId": "dfspa.username.5678",
"actions": [
"accounts.transfer",
"accounts.getBalance"
]
}
],
"callbackUri": "pisp-app://callback.com",
"authUri": "dfspa.com/authorize?consentRequestId=456"
},
"scripts": {}
},
"delay": 0,
"type": "FIXED_CALLBACK"
},
"type": "callback",
"version": 1
},
{
"ruleId": 6,
"priority": 1,
"description": "post /consentRequests -OTP",
"apiVersion": {
"minorVersion": 1,
"majorVersion": 0,
"type": "thirdparty_pisp",
"asynchronous": true
},
"conditions": {
"all": [
{
"fact": "operationPath",
"operator": "equal",
"value": "/consentRequests"
},
{
"fact": "method",
"operator": "equal",
"value": "post"
},
{
"fact": "body",
"operator": "equal",
"value": "c51ec534-ee48-4575-b6a9-ead2955b8069",
"path": "id"
}
]
},
"event": {
"method": "put",
"path": "/consentRequests/{ID}",
"params": {
"headers": {
"Accept": "application/vnd.interoperability.thirdparty+json;version=1.0",
"Content-Type": "application/vnd.interoperability.thirdparty+json;version=1.0",
"Date": "Wed, 27 May 2020 11:13:34 GMT",
"FSPIOP-Source": "DFSPA"
},
"body": {
"initiatorId": "pispA",
"authChannels": [
"OTP"
],
"scopes": [
{
"accountId": "dfspa.username.1234",
"actions": [
"accounts.transfer",
"accounts.getBalance"
]
},
{
"accountId": "dfspa.username.5678",
"actions": [
"accounts.transfer",
"accounts.getBalance"
]
}
],
"callbackUri": "pisp-app://callback.com"
}
},
"delay": 0,
"type": "FIXED_CALLBACK"
},
"type": "callback",
"version": 1
}
]
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
[]
[
{
"ruleId": 1,
"priority": 1,
"description": "post /consentRequests -error",
"apiVersion": {
"minorVersion": 1,
"majorVersion": 0,
"type": "thirdparty_pisp",
"asynchronous": true
},
"conditions": {
"all": [
{
"fact": "body",
"operator": "equal",
"value": "d51ec534-ee48-4575-b6a9-ead2955b8069",
"path": "id"
},
{
"fact": "operationPath",
"operator": "equal",
"value": "/consentRequests"
},
{
"fact": "method",
"operator": "equal",
"value": "post"
}
]
},
"event": {
"method": "put",
"path": "/consentRequests/{ID}/error",
"params": {
"headers": {
"Accept": "application/vnd.interoperability.thirdparty+json;version=1.0",
"Content-Type": "application/vnd.interoperability.thirdparty+json;version=1.0",
"Date": "Wed, 27 May 2020 11:13:34 GMT",
"FSPIOP-Source": "DFSPA"
},
"body": {
"errorInformation": {
"errorCode": "7204",
"errorDescription": "FSP does not support any requested scope actions"
}
},
"scripts": {}
},
"type": "FIXED_ERROR_CALLBACK"
},
"type": "validation",
"version": 1
}
]
Loading

0 comments on commit a95d6d2

Please sign in to comment.