Form Submission from Checkout for Responsys
We are currently trying to use a form within checkout to pass the email address and Opt-in/Out using:
MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>()
- form.add("EMAIL_ADDRESS_", emailAddress)
- form.add("EMAIL_ORIG_SOURCE", "WEB SIGNUP FORM")
- form.add("EMAIL_PERMISSION_STATUS_", isOptIn ? "Y" : "N")
- form.add("_ri_", "X0Gzc2X%3DYQpglLjHJlYQGgtsPsycBISClkdDvv44Iyze6wwwoMDnzbjGGVwjpnpgHlpgneHmgJoXX0Gzc2X%3DYQpglLjHJlYQGNg2HzbBXEOqHjPmczbzfoCYK76wwwoMDnzbjGG")
RestBuilder restBuilder = RestBuilderUtil.assembleDefaultRestBuilder()
try {
def response = restBuilder.post("https://shop.haband.com/pub/rf") {
accept("application/json")
contentType("multipart/form-data")
body(form)
}
if (response.statusCode.is2xxSuccessful()) {
return
}
log.error("Failed to opt in or out of email for ${emailAddress}")