|
|
@ -11,6 +11,7 @@ import au.com.royalpay.payment.manage.shopify.support.ShopifyHttpUtils;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@ -40,7 +41,7 @@ public class ShopifyWebhooksController {
|
|
|
|
throw new ShopifyRequestVerifyException("Unauthorized");
|
|
|
|
throw new ShopifyRequestVerifyException("Unauthorized");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ShopifyCustomerRequestCommand shopifyCustomerRequestCommand = JSONObject.parseObject(requestBody, ShopifyCustomerRequestCommand.class);
|
|
|
|
ShopifyCustomerRequestCommand shopifyCustomerRequestCommand = JSONObject.parseObject(requestBody, ShopifyCustomerRequestCommand.class);
|
|
|
|
response.setHeader("content-security-policy", "frame-ancestors https://" + shopifyCustomerRequestCommand.getShop_domain() + ".myshopify.com https://admin.shopify.com");
|
|
|
|
response.setHeader("Content-Security-Policy", "frame-ancestors https://" + shopifyCustomerRequestCommand.getShop_domain() + ".myshopify.com https://admin.shopify.com");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -48,15 +49,16 @@ public class ShopifyWebhooksController {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@PostMapping("/customer/erasure")
|
|
|
|
@PostMapping("/customer/erasure")
|
|
|
|
public void customerRedact(@RequestHeader("X-Shopify-Hmac-SHA256") String hmac,
|
|
|
|
public ResponseEntity<Void> customerRedact(@RequestHeader("X-Shopify-Hmac-SHA256") String hmac,
|
|
|
|
HttpServletRequest request,
|
|
|
|
HttpServletRequest request,
|
|
|
|
HttpServletResponse response) {
|
|
|
|
HttpServletResponse response) {
|
|
|
|
String requestBody = ShopifyHttpUtils.getRequestBody(request);
|
|
|
|
String requestBody = ShopifyHttpUtils.getRequestBody(request);
|
|
|
|
if (!shopifyRequestValidator.verify(requestBody, hmac)) {
|
|
|
|
if (!shopifyRequestValidator.verify(requestBody, hmac)) {
|
|
|
|
throw new ShopifyRequestVerifyException("Unauthorized");
|
|
|
|
throw new ShopifyRequestVerifyException("Unauthorized");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ShopifyCustomerRedactCommand shopifyCustomerRedactCommand = JSONObject.parseObject(requestBody, ShopifyCustomerRedactCommand.class);
|
|
|
|
ShopifyCustomerRedactCommand shopifyCustomerRedactCommand = JSONObject.parseObject(requestBody, ShopifyCustomerRedactCommand.class);
|
|
|
|
response.setHeader("content-security-policy", "frame-ancestors https://" + shopifyCustomerRedactCommand.getShop_domain() + ".myshopify.com https://admin.shopify.com");
|
|
|
|
return ResponseEntity.ok().header("Content-Security-Policy", "frame-ancestors https://" + shopifyCustomerRedactCommand.getShop_domain() + ".myshopify.com https://admin.shopify.com")
|
|
|
|
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -77,6 +79,6 @@ public class ShopifyWebhooksController {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
shopifyStoreService.modifyShopifyStore(shopifyShop.setStatus(0));
|
|
|
|
shopifyStoreService.modifyShopifyStore(shopifyShop.setStatus(0));
|
|
|
|
response.setHeader("content-security-policy", "frame-ancestors https://" + shopifyShopRedactCommand.getShop_domain() + ".myshopify.com https://admin.shopify.com");
|
|
|
|
response.setHeader("Content-Security-Policy", "frame-ancestors https://" + shopifyShopRedactCommand.getShop_domain() + ".myshopify.com https://admin.shopify.com");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|