1
1
package io.stepuplabs.spaydkmp
2
2
3
3
import com.ionspin.kotlin.bignum.decimal.BigDecimal
4
+ import com.ionspin.kotlin.bignum.decimal.RoundingMode
4
5
import io.stepuplabs.spaydkmp.common.BankAccount
5
6
import io.stepuplabs.spaydkmp.common.BankAccountList
6
7
import io.stepuplabs.spaydkmp.common.Key
@@ -10,7 +11,6 @@ import io.stepuplabs.spaydkmp.common.Validator
10
11
import io.stepuplabs.spaydkmp.exception.*
11
12
import kotlinx.datetime.LocalDate
12
13
import kotlinx.datetime.format
13
- import net.thauvin.erik.urlencoder.UrlEncoderUtil
14
14
15
15
/*
16
16
Class that represents and generates SPAYD
@@ -20,7 +20,7 @@ class Spayd(
20
20
private vararg val parameters : Pair <Key , Any >?
21
21
) {
22
22
// Convenience constructor that accepts map of parameters
23
- constructor (parameters: Map <Key , Any >): this (
23
+ constructor (parameters: Map <Key , Any >) : this (
24
24
parameters = parameters.mapNotNull { it.key to it.value }.toTypedArray()
25
25
)
26
26
@@ -43,7 +43,7 @@ class Spayd(
43
43
constantSymbol: Long? = null ,
44
44
referenceForSender: String? = null ,
45
45
url: String? = null ,
46
- ): this (
46
+ ) : this (
47
47
parameters = arrayOf(
48
48
Key .BANK_ACCOUNT to bankAccount,
49
49
alternativeBankAccounts?.let { Key .ALTERNATIVE_BANK_ACCOUNTS to it },
@@ -133,7 +133,9 @@ class Spayd(
133
133
134
134
val valStr = when (parameter.type) {
135
135
LocalDate ::class -> (value as LocalDate ).format(LocalDate .Formats .ISO_BASIC )
136
- BigDecimal ::class -> (value as BigDecimal ).toStringExpanded()
136
+ BigDecimal ::class -> (value as BigDecimal )
137
+ .roundToDigitPositionAfterDecimalPoint(2 , RoundingMode .ROUND_HALF_CEILING )
138
+ .toStringExpanded()
137
139
else -> sanitize(" $value " )
138
140
}
139
141
0 commit comments