Skip to content

Commit a897d28

Browse files
committed
Update lunchmoney depndency && fix errors #dockerpush
1 parent 223fafa commit a897d28

File tree

9 files changed

+57
-24
lines changed

9 files changed

+57
-24
lines changed

.idea/jarRepositories.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM openjdk:11-jre-slim
1+
FROM eclipse-temurin:17
22

33
WORKDIR /opt/app
44

build.gradle.kts

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ val githubToken: String? by project
3333

3434
repositories {
3535
mavenCentral()
36+
mavenLocal()
3637
maven("https://jitpack.io")
3738
maven("https://s01.oss.sonatype.org/content/repositories/snapshots")
3839
}
@@ -41,7 +42,7 @@ dependencies {
4142
implementation(kotlin("stdlib"))
4243
implementation(kotlin("reflect"))
4344
implementation("io.github.smaugfm:monobank:0.0.2")
44-
implementation("io.github.smaugfm:lunchmoney:1.0.2")
45+
implementation("io.github.smaugfm:lunchmoney:1.0.3-SNAPSHOT")
4546
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinxCoroutines")
4647
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutines")
4748
implementation("com.github.livefront.sealed-enum:runtime:$sealedEnum")

src/main/kotlin/io/github/smaugfm/monobudget/lunchmoney/LunchmoneyTransactionCreator.kt

+4-12
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import io.github.smaugfm.monobudget.common.statement.lifecycle.StatementProcessi
1515
import io.github.smaugfm.monobudget.common.statement.lifecycle.StatementProcessingScopeComponent
1616
import io.github.smaugfm.monobudget.common.transaction.TransactionFactory
1717
import kotlinx.coroutines.reactor.awaitSingle
18-
import kotlinx.serialization.SerializationException
1918
import org.koin.core.annotation.Scope
2019
import org.koin.core.annotation.Scoped
2120

@@ -41,17 +40,10 @@ class LunchmoneyTransactionCreator(
4140
}
4241
} catch (e: LunchmoneyApiResponseException) {
4342
val template = "Текст помилки: "
44-
if (e.cause is SerializationException) {
45-
throw BudgetBackendException(
46-
e,
47-
template + (e.message?.substringBefore("JSON input:") + "HTTP Body:\n" + e.body),
48-
)
49-
} else {
50-
throw BudgetBackendException(
51-
e,
52-
template + e.message,
53-
)
54-
}
43+
throw BudgetBackendException(
44+
e,
45+
template + e.message,
46+
)
5547
}
5648

5749
private suspend fun processTransfer(

src/main/kotlin/io/github/smaugfm/monobudget/lunchmoney/LunchmoneyTransactionMessageFormatter.kt

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class LunchmoneyTransactionMessageFormatter(
2525
private val shouldNotifyStatuses =
2626
setOf(
2727
LunchmoneyTransactionStatus.UNCLEARED,
28-
LunchmoneyTransactionStatus.RECURRING_SUGGESTED,
2928
LunchmoneyTransactionStatus.PENDING,
3029
)
3130

src/test/kotlin/io/github/smaugfm/monobudget/TestData.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.github.smaugfm.monobudget
22

3-
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategoryMultiple
3+
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategory
44
import io.github.smaugfm.monobank.model.MonoStatementItem
55
import io.github.smaugfm.monobank.model.MonoWebhookResponseData
66
import io.github.smaugfm.monobudget.mono.MonobankWebhookResponseStatementItem
@@ -62,7 +62,7 @@ object TestData {
6262

6363
val categories =
6464
listOf(
65-
LunchmoneyCategoryMultiple(
65+
LunchmoneyCategory(
6666
id = 444443,
6767
name = "Авто",
6868
description = null,
@@ -74,7 +74,7 @@ object TestData {
7474
isGroup = false,
7575
groupId = null,
7676
),
77-
LunchmoneyCategoryMultiple(
77+
LunchmoneyCategory(
7878
id = 444444,
7979
name = "Перекази",
8080
description = null,
@@ -86,7 +86,7 @@ object TestData {
8686
isGroup = false,
8787
groupId = null,
8888
),
89-
LunchmoneyCategoryMultiple(
89+
LunchmoneyCategory(
9090
id = 444445,
9191
name = "Розваги",
9292
description = null,
@@ -98,7 +98,7 @@ object TestData {
9898
isGroup = false,
9999
groupId = null,
100100
),
101-
LunchmoneyCategoryMultiple(
101+
LunchmoneyCategory(
102102
id = 444446,
103103
name = "Транспорт",
104104
description = null,

src/test/kotlin/io/github/smaugfm/monobudget/integration/util/FailTrackerTransformation.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ class FailTrackerTransformation<T>(private val configs: List<IntegrationFailConf
1111

1212
override fun apply(mono: Mono<T>): Mono<T> =
1313
mono.takeIf { configs.all { !it.attemptFailRange.contains(attempt++) } }
14-
?: Mono.error(LunchmoneyApiResponseException(HttpStatusCode.BadRequest.value))
14+
?: Mono.error(LunchmoneyApiResponseException(HttpStatusCode.BadRequest.description))
1515
}

src/test/kotlin/io/github/smaugfm/monobudget/integration/util/IntegrationTestBase.kt

+29-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package io.github.smaugfm.monobudget.integration.util
22

33
import io.github.oshai.kotlinlogging.KotlinLogging
44
import io.github.smaugfm.lunchmoney.api.LunchmoneyApi
5-
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategoryMultiple
5+
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategory
66
import io.github.smaugfm.lunchmoney.model.LunchmoneyInsertTransaction
77
import io.github.smaugfm.lunchmoney.model.LunchmoneyTransaction
88
import io.github.smaugfm.lunchmoney.response.LunchmoneyUpdateTransactionResponse
@@ -35,6 +35,8 @@ import kotlinx.coroutines.cancel
3535
import kotlinx.coroutines.flow.MutableSharedFlow
3636
import kotlinx.coroutines.launch
3737
import kotlinx.coroutines.runBlocking
38+
import kotlinx.datetime.Clock
39+
import kotlinx.datetime.toJavaInstant
3840
import org.junit.jupiter.api.assertThrows
3941
import org.koin.core.KoinApplication
4042
import org.koin.dsl.bind
@@ -65,7 +67,7 @@ abstract class IntegrationTestBase : TestBase(), CoroutineScope {
6567

6668
@MockK
6769
lateinit var categoriesFetcherMock:
68-
PeriodicFetcherFactory.PeriodicFetcher<List<LunchmoneyCategoryMultiple>>
70+
PeriodicFetcherFactory.PeriodicFetcher<List<LunchmoneyCategory>>
6971

7072
@MockK
7173
lateinit var budgetSettingsVerifier: BudgetSettingsVerifier
@@ -81,7 +83,7 @@ abstract class IntegrationTestBase : TestBase(), CoroutineScope {
8183
every { lunchmoneyMock.getBudgetSummary(any(), any(), any()) } returns Mono.just(listOf())
8284
excludeRecords { lunchmoneyMock.getBudgetSummary(any(), any(), any()) }
8385
every {
84-
periodicFetcherFactory.create<List<LunchmoneyCategoryMultiple>>(
86+
periodicFetcherFactory.create<List<LunchmoneyCategory>>(
8587
"Lunchmoney categories",
8688
any(),
8789
)
@@ -157,6 +159,14 @@ abstract class IntegrationTestBase : TestBase(), CoroutineScope {
157159
notes = insertTransaction?.notes,
158160
categoryId = insertTransaction?.categoryId,
159161
status = insertTransaction!!.status!!,
162+
accountDisplayName = "",
163+
createdAt = Clock.System.now().toJavaInstant(),
164+
updatedAt = Clock.System.now().toJavaInstant(),
165+
displayName = "",
166+
excludeFromTotals = false,
167+
excludeFromBudget = false,
168+
isIncome = false,
169+
isPending = false,
160170
),
161171
).transformDeferred(singleTransform)
162172
}
@@ -173,6 +183,14 @@ abstract class IntegrationTestBase : TestBase(), CoroutineScope {
173183
notes = insertTransaction2?.notes,
174184
categoryId = insertTransaction2?.categoryId,
175185
status = insertTransaction2!!.status!!,
186+
accountDisplayName = "",
187+
createdAt = Clock.System.now().toJavaInstant(),
188+
updatedAt = Clock.System.now().toJavaInstant(),
189+
displayName = "",
190+
excludeFromTotals = false,
191+
excludeFromBudget = false,
192+
isIncome = false,
193+
isPending = false,
176194
),
177195
).transformDeferred(singleTransform)
178196
}
@@ -243,6 +261,14 @@ abstract class IntegrationTestBase : TestBase(), CoroutineScope {
243261
notes = insertTransaction?.notes,
244262
categoryId = insertTransaction?.categoryId,
245263
status = insertTransaction!!.status!!,
264+
accountDisplayName = "",
265+
createdAt = Clock.System.now().toJavaInstant(),
266+
updatedAt = Clock.System.now().toJavaInstant(),
267+
displayName = "",
268+
excludeFromTotals = false,
269+
excludeFromBudget = false,
270+
isIncome = false,
271+
isPending = false,
246272
),
247273
).transformDeferred(singleTracker)
248274
}

src/test/kotlin/io/github/smaugfm/monobudget/lunchmoney/LunchmoneyTransactionCreatorTest.kt

+10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import io.mockk.coEvery
2020
import io.mockk.every
2121
import io.mockk.mockkClass
2222
import kotlinx.coroutines.runBlocking
23+
import kotlinx.datetime.Clock
24+
import kotlinx.datetime.toJavaInstant
2325
import org.junit.jupiter.api.BeforeEach
2426
import org.junit.jupiter.api.Test
2527
import org.koin.core.KoinApplication
@@ -58,6 +60,14 @@ class LunchmoneyTransactionCreatorTest : TestBase() {
5860
1.0,
5961
isGroup = false,
6062
status = LunchmoneyTransactionStatus.CLEARED,
63+
accountDisplayName = "",
64+
createdAt = Clock.System.now().toJavaInstant(),
65+
updatedAt = Clock.System.now().toJavaInstant(),
66+
displayName = "",
67+
excludeFromTotals = false,
68+
excludeFromBudget = false,
69+
isIncome = false,
70+
isPending = false,
6171
)
6272
private val insertTransaction =
6373
LunchmoneyInsertTransaction(

0 commit comments

Comments
 (0)