chore: update
This commit is contained in:
@@ -6,16 +6,15 @@ import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.util.UUID;
|
||||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
|
||||
|
||||
@RegisterRestClient(configKey = "eatery")
|
||||
@RegisterRestClient(configKey = "account")
|
||||
@Path(Role.Manager)
|
||||
public interface ManagerController {
|
||||
@GET
|
||||
@Path(Role.Manager + "/{id}/payment-qr")
|
||||
@Path("/{id}/payment-qr")
|
||||
public Response getManagerPaymentQr(
|
||||
@PathParam("id") UUID id,
|
||||
@PathParam("id") String id,
|
||||
@QueryParam("amount") Long amount,
|
||||
@QueryParam("cartId") String cartId
|
||||
);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class CartService {
|
||||
|
||||
@Inject
|
||||
public CartService(RedisDataSource ds) {
|
||||
this.hashCommands = ds.hash(String.class);
|
||||
this.hashCommands = ds.hash(String.class, String.class, String.class);
|
||||
this.valueCommands = ds.value(String.class);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class CartService {
|
||||
|
||||
String cartId = UUID.randomUUID().toString();
|
||||
String redisKey = "cart:" + cartId;
|
||||
String ownerId = response.getEntity().toString();
|
||||
String ownerId = response.readEntity(String.class);
|
||||
|
||||
hashCommands.hset(
|
||||
redisKey,
|
||||
@@ -100,7 +100,6 @@ public class CartService {
|
||||
|
||||
Map<String, String> data = hashCommands.hgetall(key);
|
||||
Map<String, String> itemPrices = hashCommands.hgetall(priceKey);
|
||||
String managerId = hashCommands.hget(key, "_metadata_eateryManagerId");
|
||||
|
||||
if (data.isEmpty()) {
|
||||
throw new GraphQLException("NotFoundCart");
|
||||
@@ -110,6 +109,7 @@ public class CartService {
|
||||
cart.Id = cartId;
|
||||
cart.eateryId = UUID.fromString(data.get("_metadata_eatery"));
|
||||
String ownerStr = data.get("_metadata_owner");
|
||||
String managerId = data.get("_metadata_eateryManagerId");
|
||||
cart.userId = "GUEST".equals(ownerStr) ? null : UUID.fromString(ownerStr);
|
||||
cart.items = new ArrayList<>();
|
||||
|
||||
@@ -136,7 +136,7 @@ public class CartService {
|
||||
|
||||
try {
|
||||
Response response = managerController.getManagerPaymentQr(
|
||||
UUID.fromString(managerId),
|
||||
managerId,
|
||||
total,
|
||||
cartId.toString()
|
||||
);
|
||||
@@ -144,6 +144,8 @@ public class CartService {
|
||||
cart.paymentQrUrl = response.readEntity(String.class);
|
||||
} catch (Exception e) {
|
||||
cart.paymentQrUrl = "";
|
||||
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
return cart;
|
||||
|
||||
Reference in New Issue
Block a user