// Copyright 2026 MarketAlly. All rights reserved. // SPDX-License-Identifier: MIT package forms import ( "net/http" "code.gitcaddy.com/server/v3/modules/web/middleware" "code.gitcaddy.com/server/v3/services/context" "gitea.com/go-chi/binding" ) // MonetizeSettingsForm is the admin form for configuring payment providers. type MonetizeSettingsForm struct { StripeEnabled bool StripeSecretKey string `binding:"MaxSize(255)"` StripePublishableKey string `binding:"MaxSize(255)"` StripeWebhookSecret string `binding:"MaxSize(255)"` PayPalEnabled bool PayPalClientID string `binding:"MaxSize(255)"` PayPalClientSecret string `binding:"MaxSize(255)"` PayPalWebhookID string `binding:"MaxSize(255)"` PayPalSandbox bool } // Validate validates the fields func (f *MonetizeSettingsForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { ctx := context.GetValidateContext(req) return middleware.Validate(errs, ctx.Data, f, ctx.Locale) } // SubscriptionProductForm is the repo settings form for creating/editing products. type SubscriptionProductForm struct { Name string `binding:"Required;MaxSize(255)"` Type int `binding:"Required;Range(1,3)"` PriceCents int64 `binding:"Required;Min(1)"` Currency string `binding:"Required;MaxSize(3)"` IsActive bool } // Validate validates the fields func (f *SubscriptionProductForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { ctx := context.GetValidateContext(req) return middleware.Validate(errs, ctx.Data, f, ctx.Locale) }