master
elf 1 year ago
parent 0594758a02
commit dafe9537bb

@ -42,7 +42,7 @@ class MineCommand extends HyperfCommand
public function handle(): void public function handle(): void
{ {
$this->register('RLX1990'); $this->payment();
} }
protected function generateToken() { protected function generateToken() {
@ -135,7 +135,7 @@ class MineCommand extends HyperfCommand
* @var UserService $userService * @var UserService $userService
*/ */
$userService = $this->container->make(UserService::class); $userService = $this->container->make(UserService::class);
$userService->rsyncBankCards('4673f922e30cfd2efeeb992ff6a32ece'); $userService->rsyncBankCards('247eda1b7de0c76603123c477f2072fa');
} }
protected function bindCard() protected function bindCard()
@ -155,13 +155,13 @@ class MineCommand extends HyperfCommand
*/ */
$paymentService = $this->container->make(PaymentService::class); $paymentService = $this->container->make(PaymentService::class);
$data = [ $data = [
'userId' => '24', 'userId' => 'RLX1990',
'agreementNo' => '322022110300000005068', 'agreementNo' => '312023080700002049466',
'notifyUrl' => 'http://www.baidu.com', 'notifyUrl' => 'http://www.baidu.com',
'returnUrl' => 'http://www.baidu.com', 'returnUrl' => 'http://www.baidu.com',
'amount' => 10, 'amount' => 10,
'outOrderNo' => time() . rand(1000, 9999), 'outOrderNo' => time() . rand(1000, 9999),
'expiresIn' => 15*60, 'expiresIn' => 10*60,
'splitInfoList' => [ 'splitInfoList' => [
[ [
'userId' => 'ELF1990', 'userId' => 'ELF1990',

@ -40,7 +40,7 @@ class NotifyController extends AbstractController
$baofu = new Baofu(); $baofu = new Baofu();
if (!$baofu->notifyVerify($params, 'register')) { if (!$baofu->notifyVerify($params, 'register')) {
Log::info('registerNotifyVerifyFail: ' . $params); Log::info('registerNotifyVerifyFail: ', $params);
return $baofu->notifySuccess(); return $baofu->notifySuccess();
} }

@ -75,8 +75,8 @@ class PayController extends AbstractController
public function payment(RequestInterface $request) { public function payment(RequestInterface $request) {
[$app, $data, $token] = $this->parseReqest($request, UnbindCardRequest::class); [$app, $data, $token] = $this->parseReqest($request, UnbindCardRequest::class);
$data = $this->paymentService->payment($data, $app, $token); $url = $this->paymentService->payment($data, $app, $token);
return $this->success($data); return $this->success(['url' => $url]);
} }
public function refundApply(RequestInterface $request) public function refundApply(RequestInterface $request)

@ -214,6 +214,7 @@ trait Common
$needSignParams = $notifyItem['signParams']; $needSignParams = $notifyItem['signParams'];
$paramList = explode('|', $needSignParams); $paramList = explode('|', $needSignParams);
$signString = Tool::getSignStr($needSignParams, $paramList, $data, 'response'); $signString = Tool::getSignStr($needSignParams, $paramList, $data, 'response');
Log::info('Baofu SignString: ' . $signString);
return SignatureUtil::verifySign($signString, $this->getCerFilePath(), $data['signature'] ?: ''); return SignatureUtil::verifySign($signString, $this->getCerFilePath(), $data['signature'] ?: '');
} }

@ -53,6 +53,7 @@ class SignatureUtil
$pubKey = file_get_contents($cerPath); $pubKey = file_get_contents($cerPath);
$certs = openssl_get_publickey($pubKey); $certs = openssl_get_publickey($pubKey);
$ok = openssl_verify($data, hex2bin($signature), $certs); $ok = openssl_verify($data, hex2bin($signature), $certs);
var_dump($cerPath, $signature);
if ($ok == 1) { if ($ok == 1) {
return true; return true;
} }

@ -63,7 +63,7 @@ class PaymentService extends AbstractService
$url = $baofu->paymentSplit([ $url = $baofu->paymentSplit([
'loginNo' => $user->member_id, 'loginNo' => $user->member_id,
'outOrderNo' => $order->order_no, 'outOrderNo' => $order->order_no,
'amount' => $user->member_id, 'amount' => $order->amount,
'paidType' => 'CARD', 'paidType' => 'CARD',
'agreementNo' => $order->agreement_no, 'agreementNo' => $order->agreement_no,
'pwdPayExpTime' => strtotime($order->expired_at), 'pwdPayExpTime' => strtotime($order->expired_at),
@ -72,6 +72,7 @@ class PaymentService extends AbstractService
$order->status = 'APPLY_SUCCESS'; $order->status = 'APPLY_SUCCESS';
$order->applied_at = date('Y-m-d H:i:s'); $order->applied_at = date('Y-m-d H:i:s');
$order->pay_url = $url; $order->pay_url = $url;
$order->save();
return $url; return $url;
} catch (ApiException $e) { } catch (ApiException $e) {
$order->status = 'APPLY_FAILED'; $order->status = 'APPLY_FAILED';

Loading…
Cancel
Save