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

レビューを投稿していただくと100ポイントプレゼント

レビューを投稿していただくと、レビュー1件につき100ポイントをプレゼントいたします。

レビューの投稿方法

商品詳細ページの「レビューを書く」をクリックしてください。
ニックネームをご記入ください。
おすすめ度を5段階から選択していただき、本文に商品の感想やご要望をご記入ください。
よろしければプロフィールをご記入ください。
※レビュー投稿は、1商品につき1回ご記入いただけます。

5.00
1
1件中 1-1件表示
  • 購入者
    愛知県 70歳以上 男性
    投稿日
    カヌカハニーを購入しました。ハチミツは若いころから飲み物やヨーグルトに入れたほぼ毎日です。カヌカハニーは使っているハチミツより粘りもあり味が深い感じです。有難うございます。
1件中 1-1件表示