Skip to content

Commit

Permalink
FEAT:setup API generate QR
Browse files Browse the repository at this point in the history
  • Loading branch information
rivopelu committed Dec 2, 2024
1 parent d35ffbe commit 8f19cf7
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/pos/app/controller/OrderController.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ public interface OrderController {
BaseResponse completeOrder(@PathVariable("id") String id);

@GetMapping("v1/order-list/live")
BaseResponse getLiveOrderList(@RequestParam(name = "status" ) OrderStatusEnum status);
BaseResponse getLiveOrderList(@RequestParam(name = "status") OrderStatusEnum status);

@GetMapping("v1/generate-qr-order")
BaseResponse generateQROrder();

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ public BaseResponse completeOrder(String id) {
public BaseResponse getLiveOrderList(OrderStatusEnum status) {
return ResponseHelper.createBaseResponse(orderService.getLiveOrderList(status));
}

@Override
public BaseResponse generateQROrder() {
return ResponseHelper.createBaseResponse(orderService.generateQROrder());
}
}
19 changes: 19 additions & 0 deletions src/main/java/com/pos/app/model/response/ResponseIdQr.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.pos.app.model.response;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonSerialize
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class ResponseIdQr {
private String id;
}
4 changes: 4 additions & 0 deletions src/main/java/com/pos/app/service/OrderService.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.pos.app.enums.ResponseEnum;
import com.pos.app.model.request.ReqCreateOrder;
import com.pos.app.model.response.ResListOrder;
import com.pos.app.model.response.ResponseIdQr;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

Expand All @@ -21,4 +22,7 @@ public interface OrderService {
ResponseEnum completeOrder(String id);

List<ResListOrder> getLiveOrderList(OrderStatusEnum status);


ResponseIdQr generateQROrder();
}
10 changes: 10 additions & 0 deletions src/main/java/com/pos/app/service/impl/OrderServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.pos.app.exception.SystemErrorException;
import com.pos.app.model.request.ReqCreateOrder;
import com.pos.app.model.response.ResListOrder;
import com.pos.app.model.response.ResponseIdQr;
import com.pos.app.repositories.OrderProductRepository;
import com.pos.app.repositories.OrderRepository;
import com.pos.app.repositories.ProductRepository;
Expand Down Expand Up @@ -195,6 +196,15 @@ public List<ResListOrder> getLiveOrderList(OrderStatusEnum status) {
}
}

@Override
public ResponseIdQr generateQROrder() {
try {
return null;
} catch (Exception e) {
throw new RuntimeException(e);
}
}

private BigInteger getListTotalTransaction(String orderId) {
List<Transaction> transactionList = transactionRepository.findAllByOrderId(orderId);
BigInteger totalTransaction = BigInteger.ZERO;
Expand Down

0 comments on commit 8f19cf7

Please sign in to comment.