Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
nuttawut25983 committed Mar 24, 2024
2 parents 10b2081 + 1e3edf6 commit ae41d85
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion infra/gitops/dev/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: kbazaar-api
image: ghcr.io/kbtg-kampus-classnest-se-java/workshop-group-2:3e197718264daad6ad77d8a2c4585c7a69ee96f5
image: ghcr.io/kbtg-kampus-classnest-se-java/workshop-group-2:bdf1b3108b1f2b27a2d8b2c59ce868e391a8cdc7
imagePullPolicy: Always
ports:
- containerPort: 8080
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kampus.kbazaar.promotion;
package com.kampus.kbazaar.cart;

import java.util.List;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.kampus.kbazaar.cart;

import com.kampus.kbazaar.promotion.ApplyCodeRequest;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down
12 changes: 10 additions & 2 deletions kbazaar/src/main/java/com/kampus/kbazaar/cart/CartService.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.kampus.kbazaar.exceptions.NotFoundException;
import com.kampus.kbazaar.product.Product;
import com.kampus.kbazaar.product.ProductRepository;
import com.kampus.kbazaar.promotion.ApplyCodeRequest;
import com.kampus.kbazaar.promotion.Promotion;
import com.kampus.kbazaar.promotion.PromotionRepository;
import com.kampus.kbazaar.shopper.Shopper;
Expand All @@ -14,11 +13,15 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class CartService {

@Value("${enabled.shipping.fee}")
private boolean enableShippingFee;

private final PromotionRepository promotionRepository;
private final ShopperRepository shopperRepository;

Expand Down Expand Up @@ -120,7 +123,12 @@ public CreateCartResponse createCart(String userName, CartRequest cartRequest) {
response.setItems(new ArrayList<>());
response.getItems().add(cartItem);
}
response.setFee(BigDecimal.valueOf(0));
if (enableShippingFee) {
response.setFee(BigDecimal.valueOf(25));
} else {
response.setFee(BigDecimal.valueOf(0));
}

response.setTotalPrice(totalPriceForReturn);
response.setTotalDiscount(totalDiscountForReturn);
}
Expand Down

0 comments on commit ae41d85

Please sign in to comment.