master
ljl 1 year ago
parent 03335a89bd
commit 2298a54540

@ -40,10 +40,9 @@ class PayController extends AbstractController
return $this->success($data);
}
public function protocolPayPreRequest(RequestInterface $request)
public function bindCardPay(RequestInterface $request)
{
$data = $this->paymentService->protocolPayPreRequest($request->all());
return $this->success($data);
}
public function protocolPayConfirm(RequestInterface $request)

@ -40,6 +40,11 @@ class ApiList
'url' => '/api/order/v3.0.0/assurePaymentSplit',
'signParams' => 'orgNo|merchantNo|terminalNo|loginNo|requestDate|outOrderNo|amount|paidType|splitInfoList',
],
'paymentSplit' => [
'description' => '个人支付-余额和卡',
'url' => '/api/order/v3.0.0/paymentSplitApi',
'signParams' => 'orgNo|merchantNo|terminalNo|loginNo|requestDate|outOrderNo|amount|paidType|splitInfoList',
],
'payment' => [
'description' => '个人担保支付-聚合支付',
'url' => '/api/wallet/v3.0.0/payment',

@ -43,7 +43,7 @@ class Baofu
$data = [];
$data['loginNo'] = $loginNo;
$data['dataContent'] = NotifyList::getNotifyUrl('cardBind', $token);
return $this->h5('cardBind', $data);
return $this->h5('cardBind', $data, $token);
}
public function cardUnbind($loginNo, $agreementNo, $requestNo = '')
@ -77,7 +77,7 @@ class Baofu
return $this->withReturnUrl($this->api($params['notifyUrl'], $data), $returnUrl);
}
public function assurePaymentSplit($params, $returnUrl = 'assurePaymentSplit')
public function assurePaymentSplit($params, $token)
{
$data = [];
$data['loginNo'] = $params['loginNo'];
@ -89,7 +89,21 @@ class Baofu
$data['expireDate'] = date('YmdHis', time() + 15*60);
$data['validDate'] = date('Ymd');
$data['notifyUrl'] = $params['notifyUrl'];
return $this->withReturnUrl($this->api('assurePaymentSplit', $data), $returnUrl, ['oid' => $params['oid']]);
return $this->withReturnUrl($this->api('assurePaymentSplit', $data), $token);
}
public function paymentSplit($params, $token)
{
$data = [];
$data['loginNo'] = $params['loginNo'];
$data['amount'] = $params['amount'];
$data['outOrderNo'] = $params['outOrderNo'];
$data['paidType'] = $params['paidType'] ?: 'CARD';
$data['agreementNo'] = Rsa::encryptByCERFile($params['agreementNo'], $this->getCerFilePath());
$data['splitInfoList'] = json_encode($params['splitInfoList']);
$data['pwdPayExpTime'] = time() + 15*60;
$data['notifyUrl'] = $params['notifyUrl'];
return $this->withReturnUrl($this->api('paymentSplitApi', $data), $token);
}
public function unifyPay($params){

@ -114,16 +114,16 @@ trait Common
return $this->withReturnUrl($this->parseResponse($response, 'h5'), $token);
}
private function api($apiName, $data)
private function api($apiName, $data, $token = null)
{
$apiItem = ApiList::get($apiName);
if (is_null($apiItem)) {
throw new BusinessException('未定义API接口');
}
if ($apiName == 'mEnterpriseUnbindCard'|| $apiName == 'EnterpriseUnbindCard') {
if ($apiName == 'EnterpriseUnbindCard') {
$response = $this->post($data, $apiItem, 'json');
$res = $this->parseResponse($response, 'api');
return $this->withReturnUrl($res['checkPwdUrl'], $apiName);
return $this->withReturnUrl($res['checkPwdUrl'], $token);
}else{
$response = $this->post($data, $apiItem, 'json');
return $this->parseResponse($response, 'api');

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Service;
use App\Exception\BusinessException;
use App\Helper\Baofu\Baofu;
use App\Helper\Efps\Api;
use App\Helper\Efps\Result;
use App\Helper\Log;
@ -35,10 +36,30 @@ class PaymentService extends AbstractService
return md5($appId . '-' . $outMemberId);
}
public function bindCardPay($params, $token) {
$req = new PaymentRequest($params);
$app = $req->getApp();
$reqData = $req->getData();
$user = User::where('app_id', $app->app_id)->where('user_id', $reqData['userId'])->first();
if ($user) {
throw new BusinessException('用户已存在');
}
$baofu = new Baofu();
$baofu->paymentSplit([
'loginNo' => $user->member_id,
'outOrderNo' => '',
'amount' => $user->member_id,
'paidType' => 'CARD',
'agreementNo' => $reqData[''],
'pwdPayExpTime' => $reqData[''],
'notifyUrl' => '',
], $token);
}
public function createOrder(App $app, array $params, $user) {
$order = new Order();
$order->app_id = $app->app_id;
$order->order_no = $params['outTradeNo'];
$order->member_id = $user->member_id;
$order->out_member_id = $params['outMemberId'] ?? '';
$order->out_order_no = $params['outOrderNo'] ?? '';

Loading…
Cancel
Save