feat(client): align account and order foundations
This commit is contained in:
@@ -42,11 +42,18 @@ test('supports tenant profile updates and authenticated qualification downloads'
|
||||
assert.match(storeSource, /enterpriseType: profile\.enterpriseType \?\? ''/)
|
||||
})
|
||||
|
||||
test('uploads the three required qualification fields through one multipart package request', () => {
|
||||
test('uploads the required license and omits the optional legal-person file when absent', () => {
|
||||
assert.match(source, /url: '\/merchant\/v1\/files\/qualifications\/required-package'/)
|
||||
assert.match(source, /data\.append\('businessLicense', businessLicense\)/)
|
||||
assert.match(source, /data\.append\('legalPersonId', legalPersonId\)/)
|
||||
assert.match(source, /params: \{ unifiedSocialCreditCode, replaceBusinessLicense, replaceLegalPersonId \}/)
|
||||
assert.match(source, /if \(legalPersonId\) data\.append\('legalPersonId', legalPersonId\)/)
|
||||
assert.match(source, /\.\.\.\(legalPersonId \? \{ replaceLegalPersonId: Boolean\(replaceLegalPersonId\) \} : \{\}\)/)
|
||||
assert.match(source, /legalPersonIdQualificationId: number \| string \| null/)
|
||||
})
|
||||
|
||||
test('uses the dedicated login-identifiers endpoint and keeps phone out of ordinary profile updates', () => {
|
||||
assert.match(source, /url: '\/merchant\/v1\/iam\/profile\/login-identifiers'/)
|
||||
assert.match(source, /ChangeMerchantLoginIdentifiersRequest/)
|
||||
assert.match(source, /Pick<MerchantPersonalProfile, 'displayName' \| 'email'>/)
|
||||
})
|
||||
|
||||
test('uses membershipId and full replacement arrays in authorization writes', () => {
|
||||
|
||||
@@ -65,10 +65,10 @@ export interface QualificationUploadResult {
|
||||
|
||||
export interface RequiredQualificationPackageUploadResult {
|
||||
businessLicenseQualificationId: number | string
|
||||
legalPersonIdQualificationId: number | string
|
||||
legalPersonIdQualificationId: number | string | null
|
||||
tenantStatus: MerchantTenantStatus
|
||||
businessLicenseDocumentUrl: string
|
||||
legalPersonIdDocumentUrl: string
|
||||
legalPersonIdDocumentUrl: string | null
|
||||
}
|
||||
|
||||
export interface MerchantRole {
|
||||
@@ -119,6 +119,12 @@ export interface MerchantPersonalProfile {
|
||||
email: string | null
|
||||
}
|
||||
|
||||
export interface ChangeMerchantLoginIdentifiersRequest {
|
||||
username: string
|
||||
phone: string
|
||||
currentPassword: string
|
||||
}
|
||||
|
||||
export interface CreateMerchantMemberRequest {
|
||||
username: string
|
||||
password: string
|
||||
@@ -163,10 +169,18 @@ export function getMerchantPersonalProfile() {
|
||||
return apiRequest<MerchantPersonalProfile>({ method: 'GET', url: '/merchant/v1/iam/profile' })
|
||||
}
|
||||
|
||||
export function updateMerchantPersonalProfile(payload: Pick<MerchantPersonalProfile, 'displayName' | 'phone' | 'email'>) {
|
||||
export function updateMerchantPersonalProfile(payload: Pick<MerchantPersonalProfile, 'displayName' | 'email'>) {
|
||||
return apiRequest<MerchantPersonalProfile>({ method: 'PUT', url: '/merchant/v1/iam/profile', data: payload })
|
||||
}
|
||||
|
||||
export function updateMerchantLoginIdentifiers(payload: ChangeMerchantLoginIdentifiersRequest) {
|
||||
return apiRequest<MerchantPersonalProfile>({
|
||||
method: 'PUT',
|
||||
url: '/merchant/v1/iam/profile/login-identifiers',
|
||||
data: payload,
|
||||
})
|
||||
}
|
||||
|
||||
export function uploadMerchantQualification(
|
||||
file: File,
|
||||
qualificationType: MerchantQualificationType,
|
||||
@@ -185,18 +199,22 @@ export function uploadMerchantQualification(
|
||||
|
||||
export function uploadMerchantRequiredQualificationPackage(
|
||||
businessLicense: File,
|
||||
legalPersonId: File,
|
||||
legalPersonId: File | undefined,
|
||||
unifiedSocialCreditCode: string,
|
||||
replaceBusinessLicense = false,
|
||||
replaceLegalPersonId = false,
|
||||
replaceLegalPersonId?: boolean,
|
||||
) {
|
||||
const data = new FormData()
|
||||
data.append('businessLicense', businessLicense)
|
||||
data.append('legalPersonId', legalPersonId)
|
||||
if (legalPersonId) data.append('legalPersonId', legalPersonId)
|
||||
return apiRequest<RequiredQualificationPackageUploadResult>({
|
||||
method: 'POST',
|
||||
url: '/merchant/v1/files/qualifications/required-package',
|
||||
params: { unifiedSocialCreditCode, replaceBusinessLicense, replaceLegalPersonId },
|
||||
params: {
|
||||
unifiedSocialCreditCode,
|
||||
replaceBusinessLicense,
|
||||
...(legalPersonId ? { replaceLegalPersonId: Boolean(replaceLegalPersonId) } : {}),
|
||||
},
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user