feat(settings): support per-channel WeChat OAuth and persist payment options
This commit is contained in:
@@ -519,13 +519,15 @@ func (s *PaymentService) getWeChatPaymentOAuthCredential(ctx context.Context) (s
|
||||
)
|
||||
}
|
||||
cfg, err := (&SettingService{settingRepo: s.configService.settingRepo}).GetWeChatConnectOAuthConfig(ctx)
|
||||
if err != nil || !cfg.SupportsMode("mp") || strings.TrimSpace(cfg.AppID) == "" || strings.TrimSpace(cfg.AppSecret) == "" {
|
||||
appID := strings.TrimSpace(cfg.AppIDForMode("mp"))
|
||||
appSecret := strings.TrimSpace(cfg.AppSecretForMode("mp"))
|
||||
if err != nil || !cfg.SupportsMode("mp") || appID == "" || appSecret == "" {
|
||||
return "", "", infraerrors.ServiceUnavailable(
|
||||
"WECHAT_PAYMENT_MP_NOT_CONFIGURED",
|
||||
"wechat in-app payment requires a complete WeChat MP OAuth credential",
|
||||
)
|
||||
}
|
||||
return strings.TrimSpace(cfg.AppID), strings.TrimSpace(cfg.AppSecret), nil
|
||||
return appID, appSecret, nil
|
||||
}
|
||||
|
||||
func classifyCreatePaymentError(req CreateOrderRequest, providerKey string, err error) error {
|
||||
|
||||
Reference in New Issue
Block a user