|
@@ -19,7 +19,7 @@ class Payment
|
|
function __construct()
|
|
function __construct()
|
|
{
|
|
{
|
|
// 从本地文件中加载「商户API私钥」,「商户API私钥」会用来生成请求的签名
|
|
// 从本地文件中加载「商户API私钥」,「商户API私钥」会用来生成请求的签名
|
|
- $merchantPrivateKeyFilePath = Config('wechatpay.private_key');
|
|
|
|
|
|
+ $merchantPrivateKeyFilePath = config('wechatpay.private_key');
|
|
//$merchantPrivateKeyFilePath = 'file://D:\phpstudy_pro\WWW\mall\kailin\resources\1612111355_20241118_cert\apiclient_key.pem';
|
|
//$merchantPrivateKeyFilePath = 'file://D:\phpstudy_pro\WWW\mall\kailin\resources\1612111355_20241118_cert\apiclient_key.pem';
|
|
$merchantPrivateKeyInstance = Rsa::from($merchantPrivateKeyFilePath, Rsa::KEY_TYPE_PRIVATE);
|
|
$merchantPrivateKeyInstance = Rsa::from($merchantPrivateKeyFilePath, Rsa::KEY_TYPE_PRIVATE);
|
|
|
|
|
|
@@ -27,7 +27,7 @@ class Payment
|
|
$merchantCertificateSerial = '4A5F7CFCC3280CF8C09735D5FC2DEFBC9CCD6F46';
|
|
$merchantCertificateSerial = '4A5F7CFCC3280CF8C09735D5FC2DEFBC9CCD6F46';
|
|
|
|
|
|
// 从本地文件中加载「微信支付平台证书」或者「微信支付平台公钥」,用来验证微信支付应答的签名
|
|
// 从本地文件中加载「微信支付平台证书」或者「微信支付平台公钥」,用来验证微信支付应答的签名
|
|
- $platformCertificateOrPublicKeyFilePath = Config('wechatpay.platformCertificate');
|
|
|
|
|
|
+ $platformCertificateOrPublicKeyFilePath = config('wechatpay.platformCertificate');
|
|
$platformPublicKeyInstance = Rsa::from($platformCertificateOrPublicKeyFilePath, Rsa::KEY_TYPE_PUBLIC);
|
|
$platformPublicKeyInstance = Rsa::from($platformCertificateOrPublicKeyFilePath, Rsa::KEY_TYPE_PUBLIC);
|
|
|
|
|
|
// 「微信支付平台证书」的「证书序列号」或者是「微信支付平台公钥ID」
|
|
// 「微信支付平台证书」的「证书序列号」或者是「微信支付平台公钥ID」
|
|
@@ -36,7 +36,7 @@ class Payment
|
|
|
|
|
|
// 构造一个 APIv3 客户端实例
|
|
// 构造一个 APIv3 客户端实例
|
|
$instance = Builder::factory([
|
|
$instance = Builder::factory([
|
|
- 'mchid' => Config('wechatpay.mchid'),
|
|
|
|
|
|
+ 'mchid' => config('wechatpay.mchid'),
|
|
'serial' => $merchantCertificateSerial,
|
|
'serial' => $merchantCertificateSerial,
|
|
'privateKey' => $merchantPrivateKeyInstance,
|
|
'privateKey' => $merchantPrivateKeyInstance,
|
|
'certs' => [
|
|
'certs' => [
|
|
@@ -44,10 +44,10 @@ class Payment
|
|
],
|
|
],
|
|
]);
|
|
]);
|
|
$this->instance = $instance;
|
|
$this->instance = $instance;
|
|
- $this->appid = Config('wechatpay.appid');
|
|
|
|
- $this->mchid = Config('wechatpay.mchid');
|
|
|
|
|
|
+ $this->appid = config('wechatpay.appid');
|
|
|
|
+ $this->mchid = config('wechatpay.mchid');
|
|
$this->merchantPrivateKeyInstance = $merchantPrivateKeyInstance;
|
|
$this->merchantPrivateKeyInstance = $merchantPrivateKeyInstance;
|
|
- $this->merchantCertificateSerial = Config('wechat.certificate');
|
|
|
|
|
|
+ $this->merchantCertificateSerial = config('wechat.certificate');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -55,7 +55,7 @@ class Payment
|
|
*/
|
|
*/
|
|
public function pay($params)
|
|
public function pay($params)
|
|
{
|
|
{
|
|
- $notify_url = Config('wechatpay.notify_url');
|
|
|
|
|
|
+ $notify_url = config('wechatpay.pay_notify_url');
|
|
//调用微信JSAPI下单获取预支付交易会话标识
|
|
//调用微信JSAPI下单获取预支付交易会话标识
|
|
try {
|
|
try {
|
|
$resp = $this->instance
|
|
$resp = $this->instance
|