1

我想使用 Spring WebFlux 向具有 PAReq 值的 ACS 服务器发出请求。我试过这个:

WebClient.Builder builder = WebClient.builder();
WebClient client = builder.build();
client.post().uri("https://securecode.lisa.mastercard.com/acspage/cap")
                .header("PaReq", "eJxdUdtu6jAQ/BXEB8R2uCRBiyUKB....")
                .accept(MediaType.TEXT_PLAIN)
                .contentType(MediaType.TEXT_PLAIN)
                .retrieve()
                .bodyToMono(String.class).block();

实现用户重定向的正确方法是什么?目前我正在使用服务器端 Java 代码发出请求?当他打开从 Spring 返回的链接时,我应该拨打电话并将有效负载返回给用户吗?

用户打开的 Spring 端点:

@PostMapping(value = "/redirect/to_acquirer/{token}", consumes = { MediaType.APPLICATION_XML_VALUE,
          MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_XML_VALUE,
              MediaType.APPLICATION_JSON_VALUE })
  public ModelAndView handleRedirectMessage(@PathVariable("token") String token,
          @RequestBody PaymentTransaction transaction, HttpServletRequest request) throws Exception {

        .......

        // TO DO add here POST with PAReq and redirect the user to the page.
        return new ModelAndView("redirect:" + url); 

}

4

0 回答 0