Skip to content

Instantly share code, notes, and snippets.

@NajeebArif
Created June 10, 2021 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NajeebArif/0a17d7e324a35362fe94ad830f5aa998 to your computer and use it in GitHub Desktop.
Save NajeebArif/0a17d7e324a35362fe94ad830f5aa998 to your computer and use it in GitHub Desktop.
//...
@GetMapping("/capture")
public String captureOrder(){
return "";
}
@PostMapping
public String placeOrder(@RequestParam Double amountId, HttpServletRequest request){
final URI returnUrl = buildReturnUrl(request);
return "";
}
private URI buildReturnUrl(HttpServletRequest request) {
try {
URI requestUri = URI.create(request.getRequestURL().toString());
return new URI(requestUri.getScheme(),
requestUri.getUserInfo(),
requestUri.getHost(),
requestUri.getPort(),
"/orders/capture",
null, null);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment