| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Services\Payment;
- use GuzzleHttp\Client;
- use GuzzleHttp\Exception\RequestException;
- use GuzzleHttp\Psr7\Response;
- use App\Services\BaseService;
- class SanJinService extends BaseService
- {
- // SanJin payment service methods would go here
- const REQUEST_URL = 'https://api.qbdf13.com/';
-
- /**
- * @description: 获取请求客户端
- * @return {*}
- */
- public static function getClient(): Client
- {
- return new Client([
- 'base_uri' => self::REQUEST_URL,
- 'timeout' => 5.0,
- ]);
- }
- // 查询商户余额
- public static function findBalance()
- {
- $merchant_id = config('app.tree_payment_merchant_id');
- $secret = config('app.tree_payment_secret');
- $sign = md5($merchant_id . $secret);
- $data = [
- 'merchantNum' => $merchant_id,
- 'sign' => $sign,
- ];
- $client = self::getClient();
- $response = $client->get('api/findBalance', [
- 'query' => $data,
- ]);
- $body = $response->getBody();
- return json_decode($body->getContents(), true);
- }
- }
|