移除行业凭证回调开关
This commit is contained in:
@@ -33,7 +33,6 @@ export function getKuaishouIndustryConfig(overrides: Partial<KuaishouIndustrySou
|
||||
sellerId: String(config.sellerId || '').trim(),
|
||||
lastRefreshedAt: String(config.lastRefreshedAt || '').trim(),
|
||||
lastRefreshError: String(config.lastRefreshError || '').trim(),
|
||||
sendCallbackEnabled: Boolean(config.sendCallbackEnabled),
|
||||
provider: String(config.provider || KUISHOU_INDUSTRY_PROVIDER).trim() || KUISHOU_INDUSTRY_PROVIDER,
|
||||
platform: String(config.platform || KUISHOU_INDUSTRY_PLATFORM).trim() || KUISHOU_INDUSTRY_PLATFORM,
|
||||
shopId: String(config.shopId || KUISHOU_INDUSTRY_PROVIDER).trim() || KUISHOU_INDUSTRY_PROVIDER,
|
||||
|
||||
@@ -35,8 +35,8 @@ type ConsumeCallbackInput = {
|
||||
export async function consumeCallback(input: ConsumeCallbackInput): Promise<{ success: boolean; response?: JsonObject; error?: string }> {
|
||||
let config = getKuaishouIndustryConfig()
|
||||
|
||||
if (!config.enabled || !config.sendCallbackEnabled) {
|
||||
logInfo('[kuaishou-industry/consume-callback]', '回调未启用,跳过')
|
||||
if (!config.enabled) {
|
||||
logInfo('[kuaishou-industry/consume-callback]', '行业电子凭证配置未启用,跳过核销回调')
|
||||
return { success: true }
|
||||
}
|
||||
|
||||
@@ -56,8 +56,9 @@ export async function consumeCallback(input: ConsumeCallbackInput): Promise<{ su
|
||||
}
|
||||
|
||||
if (!config.accessToken) {
|
||||
logWarn('[kuaishou-industry/consume-callback]', 'accessToken 未配置,跳过')
|
||||
return { success: true }
|
||||
const message = 'accessToken 未配置,无法发起核销回调'
|
||||
logWarn('[kuaishou-industry/consume-callback]', message)
|
||||
return { success: false, error: message }
|
||||
}
|
||||
|
||||
const bizParams: JsonObject = {
|
||||
|
||||
@@ -25,8 +25,8 @@ type DestroyCallbackInput = {
|
||||
export async function destroyCallback(input: DestroyCallbackInput): Promise<{ success: boolean; response?: JsonObject; error?: string }> {
|
||||
let config = getKuaishouIndustryConfig()
|
||||
|
||||
if (!config.enabled || !config.sendCallbackEnabled) {
|
||||
logInfo('[kuaishou-industry/destroy-callback]', '回调未启用,跳过')
|
||||
if (!config.enabled) {
|
||||
logInfo('[kuaishou-industry/destroy-callback]', '行业电子凭证配置未启用,跳过销毁回调')
|
||||
return { success: true }
|
||||
}
|
||||
|
||||
@@ -46,8 +46,9 @@ export async function destroyCallback(input: DestroyCallbackInput): Promise<{ su
|
||||
}
|
||||
|
||||
if (!config.accessToken) {
|
||||
logWarn('[kuaishou-industry/destroy-callback]', 'accessToken 未配置,跳过')
|
||||
return { success: true }
|
||||
const message = 'accessToken 未配置,无法发起销毁回调'
|
||||
logWarn('[kuaishou-industry/destroy-callback]', message)
|
||||
return { success: false, error: message }
|
||||
}
|
||||
|
||||
const bizParams: JsonObject = {
|
||||
|
||||
@@ -31,8 +31,8 @@ type SendCallbackInput = {
|
||||
export async function sendCallback(input: SendCallbackInput): Promise<{ success: boolean; response?: JsonObject; error?: string }> {
|
||||
let config = getKuaishouIndustryConfig()
|
||||
|
||||
if (!config.enabled || !config.sendCallbackEnabled) {
|
||||
logInfo('[kuaishou-industry/send-callback]', '发码回调未启用,跳过')
|
||||
if (!config.enabled) {
|
||||
logInfo('[kuaishou-industry/send-callback]', '行业电子凭证配置未启用,跳过发码回调')
|
||||
return { success: true }
|
||||
}
|
||||
|
||||
@@ -52,8 +52,9 @@ export async function sendCallback(input: SendCallbackInput): Promise<{ success:
|
||||
}
|
||||
|
||||
if (!config.accessToken) {
|
||||
logWarn('[kuaishou-industry/send-callback]', 'accessToken 未配置,跳过发码回调')
|
||||
return { success: true }
|
||||
const message = 'accessToken 未配置,无法发起发码回调'
|
||||
logWarn('[kuaishou-industry/send-callback]', message)
|
||||
return { success: false, error: message }
|
||||
}
|
||||
|
||||
const bizParams: JsonObject = {
|
||||
|
||||
@@ -11,7 +11,6 @@ type JsonObject = Record<string, any>
|
||||
|
||||
export type KuaishouIndustrySourceConfig = {
|
||||
enabled: boolean
|
||||
sendCallbackEnabled: boolean
|
||||
baseUrl: string
|
||||
authBaseUrl: string
|
||||
redirectUri: string
|
||||
@@ -72,9 +71,6 @@ function normalizeKuaishouIndustrySourceConfig(rawValue: unknown): KuaishouIndus
|
||||
|
||||
return {
|
||||
enabled: typeof source.enabled === 'boolean' ? source.enabled : fallback.enabled,
|
||||
sendCallbackEnabled: typeof source.sendCallbackEnabled === 'boolean'
|
||||
? source.sendCallbackEnabled
|
||||
: fallback.sendCallbackEnabled,
|
||||
baseUrl: normalizeUrlLike(source.baseUrl, fallback.baseUrl),
|
||||
authBaseUrl: normalizeUrlLike(source.authBaseUrl, fallback.authBaseUrl),
|
||||
redirectUri: normalizeString(source.redirectUri, fallback.redirectUri),
|
||||
@@ -106,7 +102,6 @@ function createDefaultKuaishouIndustrySourceConfig(): KuaishouIndustrySourceConf
|
||||
|
||||
return {
|
||||
enabled: true,
|
||||
sendCallbackEnabled: Boolean(runtime.sendCallbackEnabled),
|
||||
baseUrl: DEFAULT_CALLBACK_BASE_URL,
|
||||
authBaseUrl: DEFAULT_AUTH_BASE_URL,
|
||||
redirectUri: '',
|
||||
|
||||
@@ -42,7 +42,6 @@ function createConfig(
|
||||
): KuaishouIndustrySourceConfig {
|
||||
return {
|
||||
enabled: true,
|
||||
sendCallbackEnabled: true,
|
||||
baseUrl: 'https://openapi.kwaixiaodian.com',
|
||||
authBaseUrl: 'https://open.kwaixiaodian.com',
|
||||
redirectUri: '',
|
||||
|
||||
Reference in New Issue
Block a user