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.
24 lines
653 B
PHTML
24 lines
653 B
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
namespace Org\QzlPay;
|
||
|
|
||
|
trait ApiCommonTrait {
|
||
|
|
||
|
protected static function getCommonParams($apiName) {
|
||
|
return [
|
||
|
'tradeType' => $apiName,
|
||
|
'version' => '2.0',
|
||
|
'mchNo' => Config::get('mchNo'),
|
||
|
];
|
||
|
}
|
||
|
|
||
|
protected static function request($apiName, $params) {
|
||
|
$params = array_merge(self::getCommonParams($apiName), $params);
|
||
|
$params[Signer::SIGN_NAME] = Signer::sign($params, Config::get('paySecret'));
|
||
|
return Client::request(self::getUrl(), $params);
|
||
|
}
|
||
|
|
||
|
protected static function getUrl() {
|
||
|
return Config::get('baseUrl') . '/gateway/api/trade';
|
||
|
}
|
||
|
}
|