You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
payment/test.php

154 lines
2.9 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
/** ======================================================= */
/**
* 提现申请(资金从平台户到用户电子账户)
* url: payment/withdraw-apply
*
*/
$data = [
'userId' => 'ELF1990',
'accountName' => '廖金灵',
'outApplyNo' => time() . rand(1000, 9999),
'amount' => '10',
'summary' => '测试',
'notifyUrl' => 'http://124.223.222.61:9501/notify/test-notify'
];
/*
同步返回结果data
{
"batchNum": "2023083102511200001",
"applyNo": "2023083102511200001"
}
*/
/*
异步返回结果:
{
"amount": 1,
"status": "SUCCESS",
"userId": "abc",
"outApplyNo": "2023083102511200001"
}
*/
/** ======================================================= */
/**
* 提现到绑定银行卡(资金从用户电子账户到用户绑定银行卡)
* url: payment/withdraw
*
*/
$data = [
'userId' => 'ELF1990',
'agreementNo' => '312023082200002060225',
'outWithdrawNo' => time() . rand(1000, 9999),
'amount' => '1',
'notifyUrl' => 'http://124.223.222.61:9501/notify/test-notify',
'returnUrl' => 'https://www.baidu.com',
];
/*
同步返回结果data
{
"url": "http://xxxxxxx", // 输入支付密码url
}
异步返回结果data
{
"amount": 1,
"status": "SUCCESS",
"userId": "abc",
"outWithdrawNo": "2023083102511200001" // 传入的提现号
}
*/
/** ======================================================= */
/**
* 查询提现申请结果
* url: payment/withdraw-apply-query
*
*/
$data = [
'userId' => 'ELF1990',
'outApplyNo' => '16934203547527',
];
/*
同步返回结果data
{
"amount": 1,
"status": "SUCCESS",
"fee": 0, // 手续费
}
*/
/** ======================================================= */
/**
* 查询提现结果(原接口改造)
* url: payment/query-order
*/
$data = [
'type' => 'WITHDRAW',
'outOrderNo' => '16934198607215',
];
// 同步返回结果与原来相同
/** ======================================================= */
// 一般有以下状态
const STATUS_APPLY_SUCCESS = 'APPLY_SUCCESS'; // 申请失败
const STATUS_APPLY_FAILED = 'APPLY_FAILED'; // 申请成功
const STATUS_REFUND = 'REFUND'; // 已退款
const STATUS_PROCESS = 'PROCESS'; // 处理中
const STATUS_SUCCESS = 'SUCCESS'; // 成功
const STATUS_FAILED = 'FAILED'; // 失败
/**
* 委托提现授权
* url: payment/sign-withdraw-entrust
*
*/
$data = [
'userId' => 'ELF1990',
];
/*
同步返回结果data
{
"url": "xxxxxxxx",
}
*/
/**
* 解除委托提现授权
* url: payment/unbind-withdraw-entrust
*
*/
$data = [
'userId' => 'ELF1990',
];
/*
同步返回结果data
{
"url": "xxxxxxxx",
}
*/
/**
* 委托提现授权结果查询
* url: payment/query-sign-entrust
*
*/
$data = [
'userId' => 'ELF1990',
];
/*
同步返回结果data
{
"result": true,
}
*/
// 委托提现接口同提现接口: payment/withdraw
// 新增参数 withdrawType (normal: 普通提现(默认) entrust: 委托授权提现)