feat(M08-D): 补支付退款与分账运营
This commit is contained in:
@@ -14,6 +14,8 @@ import type {
|
||||
OrderAction,
|
||||
OrderHistoryItem,
|
||||
OrderStatus,
|
||||
PaymentAuthorizationStatus,
|
||||
ProfitSharingSnapshot,
|
||||
PayoutStateFilter,
|
||||
StaffRole,
|
||||
SettlementStatus,
|
||||
@@ -170,6 +172,63 @@ export function changeManagedOrderRoom(
|
||||
});
|
||||
}
|
||||
|
||||
export function getProfitSharingSnapshot(session: ApiSession, storeId?: string) {
|
||||
const query = storeId ? `?${new URLSearchParams({ storeId })}` : '';
|
||||
return request<ProfitSharingSnapshot>(session, `/pay/profit-shares${query}`);
|
||||
}
|
||||
|
||||
export function saveCollectionAccount(session: ApiSession, input: {
|
||||
storeId: string | null; merchantId: string; credentialRef: string;
|
||||
authorizationStatus: PaymentAuthorizationStatus; profitSharingEnabled: boolean; enabled: boolean;
|
||||
}) {
|
||||
return request<{ collectionAccountId: string }>(session, '/pay/collection-account', {
|
||||
method: 'PUT', body: JSON.stringify(input)
|
||||
});
|
||||
}
|
||||
|
||||
export function saveProfitShareReceiver(session: ApiSession, input: {
|
||||
collectionAccountId: string; receiverType: 'MERCHANT_ID' | 'PERSONAL_OPENID';
|
||||
receiverAccount: string; receiverCredentialRef: string; relationType: string; name: string;
|
||||
authorizationStatus: PaymentAuthorizationStatus; enabled: boolean;
|
||||
}) {
|
||||
return request<{ receiverId: string }>(session, '/pay/profit-share-receiver', {
|
||||
method: 'PUT', body: JSON.stringify(input)
|
||||
});
|
||||
}
|
||||
|
||||
export function saveProfitSharePolicy(session: ApiSession, input: {
|
||||
collectionAccountId: string; storeId: string | null; receiverId: string;
|
||||
percentageBps: number; enabled: boolean;
|
||||
}) {
|
||||
return request<{ policyId: string }>(session, '/pay/profit-share-policy', {
|
||||
method: 'PUT', body: JSON.stringify(input)
|
||||
});
|
||||
}
|
||||
|
||||
export function executeProfitSharing(
|
||||
session: ApiSession, input: { paymentId: string; clientRequestId: string; mode: 'API' | 'MOCK' }
|
||||
) {
|
||||
return request<{ shares: unknown[]; idempotent: boolean }>(session, '/pay/profit-shares', {
|
||||
method: 'POST', body: JSON.stringify(input)
|
||||
});
|
||||
}
|
||||
|
||||
export function createWechatRefund(session: ApiSession, input: {
|
||||
paymentId: string; amountCents: number; reason: string; clientRequestId: string;
|
||||
}) {
|
||||
return request<{ refundId: string; refundNo: string; status: string; refundableCents: number }>(
|
||||
session, '/pay/refund', { method: 'POST', body: JSON.stringify(input) }
|
||||
);
|
||||
}
|
||||
|
||||
export function requestWechatReconciliation(session: ApiSession, input: {
|
||||
storeId: string; billDate: string; billType: 'ALL' | 'SUCCESS' | 'REFUND';
|
||||
}) {
|
||||
return request<{ id: string; status: string; downloadUrl: string; idempotent: boolean }>(
|
||||
session, '/pay/reconciliation', { 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