feat(M08-D): 补团购与第三方平台运营
This commit is contained in:
@@ -25,6 +25,10 @@ import type {
|
||||
RoomInput,
|
||||
RoomOperationalStatus,
|
||||
StoreInput,
|
||||
ThirdPartyMode,
|
||||
ThirdPartyProvider,
|
||||
ThirdPartyRecords,
|
||||
ThirdPartySetup,
|
||||
UserStatus,
|
||||
WechatTransferPreflight
|
||||
} from './types';
|
||||
@@ -229,6 +233,57 @@ export function requestWechatReconciliation(session: ApiSession, input: {
|
||||
);
|
||||
}
|
||||
|
||||
export function listThirdPartyRecords(session: ApiSession, input: {
|
||||
provider?: ThirdPartyProvider; status?: string; storeId?: string;
|
||||
}) {
|
||||
const params = new URLSearchParams();
|
||||
if (input.provider) params.set('provider', input.provider);
|
||||
if (input.status) params.set('status', input.status);
|
||||
if (input.storeId) params.set('storeId', input.storeId);
|
||||
const query = params.toString();
|
||||
return request<ThirdPartyRecords>(session, `/third-party/records${query ? `?${query}` : ''}`);
|
||||
}
|
||||
|
||||
export function getThirdPartySetup(session: ApiSession, provider?: ThirdPartyProvider) {
|
||||
const query = provider ? `?${new URLSearchParams({ provider })}` : '';
|
||||
return request<ThirdPartySetup>(session, `/third-party/setup${query}`);
|
||||
}
|
||||
|
||||
export function saveThirdPartyConfig(session: ApiSession, input: {
|
||||
provider: ThirdPartyProvider; storeId: string | null; mode: ThirdPartyMode;
|
||||
enabled: boolean; credentialRef: string; settings: Record<string, unknown>;
|
||||
}) {
|
||||
return request<{ configId: string; created: boolean }>(session, '/third-party/config', {
|
||||
method: 'PUT', body: JSON.stringify(input)
|
||||
});
|
||||
}
|
||||
|
||||
export function saveThirdPartyMapping(session: ApiSession, input: {
|
||||
provider: ThirdPartyProvider; resourceType: 'STORE' | 'ROOM';
|
||||
externalRef: string; localResourceId: string;
|
||||
}) {
|
||||
return request<{ mapped: boolean }>(session, '/third-party/mappings', {
|
||||
method: 'PUT', body: JSON.stringify(input)
|
||||
});
|
||||
}
|
||||
|
||||
export function redeemGroupVoucher(session: ApiSession, input: {
|
||||
provider: ThirdPartyProvider; voucherCode: string; orderId: string; clientRequestId: string;
|
||||
}) {
|
||||
return request<{ redemptionId: string; status: string; voucherMasked: string }>(
|
||||
session, '/group-vouchers/redeem', { method: 'POST', body: JSON.stringify(input) }
|
||||
);
|
||||
}
|
||||
|
||||
export function redeemGroupVoucherManually(session: ApiSession, input: {
|
||||
provider: ThirdPartyProvider; voucherCode: string; orderId: string;
|
||||
amountCents: number; note: string; clientRequestId: string;
|
||||
}) {
|
||||
return request<{ redemptionId: string; status: string; voucherMasked: string }>(
|
||||
session, '/group-vouchers/redeem-manual', { method: 'POST', body: JSON.stringify(input) }
|
||||
);
|
||||
}
|
||||
|
||||
export function getBusinessStatistics(
|
||||
session: ApiSession,
|
||||
input: { storeId: string; from: string; to: string }
|
||||
|
||||
Reference in New Issue
Block a user