diff --git a/.gitignore b/.gitignore index b6f040de31..561108a778 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,9 @@ .settings .metals .vscode +*.code-workspace .zed +.cursor .classpath .project .cache @@ -35,5 +37,4 @@ marketing_diagram_generation/outputs/* .bsp .specstory project/project -coursier -*.code-workspace +coursier \ No newline at end of file diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala index 3ca2d5dfd8..78a7e747ab 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/JSONFactory_BERLIN_GROUP_1_3.scala @@ -346,7 +346,7 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats with MdcLoggable{ Some(balances.filter(_.accountId.equals(x.accountId)).flatMap(balance => (List(CoreAccountBalanceJson( balanceAmount = AmountOfMoneyV13(x.currency, balance.balanceAmount.toString()), balanceType = balance.balanceType, - lastChangeDateTime = balance.lastChangeDateTime.map(APIUtil.DateWithMsAndTimeZoneOffset.format(_)) + lastChangeDateTime = balance.lastChangeDateTime.map(APIUtil.DateWithMsFormat.format(_)) ))))) }else{ None @@ -432,7 +432,7 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats with MdcLoggable{ Some(balances.filter(_.accountId.equals(bankAccount.accountId)).flatMap(balance => (List(CoreAccountBalanceJson( balanceAmount = AmountOfMoneyV13(bankAccount.currency, balance.balanceAmount.toString()), balanceType = balance.balanceType, - lastChangeDateTime = balance.lastChangeDateTime.map(APIUtil.DateWithMsAndTimeZoneOffset.format(_)) + lastChangeDateTime = balance.lastChangeDateTime.map(APIUtil.DateWithMsFormat.format(_)) ))))) } else { None @@ -477,7 +477,7 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats with MdcLoggable{ `balances` = accountBalances.map(accountBalance => AccountBalance( balanceAmount = AmountOfMoneyV13(bankAccount.currency, accountBalance.balanceAmount.toString()), balanceType = accountBalance.balanceType, - lastChangeDateTime = accountBalance.lastChangeDateTime.map(APIUtil.DateWithMsAndTimeZoneOffset.format(_)), + lastChangeDateTime = accountBalance.lastChangeDateTime.map(APIUtil.DateWithMsFormat.format(_)), referenceDate = accountBalance.referenceDate, ) )) @@ -614,8 +614,8 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats with MdcLoggable{ else transaction.amount.get.toString() ), - bookingDate = transaction.startDate.map(APIUtil.DateWithMsAndTimeZoneOffset.format(_)).getOrElse(""), - valueDate = transaction.finishDate.map(APIUtil.DateWithMsAndTimeZoneOffset.format(_)).getOrElse(""), + bookingDate = transaction.startDate.map(APIUtil.DateWithMsFormat.format(_)).getOrElse(""), + valueDate = transaction.finishDate.map(APIUtil.DateWithMsFormat.format(_)).getOrElse(""), remittanceInformationUnstructured = transaction.description.getOrElse(""), bankTransactionCode ="", ) 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 a2bdbca8b7..c352fa46bf 100644 --- a/obp-api/src/main/scala/code/api/util/APIUtil.scala +++ b/obp-api/src/main/scala/code/api/util/APIUtil.scala @@ -130,8 +130,11 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{ val DateWithMonthFormat = new SimpleDateFormat(DateWithMonth) val DateWithDayFormat = new SimpleDateFormat(DateWithDay) val DateWithSecondsFormat = new SimpleDateFormat(DateWithSeconds) - val DateWithMsFormat = new SimpleDateFormat(DateWithMs) + // If you need UTC Z format, please continue to use DateWithMsFormat. eg: 2025-01-01T01:01:01.000Z + val DateWithMsFormat = new SimpleDateFormat(DateWithMs) + // If you need a format with timezone offset (+0000), please use DateWithMsRollbackFormat, eg: 2025-01-01T01:01:01.000+0000 val DateWithMsRollbackFormat = new SimpleDateFormat(DateWithMsAndTimeZoneOffset) + val rfc7231Date = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH) val DateWithYearExampleString: String = "1100" @@ -967,7 +970,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{ if(date == null) None else - Some(APIUtil.DateWithMsAndTimeZoneOffset.format(date)) + Some(APIUtil.DateWithMsRollbackFormat.format(date)) def stringOrNull(text : String) = if(text == null || text.isEmpty) diff --git a/obp-api/src/test/scala/code/util/APIUtilTest.scala b/obp-api/src/test/scala/code/util/APIUtilTest.scala index e3f546935e..000221b280 100644 --- a/obp-api/src/test/scala/code/util/APIUtilTest.scala +++ b/obp-api/src/test/scala/code/util/APIUtilTest.scala @@ -55,6 +55,15 @@ class APIUtilTest extends FeatureSpec with Matchers with GivenWhenThen with Prop val inputStringDateFormat = DateWithMsFormat val startDateObject: Date = DateWithMsFormat.parse(DefaultFromDateString) val endDateObject: Date = DateWithMsFormat.parse(DefaultToDateString) + + feature("Test the value of dateString formatted by DateWithMsFormat") { + scenario("Check the formatted dateString value") { + val dateString = inputStringDateFormat.format(new Date()) +// println(s"dateString value: $dateString") + dateString should not be "yyyy-MM-dd'T'HH:mm:ss.SSSZ" + } + } + ZonedDateTime.now(ZoneId.of("UTC")) feature("test APIUtil.dateRangesOverlap method") {