Skip to content

Commit

Permalink
Merge pull request #2473 from constantine2nd/develop
Browse files Browse the repository at this point in the history
Fix end month/year bug
  • Loading branch information
simonredfern authored Jan 2, 2025
2 parents b9b7670 + 7fd2031 commit 2237887
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4226,7 +4226,6 @@ object SwaggerDefinitionsJSON {
status = ConsentStatus.INITIATED.toString,
api_standard = "Berlin Group",
api_version = "v1.3",
jwt = "eyJhbGciOiJIUzI1NiJ9.eyJlbnRpdGxlbWVudHMiOltdLCJjcmVhdGVkQnlVc2VySWQiOiIiLCJzdWIiOiJmY2YzNDZkMi0xNTNiLTQ0MzAtOWE4Zi1mMzU3Njg1MzM5ODciLCJhdWQiOiIyNjY0NjUwYy04MDkwLTQ4MWUtOGJkOC0wM2E5MmY5Yzg3ZWEiLCJuYmYiOjE3MzAzNzMyNzEsImFjY2VzcyI6eyJhY2NvdW50cyI6W3siaWJhbiI6IlJTMzUyNjAwMDU2MDEwMDE2MTEzNzkifV19LCJpc3MiOiJodHRwczovLzEyNy4wLjAuMTo4MDgwIiwiZXhwIjoxNzMwOTM3NjAwLCJpYXQiOjE3MzAzNzMyNzEsImp0aSI6ImQzM2Y3NDYzLWVlNDktNGU4YS04YTkyLTYxMzhkYzE4M2QxNiIsInZpZXdzIjpbeyJiYW5rX2lkIjoibmxia2IiLCJhY2NvdW50X2lkIjoiOTUzODkyOTctNDVjNC00MGViLTllZmQtMzMxYmExOTQzZGE0Iiwidmlld19pZCI6IlJlYWRBY2NvdW50c0Jlcmxpbkdyb3VwIn1dfQ.SXE4W34596lrSXqZrA8cvQs_fvhjWYilU8VDpXZ3C3Y",
jwt_payload = SwaggerDefinitionsJsonUtil.jwtPayload,
)
val consentsJsonV510 = ConsentsJsonV510(List(allConsentJsonV510))
Expand Down
16 changes: 14 additions & 2 deletions obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12499,10 +12499,22 @@ object APIMethods400 extends RestHelper with APIMethods400 {
// Convert LocalDate to Date
zoneId: ZoneId = ZoneId.systemDefault()
firstCurrentMonthDate: Date = Date.from(firstDayOfMonth.atStartOfDay(zoneId).toInstant)
lastCurrentMonthDate: Date = Date.from(lastDayOfMonth.atStartOfDay(zoneId).toInstant)
// Adjust to include 23:59:59.999
lastCurrentMonthDate: Date = Date.from(
lastDayOfMonth
.atTime(23, 59, 59, 999000000)
.atZone(zoneId)
.toInstant
)

firstCurrentYearDate: Date = Date.from(firstDayOfYear.atStartOfDay(zoneId).toInstant)
lastCurrentYearDate: Date = Date.from(lastDayOfYear.atStartOfDay(zoneId).toInstant)
// Adjust to include 23:59:59.999
lastCurrentYearDate: Date = Date.from(
lastDayOfYear
.atTime(23, 59, 59, 999000000)
.atZone(zoneId)
.toInstant
)

defaultFromDate: Date = theEpochTime
defaultToDate: Date = APIUtil.ToDateInFuture
Expand Down
16 changes: 14 additions & 2 deletions obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3601,10 +3601,22 @@ trait APIMethods510 {
// Convert LocalDate to Date
zoneId: ZoneId = ZoneId.systemDefault()
firstCurrentMonthDate: Date = Date.from(firstDayOfMonth.atStartOfDay(zoneId).toInstant)
lastCurrentMonthDate: Date = Date.from(lastDayOfMonth.atStartOfDay(zoneId).toInstant)
// Adjust to include 23:59:59.999
lastCurrentMonthDate: Date = Date.from(
lastDayOfMonth
.atTime(23, 59, 59, 999000000)
.atZone(zoneId)
.toInstant
)

firstCurrentYearDate: Date = Date.from(firstDayOfYear.atStartOfDay(zoneId).toInstant)
lastCurrentYearDate: Date = Date.from(lastDayOfYear.atStartOfDay(zoneId).toInstant)
// Adjust to include 23:59:59.999
lastCurrentYearDate: Date = Date.from(
lastDayOfYear
.atTime(23, 59, 59, 999000000)
.atZone(zoneId)
.toInstant
)

defaultFromDate: Date = theEpochTime
defaultToDate: Date = APIUtil.ToDateInFuture
Expand Down
2 changes: 0 additions & 2 deletions obp-api/src/main/scala/code/api/v5_1_0/JSONFactory5.1.0.scala
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ case class AllConsentJsonV510(consent_reference_id: String,
status: String,
last_action_date: String,
last_usage_date: String,
jwt: String,
jwt_payload: Box[ConsentJWT],
api_standard: String,
api_version: String,
Expand Down Expand Up @@ -889,7 +888,6 @@ object JSONFactory510 extends CustomJsonFormats {
status = c.status,
last_action_date = if (c.lastActionDate != null) new SimpleDateFormat(DateWithDay).format(c.lastActionDate) else null,
last_usage_date = if (c.usesSoFarTodayCounterUpdatedAt != null) new SimpleDateFormat(DateWithSeconds).format(c.usesSoFarTodayCounterUpdatedAt) else null,
jwt = c.jsonWebToken,
jwt_payload = jwtPayload,
api_standard = c.apiStandard,
api_version = c.apiVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class CounterpartyLimitTest extends V510ServerSetup {
response4.body.extract[ErrorMessage].message contains(CounterpartyLimitValidationError) shouldBe (true)
response4.body.extract[ErrorMessage].message contains("max_number_of_transactions") shouldBe(true)

val requestLimitStatus = (v5_1_0_Request / "banks" / bankId / "accounts" / accountId / "views" / ownerView /"counterparties" / counterparty.counterpartyId /"limit-status").POST <@ (user1)
val requestLimitStatus = (v5_1_0_Request / "banks" / bankId / "accounts" / accountId / "views" / ownerView /"counterparties" / counterparty.counterpartyId /"limit-status").GET <@ (user1)
val responseLimitStatus = makeGetRequest(requestLimitStatus)
responseLimitStatus.code shouldBe (200)
responseLimitStatus.body.extract[CounterpartyLimitStatusV510].status.currency_status shouldBe("EUR")
Expand Down

0 comments on commit 2237887

Please sign in to comment.