Browse Source

fix:支付的

super-yimizi 1 month ago
parent
commit
d26141b253

+ 4 - 0
application/common/Service/Pay/Provider/Base.php

@@ -70,6 +70,10 @@ class Base
     public function init($payment, $config = [], $type = 'normal')
     {
         $this->config = $this->getConfig($payment, $config, $type);
+        // echo "<pre>";
+        // print_r($this->config);
+        // echo "</pre>";
+        // exit;
         $this->pay = Pay::config($this->config);
         Pay::set(HttpClientInterface::class, HttpClient::instance());       // 使用自定义 client (也继承至 GuzzleHttp\Client)
        

+ 7 - 5
application/common/Service/Pay/Provider/Wechat.php

@@ -48,7 +48,7 @@ class Wechat extends Base
                 ]
             ];
         }
-
+      
         unset($order['order_id'], $order['total_amount']);
         $method = $this->getMethod('wechat');
         $result = Pay::wechat()->$method($order);
@@ -331,16 +331,18 @@ class Wechat extends Base
                 break;
         }
 
-        $config['notify_url'] = request()->domain() . '/addons/shopro/pay/notify/payment/wechat/platform/' . $this->platform;
-        $config['mch_secret_cert'] = ROOT_PATH . 'public' . $config['mch_secret_cert'];
-        $config['mch_public_cert_path'] = ROOT_PATH . 'public' . $config['mch_public_cert_path'];
+        $config['notify_url'] = request()->domain() . '/api/pay/notify/payment/wechat/platform/' . $this->platform;
+        // $config['mch_secret_cert'] = cdnurl($config['mch_secret_cert'], true);
+        // $config['mch_public_cert_path'] = cdnurl($config['mch_public_cert_path'], true);
+        $config['mch_secret_cert'] = ROOT_PATH . 'public/apiclient_cert.pem';
+        $config['mch_public_cert_path'] = ROOT_PATH . 'public/apiclient_key.pem';
 
         // 可手动配置微信支付公钥证书
         $config['wechat_public_cert_id'] = $config['wechat_public_cert_id'] ?? '';
         $config['wechat_public_cert'] = $config['wechat_public_cert'] ?? '';
         if ($config['wechat_public_cert_id'] && $config['wechat_public_cert']) {
             $config['wechat_public_cert_path'] = [
-                $config['wechat_public_cert_id'] => ROOT_PATH . 'public' . $config['wechat_public_cert']
+                $config['wechat_public_cert_id'] => cdnurl($config['wechat_public_cert'], true)
             ];
         }
         unset($config['wechat_public_cert_id'], $config['wechat_public_cert']);

+ 25 - 0
public/apiclient_cert.pem

@@ -0,0 +1,25 @@
+-----BEGIN CERTIFICATE-----
+MIIENDCCAxygAwIBAgIUHD7VoMZmSkrj/bDxs/MYNdexDiAwDQYJKoZIhvcNAQEL
+BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
+FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
+Q0EwHhcNMjUwNzEyMDYyOTM4WhcNMzAwNzExMDYyOTM4WjCBjTETMBEGA1UEAwwK
+MTYyMjQ3MDQ0MTEbMBkGA1UECgwS5b6u5L+h5ZWG5oi357O757ufMTkwNwYDVQQL
+DDDlrpzlrr7luILkuInkurrooYzokKXplIDnrZbliJLmnInpmZDotKPku7vlhazl
+j7gxCzAJBgNVBAYTAkNOMREwDwYDVQQHDAhTaGVuWmhlbjCCASIwDQYJKoZIhvcN
+AQEBBQADggEPADCCAQoCggEBAP0XLehI7jefu8B+FmWBmRYIyCPEw4z/k22U2ndy
+FykBDbPL5a6I879qetJ7iW2z6byAnm4CvsUtGNae+gx50jnnlumUodXCMbzse2W2
+9ifao6hnSPDOFbeexQHQAKafgszeMu1V/BmSsXd1nrlTXUgT2PsTzBEQ8UqvOQ63
+25FIl9ae6v7PzKlvOcPKGq1Vqo8cu90JO302rb8MCS+wOg12crSUyYqdWsshUvd8
+rltDkJhLuIxLpgMYxUeEQEmNHNbdUOChbJqgm15uF7g7MnVoVdfwTN0XQ+V3bWZA
+dW0Sa2iCXKMUC22AMPjsrRtrv/+izdq6rTBGyzvCh0X6/2kCAwEAAaOBuTCBtjAJ
+BgNVHRMEAjAAMAsGA1UdDwQEAwID+DCBmwYDVR0fBIGTMIGQMIGNoIGKoIGHhoGE
+aHR0cDovL2V2Y2EuaXRydXMuY29tLmNuL3B1YmxpYy9pdHJ1c2NybD9DQT0xQkQ0
+MjIwRTUwREJDMDRCM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