File tree Expand file tree Collapse file tree
apps/commerce-api/src/main/java/com/loopers/application/order Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,17 +59,12 @@ public OrderInfo placeOrder(OrderPlaceCommand command) {
5959 Long couponId = command .couponId ();
6060
6161 if (couponId != null ) {
62- try {
63- Coupon coupon = couponService .getCouponWithOptimisticLock (couponId );
64- couponService .validateCouponUsable (coupon , user );
65-
66- discountAmount = coupon .calculateDiscount (totalAmount );
67- coupon .use ();
68- couponService .save (coupon );
69- } catch (ObjectOptimisticLockingFailureException e ) {
70- throw new CoreException (ErrorType .CONFLICT ,
71- "쿠폰이 이미 사용 중입니다. 잠시 후 다시 시도해주세요." );
72- }
62+ Coupon coupon = couponService .getCouponWithOptimisticLock (couponId );
63+ couponService .validateCouponUsable (coupon , user );
64+
65+ discountAmount = coupon .calculateDiscount (totalAmount );
66+ coupon .use ();
67+ couponService .save (coupon );
7368 }
7469 long finalAmount = totalAmount - discountAmount ;
7570 pointService .usePointWithLock (user .getUserIdValue (), finalAmount );
You can’t perform that action at this time.
0 commit comments