fix: add payment features #52

Merged
TakahashiNguyen merged 13 commits from add-payment into main 2026-05-12 05:22:10 +00:00
5 changed files with 9 additions and 7 deletions
Showing only changes of commit 01d43bc622 - Show all commits
@@ -65,7 +65,6 @@ public class CustomerService extends BaseService<CustomerEntity> {
return Response.accepted() return Response.accepted()
.header(InternalValue.userId, customer.id.toString()) .header(InternalValue.userId, customer.id.toString())
.header(InternalValue.role, Role.Customer) .header(InternalValue.role, Role.Customer)
.entity(customer)
.build(); .build();
} }
@@ -68,7 +68,6 @@ public class ManagerService extends BaseService<ManagerEntity> {
return Response.accepted() return Response.accepted()
.header(InternalValue.userId, manager.id.toString()) .header(InternalValue.userId, manager.id.toString())
.header(InternalValue.role, Role.Manager) .header(InternalValue.role, Role.Manager)
.entity(manager)
.build(); .build();
} }
@@ -67,7 +67,6 @@ public class StaffService extends BaseService<StaffEntity> {
.header(InternalValue.userId, staff.id.toString()) .header(InternalValue.userId, staff.id.toString())
.header(InternalValue.managerId, staff.serve.id.toString()) .header(InternalValue.managerId, staff.serve.id.toString())
.header(InternalValue.role, Role.Staff) .header(InternalValue.role, Role.Staff)
.entity(staff)
.build(); .build();
} }
} }
@@ -15,7 +15,6 @@ import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
import java.time.Duration; import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.eclipse.microprofile.graphql.GraphQLApi; import org.eclipse.microprofile.graphql.GraphQLApi;
@@ -63,7 +62,7 @@ public class CartService {
String cartId = UUID.randomUUID().toString(); String cartId = UUID.randomUUID().toString();
String redisKey = "cart:" + cartId; String redisKey = "cart:" + cartId;
String ownerId = response.readEntity(String.class); String ownerId = response.getEntity().toString();
hashCommands.hset( hashCommands.hset(
redisKey, redisKey,
@@ -7,6 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import com.drinkool.controllers.EateryController; import com.drinkool.controllers.EateryController;
import com.drinkool.controllers.ManagerController;
import com.drinkool.dtos.Cart; import com.drinkool.dtos.Cart;
import io.quarkus.redis.datasource.RedisDataSource; import io.quarkus.redis.datasource.RedisDataSource;
import io.quarkus.redis.datasource.hash.HashCommands; import io.quarkus.redis.datasource.hash.HashCommands;
@@ -40,6 +41,11 @@ public class CartServiceTest {
@RestClient @RestClient
EateryController eateryController; EateryController eateryController;
@InjectMock
@RestClient
ManagerController managerController;
@Inject @Inject
RedisDataSource redisDataSource; RedisDataSource redisDataSource;
@@ -59,7 +65,7 @@ public class CartServiceTest {
UUID eateryId = UUID.randomUUID(); UUID eateryId = UUID.randomUUID();
when(eateryController.getEateryById(eateryId)).thenReturn( when(eateryController.getEateryById(eateryId)).thenReturn(
Uni.createFrom().item(Response.ok().build()) Uni.createFrom().item(Response.ok(UUID.randomUUID()).build())
); );
String cartId = cartService String cartId = cartService
@@ -129,7 +135,7 @@ public class CartServiceTest {
hashCommands.hset(key, "_metadata_owner", UUID.randomUUID().toString()); hashCommands.hset(key, "_metadata_owner", UUID.randomUUID().toString());
when(eateryController.checkMenuItemExists(eateryId, menuItemId)).thenReturn( when(eateryController.checkMenuItemExists(eateryId, menuItemId)).thenReturn(
Uni.createFrom().item(Response.ok().build()) Uni.createFrom().item(Response.ok(17.0).build())
); );
Cart result = cartService Cart result = cartService