feat(M08-B): 补保洁微信转账回调与轮询
This commit is contained in:
@@ -210,6 +210,22 @@ export class WechatPayClient {
|
||||
};
|
||||
}
|
||||
|
||||
async queryMerchantTransferByOutBillNo(credential: WechatPayCredential, outBillNo: string) {
|
||||
const result = await this.apiRequest(
|
||||
credential,
|
||||
'GET',
|
||||
`/v3/fund-app/mch-transfer/transfer-bills/out-bill-no/${encodeURIComponent(outBillNo)}`
|
||||
);
|
||||
return {
|
||||
merchantId: stringField(result, 'mch_id'),
|
||||
outBillNo: stringField(result, 'out_bill_no'),
|
||||
transferBillNo: optionalStringField(result, 'transfer_bill_no'),
|
||||
state: stringField(result, 'state'),
|
||||
failReason: optionalStringField(result, 'fail_reason'),
|
||||
amountCents: optionalNumberField(result, 'transfer_amount')
|
||||
};
|
||||
}
|
||||
|
||||
verifyAndDecrypt(
|
||||
credential: WechatPayCredential,
|
||||
headers: WechatNotificationHeaders,
|
||||
@@ -368,6 +384,11 @@ function optionalStringField(value: Record<string, unknown>, key: string) {
|
||||
return typeof field === 'string' ? field : '';
|
||||
}
|
||||
|
||||
function optionalNumberField(value: Record<string, unknown>, key: string) {
|
||||
const field = value[key];
|
||||
return typeof field === 'number' ? field : 0;
|
||||
}
|
||||
|
||||
function parseTransferReportInfos(value: unknown) {
|
||||
if (!Array.isArray(value)) return undefined;
|
||||
return value.map((item) => {
|
||||
|
||||
Reference in New Issue
Block a user