fix wxpay config contract and h5 scene info
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { PROVIDER_CONFIG_FIELDS } from '@/components/payment/providerConfig'
|
||||
|
||||
function findField(key: string) {
|
||||
const fields = PROVIDER_CONFIG_FIELDS.wxpay || []
|
||||
return fields.find(field => field.key === key)
|
||||
}
|
||||
|
||||
describe('PROVIDER_CONFIG_FIELDS.wxpay', () => {
|
||||
it('keeps admin form validation aligned with backend-required credentials', () => {
|
||||
expect(findField('publicKeyId')?.optional).toBeFalsy()
|
||||
expect(findField('certSerial')?.optional).toBeFalsy()
|
||||
})
|
||||
|
||||
it('exposes optional mp and H5 metadata fields for WeChat-specific flows', () => {
|
||||
expect(findField('mpAppId')?.optional).toBe(true)
|
||||
expect(findField('h5AppName')?.optional).toBe(true)
|
||||
expect(findField('h5AppUrl')?.optional).toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -83,12 +83,15 @@ export const PROVIDER_CONFIG_FIELDS: Record<string, ConfigFieldDef[]> = {
|
||||
],
|
||||
wxpay: [
|
||||
{ key: 'appId', label: 'App ID', sensitive: false },
|
||||
{ key: 'mpAppId', label: '', sensitive: false, optional: true },
|
||||
{ key: 'mchId', label: '', sensitive: false },
|
||||
{ key: 'privateKey', label: '', sensitive: true },
|
||||
{ key: 'apiV3Key', label: '', sensitive: true },
|
||||
{ key: 'publicKey', label: '', sensitive: true },
|
||||
{ key: 'publicKeyId', label: '', sensitive: false, optional: true },
|
||||
{ key: 'certSerial', label: '', sensitive: false, optional: true },
|
||||
{ key: 'publicKeyId', label: '', sensitive: false },
|
||||
{ key: 'certSerial', label: '', sensitive: false },
|
||||
{ key: 'h5AppName', label: '', sensitive: false, optional: true },
|
||||
{ key: 'h5AppUrl', label: '', sensitive: false, optional: true },
|
||||
],
|
||||
stripe: [
|
||||
{ key: 'secretKey', label: '', sensitive: true },
|
||||
|
||||
Reference in New Issue
Block a user