-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSyncConfig.kt
58 lines (54 loc) · 2.13 KB
/
SyncConfig.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package dev.ja.sync.model
import dev.ja.bhb.model.AccountId
import dev.ja.model.Currency
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import net.mamoe.yamlkt.Yaml
import java.nio.file.Files
import java.nio.file.Path
@Serializable
data class SyncConfig(
@SerialName("bhb_api_client")
val bhbApiClient: String,
@SerialName("bhb_api_secret")
val bhbApiSecret: String,
@SerialName("bhb_api_key")
val bhbApiKey: String,
@SerialName("bhb_accounts")
val bhbAccountToWiseCurrency: Map<AccountId, Currency>,
@SerialName("bhb_fee_id")
val bhbFeePostingId: Int? = null,
@SerialName("wise_api_key")
val wiseApiKey: String,
/**
* Private key to support secure SCA operations with the Wise.com API.
* Balances are secured and require signed data in the request.
* The matching public key must have been uploaded to Wise.com to make this work.
*/
@SerialName("wise_private_key")
val wisePrivateKey: String,
@SerialName("read_only")
val readOnly: Boolean? = false,
// labels
@SerialName("label_unknown_sender")
val unknownSender: String = "Unbekannt",
@SerialName("label_wise_sender")
val wiseSenderLabel: String = "Wise",
@SerialName("label_wise_fee")
val wiseFeeLabel: String = "Wise Gebühren",
@SerialName("label_wise_fee_conversion")
val wiseFeeLabelConversion: String = "Wise Gebühren Währungstausch",
@SerialName("label_wise_cashback")
val wiseCashbackLabel: String = "Wise Cashback",
@SerialName("label_wise_conversion")
val wiseConversionLabel: String = "Wise \$from - \$to",
) {
fun wiseConversionLabel(sourceCurrency: Currency, targetCurrency: Currency): String {
return this.wiseConversionLabel.replace("\$from", sourceCurrency.id).replace("\$to", targetCurrency.id)
}
companion object {
fun loadFromYaml(filePath: Path): SyncConfig {
return Yaml.decodeFromString(serializer(), Files.readString(filePath))
}
}
}