You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
4.1 KiB
PHP
127 lines
4.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Command;
|
|
|
|
use App\Helper\Efps\Api;
|
|
use App\Helper\Signer;
|
|
use App\Service\AppService;
|
|
use App\Service\MerchantService;
|
|
use App\Service\PaymentService;
|
|
use Hyperf\Command\Annotation\Command;
|
|
use Hyperf\Command\Command as HyperfCommand;
|
|
use Hyperf\Contract\ContainerInterface;
|
|
|
|
/**
|
|
* @Command
|
|
*/
|
|
class JinlingCommand extends HyperfCommand
|
|
{
|
|
/**
|
|
* @var ContainerInterface
|
|
*/
|
|
protected $container;
|
|
|
|
protected $admin;
|
|
|
|
public function __construct(ContainerInterface $container)
|
|
{
|
|
$this->container = $container;
|
|
|
|
parent::__construct('jinling');
|
|
}
|
|
|
|
public function configure(): void
|
|
{
|
|
parent::configure();
|
|
$this->setDescription('廖金灵测试');
|
|
}
|
|
|
|
public function handle(): void
|
|
{
|
|
/*Api::register([
|
|
'merId' => "100", // 562238003185933
|
|
'backUrl' => 'http://www.baidu.com',
|
|
'certificateName' => '测试',
|
|
'lawyerCertType' => 0,
|
|
'lawyerCertNo' => '430481198104234557',
|
|
'lawyerCertPhotoFront' => 'http://5b0988e595225.cdn.sohucs.com/images/20191031/e6a31c2611f042bbbfd39297243437a7.png',
|
|
'lawyerCertPhotoBack' => 'http://5b0988e595225.cdn.sohucs.com/images/20191031/e6a31c2611f042bbbfd39297243437a7.png',
|
|
'certificateTo' => '20500211',
|
|
'contactPhone' => '18888888888',
|
|
'accountType' => 3,
|
|
'canDownType' => '01',
|
|
]);*/
|
|
Api::bindCard([
|
|
'memberId' => '562238003185933',
|
|
'mchtOrderNo' => time() . rand(1000, 9999),
|
|
'userName' => '测试',
|
|
'phoneNum' => '18888888888',
|
|
'bankCardNo' => '6214835911385365',
|
|
'bankCardType' => 'debit',
|
|
'certificatesNo' => '430481198104234557',
|
|
]);
|
|
return;
|
|
echo \App\Helper\Efps\Signer::sign('sss');
|
|
$sm3 = new \OneSm\Sm3();
|
|
|
|
// 字符串签名
|
|
echo $sm3->sign('abc') . PHP_EOL;
|
|
echo $sm3->sign(str_repeat("adfas哈哈哈", 100)) . PHP_EOL;
|
|
return;
|
|
/**
|
|
* @var PaymentService $paymentService
|
|
*/
|
|
$paymentService = $this->container->make(PaymentService::class);
|
|
$paymentService = $this->container->make(PaymentService::class);
|
|
$paramsJson = '{"return_code":"SUCCESS","nonce_str":"4a40481401bb47cc81411ab3a8181bad","timestamp":1682659313039,"sign":"5AD859576B783CB44D1FAA0E7DD4C463","order_no":"TR23042830042195760003775","out_order_no":"2023042813194700001","total_amount":2,"currency":"AUD","order_time":"20230428151948","pay_time":"20230428152021","exchange_rate":459899100,"cny_amount":9}';
|
|
$params = json_decode($paramsJson, true);
|
|
$ret = $paymentService->notify($params);
|
|
var_dump($ret);
|
|
return;
|
|
$this->buildPayPrams();
|
|
return;
|
|
/**
|
|
* @var MerchantService $merchantService
|
|
*/
|
|
$merchantService = $this->container->make(MerchantService::class);
|
|
|
|
/**
|
|
* @var AppService $appService
|
|
*/
|
|
$appService = $this->container->make(AppService::class);
|
|
$merchant = $merchantService->createMerchant([
|
|
'username' => 'elf',
|
|
'password' => '123456',
|
|
'email' => '360197197@qq.com',
|
|
'mobile' => '18760419185',
|
|
'ip' => '127.0.0.1',
|
|
]);
|
|
$appService->createApp($merchant);
|
|
}
|
|
|
|
public function buildPayPrams(): void
|
|
{
|
|
$params = [
|
|
'app_id' => '202304270000004',
|
|
'timestamp' => time(),
|
|
'nonce_str' => 'lSHKbuFngCXHN8Ue1s8QHAAzPvOL3u9O',
|
|
];
|
|
$data = [
|
|
'order_name' => '测试订单',
|
|
'currency' => 'CNY',
|
|
'amount' => '10',
|
|
'notify_url' => 'https://www.baidu.com',
|
|
'redirect_url' => 'https://www.google.com',
|
|
'out_order_no' => '1122',
|
|
'direct_pay' => 0,
|
|
'show_pc_pay_url' => 0,
|
|
];
|
|
$params['data'] = json_encode($data);
|
|
$sign = Signer::sign($params, 'lSHKbuFngCXHN8Ue1s8QHAAzPvOL3u9O');
|
|
$params['sign'] = $sign;
|
|
var_dump(json_encode($params));
|
|
}
|
|
}
|