@@ -35,8 +35,8 @@ public function gatewayRegister()
3535 $ this ->where ('status ' , true )->get ()->map (function ($ item ) {
3636 //获取证书密钥文件路径
3737 $ upload = new Upload ();
38- $ private_key = storage_path ('app/ ' .$ upload ->getUploadWhereFirst ($ item ->private_key )->path );
39- $ public_key = storage_path ('app/ ' .$ upload ->getUploadWhereFirst ($ item ->public_key )->path );
38+ $ private_key = $ item -> private_key ? storage_path ('app/ ' .$ upload ->getUploadWhereFirst ($ item ->private_key )->path ): null ;
39+ $ public_key = $ item -> public_key ? storage_path ('app/ ' .$ upload ->getUploadWhereFirst ($ item ->public_key )->path ): null ;
4040 switch ($ item ->gateway ) {
4141 case 'alipay ' :
4242 config (['laravel-omnipay.gateways. ' .$ item ->gateway .'.driver ' => $ item ->driver ]);
@@ -50,6 +50,19 @@ public function gatewayRegister()
5050 'notifyUrl ' => $ item ->notify_url
5151 ]]);
5252 break ;
53+ case 'wechat ' :
54+ config (['laravel-omnipay.gateways. ' .$ item ->gateway .'.driver ' => $ item ->driver ]);
55+ config (['laravel-omnipay.gateways. ' .$ item ->gateway .'.options ' => [
56+ 'appId ' => $ item ->app_id ,
57+ 'mchId ' => $ item ->seller_id ,
58+ 'apiKey ' => $ item ->other ,
59+ 'keyPath ' => $ private_key ,
60+ 'certPath ' => $ public_key ,
61+ 'returnUrl ' => $ item ->return_url ,
62+ 'notifyUrl ' => $ item ->notify_url ,
63+ 'tradeType ' => 'JSAPI ' ,
64+ ]]);
65+ break ;
5366 case 'unionpay ' :
5467 config (['laravel-omnipay.gateways. ' .$ item ->gateway .'.driver ' => $ item ->driver ]);
5568 config (['laravel-omnipay.gateways. ' .$ item ->gateway .'.options ' => [
0 commit comments