| 12345678910111213141516171819202122232425 |
- 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)
- case payment.TypeAirwallex:
- return NewAirwallex(instanceID, config)
- default:
- return nil, fmt.Errorf("unknown provider key: %s", providerKey)
- }
- }
|