feat(withdraw): 落地方案B一体化商城余额提现与手续费内扣模式,完善多端打款退款与对账闭环
这个提交包含在:
42
tests/test_v3_prepay_result.php
普通文件
42
tests/test_v3_prepay_result.php
普通文件
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
define('APP_PATH', __DIR__ . '/../application/');
|
||||
define('ROOT_PATH', __DIR__ . '/../');
|
||||
require_once ROOT_PATH . 'thinkphp/base.php';
|
||||
require_once ROOT_PATH . 'thinkphp/helper.php';
|
||||
\think\Config::set(\think\Config::load(APP_PATH . 'config.php'));
|
||||
\think\Config::set(include APP_PATH . 'database.php', 'database');
|
||||
\think\Loader::addNamespace('app', APP_PATH);
|
||||
\think\Loader::addNamespace('addons\\shopro', ROOT_PATH . 'addons/shopro/');
|
||||
require_once ROOT_PATH . 'addons/shopro/helper/helper.php';
|
||||
|
||||
// 强制设置 epay 为 v3
|
||||
set_addon_config('epay', ['version' => 'v3'], false);
|
||||
|
||||
require_once ROOT_PATH . 'addons/epay/Epay.php';
|
||||
$epay = new \addons\epay\Epay();
|
||||
$epay->actionBegin();
|
||||
|
||||
echo "Yansongda Pay loaded: " . (class_exists('\\Yansongda\\Pay\\Pay') ? 'YES' : 'NO') . PHP_EOL;
|
||||
|
||||
$order_data = [
|
||||
'order_sn' => 'P' . date('YmdHis') . '0001',
|
||||
'total_amount' => 0.01,
|
||||
'description' => '测试订单',
|
||||
'openid' => 'oUmhc3dnq-Z-f7GrVth17frJovX8',
|
||||
];
|
||||
|
||||
$payService = new \addons\shopro\library\pay\PayService('wechat', 'WechatMiniProgram');
|
||||
|
||||
try {
|
||||
$result = $payService->pay($order_data);
|
||||
echo "Result Type: " . (is_object($result) ? get_class($result) : gettype($result)) . PHP_EOL;
|
||||
echo "Result Raw:\n";
|
||||
print_r($result);
|
||||
echo "\nResult json_encode:\n" . json_encode($result, JSON_UNESCAPED_UNICODE) . PHP_EOL;
|
||||
} catch (\Exception $e) {
|
||||
echo "Exception: " . $e->getMessage() . PHP_EOL;
|
||||
echo "File: " . $e->getFile() . ":" . $e->getLine() . PHP_EOL;
|
||||
if (method_exists($e, 'getResponse')) {
|
||||
echo "Response: " . json_encode($e->getResponse(), JSON_UNESCAPED_UNICODE) . PHP_EOL;
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户