shopify hmac test verify

master
Yixian 3 years ago
parent e4a1d63967
commit 008fa6a60b

@ -9,6 +9,7 @@ import au.com.royalpay.payment.manage.shopify.store.domain.entity.ShopifyStore;
import au.com.royalpay.payment.manage.shopify.store.domain.service.ShopifyStoreService;
import au.com.royalpay.payment.manage.shopify.support.ShopifyEndpoint;
import au.com.royalpay.payment.manage.shopify.support.ShopifyHttpUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -75,7 +76,7 @@ public class ShopifyWebhooksController {
throw new ShopifyRequestVerifyException("Unauthorized");
}
ShopifyShopRedactCommand shopifyShopRedactCommand = JSONObject.parseObject(requestBody, ShopifyShopRedactCommand.class);
ShopifyShopRedactCommand shopifyShopRedactCommand = JSON.parseObject(requestBody, ShopifyShopRedactCommand.class);
ShopifyStore shopifyShop = shopifyStoreService.getByShopifyShop(shopifyShopRedactCommand.getShop_domain());
if (shopifyShop == null) {
return;

@ -62,7 +62,7 @@ public class HmacVerificationUtil {
}
private static boolean isHex(String str) {
return str != null && str.toUpperCase(Locale.ROOT).matches("^[0-9A-F]$");
return str != null && str.toUpperCase(Locale.ROOT).matches("^[0-9A-F]+$");
}
private static byte[] hmac(String input, String key, HmacAlgorithms algorithm) {

Loading…
Cancel
Save