* feat(billing): route Stripe returns to declared app
Signed-off-by: aimeritething <aimeritething@gmail.com>
* fix(billing): persist Stripe callback app
Signed-off-by: aimeritething <aimeritething@gmail.com>
* fix(billing): address review feedback for Stripe payApp routing
- Fix golangci-lint issues: use NewRequestWithContext and
http.MethodPost in tests, drop a trailing blank line
- Normalize array-valued app query params in the desktop
Stripe callback resolver and cover it with a test
- Simplify pendingTransactionPromotionCode with strings.SplitN
- Rename the parser test to reflect it only verifies JSON binding
- Refresh the stale callback URL example comment in buildURLs
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: aimeritething <aimeritething@gmail.com>
* docs(pay): use placeholder values in callback URL example
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: aimeritething <aimeritething@gmail.com>
---------
Signed-off-by: aimeritething <aimeritething@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(account): recover debt status after balance normalization
* fix(account): retry debt refresh when user lock is busy
* fix(account): verify workspace subscriptions during debt recovery
* feat(devbox): add dual Prisma schemas for cockroach and postgresql
- split schema/migrations into prisma/cockroach and prisma/postgresql
- route runtime client and deploy migration by DATABASE_PROVIDER
- add postgres migration compatibility for Kingbase UUID generation
- remove default prisma entrypoint and document explicit commands
* fix(devbox): package prisma migrations in runtime image
Copy CockroachDB and PostgreSQL migration directories into the runtime image so initContainer migrate deploy can find migration files for both providers.
Add frontend/.dockerignore to reduce Docker build context size.
* fix(frontend): copy devbox prisma provider migrations
Co-authored-by: Alex Lee <3076438032@qq.com>
- Replace manifest-based deployment with Helm chart structure
- Add Helm chart with standard templates (deployment, service, configmap)
- Create account-service-entrypoint.sh for Helm installation
- Update Kubefile to use Helm chart instead of manifests
- Simplify deployment by reusing account-controller-manager service account
- Remove unnecessary components (no webhook, RBAC, metrics, certificates)
- Use compatible selector labels for seamless migration from manifests
- Add comprehensive README.md with configuration examples and troubleshooting guide
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* feat: service build on docker and arm runner
* fix: build context
* fix: go mod downlaod cache
* fix: go build main pachage
* fix: hubble build main package
* fix: remote jsoniter tag
* fix: configure ReadHeaderTimeout for minio http server (#129)
---------
Co-authored-by: xzy <nowinkey@tom.com>
This commit resolves the issue where multiple regions simultaneously process
the same invoice.created event, causing Stripe API errors:
"This invoice is already finalized, you can't re-finalize a non-draft invoice."
Changes:
1. Add region check in handleWorkspaceSubscriptionInvoiceCreated
- Only process events belonging to the current region
- Skip events from other regions with appropriate logging
- Use existing checkIsLocalEvent function for consistency
2. Add fault tolerance in ConfirmInvoice for FinalizeInvoice
- Detect "already finalized" errors gracefully
- Re-fetch invoice status when finalized by another region
- Continue processing instead of failing
Impact:
- Eliminates race conditions in multi-region deployments
- Ensures only one region processes each invoice.created event
- Provides graceful fallback for edge cases
- Maintains backward compatibility with idempotent behavior
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* fix the issue of inconsistent subscription periods
* fix the unhandled situation of the namespace controller
* fix the expiration time of the initial subscription
* Return the invoice order address after the due date if the payment is not made
* add handleWorkspaceSubscriptionInvoiceCreated
* support resubscription in an outstanding status
* optimize the return of unpaid invoice data
* Fixed the issue where the status of the last subscription might be synchronized for new subscriptions
Check namespace annotation 'subscription.sealos.io/status' to identify subscription users. Only query and return traffic/ai_quota data for subscription users, reducing unnecessary database queries for non-subscription workspaces.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* feat: add workspace subscription card management APIs
- Add CreateWorkspaceSubscriptionCardManagePortal for creating Stripe portal sessions
- Add GetWorkspaceSubscriptionCardInfo for retrieving payment method details
- Add new request structs and route definitions
- Update constants for new API endpoints
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: implement subscription-specific card management portal
- Add CreateSubscriptionPortalSession method in Stripe service
- Modify CreateWorkspaceSubscriptionCardManagePortal to use workspace-specific subscription
- Use flow_data to restrict portal to payment method updates only
- This ensures users only see the current workspace's subscription in the portal
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: implement subscription upgrade billing cycle reset and discount code support
## Key Changes
### 1. New Billing Logic for Upgrades
- Changed from prorated remaining value to current plan remaining value calculation
- Formula: Upgrade Fee = New Plan Full Price - Current Plan Remaining Value
- Ensures fair pricing based on unused portion of current plan
### 2. Billing Cycle Reset for Upgrades
- Upgrade payments now start a new billing cycle from the upgrade date
- Next payment date resets to the same day next month
- Modified finalizeWorkspaceSubscriptionSuccess to handle upgrade cycle reset
### 3. Discount Code Integration
- Added DiscountCode field to WorkspaceSubscriptionOperatorReq
- Created CreateWorkspaceSubscriptionSessionWithDiscount method for payment sessions
- Enhanced UpdatePlanPricePreviewWithDiscount for accurate discount preview
- Discount information stored in transaction.StatusDesc
### 4. API Response Enhancement
- Upgrade amount API returns detailed discount information
- Supports amount preview with and without discount codes
- Frontend can display discount comparison and validation
### 5. Stripe SDK Integration
- Used InvoiceCreatePreviewParams.Discounts for discount preview
- Used CheckoutSessionParams.Discounts for payment discount
- Proper BillingCycleAnchor configuration for upgrade cycles
## Technical Implementation
- Maintains backward compatibility for existing operations
- Discount codes only apply to upgrade operations
- Consistent billing cycle logic across preview and payment
- No database schema changes required
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: enhance subscription upgrade package management with proper expiration
- Add upgrade-aware traffic and AI quota package management
- Implement proper expiration of old packages during upgrades
- Add AddTrafficPackageWithUpgrade and AddWorkspaceSubscriptionAIQuotaPackageWithUpgrade functions
- Fix stripe subscription cancellation and upgrade logic
- Maintain backward compatibility with existing package functions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* add redirect url & create subscription setup intent
* support get create subscription amount with discount code.
* convert the discount code to the promotion code
* support cancel workspace subscription invoice
* support deleteImmediately
---------
Co-authored-by: Claude <noreply@anthropic.com>
* add user alert notification account
* debt supports multiple notification account
* feat: add UserAlertNotificationAccount CRUD interfaces with unified POST endpoints
- Implement user-level alert notification account management
- Add CREATE, LIST, DELETE operations using POST requests
- Remove GET and UPDATE operations as per requirements
- All endpoints use POST method with different route paths
- Delete operation is idempotent (succeeds even if record doesn't exist)
- Include proper authentication, validation, and error handling
- Add comprehensive API documentation with Swagger annotations
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: return 409 status for duplicate user alert notification accounts
- Add duplicate key error detection in CreateUserAlertNotificationAccount
- Return HTTP 409 Conflict instead of 500 for duplicate entries
- Add isDuplicatedKeyError helper function to handle various DB error messages
- Import necessary packages (errors, strings, gorm)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: migrate PaymentRefund table to support multiple refunds per order
- Add OrderID field to PaymentRefund struct for business logic
- Add RowID UUID primary key for CockroachDB compatibility
- Migrate ID primary key to RowID using atomic transaction
- Copy existing ID values to OrderID field
- Remove primary key constraint from ID field
- Convert trade_no from UUID to TEXT type if needed
- Enable multiple partial refunds per payment order
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* ci fix
---------
Co-authored-by: Claude <noreply@anthropic.com>