test
This commit is contained in:
parent
1e0e80d589
commit
89e553dced
@ -23,4 +23,10 @@ class Controller extends BaseController
|
|||||||
$res = WechatPayService::officialUserTransfer($trade_no, $scene_id, $openid, $amount, $remark);
|
$res = WechatPayService::officialUserTransfer($trade_no, $scene_id, $openid, $amount, $remark);
|
||||||
dd($res);
|
dd($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getWechatplatformcCert()
|
||||||
|
{
|
||||||
|
$res = WechatPayService::getPlatformCert();
|
||||||
|
dd($res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,20 +25,20 @@ class WechatPayService
|
|||||||
$merchantCertificateSerial = config("wechatpay.payment.serial");
|
$merchantCertificateSerial = config("wechatpay.payment.serial");
|
||||||
|
|
||||||
// 从本地文件中加载「微信支付平台证书」,可由内置CLI工具下载到,用来验证微信支付应答的签名
|
// 从本地文件中加载「微信支付平台证书」,可由内置CLI工具下载到,用来验证微信支付应答的签名
|
||||||
$platformCertificateFilePath = 'file://' . config("wechatpay.payment.platform_cert_path");
|
// $platformCertificateFilePath = 'file://' . config("wechatpay.payment.platform_cert_path");
|
||||||
$onePlatformPublicKeyInstance = Rsa::from($platformCertificateFilePath, Rsa::KEY_TYPE_PUBLIC);
|
// $onePlatformPublicKeyInstance = Rsa::from($platformCertificateFilePath, Rsa::KEY_TYPE_PUBLIC);
|
||||||
|
|
||||||
// 「微信支付平台证书」的「平台证书序列号」
|
// 「微信支付平台证书」的「平台证书序列号」
|
||||||
// 可以从「微信支付平台证书」文件解析,也可以在 商户平台 -> 账户中心 -> API安全 查询到
|
// 可以从「微信支付平台证书」文件解析,也可以在 商户平台 -> 账户中心 -> API安全 查询到
|
||||||
$platformCertificateSerial = config("wechatpay.payment.platform_cert_serial");
|
// $platformCertificateSerial = config("wechatpay.payment.platform_cert_serial");
|
||||||
|
|
||||||
// // 从本地文件中加载「微信支付公钥」,用来验证微信支付应答的签名
|
// // 从本地文件中加载「微信支付公钥」,用来验证微信支付应答的签名
|
||||||
// $platformPublicKeyFilePath = 'file://' . config("wechatpay.payment.public_key_path");
|
$platformPublicKeyFilePath = 'file://' . config("wechatpay.payment.public_key_path");
|
||||||
// $twoPlatformPublicKeyInstance = Rsa::from($platformPublicKeyFilePath, Rsa::KEY_TYPE_PUBLIC);
|
$twoPlatformPublicKeyInstance = Rsa::from($platformPublicKeyFilePath, Rsa::KEY_TYPE_PUBLIC);
|
||||||
|
|
||||||
// // 「微信支付公钥」的「微信支付公钥ID」
|
// // 「微信支付公钥」的「微信支付公钥ID」
|
||||||
// // 需要在 商户平台 -> 账户中心 -> API安全 查询
|
// // 需要在 商户平台 -> 账户中心 -> API安全 查询
|
||||||
// $platformPublicKeyId = config("wechatpay.payment.public_key_id");
|
$platformPublicKeyId = config("wechatpay.payment.public_key_id");
|
||||||
|
|
||||||
// 构造一个 APIv3 客户端实例
|
// 构造一个 APIv3 客户端实例
|
||||||
$instance = Builder::factory([
|
$instance = Builder::factory([
|
||||||
@ -46,13 +46,21 @@ class WechatPayService
|
|||||||
'serial' => $merchantCertificateSerial,
|
'serial' => $merchantCertificateSerial,
|
||||||
'privateKey' => $merchantPrivateKeyInstance,
|
'privateKey' => $merchantPrivateKeyInstance,
|
||||||
'certs' => [
|
'certs' => [
|
||||||
$platformCertificateSerial => $onePlatformPublicKeyInstance,
|
// $platformCertificateSerial => $onePlatformPublicKeyInstance,
|
||||||
// $platformPublicKeyId => $twoPlatformPublicKeyInstance,
|
$platformPublicKeyId => $twoPlatformPublicKeyInstance,
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPlatformCert()
|
||||||
|
{
|
||||||
|
$instance = $this->newClient();
|
||||||
|
$resp = $instance->chain('v3/fund-app/mch-transfer/transfer-bills')->get();
|
||||||
|
$res = json_decode($resp->getBody(), true);
|
||||||
|
dd($res);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转账零钱
|
* 转账零钱
|
||||||
* @return void
|
* @return void
|
||||||
|
|||||||
@ -20,3 +20,5 @@ Route::prefix("transfer")->group(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Route::get("test", [Controller::class, "test"]);
|
Route::get("test", [Controller::class, "test"]);
|
||||||
|
|
||||||
|
Route::get("wechat/platform/cert", [Controller::class, "getWechatplatformcCert"]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user