Backend: - Split payment_order.go (546→314 lines) into payment_order_lifecycle.go - Replace magic strings with constants in factory, easypay, webhook handler - Add rate limit/validity unit constants in payment_order_lifecycle, payment_service - Fix critical regression: add PaymentEnabled to GetPublicSettings response - Add missing migration 099_fix_migrated_purchase_menu_label_icon.sql Frontend: - Fix StripePopupView.vue: replace `as any` with typed interface, use extractApiErrorMessage - Fix AdminOrderTable.vue: replace hardcoded column labels with i18n t() calls - Fix SubscriptionsView.vue: replace hardcoded Today/Tomorrow with i18n - Extract duplicate statusBadgeClass/canRefund/formatOrderDateTime to orderUtils.ts - Add missing i18n keys: common.today, common.tomorrow, payment.orders.orderType/actions - Remove dead PurchaseSubscriptionView.vue (replaced by PaymentView)
24 lines
654 B
Go
24 lines
654 B
Go
package provider
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/Wei-Shaw/sub2api/internal/payment"
|
|
)
|
|
|
|
// CreateProvider creates a Provider from a provider key, instance ID and decrypted config.
|
|
func CreateProvider(providerKey string, instanceID string, config map[string]string) (payment.Provider, error) {
|
|
switch providerKey {
|
|
case payment.TypeEasyPay:
|
|
return NewEasyPay(instanceID, config)
|
|
case payment.TypeAlipay:
|
|
return NewAlipay(instanceID, config)
|
|
case payment.TypeWxpay:
|
|
return NewWxpay(instanceID, config)
|
|
case payment.TypeStripe:
|
|
return NewStripe(instanceID, config)
|
|
default:
|
|
return nil, fmt.Errorf("unknown provider key: %s", providerKey)
|
|
}
|
|
}
|