Skip to content

Commit

Permalink
changing metadata type for invoice uuid (#59)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Davis <[email protected]>
  • Loading branch information
matthappens and Matt Davis authored Sep 10, 2024
1 parent fb62a2f commit f04ed88
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion javatest/src/test/java/me/uma/javatest/UmaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class UmaTest {
UmaProtocolHelper umaProtocolHelper = new UmaProtocolHelper(new InMemoryPublicKeyCache(), new TestUmaRequester());
private static final String PUBKEY_HEX = "04419c5467ea563f0010fd614f85e885ac99c21b8e8d416241175fdd5efd2244fe907e2e6fa3dd6631b1b17cd28798da8d882a34c4776d44cc4090781c7aadea1b";
private static final String PRIVKEY_HEX = "77e891f0ecd265a3cda435eaa73792233ebd413aeb0dbb66f2940babfc9a2667";
private static final String encodedPayReqMetadata = "[[\"text/plain\",\"invoiceUUID\"],[\"text/plain\",\"otherInformations\"]]";
private static final String encodedPayReqMetadata = "[[\"text/uma-invoice\",\"invoiceUUID\"],[\"text/plain\",\"otherInformations\"]]";

private static final String CERT_CHAIN = "-----BEGIN CERTIFICATE-----\n" +
"MIIB1zCCAXygAwIBAgIUGN3ihBj1RnKoeTM/auDFnNoThR4wCgYIKoZIzj0EAwIw\n" +
Expand Down
2 changes: 1 addition & 1 deletion uma-sdk/src/commonMain/kotlin/me/uma/UmaProtocolHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ class UmaProtocolHelper @JvmOverloads constructor(
private fun addInvoiceUUIDtoMetadata(metadata: String, invoiceUUID: String): String {
return try {
val decodedMetadata = Json.decodeFromString<List<List<String>>>(metadata).toMutableList()
decodedMetadata.add(listOf("text/plain", invoiceUUID))
decodedMetadata.add(listOf("text/uma-invoice", invoiceUUID))
Json.encodeToString(decodedMetadata)
} catch (e: Exception) {
metadata
Expand Down
2 changes: 1 addition & 1 deletion uma-sdk/src/commonTest/kotlin/me/uma/UmaTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class UmaTests {
@Test
fun `test create invoice currency`() = runTest {
val data = listOf(
listOf("text/plain", "invoiceUUID"),
listOf("text/uma-invoice", "invoiceUUID"),
listOf("text/plain", "otherInformations"),
)
val encoded1 = Json.encodeToString(data)
Expand Down

0 comments on commit f04ed88

Please sign in to comment.