File tree Expand file tree Collapse file tree
apps/commerce-api/src/main/java/com/loopers/domain/point Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,16 +44,16 @@ public PointBalance charge(Long amount) {
4444 if (amount == null || amount <= 0 ) {
4545 throw new CoreException (ErrorType .BAD_REQUEST , "충전 금액은 0보다 커야 합니다." );
4646 }
47+ if (this .value > Long .MAX_VALUE - amount ) {
48+ throw new CoreException (ErrorType .BAD_REQUEST , "충전 가능한 최대 금액을 초과했습니다." );
49+ }
4750 return new PointBalance (this .value + amount );
4851 }
4952
5053 public PointBalance use (Long amount ) {
5154 if (amount == null || amount <= 0 ) {
5255 throw new CoreException (ErrorType .BAD_REQUEST , "사용 금액은 0보다 커야 합니다." );
5356 }
54- if (this .value > Long .MAX_VALUE - amount ) {
55- throw new CoreException (ErrorType .BAD_REQUEST , "충전 가능한 최대 금액을 초과했습니다." );
56- }
5757 if (this .value < amount ) {
5858 throw new CoreException (ErrorType .BAD_REQUEST , "보유 포인트가 부족합니다." );
5959 }
You can’t perform that action at this time.
0 commit comments