parent
6d9986d044
commit
2362015ae1
@ -0,0 +1,25 @@
|
|||||||
|
package au.com.royalpay.payment.manage.shopify.support;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
class HmacVerificationUtilTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void checkParameters() {
|
||||||
|
String message = "host=Z2Vlay10ZXN0LXNob3AubXlzaG9waWZ5LmNvbS9hZG1pbg&shop=geek-test-shop.myshopify.com×tamp=1648025715";
|
||||||
|
String key = "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";
|
||||||
|
String hmac = "803cd4924b19cedc5361ab09776d078a18be3ba32fd7d62de72269a12bec1ffc";
|
||||||
|
assert HmacVerificationUtil.hmacSHA256(message, key, hmac);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testQuery() {
|
||||||
|
String base = "host=Z2Vlay10ZXN0LXNob3AubXlzaG9waWZ5LmNvbS9hZG1pbg×tamp=1648025715&shop=geek-test-shop.myshopify.com";
|
||||||
|
String query = UriComponentsBuilder.fromUriString("/shopify/auth?hmac=803cd4924b19cedc5361ab09776d078a18be3ba32fd7d62de72269a12bec1ffc&host=Z2Vlay10ZXN0LXNob3AubXlzaG9waWZ5LmNvbS9hZG1pbg×tamp=1648025715&shop=geek-test-shop.myshopify.com")
|
||||||
|
.replaceQueryParam("hmac").build().getQuery();
|
||||||
|
assertEquals(base, query);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue