|
|
@@ -12,6 +12,14 @@ class SanJinService extends BaseService
|
|
|
// SanJin payment service methods would go here
|
|
|
const REQUEST_URL = 'https://api.qbdf13.com/';
|
|
|
|
|
|
+ const ALIPAY_TO_CARD = 'DF001'; // 支付宝转银行卡
|
|
|
+ const ALIPAY_TO_ALIPAY = 'DF002'; // 支付宝转支付宝
|
|
|
+
|
|
|
+ // 获取异步的通知地址
|
|
|
+ public static function getNotifyUrl()
|
|
|
+ {
|
|
|
+ return 'https://botpc28.testx2.cc/';
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* @description: 获取请求客户端
|
|
|
@@ -25,7 +33,15 @@ class SanJinService extends BaseService
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
- // 查询商户余额
|
|
|
+ /**
|
|
|
+ * @description: 查询商户余额
|
|
|
+ * @return {array}
|
|
|
+ * {array.success - 是否成功 true|false}
|
|
|
+ * {array.msg - 返回错误消息}
|
|
|
+ * {array.code - 返回状态码:200成功,其他失败}
|
|
|
+ * {array.timestamp - 时间戳 13位}
|
|
|
+ * {array.data - 商户余额}
|
|
|
+ */
|
|
|
public static function findBalance()
|
|
|
{
|
|
|
$merchant_id = config('app.tree_payment_merchant_id');
|
|
|
@@ -43,4 +59,34 @@ class SanJinService extends BaseService
|
|
|
$body = $response->getBody();
|
|
|
return json_decode($body->getContents(), true);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public static function pay($amount, $order_no, $notify_url, $return_url)
|
|
|
+ {
|
|
|
+ $data = [];
|
|
|
+ $merchant_id = config('app.tree_payment_merchant_id');
|
|
|
+ $secret = config('app.tree_payment_secret');
|
|
|
+
|
|
|
+ $data['merchantNum'] = $merchant_id;
|
|
|
+ $data['amount'] = $amount;
|
|
|
+ $data['orderNo'] = $order_no;
|
|
|
+ $data['notifyUrl'] = $notify_url;
|
|
|
+ $data['returnUrl'] = $return_url;
|
|
|
+
|
|
|
+ $signStr = $merchant_id . $order_no . $amount . $secret;
|
|
|
+ $sign = md5($signStr);
|
|
|
+ $data['sign'] = $sign;
|
|
|
+
|
|
|
+ $client = self::getClient();
|
|
|
+ $response = $client->post('api/pay', [
|
|
|
+ 'json' => $data,
|
|
|
+ 'headers' => [
|
|
|
+ 'Content-Type' => 'application/json',
|
|
|
+ ]
|
|
|
+ ]);
|
|
|
+ $body = $response->getBody();
|
|
|
+ $result = json_decode($body->getContents(), true);
|
|
|
+
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
}
|