|
|
@ -4,13 +4,15 @@ declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Command;
|
|
|
|
namespace App\Command;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use App\Helper\Efps\Api;
|
|
|
|
use App\Helper\StringHelper;
|
|
|
|
use App\Helper\StringHelper;
|
|
|
|
use App\Request\BindCardRequest;
|
|
|
|
use App\Request\BindCardRequest;
|
|
|
|
use App\Request\PaymentQueryRequest;
|
|
|
|
use App\Request\PaymentQueryRequest;
|
|
|
|
use App\Request\ProtocolPayConfirmRequest;
|
|
|
|
use App\Request\ProtocolPayConfirmRequest;
|
|
|
|
use App\Request\ProtocolPayPreRequest;
|
|
|
|
|
|
|
|
use App\Request\RefundQueryRequest;
|
|
|
|
use App\Request\RefundQueryRequest;
|
|
|
|
use App\Request\UnBindCardRequest;
|
|
|
|
use App\Request\UnBindCardRequest;
|
|
|
|
|
|
|
|
use App\Service\PaymentService;
|
|
|
|
|
|
|
|
use Hyperf\Command\Annotation\Command;
|
|
|
|
use Hyperf\Command\Command as HyperfCommand;
|
|
|
|
use Hyperf\Command\Command as HyperfCommand;
|
|
|
|
use Hyperf\Contract\ContainerInterface;
|
|
|
|
use Hyperf\Contract\ContainerInterface;
|
|
|
|
|
|
|
|
|
|
|
@ -41,6 +43,24 @@ class MineCommand extends HyperfCommand
|
|
|
|
|
|
|
|
|
|
|
|
public function handle(): void
|
|
|
|
public function handle(): void
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// $ret = Api::withdrawalToCard([]);
|
|
|
|
|
|
|
|
// var_dump($ret);
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @var PaymentService $paymentService
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
$paymentService = $this->container->make(PaymentService::class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$memberId = 'T01';
|
|
|
|
|
|
|
|
$protocol = 'p202305296288304915744';
|
|
|
|
|
|
|
|
// $result = $paymentService->protocolPayPreRequest($this->prepay($memberId, $protocol, 1));
|
|
|
|
|
|
|
|
// var_dump($result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$token = 'de83e93fc3594dab8d5c8707fcbc8f5c';
|
|
|
|
|
|
|
|
$smsCode = '454925';
|
|
|
|
|
|
|
|
$result = $paymentService->protocolPayConfirm($this->confirmPay($token, $protocol, $smsCode));
|
|
|
|
|
|
|
|
var_dump($result);
|
|
|
|
|
|
|
|
return;
|
|
|
|
// $this->bindCard();
|
|
|
|
// $this->bindCard();
|
|
|
|
// $this->comfirmBindCard();
|
|
|
|
// $this->comfirmBindCard();
|
|
|
|
// $this->prepay();
|
|
|
|
// $this->prepay();
|
|
|
@ -96,45 +116,39 @@ class MineCommand extends HyperfCommand
|
|
|
|
var_dump($params);
|
|
|
|
var_dump($params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function prepay()
|
|
|
|
public function prepay($memberId, $protocol, $amount)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$params = [
|
|
|
|
$params = [
|
|
|
|
'app_id' => '202304270000004',
|
|
|
|
'app_id' => '202304270000004',
|
|
|
|
'timestamp' => time(),
|
|
|
|
'timestamp' => time(),
|
|
|
|
'nonce_str' => StringHelper::getRandomString(32),
|
|
|
|
'nonce_str' => StringHelper::getRandomString(32),
|
|
|
|
'data' => json_encode([
|
|
|
|
'data' => json_encode([
|
|
|
|
'memberId' => 'T01',
|
|
|
|
'memberId' => $memberId,
|
|
|
|
'outTradeNo' => time() . rand(1000, 9999),
|
|
|
|
'outTradeNo' => time() . rand(1000, 9999),
|
|
|
|
'protocol' => 'p88888888888888888',
|
|
|
|
'protocol' => $protocol,
|
|
|
|
'payAmount' => 1,
|
|
|
|
'payAmount' => $amount,
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$sign = \App\Helper\Platform\Signer::sign($params, 'lSHKbuFngCXHN8Ue1s8QHAAzPvOL3u9O');
|
|
|
|
$sign = \App\Helper\Platform\Signer::sign($params, 'lSHKbuFngCXHN8Ue1s8QHAAzPvOL3u9O');
|
|
|
|
$params['sign'] = $sign;
|
|
|
|
$params['sign'] = $sign;
|
|
|
|
var_dump($params);
|
|
|
|
return $params;
|
|
|
|
$request = new ProtocolPayPreRequest($params);
|
|
|
|
|
|
|
|
$params = $request->getData();
|
|
|
|
|
|
|
|
var_dump($params);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function confirmPay()
|
|
|
|
public function confirmPay($token, $protocol, $smsCode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$params = [
|
|
|
|
$params = [
|
|
|
|
'app_id' => '202304270000004',
|
|
|
|
'app_id' => '202304270000004',
|
|
|
|
'timestamp' => time(),
|
|
|
|
'timestamp' => time(),
|
|
|
|
'nonce_str' => StringHelper::getRandomString(32),
|
|
|
|
'nonce_str' => StringHelper::getRandomString(32),
|
|
|
|
'data' => json_encode([
|
|
|
|
'data' => json_encode([
|
|
|
|
'token' => 's3skls8d3402skfj23',
|
|
|
|
'token' => $token,
|
|
|
|
'protocol' => 'p88888888888888888',
|
|
|
|
'protocol' => $protocol,
|
|
|
|
'smsCode' => '123456',
|
|
|
|
'smsCode' => $smsCode,
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$sign = \App\Helper\Platform\Signer::sign($params, 'lSHKbuFngCXHN8Ue1s8QHAAzPvOL3u9O');
|
|
|
|
$sign = \App\Helper\Platform\Signer::sign($params, 'lSHKbuFngCXHN8Ue1s8QHAAzPvOL3u9O');
|
|
|
|
$params['sign'] = $sign;
|
|
|
|
$params['sign'] = $sign;
|
|
|
|
var_dump($params);
|
|
|
|
return $params;
|
|
|
|
$request = new ProtocolPayConfirmRequest($params);
|
|
|
|
|
|
|
|
$params = $request->getData();
|
|
|
|
|
|
|
|
var_dump($params);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function refund()
|
|
|
|
public function refund()
|
|
|
|