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件表示
  • 購入者
    非公開
    投稿日
    以前は楽天で購入していましたが、最近はマリリ本店で購入しています。 質の高いマヌカがお得に購入出来てとても助かります。 UMF+15をずっと食べていますが、お陰で風邪をひきにくくなりました。 ありがとうございます。
1件中 1-1件表示