Add list Paymenty method
This commit is contained in:
@@ -51,7 +51,7 @@ func (h *PaymentMethodHandler) CreatePaymentMethod(c *gin.Context) {
|
||||
|
||||
req.OrganizationID = contextInfo.OrganizationID
|
||||
req.OutletID = contextInfo.OutletID
|
||||
|
||||
|
||||
paymentMethodResponse := h.paymentMethodService.CreatePaymentMethod(ctx, contextInfo, &req)
|
||||
if paymentMethodResponse.HasErrors() {
|
||||
errorResp := paymentMethodResponse.GetErrors()[0]
|
||||
@@ -84,13 +84,13 @@ func (h *PaymentMethodHandler) GetPaymentMethod(c *gin.Context) {
|
||||
|
||||
func (h *PaymentMethodHandler) ListPaymentMethods(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
contextInfo := appcontext.FromGinContext(ctx)
|
||||
|
||||
req := &contract.ListPaymentMethodsRequest{
|
||||
Page: 1,
|
||||
Limit: 10,
|
||||
}
|
||||
|
||||
// Parse query parameters
|
||||
if pageStr := c.Query("page"); pageStr != "" {
|
||||
if page, err := strconv.Atoi(pageStr); err == nil {
|
||||
req.Page = page
|
||||
@@ -111,11 +111,7 @@ func (h *PaymentMethodHandler) ListPaymentMethods(c *gin.Context) {
|
||||
req.Type = &paymentMethodType
|
||||
}
|
||||
|
||||
if organizationIDStr := c.Query("organization_id"); organizationIDStr != "" {
|
||||
if organizationID, err := uuid.Parse(organizationIDStr); err == nil {
|
||||
req.OrganizationID = &organizationID
|
||||
}
|
||||
}
|
||||
req.OrganizationID = &contextInfo.OrganizationID
|
||||
|
||||
if isActiveStr := c.Query("is_active"); isActiveStr != "" {
|
||||
if isActive, err := strconv.ParseBool(isActiveStr); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user