Skip to content

Commit 1f8e5bc

Browse files
authored
Merge pull request #2505 from constantine2nd/develop
A few tweaks
2 parents 362af8f + c947c55 commit 1f8e5bc

File tree

6 files changed

+196
-173
lines changed

6 files changed

+196
-173
lines changed

obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ object APIMethods_AccountInformationServiceAISApi extends RestHelper {
5656
getConsentStatus ::
5757
getTransactionDetails ::
5858
getTransactionList ::
59-
readAccountDetails ::
59+
getAccountDetails ::
6060
readCardAccount ::
6161
startConsentAuthorisationTransactionAuthorisation ::
6262
startConsentAuthorisationUpdatePsuAuthentication ::
@@ -78,7 +78,7 @@ object APIMethods_AccountInformationServiceAISApi extends RestHelper {
7878
unboxFullOrFail(_, callContext, s"$NoViewReadAccountsBerlinGroup ${viewId.value} userId : ${u.userId}. account : ${account.accountId}", 403)
7979
}
8080
}
81-
81+
8282
resourceDocs += ResourceDoc(
8383
createConsent,
8484
apiVersion,
@@ -87,22 +87,22 @@ object APIMethods_AccountInformationServiceAISApi extends RestHelper {
8787
"/consents",
8888
"Create consent",
8989
s"""${mockedDataText(false)}
90-
This method create a consent resource, defining access rights to dedicated accounts of
91-
a given PSU-ID. These accounts are addressed explicitly in the method as
90+
This method create a consent resource, defining access rights to dedicated accounts of
91+
a given PSU-ID. These accounts are addressed explicitly in the method as
9292
parameters as a core function.
9393

9494
**Side Effects**
95-
When this Consent Request is a request where the "recurringIndicator" equals "true",
96-
and if it exists already a former consent for recurring access on account information
97-
for the addressed PSU, then the former consent automatically expires as soon as the new
95+
When this Consent Request is a request where the "recurringIndicator" equals "true",
96+
and if it exists already a former consent for recurring access on account information
97+
for the addressed PSU, then the former consent automatically expires as soon as the new
9898
consent request is authorised by the PSU.
9999

100100
Optional Extension:
101-
As an option, an ASPSP might optionally accept a specific access right on the access on all psd2 related services for all available accounts.
101+
As an option, an ASPSP might optionally accept a specific access right on the access on all psd2 related services for all available accounts.
102102

103-
As another option an ASPSP might optionally also accept a command, where only access rights are inserted without mentioning the addressed account.
104-
The relation to accounts is then handled afterwards between PSU and ASPSP.
105-
This option is not supported for the Embedded SCA Approach.
103+
As another option an ASPSP might optionally also accept a command, where only access rights are inserted without mentioning the addressed account.
104+
The relation to accounts is then handled afterwards between PSU and ASPSP.
105+
This option is not supported for the Embedded SCA Approach.
106106
As a last option, an ASPSP might in addition accept a command with access rights
107107
* to see the list of available payment accounts or
108108
* to see the list of available payment accounts with balances.
@@ -164,9 +164,9 @@ As a last option, an ASPSP might in addition accept a command with access rights
164164
validUntil <- NewStyle.function.tryons(failMsg, 400, callContext) {
165165
new SimpleDateFormat(DateWithDay).parse(consentJson.validUntil)
166166
}
167-
167+
168168
_ <- NewStyle.function.getBankAccountsByIban(consentJson.access.accounts.getOrElse(Nil).map(_.iban.getOrElse("")), callContext)
169-
169+
170170
createdConsent <- Future(Consents.consentProvider.vend.createBerlinGroupConsent(
171171
createdByUser,
172172
callContext.flatMap(_.consumer),
@@ -194,7 +194,7 @@ As a last option, an ASPSP might in addition accept a command with access rights
194194
_ <- Future(Consents.consentProvider.vend.setJsonWebToken(createdConsent.consentId, consentJWT)) map {
195195
i => connectorEmptyResponse(i, callContext)
196196
}
197-
197+
198198
/* _ <- Future(Authorisations.authorisationProvider.vend.createAuthorization(
199199
"",
200200
createdConsent.consentId,
@@ -210,7 +210,7 @@ As a last option, an ASPSP might in addition accept a command with access rights
210210
}
211211
}
212212
}
213-
213+
214214
resourceDocs += ResourceDoc(
215215
deleteConsent,
216216
apiVersion,
@@ -243,7 +243,7 @@ As a last option, an ASPSP might in addition accept a command with access rights
243243
}
244244
}
245245
}
246-
246+
247247
resourceDocs += ResourceDoc(
248248
getAccountList,
249249
apiVersion,
@@ -252,21 +252,21 @@ As a last option, an ASPSP might in addition accept a command with access rights
252252
"/accounts",
253253
"Read Account List",
254254
s"""${mockedDataText(false)}
255-
Read the identifiers of the available payment account together with
255+
Read the identifiers of the available payment account together with
256256
booking balance information, depending on the consent granted.
257257

258-
It is assumed that a consent of the PSU to this access is already given and stored on the ASPSP system.
259-
The addressed list of accounts depends then on the PSU ID and the stored consent addressed by consentId,
260-
respectively the OAuth2 access token.
258+
It is assumed that a consent of the PSU to this access is already given and stored on the ASPSP system.
259+
The addressed list of accounts depends then on the PSU ID and the stored consent addressed by consentId,
260+
respectively the OAuth2 access token.
261261

262-
Returns all identifiers of the accounts, to which an account access has been granted to through
263-
the /consents endpoint by the PSU.
264-
In addition, relevant information about the accounts and hyperlinks to corresponding account
262+
Returns all identifiers of the accounts, to which an account access has been granted to through
263+
the /consents endpoint by the PSU.
264+
In addition, relevant information about the accounts and hyperlinks to corresponding account
265265
information resources are provided if a related consent has been already granted.
266266

267-
Remark: Note that the /consents endpoint optionally offers to grant an access on all available
268-
payment accounts of a PSU.
269-
In this case, this endpoint will deliver the information about all available payment accounts
267+
Remark: Note that the /consents endpoint optionally offers to grant an access on all available
268+
payment accounts of a PSU.
269+
In this case, this endpoint will deliver the information about all available payment accounts
270270
of the PSU at this ASPSP.
271271
""",
272272
EmptyBody,
@@ -320,7 +320,7 @@ of the PSU at this ASPSP.
320320
attribute.`type`.equals("STRING")&&
321321
attribute.value.equalsIgnoreCase("card")
322322
).isEmpty)
323-
323+
324324
} yield {
325325
(JSONFactory_BERLIN_GROUP_1_3.createAccountListJson(
326326
bankAccountsFiltered,
@@ -331,7 +331,7 @@ of the PSU at this ASPSP.
331331
}
332332
}
333333
}
334-
334+
335335
resourceDocs += ResourceDoc(
336336
getBalances,
337337
apiVersion,
@@ -340,10 +340,10 @@ of the PSU at this ASPSP.
340340
"/accounts/ACCOUNT_ID/balances",
341341
"Read Balance",
342342
s"""${mockedDataText(false)}
343-
Reads account data from a given account addressed by "account-id".
343+
Reads account data from a given account addressed by "account-id".
344344

345-
**Remark:** This account-id can be a tokenised identification due to data protection reason since the path
346-
information might be logged on intermediary servers within the ASPSP sphere.
345+
**Remark:** This account-id can be a tokenised identification due to data protection reason since the path
346+
information might be logged on intermediary servers within the ASPSP sphere.
347347
This account-id then can be retrieved by the "GET Account List" call.
348348

349349
The account-id is constant at least throughout the lifecycle of a given consent.
@@ -383,7 +383,7 @@ The account-id is constant at least throughout the lifecycle of a given consent.
383383
}
384384
}
385385
}
386-
386+
387387
resourceDocs += ResourceDoc(
388388
getCardAccounts,
389389
apiVersion,
@@ -392,10 +392,10 @@ The account-id is constant at least throughout the lifecycle of a given consent.
392392
"/card-accounts",
393393
"Reads a list of card accounts",
394394
s"""${mockedDataText(false)}
395-
Reads a list of card accounts with additional information, e.g. balance information.
396-
It is assumed that a consent of the PSU to this access is already given and stored on the ASPSP system.
397-
The addressed list of card accounts depends then on the PSU ID and the stored consent addressed by consentId,
398-
respectively the OAuth2 access token.
395+
Reads a list of card accounts with additional information, e.g. balance information.
396+
It is assumed that a consent of the PSU to this access is already given and stored on the ASPSP system.
397+
The addressed list of card accounts depends then on the PSU ID and the stored consent addressed by consentId,
398+
respectively the OAuth2 access token.
399399
""",
400400
EmptyBody,
401401
json.parse("""{
@@ -434,19 +434,19 @@ respectively the OAuth2 access token.
434434
(_, callContext) <- NewStyle.function.getPhysicalCardsForUser(u, callContext)
435435
(accounts, callContext) <- NewStyle.function.getBankAccounts(availablePrivateAccounts, callContext)
436436
//also see `getAccountList` endpoint
437-
bankAccountsFiltered = accounts.filter(bankAccount =>
438-
bankAccount.attributes.toList.flatten.find(attribute=>
439-
attribute.name.equals("CashAccountTypeCode")&&
437+
bankAccountsFiltered = accounts.filter(bankAccount =>
438+
bankAccount.attributes.toList.flatten.find(attribute=>
439+
attribute.name.equals("CashAccountTypeCode")&&
440440
attribute.`type`.equals("STRING")&&
441-
attribute.value.equalsIgnoreCase("card")
441+
attribute.value.equalsIgnoreCase("card")
442442
).isDefined)
443443
} yield {
444444
(JSONFactory_BERLIN_GROUP_1_3.createCardAccountListJson(bankAccountsFiltered, u), callContext)
445445
}
446446
}
447447
}
448-
449-
448+
449+
450450
resourceDocs += ResourceDoc(
451451
getCardAccountBalances,
452452
apiVersion,
@@ -455,13 +455,13 @@ respectively the OAuth2 access token.
455455
"/card-accounts/ACCOUNT_ID/balances",
456456
"Read card account balances",
457457
s"""${mockedDataText(false)}
458-
Reads balance data from a given card account addressed by
459-
"account-id".
458+
Reads balance data from a given card account addressed by
459+
"account-id".
460460

461-
Remark: This account-id can be a tokenised identification due
462-
to data protection reason since the path information might be
463-
logged on intermediary servers within the ASPSP sphere.
464-
This account-id then can be retrieved by the
461+
Remark: This account-id can be a tokenised identification due
462+
to data protection reason since the path information might be
463+
logged on intermediary servers within the ASPSP sphere.
464+
This account-id then can be retrieved by the
465465
"GET Card Account List" call
466466
""",
467467
EmptyBody,
@@ -498,7 +498,7 @@ This account-id then can be retrieved by the
498498
}
499499
}
500500
}
501-
501+
502502
resourceDocs += ResourceDoc(
503503
getCardAccountTransactionList,
504504
apiVersion,
@@ -596,7 +596,7 @@ Reads account data from a given card account addressed by "account-id".
596596
}
597597
}
598598
}
599-
599+
600600
resourceDocs += ResourceDoc(
601601
getConsentAuthorisation,
602602
apiVersion,
@@ -629,7 +629,7 @@ This function returns an array of hyperlinks to all generated authorisation sub-
629629
}
630630
}
631631
}
632-
632+
633633
resourceDocs += ResourceDoc(
634634
getConsentInformation,
635635
apiVersion,
@@ -638,8 +638,8 @@ This function returns an array of hyperlinks to all generated authorisation sub-
638638
"/consents/CONSENTID",
639639
"Get Consent Request",
640640
s"""${mockedDataText(false)}
641-
Returns the content of an account information consent object.
642-
This is returning the data for the TPP especially in cases,
641+
Returns the content of an account information consent object.
642+
This is returning the data for the TPP especially in cases,
643643
where the consent was directly managed between ASPSP and PSU e.g. in a re-direct SCA Approach.
644644
""",
645645
EmptyBody,
@@ -702,7 +702,7 @@ where the consent was directly managed between ASPSP and PSU e.g. in a re-direct
702702
.replace(ConsentStatus.REJECTED.toString, "failed")
703703
scaStatus
704704
}
705-
705+
706706
resourceDocs += ResourceDoc(
707707
getConsentScaStatus,
708708
apiVersion,
@@ -738,7 +738,7 @@ This method returns the SCA status of a consent initiation's authorisation sub-r
738738
}
739739
}
740740
}
741-
741+
742742
resourceDocs += ResourceDoc(
743743
getConsentStatus,
744744
apiVersion,
@@ -770,22 +770,22 @@ This method returns the SCA status of a consent initiation's authorisation sub-r
770770
.replace(ConsentStatus.REVOKED.toString.toLowerCase(), "revokedByPsu")
771771
(JSONFactory_BERLIN_GROUP_1_3.ConsentStatusJsonV13(status), HttpCode.`200`(callContext))
772772
}
773-
773+
774774
}
775775
}
776-
776+
777777
resourceDocs += ResourceDoc(
778778
getTransactionDetails,
779779
apiVersion,
780780
nameOf(getTransactionDetails),
781-
"GET",
782-
"/accounts/ACCOUNT_ID/transactions/TRANSACTIONID",
781+
"GET",
782+
"/accounts/ACCOUNT_ID/transactions/TRANSACTIONID",
783783
"Read Transaction Details",
784784
s"""${mockedDataText(false)}
785-
Reads transaction details from a given transaction addressed by "transactionId" on a given account addressed
786-
by "account-id". This call is only available on transactions as reported in a JSON format.
785+
Reads transaction details from a given transaction addressed by "transactionId" on a given account addressed
786+
by "account-id". This call is only available on transactions as reported in a JSON format.
787787

788-
**Remark:** Please note that the PATH might be already given in detail by the corresponding entry of the response
788+
**Remark:** Please note that the PATH might be already given in detail by the corresponding entry of the response
789789
of the "Read Transaction List" call within the _links subfield.
790790

791791
""",
@@ -932,20 +932,20 @@ The ASPSP might add balance information, if transaction lists without balances a
932932
}
933933
}
934934
}
935-
935+
936936
resourceDocs += ResourceDoc(
937-
readAccountDetails,
937+
getAccountDetails,
938938
apiVersion,
939-
nameOf(readAccountDetails),
939+
nameOf(getAccountDetails),
940940
"GET",
941941
"/accounts/ACCOUNT_ID",
942942
"Read Account Details",
943943
s"""${mockedDataText(false)}
944-
Reads details about an account, with balances where required.
945-
It is assumed that a consent of the PSU to this access is already given and stored on the ASPSP system.
946-
The addressed details of this account depends then on the stored consent addressed by consentId,
947-
respectively the OAuth2 access token. **NOTE:** The account-id can represent a multicurrency account.
948-
In this case the currency code is set to "XXX". Give detailed information about the addressed account.
944+
Reads details about an account, with balances where required.
945+
It is assumed that a consent of the PSU to this access is already given and stored on the ASPSP system.
946+
The addressed details of this account depends then on the stored consent addressed by consentId,
947+
respectively the OAuth2 access token. **NOTE:** The account-id can represent a multicurrency account.
948+
In this case the currency code is set to "XXX". Give detailed information about the addressed account.
949949
Give detailed information about the addressed account together with balance information
950950

951951
""",
@@ -972,7 +972,7 @@ Give detailed information about the addressed account together with balance info
972972
ApiTag("Account Information Service (AIS)") :: apiTagBerlinGroupM :: Nil
973973
)
974974

975-
lazy val readAccountDetails : OBPEndpoint = {
975+
lazy val getAccountDetails : OBPEndpoint = {
976976
case "accounts" :: accountId :: Nil JsonGet _ => {
977977
cc =>
978978
for {

obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats {
105105
case class AccountBalance(
106106
balanceAmount : AmountOfMoneyV13 = AmountOfMoneyV13("EUR","123"),
107107
balanceType: String = "closingBooked",
108-
lastChangeDateTime: String = "2020-07-02T10:23:57.814Z",
109-
lastCommittedTransaction: String = "string",
110-
referenceDate: String = "2020-07-02",
108+
lastChangeDateTime: Option[String] = None,
109+
lastCommittedTransaction: Option[String] = None,
110+
referenceDate: Option[String] = None,
111111

112112
)
113113
case class FromAccount(
@@ -315,8 +315,8 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats {
315315
x =>
316316
val (iBan: String, bBan: String) = getIbanAndBban(x)
317317
val commonPath = s"${OBP_BERLIN_GROUP_1_3.apiVersion.urlPrefix}/${OBP_BERLIN_GROUP_1_3.version}/accounts/${x.accountId.value}"
318-
val balanceRef = LinkHrefJson(s"/$commonPath/accounts/${x.accountId.value}/balances")
319-
val transactionRef = LinkHrefJson(s"/$commonPath/accounts/${x.accountId.value}/transactions")
318+
val balanceRef = LinkHrefJson(s"/$commonPath/balances")
319+
val transactionRef = LinkHrefJson(s"/$commonPath/transactions")
320320
val canReadTransactions = canReadTransactionsAccounts.map(_.accountId.value).contains(x.accountId.value)
321321

322322

@@ -401,9 +401,8 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats {
401401
`balances` = accountBalances.balances.map(accountBalance => AccountBalance(
402402
balanceAmount = AmountOfMoneyV13(accountBalance.balance.currency, accountBalance.balance.amount),
403403
balanceType = accountBalance.balanceType,
404-
lastChangeDateTime = APIUtil.dateOrNull(bankAccount.lastUpdate),
405-
referenceDate = APIUtil.dateOrNull(bankAccount.lastUpdate),
406-
lastCommittedTransaction = "String"
404+
lastChangeDateTime = APIUtil.dateOrNone(bankAccount.lastUpdate),
405+
referenceDate = APIUtil.dateOrNone(bankAccount.lastUpdate),
407406
)
408407
))
409408
}

0 commit comments

Comments
 (0)