Skip to content

Commit

Permalink
bugfix/Fix end month/year range bug at endpoint getCounterpartyLimitS…
Browse files Browse the repository at this point in the history
…tatus
  • Loading branch information
constantine2nd committed Dec 31, 2024
1 parent 354649f commit 7fd2031
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
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
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 7fd2031

Please sign in to comment.