diff --git a/obp-api/pom.xml b/obp-api/pom.xml
index 6f8c8ea525..0cbb7cb5b2 100644
--- a/obp-api/pom.xml
+++ b/obp-api/pom.xml
@@ -121,10 +121,11 @@
ojdbc8
21.5.0.0
+
com.h2database
h2
- 2.1.214
+ 2.2.220
runtime
@@ -296,10 +297,11 @@
scala-nameof_${scala.version}
1.0.3
+
com.nimbusds
nimbus-jose-jwt
- 9.19
+ 9.31
com.github.OpenBankProject
@@ -438,12 +440,6 @@
1.2.0
-
- sh.ory.hydra
- hydra-client
- 1.11.8
-
-
com.networknt
diff --git a/obp-api/src/main/resources/ResourceDocs/ResourceDocs-Chinese.json b/obp-api/src/main/resources/ResourceDocs/ResourceDocs-Chinese.json
index da926e0359..e81a77ef2b 100644
--- a/obp-api/src/main/resources/ResourceDocs/ResourceDocs-Chinese.json
+++ b/obp-api/src/main/resources/ResourceDocs/ResourceDocs-Chinese.json
@@ -93,8 +93,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "Metric",
- "New-Style"
+ "Metric"
],
"typed_request_body": {
"type": "object",
@@ -396,8 +395,7 @@
"is_obwg": false,
"tags": [
"Customer",
- "KYC",
- "New-Style"
+ "KYC"
],
"typed_request_body": {
"type": "object",
@@ -673,8 +671,7 @@
"is_obwg": false,
"tags": [
"Standing-Order",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -885,8 +882,7 @@
"tags": [
"Role",
"Entitlement",
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -1443,8 +1439,7 @@
"is_obwg": true,
"tags": [
"Account",
- "Account Information Service (AIS)",
- "New-Style"
+ "Account Information Service (AIS)"
],
"typed_request_body": {
"type": "object",
@@ -1616,8 +1611,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -1908,8 +1902,7 @@
"is_obwg": true,
"tags": [
"Transaction-Request",
- "Payment Initiation Service (PIS)",
- "New-Style"
+ "Payment Initiation Service (PIS)"
],
"typed_request_body": {
"type": "object",
@@ -2494,8 +2487,7 @@
"tags": [
"Scope",
"Role",
- "Entitlement",
- "New-Style"
+ "Entitlement"
],
"typed_request_body": {
"type": "object",
@@ -2546,8 +2538,7 @@
"is_obwg": false,
"tags": [
"Consent",
- "Account Information Service (AIS)",
- "New-Style"
+ "Account Information Service (AIS)"
],
"typed_request_body": {
"type": "object",
@@ -2609,8 +2600,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "Card",
- "New-Style"
+ "Card"
],
"typed_request_body": {
"type": "object",
@@ -2700,8 +2690,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -2826,8 +2815,7 @@
"is_obwg": false,
"tags": [
"Dynamic-Entity",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -2889,8 +2877,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -2992,8 +2979,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -3150,8 +3136,7 @@
"is_obwg": false,
"tags": [
"Method-Routing",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -3352,8 +3337,7 @@
"tags": [
"Account",
"PrivateData",
- "PublicData",
- "New-Style"
+ "PublicData"
],
"typed_request_body": {
"type": "object",
@@ -3755,8 +3739,7 @@
"is_obwg": false,
"tags": [
"View",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -4121,8 +4104,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -4253,8 +4235,7 @@
"is_obwg": false,
"tags": [
"Consumer",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -4610,8 +4591,7 @@
"tags": [
"Account",
"Account Information Service (AIS)",
- "View",
- "New-Style"
+ "View"
],
"typed_request_body": {
"type": "object",
@@ -4785,8 +4765,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Consumer",
- "New-Style"
+ "Consumer"
],
"typed_request_body": {
"type": "object",
@@ -4912,8 +4891,7 @@
"tags": [
"Role",
"Entitlement",
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -5138,8 +5116,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "System-View",
- "New-Style"
+ "System-View"
],
"typed_request_body": {
"type": "object",
@@ -5586,8 +5563,7 @@
"is_obwg": false,
"tags": [
"Account-Public",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -5710,8 +5686,7 @@
"is_obwg": false,
"tags": [
"WebUi-Props",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -6226,8 +6201,7 @@
"is_obwg": false,
"tags": [
"Webhook",
- "Bank",
- "New-Style"
+ "Bank"
],
"typed_request_body": {
"type": "object",
@@ -6321,8 +6295,7 @@
"is_obwg": false,
"tags": [
"Customer",
- "KYC",
- "New-Style"
+ "KYC"
],
"typed_request_body": {
"type": "object",
@@ -6405,8 +6378,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Consumer",
- "New-Style"
+ "Consumer"
],
"typed_request_body": {
"type": "object",
@@ -6551,8 +6523,7 @@
"is_obwg": true,
"tags": [
"Consent",
- "Account Information Service (AIS)",
- "New-Style"
+ "Account Information Service (AIS)"
],
"typed_request_body": {
"type": "object",
@@ -6804,8 +6775,7 @@
"is_obwg": false,
"tags": [
"Account-Application",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -7384,8 +7354,7 @@
"is_obwg": false,
"tags": [
"Role",
- "Entitlement",
- "New-Style"
+ "Entitlement"
],
"typed_request_body": {
"type": "object",
@@ -7637,8 +7606,7 @@
"is_obwg": false,
"tags": [
"Transaction",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -8078,8 +8046,7 @@
"is_obwg": false,
"tags": [
"Standing-Order",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -8273,8 +8240,7 @@
"tags": [
"Transaction",
"Account Information Service (AIS)",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -8493,8 +8459,7 @@
"is_obwg": false,
"tags": [
"Dynamic-Entity",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -8654,8 +8619,7 @@
"is_obwg": true,
"tags": [
"Bank",
- "Account Information Service (AIS)",
- "New-Style"
+ "Account Information Service (AIS)"
],
"typed_request_body": {
"type": "object",
@@ -8817,8 +8781,7 @@
"is_obwg": true,
"tags": [
"Account",
- "Confirmation of Funds Service (PIIS)",
- "New-Style"
+ "Confirmation of Funds Service (PIIS)"
],
"typed_request_body": {
"type": "object",
@@ -9372,8 +9335,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "ATM",
- "New-Style"
+ "ATM"
],
"typed_request_body": {
"type": "object",
@@ -9577,8 +9539,7 @@
"is_obwg": false,
"tags": [
"Customer",
- "KYC",
- "New-Style"
+ "KYC"
],
"typed_request_body": {
"type": "object",
@@ -10140,8 +10101,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Product",
- "New-Style"
+ "Product"
],
"typed_request_body": {
"type": "object",
@@ -10461,8 +10421,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -10646,8 +10605,7 @@
"is_obwg": false,
"tags": [
"Transaction-Request",
- "Payment Initiation Service (PIS)",
- "New-Style"
+ "Payment Initiation Service (PIS)"
],
"typed_request_body": {
"type": "object",
@@ -11007,8 +10965,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "System-View",
- "New-Style"
+ "System-View"
],
"typed_request_body": {
"type": "object",
@@ -11292,8 +11249,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -11398,8 +11354,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Card",
- "New-Style"
+ "Card"
],
"typed_request_body": {
"type": "object",
@@ -11567,8 +11522,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -11628,8 +11582,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -11706,8 +11659,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -12010,8 +11962,7 @@
"is_obwg": false,
"tags": [
"Dynamic-Entity",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -12173,8 +12124,7 @@
"is_obwg": true,
"tags": [
"Bank",
- "Account Information Service (AIS)",
- "New-Style"
+ "Account Information Service (AIS)"
],
"typed_request_body": {
"type": "object",
@@ -12429,8 +12379,7 @@
"is_obwg": true,
"tags": [
"Branch",
- "Bank",
- "New-Style"
+ "Bank"
],
"typed_request_body": {
"type": "object",
@@ -12789,8 +12738,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -12960,8 +12908,7 @@
"is_obwg": false,
"tags": [
"Customer",
- "FirehoseData",
- "New-Style"
+ "FirehoseData"
],
"typed_request_body": {
"type": "object",
@@ -13151,8 +13098,7 @@
"is_obwg": true,
"tags": [
"Counterparty",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -13325,8 +13271,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -13486,8 +13431,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "ATM",
- "New-Style"
+ "ATM"
],
"typed_request_body": {
"type": "object",
@@ -13717,8 +13661,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -13882,8 +13825,7 @@
"is_obwg": false,
"tags": [
"Direct-Debit",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -14228,8 +14170,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -14305,8 +14246,7 @@
"is_obwg": false,
"tags": [
"User",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -14387,8 +14327,7 @@
"is_obwg": false,
"tags": [
"Method-Routing",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -14534,8 +14473,7 @@
"is_obwg": true,
"tags": [
"Transaction-Request",
- "Payment Initiation Service (PIS)",
- "New-Style"
+ "Payment Initiation Service (PIS)"
],
"typed_request_body": {
"type": "object",
@@ -14731,8 +14669,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Data-Warehouse",
- "New-Style"
+ "Data-Warehouse"
],
"typed_request_body": {
"type": "object",
@@ -14797,8 +14734,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Product",
- "New-Style"
+ "Product"
],
"typed_request_body": {
"type": "object",
@@ -16096,8 +16032,7 @@
"is_obwg": false,
"tags": [
"Account-Application",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -16286,8 +16221,7 @@
"is_obwg": false,
"tags": [
"Customer",
- "KYC",
- "New-Style"
+ "KYC"
],
"typed_request_body": {
"type": "object",
@@ -16517,8 +16451,7 @@
"is_obwg": true,
"tags": [
"Transaction-Request",
- "Payment Initiation Service (PIS)",
- "New-Style"
+ "Payment Initiation Service (PIS)"
],
"typed_request_body": {
"type": "object",
@@ -16890,8 +16823,7 @@
"tags": [
"Account",
"Account Information Service (AIS)",
- "PrivateData",
- "New-Style"
+ "PrivateData"
],
"typed_request_body": {
"type": "object",
@@ -17008,8 +16940,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -17137,8 +17068,7 @@
"tags": [
"Account",
"Account-Firehose",
- "FirehoseData",
- "New-Style"
+ "FirehoseData"
],
"typed_request_body": {
"type": "object",
@@ -17457,8 +17387,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -17693,8 +17622,7 @@
"tags": [
"Account-Public",
"Account",
- "PublicData",
- "New-Style"
+ "PublicData"
],
"typed_request_body": {
"type": "object",
@@ -17978,8 +17906,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Data-Warehouse",
- "New-Style"
+ "Data-Warehouse"
],
"typed_request_body": {
"type": "object",
@@ -18150,8 +18077,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -18543,8 +18469,7 @@
"is_obwg": false,
"tags": [
"Customer",
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -19204,8 +19129,7 @@
"is_obwg": false,
"tags": [
"Scope",
- "Role",
- "New-Style"
+ "Role"
],
"typed_request_body": {
"type": "object",
@@ -19303,8 +19227,7 @@
"is_obwg": false,
"tags": [
"Customer",
- "KYC",
- "New-Style"
+ "KYC"
],
"typed_request_body": {
"type": "object",
@@ -20082,8 +20005,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -20166,8 +20088,7 @@
"is_obwg": false,
"tags": [
"Consumer",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -20288,8 +20209,7 @@
"is_obwg": true,
"tags": [
"Account",
- "Account Information Service (AIS)",
- "New-Style"
+ "Account Information Service (AIS)"
],
"typed_request_body": {
"type": "object",
@@ -20710,8 +20630,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -20918,8 +20837,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -20993,8 +20911,7 @@
"tags": [
"Role",
"Entitlement",
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -21111,8 +21028,7 @@
"is_obwg": false,
"tags": [
"Account-Application",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -21423,8 +21339,7 @@
"is_obwg": true,
"tags": [
"Transaction-Request",
- "Payment Initiation Service (PIS)",
- "New-Style"
+ "Payment Initiation Service (PIS)"
],
"typed_request_body": {
"type": "object",
@@ -21799,8 +21714,7 @@
"is_obwg": false,
"tags": [
"Webhook",
- "Bank",
- "New-Style"
+ "Bank"
],
"typed_request_body": {
"type": "object",
@@ -21901,8 +21815,7 @@
"is_obwg": true,
"tags": [
"Account",
- "Account Information Service (AIS)",
- "New-Style"
+ "Account Information Service (AIS)"
],
"typed_request_body": {
"type": "object",
@@ -22134,8 +22047,7 @@
"is_obwg": true,
"tags": [
"Transaction-Request",
- "Payment Initiation Service (PIS)",
- "New-Style"
+ "Payment Initiation Service (PIS)"
],
"typed_request_body": {
"type": "object",
@@ -22530,8 +22442,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -23216,8 +23127,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "System-View",
- "New-Style"
+ "System-View"
],
"typed_request_body": {
"type": "object",
@@ -23548,8 +23458,7 @@
"is_obwg": true,
"tags": [
"Consent",
- "Account Information Service (AIS)",
- "New-Style"
+ "Account Information Service (AIS)"
],
"typed_request_body": {
"type": "object",
@@ -23868,8 +23777,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -24020,8 +23928,7 @@
"tags": [
"Role",
"Entitlement",
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -24323,8 +24230,7 @@
"is_obwg": true,
"tags": [
"Consent",
- "Account Information Service (AIS)",
- "New-Style"
+ "Account Information Service (AIS)"
],
"typed_request_body": {
"type": "object",
@@ -24645,8 +24551,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -24762,8 +24667,7 @@
"is_obwg": false,
"tags": [
"Dynamic-Entity",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -24876,8 +24780,7 @@
"is_obwg": false,
"tags": [
"Method-Routing",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -26266,8 +26169,7 @@
"tags": [
"Role",
"Entitlement",
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -26507,8 +26409,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "Transaction",
- "New-Style"
+ "Transaction"
],
"typed_request_body": {
"type": "object",
@@ -26902,8 +26803,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -27117,8 +27017,7 @@
"is_obwg": false,
"tags": [
"View",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -27616,8 +27515,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -28029,8 +27927,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Role",
- "New-Style"
+ "Role"
],
"typed_request_body": {
"type": "object",
@@ -28195,8 +28092,7 @@
"is_obwg": true,
"tags": [
"Branch",
- "Bank",
- "New-Style"
+ "Bank"
],
"typed_request_body": {
"type": "object",
@@ -28525,8 +28421,7 @@
"tags": [
"Role",
"Entitlement",
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -28669,8 +28564,7 @@
"is_obwg": false,
"tags": [
"Method-Routing",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -28778,8 +28672,7 @@
"is_obwg": false,
"tags": [
"WebUi-Props",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -28982,8 +28875,7 @@
"is_obwg": false,
"tags": [
"Customer",
- "KYC",
- "New-Style"
+ "KYC"
],
"typed_request_body": {
"type": "object",
@@ -29081,8 +28973,7 @@
"is_obwg": false,
"tags": [
"Account-Application",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -29265,8 +29156,7 @@
"tags": [
"Scope",
"Role",
- "Entitlement",
- "New-Style"
+ "Entitlement"
],
"typed_request_body": {
"type": "object",
@@ -29424,8 +29314,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -29588,8 +29477,7 @@
"is_obwg": false,
"tags": [
"Consumer",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -30836,8 +30724,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -31018,8 +30905,7 @@
"is_obwg": false,
"tags": [
"View",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -31472,8 +31358,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -31540,8 +31425,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "Metric",
- "New-Style"
+ "Metric"
],
"typed_request_body": {
"type": "object",
@@ -31615,8 +31499,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -31683,8 +31566,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "FX",
- "New-Style"
+ "FX"
],
"typed_request_body": {
"type": "object",
@@ -31752,8 +31634,7 @@
"is_obwg": false,
"tags": [
"Metric",
- "Aggregate-Metrics",
- "New-Style"
+ "Aggregate-Metrics"
],
"typed_request_body": {
"type": "object",
@@ -31844,8 +31725,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -31975,8 +31855,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -32212,8 +32091,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Card",
- "New-Style"
+ "Card"
],
"typed_request_body": {
"type": "object",
@@ -32296,8 +32174,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Product",
- "New-Style"
+ "Product"
],
"typed_request_body": {
"type": "object",
@@ -32616,8 +32493,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -32773,8 +32649,7 @@
"is_obwg": false,
"tags": [
"Consent",
- "Account Information Service (AIS)",
- "New-Style"
+ "Account Information Service (AIS)"
],
"typed_request_body": {
"type": "object",
@@ -32856,8 +32731,7 @@
"is_obwg": false,
"tags": [
"Customer",
- "KYC",
- "New-Style"
+ "KYC"
],
"typed_request_body": {
"type": "object",
@@ -32981,8 +32855,7 @@
"is_obwg": false,
"tags": [
"Direct-Debit",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -33524,8 +33397,7 @@
"is_obwg": true,
"tags": [
"Transaction-Request",
- "Payment Initiation Service (PIS)",
- "New-Style"
+ "Payment Initiation Service (PIS)"
],
"typed_request_body": {
"type": "object",
@@ -34212,8 +34084,7 @@
"is_obwg": false,
"tags": [
"WebUi-Props",
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -34414,8 +34285,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -34872,8 +34742,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "System-View",
- "New-Style"
+ "System-View"
],
"typed_request_body": {
"type": "object",
@@ -35304,8 +35173,7 @@
"is_obwg": false,
"tags": [
"Customer",
- "Person",
- "New-Style"
+ "Person"
],
"typed_request_body": {
"type": "object",
@@ -35620,8 +35488,7 @@
"is_obwg": false,
"tags": [
"Webhook",
- "Bank",
- "New-Style"
+ "Bank"
],
"typed_request_body": {
"type": "object",
@@ -35752,8 +35619,7 @@
"is_obwg": true,
"tags": [
"Counterparty",
- "Account",
- "New-Style"
+ "Account"
],
"typed_request_body": {
"type": "object",
@@ -35999,8 +35865,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -36202,8 +36067,7 @@
"is_obwg": false,
"tags": [
"Account",
- "Account Information Service (AIS)",
- "New-Style"
+ "Account Information Service (AIS)"
],
"typed_request_body": {
"type": "object",
@@ -36414,8 +36278,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Customer",
- "New-Style"
+ "Customer"
],
"typed_request_body": {
"type": "object",
@@ -36593,8 +36456,7 @@
"tags": [
"Role",
"Entitlement",
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -36697,8 +36559,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -37000,8 +36861,7 @@
"Transaction",
"Account-Firehose",
"Transaction-Firehose",
- "FirehoseData",
- "New-Style"
+ "FirehoseData"
],
"typed_request_body": {
"type": "object",
@@ -37411,8 +37271,7 @@
"is_psd2": false,
"is_obwg": false,
"tags": [
- "Product",
- "New-Style"
+ "Product"
],
"typed_request_body": {
"type": "object",
@@ -37466,8 +37325,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -37805,8 +37663,7 @@
"is_psd2": false,
"is_obwg": true,
"tags": [
- "API",
- "New-Style"
+ "API"
],
"typed_request_body": {
"type": "object",
@@ -38684,8 +38541,7 @@
"tags": [
"Role",
"Entitlement",
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
@@ -38826,8 +38682,7 @@
"tags": [
"View",
"Account",
- "User",
- "New-Style"
+ "User"
],
"typed_request_body": {
"type": "object",
diff --git a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala
index d2f7d498bd..5436175d1d 100644
--- a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala
+++ b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala
@@ -5116,6 +5116,7 @@ object SwaggerDefinitionsJSON {
val postConsentRequestJsonV500 = PostConsentRequestJsonV500(
everything = false,
+ bank_id = None,
account_access = List(AccountAccessV500(
account_routing = accountRoutingJsonV121,
view_id = viewIdExample.value
diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala
index dd61821ad4..d88a7a9092 100644
--- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala
+++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala
@@ -374,7 +374,7 @@ The account-id is constant at least throughout the lifecycle of a given consent.
"GET",
"/card-accounts",
"Reads a list of card accounts",
- s"""${mockedDataText(true)}
+ s"""${mockedDataText(false)}
Reads a list of card accounts with additional information, e.g. balance information.
It is assumed that a consent of the PSU to this access is already given and stored on the ASPSP system.
The addressed list of card accounts depends then on the PSU ID and the stored consent addressed by consentId,
@@ -761,7 +761,7 @@ This method returns the SCA status of a consent initiation's authorisation sub-r
"GET",
"/accounts/ACCOUNT_ID/transactions/TRANSACTIONID",
"Read Transaction Details",
- s"""${mockedDataText(true)}
+ s"""${mockedDataText(false)}
Reads transaction details from a given transaction addressed by "transactionId" on a given account addressed
by "account-id". This call is only available on transactions as reported in a JSON format.
diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala
index a3df2d673f..77922e2348 100644
--- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala
+++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala
@@ -66,7 +66,7 @@ object APIMethods_PaymentInitiationServicePISApi extends RestHelper {
"DELETE",
"/PAYMENT_SERVICE/PAYMENT_PRODUCT/PAYMENTID",
"Payment Cancellation Request",
- s"""${mockedDataText(true)}
+ s"""${mockedDataText(false)}
This method initiates the cancellation of a payment. Depending on the payment-service, the payment-product
and the ASPSP's implementation, this TPP call might be sufficient to cancel a payment. If an authorisation
of the payment cancellation is mandated by the ASPSP, a corresponding hyperlink will be contained in the
diff --git a/obp-api/src/main/scala/code/api/util/APIUtil.scala b/obp-api/src/main/scala/code/api/util/APIUtil.scala
index bd648135f5..ab44b9f34b 100644
--- a/obp-api/src/main/scala/code/api/util/APIUtil.scala
+++ b/obp-api/src/main/scala/code/api/util/APIUtil.scala
@@ -480,7 +480,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
*/
private def checkIfNotMatchHeader(cc: Option[CallContext], httpCode: Int, httpBody: Box[String], headerValue: String): Int = {
val url = cc.map(_.url).getOrElse("")
- val hash = HashUtil.Sha256Hash(s"${url}${httpBody.getOrElse("")}")
+ val hash = HashUtil.calculateETag(url, httpBody)
if (httpCode == 200 && hash == headerValue) 304 else httpCode
}
@@ -542,7 +542,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
s"""consumerId${consumerId}::userId${userId}"""
}
val cacheKey = s"""$compositeKey::${hashedRequestPayload}"""
- val eTag = HashUtil.Sha256Hash(s"${url}${httpBody.getOrElse("")}")
+ val eTag = HashUtil.calculateETag(url, httpBody)
if(httpVerb.toUpperCase() == "GET" || httpVerb.toUpperCase() == "HEAD") { // If-Modified-Since can only be used with a GET or HEAD
val validETag = MappedETag.find(By(MappedETag.ETagResource, cacheKey)) match {
@@ -631,7 +631,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
}
private def getRequestHeadersNewStyle(cc: Option[CallContext], httpBody: Box[String]): CustomResponseHeaders = {
cc.map { i =>
- val hash = HashUtil.Sha256Hash(s"${i.url}${httpBody.getOrElse("")}")
+ val hash = HashUtil.calculateETag(i.url, httpBody)
CustomResponseHeaders(
List(
(ResponseHeader.ETag, hash),
diff --git a/obp-api/src/main/scala/code/api/util/ConsentUtil.scala b/obp-api/src/main/scala/code/api/util/ConsentUtil.scala
index 2176817847..1d31ffb767 100644
--- a/obp-api/src/main/scala/code/api/util/ConsentUtil.scala
+++ b/obp-api/src/main/scala/code/api/util/ConsentUtil.scala
@@ -4,6 +4,7 @@ import java.text.SimpleDateFormat
import java.util.{Date, UUID}
import code.api.berlin.group.v1_3.JSONFactory_BERLIN_GROUP_1_3.{ConsentAccessJson, PostConsentJson}
+import code.api.util.ApiRole.{canCreateEntitlementAtAnyBank, canCreateEntitlementAtOneBank}
import code.api.v3_1_0.{PostConsentBodyCommonJson, PostConsentEntitlementJsonV310, PostConsentViewJsonV310}
import code.api.{Constant, RequestHeader}
import code.bankconnectors.Connector
@@ -541,9 +542,19 @@ object Consent {
// 1. Add views
// Please note that consents can only contain Views that the User already has access to.
- val views: Seq[ConsentView] =
+ val allUserViews = Views.views.vend.getPermissionForUser(user).map(_.views).getOrElse(Nil)
+ val views = consent.bank_id match {
+ case Some(bankId) =>
+ // Filter out roles for other banks
+ allUserViews.filterNot { i =>
+ !i.bankId.value.isEmpty() && i.bankId.value != bankId
+ }
+ case None =>
+ allUserViews
+ }
+ val viewsToAdd: Seq[ConsentView] =
for {
- view <- Views.views.vend.getPermissionForUser(user).map(_.views).getOrElse(Nil)
+ view <- views
if consent.everything || consent.views.exists(_ == PostConsentViewJsonV310(view.bankId.value,view.accountId.value, view.viewId.value))
} yield {
ConsentView(
@@ -554,9 +565,21 @@ object Consent {
}
// 2. Add Roles
// Please note that consents can only contain Roles that the User already has access to.
- val entitlements: Seq[Role] =
+ val allUserEntitlements = Entitlement.entitlement.vend.getEntitlementsByUserId(user.userId).getOrElse(Nil)
+ val entitlements = consent.bank_id match {
+ case Some(bankId) =>
+ // Filter out roles for other banks
+ allUserEntitlements.filterNot { i =>
+ !i.bankId.isEmpty() && i.bankId != bankId
+ }
+ case None =>
+ allUserEntitlements
+ }
+ val entitlementsToAdd: Seq[Role] =
for {
- entitlement <- Entitlement.entitlement.vend.getEntitlementsByUserId(user.userId).getOrElse(Nil)
+ entitlement <- entitlements
+ if !(entitlement.roleName == canCreateEntitlementAtOneBank.toString())
+ if !(entitlement.roleName == canCreateEntitlementAtAnyBank.toString())
if consent.everything || consent.entitlements.exists(_ == PostConsentEntitlementJsonV310(entitlement.bankId,entitlement.roleName))
} yield {
Role(entitlement.roleName, entitlement.bankId)
@@ -572,8 +595,8 @@ object Consent {
exp=timeInSeconds + timeToLive,
name=None,
email=None,
- entitlements=entitlements.toList,
- views=views.toList,
+ entitlements=entitlementsToAdd.toList,
+ views=viewsToAdd.toList,
access = None
)
@@ -787,6 +810,8 @@ object Consent {
val jsonWebTokenAsCaseClass: Box[ConsentJWT] = JwtUtil.getSignedPayloadAsJson(consent.jsonWebToken)
.map(parse(_).extract[ConsentJWT])
jsonWebTokenAsCaseClass match {
+ case Full(consentJWT) => consentJWT.entitlements.exists(_.bank_id.isEmpty()) // System roles
+ case Full(consentJWT) => consentJWT.entitlements.map(_.bank_id).contains(bankId.value) // Bank level roles
case Full(consentJWT) => consentJWT.views.map(_.bank_id).contains(bankId.value)
case _ => false
}
diff --git a/obp-api/src/main/scala/code/api/util/HashUtil.scala b/obp-api/src/main/scala/code/api/util/HashUtil.scala
index bd8b5836ec..e7960564e3 100644
--- a/obp-api/src/main/scala/code/api/util/HashUtil.scala
+++ b/obp-api/src/main/scala/code/api/util/HashUtil.scala
@@ -1,6 +1,7 @@
package code.api.util
import java.math.BigInteger
+import net.liftweb.common.Box
object HashUtil {
def Sha256Hash(in: String): String = {
@@ -10,6 +11,11 @@ object HashUtil {
val hashedValue = String.format("%032x", new BigInteger(1, MessageDigest.getInstance("SHA-256").digest(in.getBytes("UTF-8"))))
hashedValue
}
+
+ // Single Point of Entry in order to calculate ETag
+ def calculateETag(url: String, httpBody: Box[String]): String = {
+ HashUtil.Sha256Hash(s"${url}${httpBody.getOrElse("")}")
+ }
def main(args: Array[String]): Unit = {
// You can verify hash with command line tool in linux, unix:
diff --git a/obp-api/src/main/scala/code/api/v3_1_0/JSONFactory3.1.0.scala b/obp-api/src/main/scala/code/api/v3_1_0/JSONFactory3.1.0.scala
index c7036700a8..41b66593fe 100644
--- a/obp-api/src/main/scala/code/api/v3_1_0/JSONFactory3.1.0.scala
+++ b/obp-api/src/main/scala/code/api/v3_1_0/JSONFactory3.1.0.scala
@@ -528,6 +528,7 @@ trait PostConsentCommonBody{
case class PostConsentBodyCommonJson(
everything: Boolean,
+ bank_id: Option[String],
views: List[PostConsentViewJsonV310],
entitlements: List[PostConsentEntitlementJsonV310],
consumer_id: Option[String],
diff --git a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala
index d669bae986..8b8edd272c 100644
--- a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala
+++ b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala
@@ -18,7 +18,7 @@ import code.api.v4_0_0.JSONFactory400.createCustomersMinimalJson
import code.api.v4_0_0.{JSONFactory400, PutProductJsonV400}
import code.api.v5_0_0.JSONFactory500.{createPhysicalCardJson, createViewJsonV500, createViewsIdsJsonV500, createViewsJsonV500}
import code.bankconnectors.Connector
-import code.consent.{ConsentRequests, Consents}
+import code.consent.{ConsentRequest, ConsentRequests, Consents}
import code.entitlement.Entitlement
import code.metrics.APIMetrics
import code.model._
@@ -611,9 +611,11 @@ trait APIMethods500 {
postConsentRequestJsonV500,
consentRequestResponseJson,
List(
- $BankNotFound,
InvalidJsonFormat,
ConsentMaxTTL,
+ X509CannotGetCertificate,
+ X509GeneralError,
+ InvalidConnectorResponse,
UnknownError
),
apiTagConsent :: apiTagPSD2AIS :: apiTagPsd2 :: Nil
@@ -643,14 +645,7 @@ trait APIMethods500 {
i => connectorEmptyResponse(i, callContext)
}
} yield {
- (
- ConsentRequestResponseJson(
- createdConsentRequest.consentRequestId,
- net.liftweb.json.parse(createdConsentRequest.payload),
- createdConsentRequest.consumerId,
- ),
- HttpCode.`201`(callContext)
- )
+ (JSONFactory500.createConsentRequestResponseJson(createdConsentRequest), HttpCode.`201`(callContext))
}
}
}
@@ -666,8 +661,11 @@ trait APIMethods500 {
EmptyBody,
consentRequestResponseJson,
List(
- $BankNotFound,
- ConsentRequestNotFound,
+ InvalidJsonFormat,
+ ConsentMaxTTL,
+ X509CannotGetCertificate,
+ X509GeneralError,
+ InvalidConnectorResponse,
UnknownError
),
apiTagConsent :: apiTagPSD2AIS :: apiTagPsd2 :: Nil
@@ -685,12 +683,7 @@ trait APIMethods500 {
i => unboxFullOrFail(i,callContext, ConsentRequestNotFound)
}
} yield {
- (ConsentRequestResponseJson(
- consent_request_id = createdConsentRequest.consentRequestId,
- payload = json.parse(createdConsentRequest.payload),
- consumer_id = createdConsentRequest.consumerId
- ),
- HttpCode.`200`(callContext)
+ (JSONFactory500.createConsentRequestResponseJson(createdConsentRequest), HttpCode.`200`(callContext)
)
}
}
@@ -722,9 +715,12 @@ trait APIMethods500 {
cc =>
for {
(_, callContext) <- applicationAccess(cc)
- consent<- Future { Consents.consentProvider.vend.getConsentByConsentRequestId(consentRequestId)} map {
+ consent <- Future { Consents.consentProvider.vend.getConsentByConsentRequestId(consentRequestId)} map {
unboxFullOrFail(_, callContext, ConsentRequestNotFound)
}
+ _ <- Helper.booleanToFuture(failMsg = ConsentNotFound, cc = cc.callContext) {
+ consent.mUserId == cc.userId
+ }
} yield {
(
ConsentJsonV500(
@@ -960,6 +956,7 @@ trait APIMethods500 {
postConsentBodyCommonJson = PostConsentBodyCommonJson(
everything = consentRequestJson.everything,
+ bank_id = consentRequestJson.bank_id,
views = postConsentViewJsons,
entitlements = consentRequestJson.entitlements.getOrElse(Nil),
consumer_id = consentRequestJson.consumer_id,
diff --git a/obp-api/src/main/scala/code/api/v5_0_0/JSONFactory5.0.0.scala b/obp-api/src/main/scala/code/api/v5_0_0/JSONFactory5.0.0.scala
index aa263ebeb0..3af8599e77 100644
--- a/obp-api/src/main/scala/code/api/v5_0_0/JSONFactory5.0.0.scala
+++ b/obp-api/src/main/scala/code/api/v5_0_0/JSONFactory5.0.0.scala
@@ -39,6 +39,7 @@ import code.api.v3_0_0.{AdapterInfoJsonV300, CustomerAttributeResponseJsonV300,
import code.api.v3_1_0.{AccountAttributeResponseJson, AccountBasicV310, CustomerWithAttributesJsonV310, PhysicalCardWithAttributesJsonV310, PostConsentEntitlementJsonV310}
import code.api.v4_0_0.BankAttributeBankResponseJsonV400
import code.bankattribute.BankAttribute
+import code.consent.ConsentRequest
import code.customeraccountlinks.CustomerAccountLinkTrait
import com.openbankproject.commons.model.{AccountAttribute, AccountRouting, AccountRoutingJsonV121, AmountOfMoneyJsonV121, Bank, BankAccount, CardAttribute, CreateViewJson, Customer, CustomerAttribute, InboundAdapterInfoInternal, InboundStatusMessage, PhysicalCardTrait, UpdateViewJSON, User, UserAuthContext, UserAuthContextUpdate, View, ViewBasic}
import net.liftweb.json.JsonAST.JValue
@@ -220,6 +221,7 @@ case class AccountAccessV500(
case class PostConsentRequestJsonV500(
everything: Boolean,
+ bank_id: Option[String],
account_access: List[AccountAccessV500],
entitlements: Option[List[PostConsentEntitlementJsonV310]],
consumer_id: Option[String],
@@ -749,7 +751,13 @@ object JSONFactory500 {
CustomerAccountLinksJson(customerAccountLinks.map(createCustomerAccountLinkJson))
}
-
+ def createConsentRequestResponseJson(createdConsentRequest: ConsentRequest): ConsentRequestResponseJson = {
+ ConsentRequestResponseJson(
+ createdConsentRequest.consentRequestId,
+ net.liftweb.json.parse(createdConsentRequest.payload),
+ createdConsentRequest.consumerId,
+ )
+ }
def createViewJsonV500(view : View) : ViewJsonV500 = {
val alias =
diff --git a/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala b/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala
index 42a216ef42..e436c1cd81 100644
--- a/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala
+++ b/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala
@@ -8,10 +8,12 @@ import code.api.util.ApiTag._
import code.api.util.ErrorMessages.{$UserNotLoggedIn, BankNotFound, ConsentNotFound, InvalidJsonFormat, UnknownError, UserNotFoundByUserId, UserNotLoggedIn, _}
import code.api.util.NewStyle.HttpCode
import code.api.util._
+import code.api.v3_0_0.JSONFactory300
import code.api.v3_0_0.JSONFactory300.createAggregateMetricJson
import code.api.v3_1_0.ConsentJsonV310
import code.api.v3_1_0.JSONFactory310.createBadLoginStatusJson
import code.api.v4_0_0.{JSONFactory400, PostApiCollectionJson400}
+import code.api.v5_0_0.ConsentJsonV500
import code.atmattribute.AtmAttribute
import code.bankconnectors.Connector
import code.consent.Consents
@@ -25,12 +27,14 @@ import code.util.Helper
import code.views.system.{AccountAccess, ViewDefinition}
import com.github.dwickern.macros.NameOf.nameOf
import com.openbankproject.commons.ExecutionContext.Implicits.global
+import com.openbankproject.commons.dto.CustomerAndAttribute
import com.openbankproject.commons.model.enums.{AtmAttributeType, UserAttributeType}
import com.openbankproject.commons.model.{AtmId, AtmT, BankId}
import com.openbankproject.commons.util.{ApiVersion, ScannedApiVersion}
-import net.liftweb.common.Full
+import net.liftweb.common.{Box, Full}
import net.liftweb.http.S
import net.liftweb.http.rest.RestHelper
+import net.liftweb.json.parse
import net.liftweb.mapper.By
import net.liftweb.util.Helpers.tryo
@@ -738,9 +742,45 @@ trait APIMethods510 {
}
}
}
-
-
+
+ staticResourceDocs += ResourceDoc(
+ getConsentByConsentId,
+ implementedInApiVersion,
+ nameOf(getConsentByConsentId),
+ "GET",
+ "/consumer/consents/CONSENT_ID",
+ "Get Consent By Consent Id",
+ s"""
+ |
+ |This endpoint gets the Consent By consent id.
+ |
+ |${authenticationRequiredMessage(true)}
+ |
+ """.stripMargin,
+ EmptyBody,
+ consentJsonV500,
+ List(
+ $UserNotLoggedIn,
+ UnknownError
+ ),
+ List(apiTagConsent, apiTagPSD2AIS, apiTagPsd2))
+ lazy val getConsentByConsentId: OBPEndpoint = {
+ case "consumer" :: "consents" :: consentId :: Nil JsonGet _ => {
+ cc =>
+ for {
+ consent <- Future { Consents.consentProvider.vend.getConsentByConsentId(consentId)} map {
+ unboxFullOrFail(_, cc.callContext, ConsentNotFound)
+ }
+ _ <- Helper.booleanToFuture(failMsg = ConsentNotFound, cc = cc.callContext) {
+ consent.mUserId == cc.userId
+ }
+ } yield {
+ (JSONFactory510.getConsentInfoJson(consent), HttpCode.`200`(cc))
+ }
+ }
+ }
+
staticResourceDocs += ResourceDoc(
revokeConsentAtBank,
implementedInApiVersion,
@@ -1157,6 +1197,46 @@ trait APIMethods510 {
}
}
+
+
+ staticResourceDocs += ResourceDoc(
+ getCustomersForUserIdsOnly,
+ implementedInApiVersion,
+ nameOf(getCustomersForUserIdsOnly),
+ "GET",
+ "/users/current/customers/customer_ids",
+ "Get Customers for Current User (IDs only)",
+ s"""Gets all Customers Ids that are linked to a User.
+ |
+ |
+ |${authenticationRequiredMessage(true)}
+ |
+ |""",
+ EmptyBody,
+ customersWithAttributesJsonV300,
+ List(
+ $UserNotLoggedIn,
+ UserCustomerLinksNotFoundForUser,
+ UnknownError
+ ),
+ List(apiTagCustomer, apiTagUser)
+ )
+
+ lazy val getCustomersForUserIdsOnly : OBPEndpoint = {
+ case "users" :: "current" :: "customers" :: "customer_ids" :: Nil JsonGet _ => {
+ cc => {
+ for {
+ (customers, callContext) <- Connector.connector.vend.getCustomersByUserId(cc.userId, cc.callContext) map {
+ connectorEmptyResponse(_, cc.callContext)
+ }
+ } yield {
+ (JSONFactory510.createCustomersIds(customers), HttpCode.`200`(callContext))
+ }
+ }
+ }
+ }
+
+
staticResourceDocs += ResourceDoc(
createAtm,
implementedInApiVersion,
diff --git a/obp-api/src/main/scala/code/api/v5_1_0/JSONFactory5.1.0.scala b/obp-api/src/main/scala/code/api/v5_1_0/JSONFactory5.1.0.scala
index f92161f21a..2496d4411d 100644
--- a/obp-api/src/main/scala/code/api/v5_1_0/JSONFactory5.1.0.scala
+++ b/obp-api/src/main/scala/code/api/v5_1_0/JSONFactory5.1.0.scala
@@ -27,20 +27,24 @@
package code.api.v5_1_0
import code.api.Constant
-import code.api.util.APIUtil
+import code.api.util.{APIUtil, ConsentJWT, CustomJsonFormats, JwtUtil, Role}
import code.api.util.APIUtil.gitCommit
import code.api.v1_4_0.JSONFactory1_4_0.{LocationJsonV140, MetaJsonV140, transformToLocationFromV140, transformToMetaFromV140}
import code.api.v3_0_0.JSONFactory300.{createLocationJson, createMetaJson, transformToAddressFromV300}
-import code.api.v3_0_0.{AddressJsonV300, OpeningTimesV300}
+import code.api.v3_0_0.{AccountIdJson, AccountsIdsJsonV300, AddressJsonV300, OpeningTimesV300}
import code.api.v4_0_0.{EnergySource400, HostedAt400, HostedBy400}
import code.atmattribute.AtmAttribute
import code.atms.Atms.Atm
import code.users.UserAttribute
import code.views.system.{AccountAccess, ViewDefinition}
-import com.openbankproject.commons.model.{Address, AtmId, AtmT, BankId, Location, Meta}
+import com.openbankproject.commons.model.{Address, AtmId, AtmT, BankId, BankIdAccountId, Customer, Location, Meta}
import com.openbankproject.commons.util.{ApiVersion, ScannedApiVersion}
-
import java.util.Date
+
+import code.consent.MappedConsent
+import net.liftweb.common.Box
+import net.liftweb.json.parse
+
import scala.collection.immutable.List
import scala.util.Try
@@ -73,6 +77,13 @@ case class CheckSystemIntegrityJsonV510(
success: Boolean,
debug_info: Option[String] = None
)
+
+case class ConsentJsonV510(consent_id: String,
+ jwt: String,
+ status: String,
+ consent_request_id: Option[String],
+ scopes: Option[List[Role]])
+
case class CurrencyJsonV510(alphanumeric_code: String)
case class CurrenciesJsonV510(currencies: List[CurrencyJsonV510])
@@ -215,9 +226,13 @@ case class UserAttributesResponseJsonV510(
user_attributes: List[UserAttributeResponseJsonV510]
)
+case class CustomerIdJson(id: String)
+case class CustomersIdsJsonV510(customers: List[CustomerIdJson])
+object JSONFactory510 extends CustomJsonFormats {
-object JSONFactory510 {
+ def createCustomersIds(customers : List[Customer]): CustomersIdsJsonV510 =
+ CustomersIdsJsonV510(customers.map(x => CustomerIdJson(x.customerId)))
def waitingForGodot(sleep: Long): WaitingForGodotJsonV510 = WaitingForGodotJsonV510(sleep)
@@ -425,6 +440,17 @@ object JSONFactory510 {
)
}
+ def getConsentInfoJson(consent: MappedConsent): ConsentJsonV510 = {
+ val jsonWebTokenAsJValue: Box[ConsentJWT] = JwtUtil.getSignedPayloadAsJson(consent.jsonWebToken).map(parse(_).extract[ConsentJWT])
+ ConsentJsonV510(
+ consent.consentId,
+ consent.jsonWebToken,
+ consent.status,
+ Some(consent.consentRequestId),
+ jsonWebTokenAsJValue.map(_.entitlements).toOption
+ )
+ }
+
def getApiInfoJSON(apiVersion : ApiVersion, apiVersionStatus: String) = {
val organisation = APIUtil.getPropsValue("hosted_by.organisation", "TESOBE")
val email = APIUtil.getPropsValue("hosted_by.email", "contact@tesobe.com")
diff --git a/obp-api/src/test/scala/code/api/v5_0_0/ConsentRequestTest.scala b/obp-api/src/test/scala/code/api/v5_0_0/ConsentRequestTest.scala
index a96b0c7650..22a87d247e 100644
--- a/obp-api/src/test/scala/code/api/v5_0_0/ConsentRequestTest.scala
+++ b/obp-api/src/test/scala/code/api/v5_0_0/ConsentRequestTest.scala
@@ -60,6 +60,7 @@ class ConsentRequestTest extends V500ServerSetupAsync with PropsReset{
object ApiEndpoint3 extends Tag(nameOf(Implementations5_0_0.createConsentByConsentRequestId))
object ApiEndpoint4 extends Tag(nameOf(Implementations5_0_0.getConsentByConsentRequestId))
object ApiEndpoint5 extends Tag(nameOf(Implementations4_0_0.getUsers))
+ object ApiEndpoint6 extends Tag(nameOf(Implementations5_0_0.getConsentRequest))
lazy val entitlements = List(PostConsentEntitlementJsonV310("", CanGetAnyUser.toString()))
lazy val forbiddenEntitlementOneBank = List(PostConsentEntitlementJsonV310(testBankId1.value, CanCreateEntitlementAtOneBank.toString()))
@@ -163,7 +164,7 @@ class ConsentRequestTest extends V500ServerSetupAsync with PropsReset{
// responseGetUsersWrong.body.extract[ErrorMessage].message contains (ConsentHeaderValueInvalid) should be (true)
// }
- scenario("We will call the Create (IMPLICIT), Get and Delete endpoints with user credentials ", ApiEndpoint1, ApiEndpoint2, ApiEndpoint3, ApiEndpoint4, ApiEndpoint5, VersionOfApi) {
+ scenario("We will call the Create (IMPLICIT), Get and Delete endpoints with user credentials ", ApiEndpoint1, ApiEndpoint2, ApiEndpoint3, ApiEndpoint4, ApiEndpoint5, ApiEndpoint6, VersionOfApi) {
When(s"We try $ApiEndpoint1 v5.0.0")
val createConsentResponse = makePostRequest(createConsentRequestUrl, write(postConsentRequestJsonV310))
Then("We should get a 201")
diff --git a/obp-api/src/test/scala/code/api/v5_1_0/ConsentsTest.scala b/obp-api/src/test/scala/code/api/v5_1_0/ConsentsTest.scala
index 6e1283edd8..afaff87370 100644
--- a/obp-api/src/test/scala/code/api/v5_1_0/ConsentsTest.scala
+++ b/obp-api/src/test/scala/code/api/v5_1_0/ConsentsTest.scala
@@ -63,6 +63,7 @@ class ConsentsTest extends V510ServerSetup with PropsReset{
object ApiEndpoint4 extends Tag(nameOf(Implementations5_0_0.getConsentByConsentRequestId))
object ApiEndpoint5 extends Tag(nameOf(Implementations4_0_0.getUsers))
object ApiEndpoint6 extends Tag(nameOf(Implementations5_1_0.revokeConsentAtBank))
+ object ApiEndpoint7 extends Tag(nameOf(Implementations5_1_0.getConsentByConsentId))
lazy val entitlements = List(PostConsentEntitlementJsonV310("", CanGetAnyUser.toString()))
lazy val bankId = testBankId1.value
@@ -80,6 +81,7 @@ class ConsentsTest extends V510ServerSetup with PropsReset{
def getConsentRequestUrl(requestId:String) = (v5_1_0_Request / "consumer"/ "consent-requests"/requestId).GET<@(user1)
def createConsentByConsentRequestIdEmail(requestId:String) = (v5_1_0_Request / "consumer"/ "consent-requests"/requestId/"EMAIL"/"consents").POST<@(user1)
def getConsentByRequestIdUrl(requestId:String) = (v5_1_0_Request / "consumer"/ "consent-requests"/requestId/"consents").GET<@(user1)
+ def getConsentByIdUrl(requestId:String) = (v5_1_0_Request / "consumer" / "consents" / requestId ).GET<@(user1)
def revokeConsentUrl(consentId: String) = (v5_1_0_Request / "banks" / bankId / "consents" / consentId).DELETE
feature(s"test $ApiEndpoint6 version $VersionOfApi - Unauthorized access") {
@@ -102,7 +104,7 @@ class ConsentsTest extends V510ServerSetup with PropsReset{
}
feature(s"Create/Use/Revoke Consent $VersionOfApi") {
- scenario("We will call the Create, Get and Delete endpoints with user credentials ", ApiEndpoint1, ApiEndpoint2, ApiEndpoint3, ApiEndpoint4, ApiEndpoint5, ApiEndpoint6, VersionOfApi) {
+ scenario("We will call the Create, Get and Delete endpoints with user credentials ", ApiEndpoint1, ApiEndpoint2, ApiEndpoint3, ApiEndpoint4, ApiEndpoint5, ApiEndpoint6, ApiEndpoint7, VersionOfApi) {
When(s"We try $ApiEndpoint1 v5.0.0")
val createConsentResponse = makePostRequest(createConsentRequestUrl, write(postConsentRequestJsonV310))
Then("We should get a 201")
@@ -148,6 +150,14 @@ class ConsentsTest extends V510ServerSetup with PropsReset{
getConsentByRequestResponseJson.consent_request_id.head should be(consentRequestId)
getConsentByRequestResponseJson.status should be(ConsentStatus.ACCEPTED.toString)
+ When("We try to make the GET request v5.1.0")
+ val getConsentById = makeGetRequest(getConsentByIdUrl(getConsentByRequestResponseJson.consent_id))
+ Then("We should get a 200")
+ getConsentById.code should equal(200)
+ val getConsentByIdJson = getConsentById.body.extract[ConsentJsonV500]
+ getConsentByIdJson.consent_request_id.head should be(consentRequestId)
+ getConsentByIdJson.status should be(ConsentStatus.ACCEPTED.toString)
+
val requestGetUsers = (v5_1_0_Request / "users").GET
diff --git a/obp-api/src/test/scala/code/api/v5_1_0/CustomerTest.scala b/obp-api/src/test/scala/code/api/v5_1_0/CustomerTest.scala
new file mode 100644
index 0000000000..3ca4931d94
--- /dev/null
+++ b/obp-api/src/test/scala/code/api/v5_1_0/CustomerTest.scala
@@ -0,0 +1,98 @@
+/**
+Open Bank Project - API
+Copyright (C) 2011-2022, TESOBE GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .
+
+Email: contact@tesobe.com
+TESOBE GmbH
+Osloerstrasse 16/17
+Berlin 13359, Germany
+
+This product includes software developed at
+TESOBE (http://www.tesobe.com/)
+ */
+package code.api.v5_1_0
+
+import java.util.Date
+
+import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
+import code.api.util.APIUtil.OAuth._
+import code.api.util.ErrorMessages._
+import code.api.v3_1_0.CustomerJsonV310
+import code.api.v5_1_0.OBPAPI5_1_0.Implementations5_1_0
+import code.customer.CustomerX
+import code.usercustomerlinks.UserCustomerLink
+import com.github.dwickern.macros.NameOf.nameOf
+import com.openbankproject.commons.model.ErrorMessage
+import com.openbankproject.commons.util.ApiVersion
+import org.scalatest.Tag
+
+import scala.language.postfixOps
+
+class CustomerTest extends V510ServerSetup {
+
+ override def beforeAll(): Unit = {
+ super.beforeAll()
+ }
+
+ override def afterAll(): Unit = {
+ super.afterAll()
+ CustomerX.customerProvider.vend.bulkDeleteCustomers()
+ UserCustomerLink.userCustomerLink.vend.bulkDeleteUserCustomerLinks()
+ }
+
+ /**
+ * Test tags
+ * Example: To run tests with tag "getPermissions":
+ * mvn test -D tagsToInclude
+ *
+ * This is made possible by the scalatest maven plugin
+ */
+ object VersionOfApi extends Tag(ApiVersion.v5_1_0.toString)
+ object ApiEndpoint1 extends Tag(nameOf(Implementations5_1_0.getCustomersForUserIdsOnly))
+
+ lazy val bankId = testBankId1.value
+ val getCustomerJson = SwaggerDefinitionsJSON.postCustomerOverviewJsonV500
+
+ feature(s"$ApiEndpoint1 $VersionOfApi - Unauthorized access") {
+ scenario("We will call the endpoint without user credentials", ApiEndpoint1, VersionOfApi) {
+ When(s"We make a request $VersionOfApi")
+ val request = (v5_1_0_Request / "users" / "current" / "customers" / "customer_ids").GET
+ val response = makeGetRequest(request)
+ Then("We should get a 401")
+ response.code should equal(401)
+ And("error should be " + UserNotLoggedIn)
+ response.body.extract[ErrorMessage].message should equal (UserNotLoggedIn)
+ }
+ }
+
+ feature(s"$ApiEndpoint1 $VersionOfApi - Authorized access") {
+ scenario(s"We will call the endpoint $ApiEndpoint1 with a user credentials and successful result", ApiEndpoint1, VersionOfApi) {
+ val legalName = "Evelin Doe"
+ val mobileNumber = "+44 123 456"
+ val customer: CustomerJsonV310 = createCustomerEndpointV510(bankId, legalName, mobileNumber)
+ UserCustomerLink.userCustomerLink.vend.getOCreateUserCustomerLink(resourceUser1.userId, customer.customer_id, new Date(), true)
+ When(s"We make a request $VersionOfApi")
+ val request = (v5_1_0_Request / "users" / "current" / "customers" / "customer_ids").GET <@(user1)
+ val response = makeGetRequest(request)
+ Then("We should get a 200")
+ response.code should equal(200)
+ val ids = response.body.extract[CustomersIdsJsonV510]
+ ids.customers.map(_.id).filter(_ == customer.customer_id).length should equal(1)
+ }
+ }
+
+
+}
diff --git a/obp-api/src/test/scala/code/api/v5_1_0/V510ServerSetup.scala b/obp-api/src/test/scala/code/api/v5_1_0/V510ServerSetup.scala
index 2df9daee61..32a54de625 100644
--- a/obp-api/src/test/scala/code/api/v5_1_0/V510ServerSetup.scala
+++ b/obp-api/src/test/scala/code/api/v5_1_0/V510ServerSetup.scala
@@ -3,8 +3,11 @@ package code.api.v5_1_0
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
import code.api.util.APIUtil.OAuth.{Consumer, Token, _}
import code.api.util.ApiRole
+import code.api.util.ApiRole.CanCreateCustomer
import code.api.v2_0_0.BasicAccountsJSON
+import code.api.v3_1_0.CustomerJsonV310
import code.api.v4_0_0.{AtmJsonV400, BanksJson400}
+import code.api.v5_0_0.PostCustomerJsonV500
import code.entitlement.Entitlement
import code.setup.{APIResponse, DefaultUsers, ServerSetupWithTestData}
import com.openbankproject.commons.util.ApiShortVersions
@@ -53,5 +56,14 @@ trait V510ServerSetup extends ServerSetupWithTestData with DefaultUsers {
val randomPosition = nextInt(accountsJson.size)
accountsJson(randomPosition).id
}
+
+ def createCustomerEndpointV510(bankId: String, legalName: String, mobilePhoneNumber: String): CustomerJsonV310 = {
+ Entitlement.entitlement.vend.addEntitlement(bankId, resourceUser1.userId, CanCreateCustomer.toString)
+ val request = (v5_0_0_Request / "banks" / bankId / "customers").POST <@(user1)
+ val response = makePostRequest(request, write(PostCustomerJsonV500(legal_name = legalName,mobile_phone_number = mobilePhoneNumber)))
+ Then("We should get a 201")
+ response.code should equal(201)
+ response.body.extract[CustomerJsonV310]
+ }
}
\ No newline at end of file