mirror of
https://github.com/Nezumi-2711/spring-boot-ecommerce.git
synced 2026-09-22 13:48:34 +00:00
26 lines
760 B
Java
26 lines
760 B
Java
package com.luv2code.ecommerce.controller;
|
|
|
|
import com.luv2code.ecommerce.dto.Purchase;
|
|
import com.luv2code.ecommerce.dto.PurchaseResponse;
|
|
import com.luv2code.ecommerce.service.CheckoutService;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
@CrossOrigin("http://localhost:4200")
|
|
@RestController
|
|
@RequestMapping("/api/checkout")
|
|
public class CheckoutController {
|
|
|
|
private CheckoutService checkoutService;
|
|
|
|
public CheckoutController(CheckoutService checkoutService){
|
|
this.checkoutService = checkoutService;
|
|
}
|
|
|
|
@PostMapping("/purchase")
|
|
public PurchaseResponse placeOrder(@RequestBody Purchase purchase) {
|
|
PurchaseResponse purchaseResponse = checkoutService.placeOrder(purchase);
|
|
|
|
return purchaseResponse;
|
|
}
|
|
}
|