Skip to content

Commit

Permalink
rename variables uma version & max num payments (#60)
Browse files Browse the repository at this point in the history
# change uma invoice field names

umaVersion -> umaVersions

invoiceLimit -> maxNumPayments

ref: https://app.graphite.dev/github/pr/uma-universal-money-address/uma-python-sdk/62/Rename-fields-based-on-suggestions
  • Loading branch information
matthappens authored Sep 10, 2024
1 parent f04ed88 commit 141cfca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions uma-sdk/src/commonMain/kotlin/me/uma/UmaProtocolHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -941,10 +941,10 @@ class UmaProtocolHelper @JvmOverloads constructor(
receivingCurrency = receivingCurrency,
expiration = expiration,
isSubjectToTravelRule = isSubjectToTravelRule,
umaVersion = UMA_VERSION_STRING,
umaVersions = UMA_VERSION_STRING,
commentCharsAllowed = commentCharsAllowed,
senderUma = senderUma,
invoiceLimit = invoiceLimit,
maxNumPayments = invoiceLimit,
callback = callback,
kycStatus = kycStatus,
requiredPayerData = requiredPayerData,
Expand Down
12 changes: 6 additions & 6 deletions uma-sdk/src/commonMain/kotlin/me/uma/protocol/Invoice.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ data class Invoice(
/** UmaVersion is a list of UMA versions that the VASP supports for this transaction. It should be
* containing the lowest minor version of each major version it supported, separated by commas.
*/
val umaVersion: String,
val umaVersions: String,
/** CommentCharsAllowed is the number of characters that the sender can include in the comment field of the pay request. */
val commentCharsAllowed: Int? = null,
/** The sender's UMA address. If this field presents, the UMA invoice should directly go to the sending VASP instead of showing in other formats. */
val senderUma: String? = null,
/** The maximum number of the invoice can be paid */
val invoiceLimit: Int? = null,
val maxNumPayments: Int? = null,
/** YC status of the receiver, default is verified. */
val kycStatus: KycStatus? = null,
/** The callback url that the sender should send the PayRequest to. */
Expand All @@ -107,10 +107,10 @@ data class Invoice(
.putNumber(4, expiration)
.putBoolean(5, isSubjectToTravelRule)
.putByteCodeable(6, requiredPayerData?.let(::InvoiceCounterPartyDataOptions))
.putString(7, umaVersion)
.putString(7, umaVersions)
.putNumber(8, commentCharsAllowed)
.putString(9, senderUma)
.putNumber(10, invoiceLimit)
.putNumber(10, maxNumPayments)
.putByteCodeable(11, kycStatus?.let(::InvoiceKycStatus))
.putString(12, callback)
.putByteArray(100, signature)
Expand Down Expand Up @@ -244,10 +244,10 @@ class InvoiceBuilder {
expiration = expiration!!,
isSubjectToTravelRule = isSubjectToTravelRule!!,
requiredPayerData = requiredPayerData,
umaVersion = umaVersion!!,
umaVersions = umaVersion!!,
commentCharsAllowed = commentCharsAllowed,
senderUma = senderUma,
invoiceLimit = invoiceLimit,
maxNumPayments = invoiceLimit,
kycStatus = kycStatus,
callback = callback!!,
signature = signature,
Expand Down
10 changes: 5 additions & 5 deletions uma-sdk/src/commonTest/kotlin/me/uma/UmaTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class UmaTests {
assertEquals(1000, decodedInvoice.amount)
assertEquals(1000000L, decodedInvoice.expiration)
assertEquals(true, decodedInvoice.isSubjectToTravelRule)
assertEquals("0.3", decodedInvoice.umaVersion)
assertEquals("0.3", decodedInvoice.umaVersions)
assertEquals(KycStatus.VERIFIED, decodedInvoice.kycStatus)
assertEquals("https://example.com/callback", decodedInvoice.callback)
assertEquals(InvoiceCurrency("USD", "US Dollar", "$", 2), decodedInvoice.receivingCurrency)
Expand Down Expand Up @@ -292,8 +292,8 @@ class UmaTests {
requiredPayerData = requiredPayerData,
commentCharsAllowed = null,
senderUma = null,
invoiceLimit = null,
umaVersion = "0.3",
maxNumPayments = null,
umaVersions = "0.3",
kycStatus = KycStatus.VERIFIED,
callback = "https://example.com/callback",
signature = "signature".toByteArray(),
Expand All @@ -308,8 +308,8 @@ class UmaTests {
assertEquals(preEncodedInvoice.isSubjectToTravelRule, decodedInvoice.isSubjectToTravelRule)
assertEquals(preEncodedInvoice.commentCharsAllowed, decodedInvoice.commentCharsAllowed)
assertEquals(preEncodedInvoice.senderUma, decodedInvoice.senderUma)
assertEquals(preEncodedInvoice.invoiceLimit, decodedInvoice.invoiceLimit)
assertEquals(preEncodedInvoice.umaVersion, decodedInvoice.umaVersion)
assertEquals(preEncodedInvoice.maxNumPayments, decodedInvoice.maxNumPayments)
assertEquals(preEncodedInvoice.umaVersions, decodedInvoice.umaVersions)
assertEquals(preEncodedInvoice.kycStatus, decodedInvoice.kycStatus)
assertEquals(preEncodedInvoice.callback, decodedInvoice.callback)
assertEquals(preEncodedInvoice.requiredPayerData, decodedInvoice.requiredPayerData)
Expand Down

0 comments on commit 141cfca

Please sign in to comment.