Jhipster monolithic with angular : show a specific component from the backend

Viewed 32

I need some help. I'm trying to integrate a different payment API than you are used to.

It is CINETPAY. They have a payment method with redirection.

It works as follows: With the backend part (Spring boot), you send payment information (name, amount, currency to use, notification url, return url etc.) and CINETPAY replies with a payment link. After receiving this payment link, it is displayed to the user, who just has to click to go to the payment screen of CINET pay to make the payment. As a response to the payment, CINET pay sends a POST request to the return url provided. My application is a monolithic application with angular as frontend. Angular can't receive POST requests, so the return url I provided to CINET pay is a backend url (spring boot). The problem I have is how to display a specific component of Angular after receiving the POST request from the backend (spring-boot). Is it possible to display a specific component through spring boot? If you have solutions to propose, I'm interested. Sincerely.

You can find the documentation of CINET PAY here

1 Answers

I finally find a solution. So I'm going to answer my question, hoping that it'll someone else. My solution consists to use Spring Redirects.

All I had to was to make my POST method return a redirect. Here is an example from this article:

@Controller
@RequestMapping("/")
public class RedirectController {
    
    @GetMapping("/redirectWithRedirectPrefix")
    public ModelAndView redirectWithUsingRedirectPrefix(ModelMap model) {
        model.addAttribute("attribute", "redirectWithRedirectPrefix");
        return new ModelAndView("redirect:/redirectedUrl", model);
    }
}

You can even specify an absolute URL like this:

return new ModelAndView("redirect://localhost:9000/payment")

You can find details in this article.

Related