Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyav committed Mar 20, 2024
1 parent bf824be commit 88ec984
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions javatest/src/test/java/me/uma/javatest/UmaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,72 @@ public void testGetLnurlpResponse_umaV0() throws Exception {
new InMemoryNonceCache(1L)));
}

@Test
public void testGetPayRequest_umaV1() throws Exception {
PayRequest request = umaProtocolHelper.getPayRequest(
publicKeyBytes(),
privateKeyBytes(),
"USD",
100L,
true,
"[email protected]",
KycStatus.VERIFIED,
"",
null,
null,
null,
"payerName",
"payerEmail",
null,
null,
"comment",
"1.0"
);
assertNotNull(request);
System.out.println(request);
assertTrue(request instanceof PayRequestV1);
assertTrue(umaProtocolHelper.verifyPayReqSignature(
request, new PubKeyResponse(publicKeyBytes(), publicKeyBytes()),
new InMemoryNonceCache(1L)));
String requestJson = request.toJson();
PayRequest parsedRequest = umaProtocolHelper.parseAsPayRequest(requestJson);
assertNotNull(parsedRequest);
assertEquals(request, parsedRequest);
}

@Test
public void testGetPayRequest_umaV0() throws Exception {
PayRequest request = umaProtocolHelper.getPayRequest(
publicKeyBytes(),
privateKeyBytes(),
"USD",
100L,
true,
"[email protected]",
KycStatus.VERIFIED,
"",
null,
null,
null,
"payerName",
"payerEmail",
null,
null,
"comment",
"0.3"
);
assertNotNull(request);
System.out.println(request);
assertTrue(request instanceof PayRequestV0);
assertTrue(umaProtocolHelper.verifyPayReqSignature(
request, new PubKeyResponse(publicKeyBytes(), publicKeyBytes()),
new InMemoryNonceCache(1L)));
String requestJson = request.toJson();
PayRequest parsedRequest = umaProtocolHelper.parseAsPayRequest(requestJson);
assertNotNull(parsedRequest);
assertEquals(request, parsedRequest);
}

@Test
public void testGetPayReqResponseSync_umaV1() throws Exception {
PayRequest request = umaProtocolHelper.getPayRequest(
Expand Down

0 comments on commit 88ec984

Please sign in to comment.