import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.*; @RestController public class CheckoutController { @GetMapping("/checkout") public Map checkout( @RequestParam String products, @RequestParam(required = false) String coupon) { // Parse products Map productQuantities = new HashMap<>(); for (String productEntry : products.split(",")) { String[] parts = productEntry.split(":"); productQuantities.put( parts[0], // Product ID Integer.parseInt(parts[1]) // Quantity ); } // Build result Map result = new HashMap<>(); result.put("products", productQuantities); result.put("coupon", coupon != null ? coupon : "No coupon applied"); return result; } }

SEARCH

AND MORE

PICK UP

HOT

2件中 1-2件表示

【マリリの月イチ!】12%OFF! マヌカハニー MG200以上 (MGS8+相当) 500g 1本 Rauhi(ラウヒ) マリリ モノフローラル 安心安全のNZ産 生 はちみつ 非加熱 無添加 【本店限定!会員パスポートでさらに最大12%OFF】

当店通常価格 ¥ 5,100
販売価格 ¥ 4,488 税込
会員様はさらに2%OFF! ¥ 4,398 税込
販売期間
在庫切れ
詳細を見る
2件中 1-2件表示