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);
}