first commit

This commit is contained in:
2024-04-01 09:54:43 +08:00
commit 899d816bc3
795 changed files with 130040 additions and 0 deletions

View File

@@ -0,0 +1,353 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Nccashierapi\Model;
use Yeepay\Yop\Sdk\Model\BaseRequest;
class ApiPayRequest extends BaseRequest
{
/**
* @var string
*/
private $payTool;
/**
* @var string
*/
private $payType;
/**
* @var string
*/
private $token;
/**
* @var string
*/
private $appId;
/**
* @var string
*/
private $openId;
/**
* @var string
*/
private $version;
/**
* @var string
*/
private $payEmpowerNo;
/**
* @var string
*/
private $merchantTerminalId;
/**
* @var string
*/
private $merchantStoreNo;
/**
* @var string
*/
private $userIp;
/**
* @var string
*/
private $extParamMap;
/**
* @var string
*/
private $userNo;
/**
* @var string
*/
private $userType;
/**
* Gets payTool
* @return string
*/
public function getPayTool()
{
return $this->payTool;
}
/**
* Sets payTool
* @param string $payTool
* @return ApiPayRequest
*/
public function setPayTool($payTool)
{
$this->payTool = $payTool;
return $this;
}
/**
* Gets payType
* @return string
*/
public function getPayType()
{
return $this->payType;
}
/**
* Sets payType
* @param string $payType
* @return ApiPayRequest
*/
public function setPayType($payType)
{
$this->payType = $payType;
return $this;
}
/**
* Gets token
* @return string
*/
public function getToken()
{
return $this->token;
}
/**
* Sets token
* @param string $token
* @return ApiPayRequest
*/
public function setToken($token)
{
$this->token = $token;
return $this;
}
/**
* Gets appId
* @return string
*/
public function getAppId()
{
return $this->appId;
}
/**
* Sets appId
* @param string $appId
* @return ApiPayRequest
*/
public function setAppId($appId)
{
$this->appId = $appId;
return $this;
}
/**
* Gets openId
* @return string
*/
public function getOpenId()
{
return $this->openId;
}
/**
* Sets openId
* @param string $openId
* @return ApiPayRequest
*/
public function setOpenId($openId)
{
$this->openId = $openId;
return $this;
}
/**
* Gets version
* @return string
*/
public function getVersion()
{
return $this->version;
}
/**
* Sets version
* @param string $version
* @return ApiPayRequest
*/
public function setVersion($version)
{
$this->version = $version;
return $this;
}
/**
* Gets payEmpowerNo
* @return string
*/
public function getPayEmpowerNo()
{
return $this->payEmpowerNo;
}
/**
* Sets payEmpowerNo
* @param string $payEmpowerNo
* @return ApiPayRequest
*/
public function setPayEmpowerNo($payEmpowerNo)
{
$this->payEmpowerNo = $payEmpowerNo;
return $this;
}
/**
* Gets merchantTerminalId
* @return string
*/
public function getMerchantTerminalId()
{
return $this->merchantTerminalId;
}
/**
* Sets merchantTerminalId
* @param string $merchantTerminalId
* @return ApiPayRequest
*/
public function setMerchantTerminalId($merchantTerminalId)
{
$this->merchantTerminalId = $merchantTerminalId;
return $this;
}
/**
* Gets merchantStoreNo
* @return string
*/
public function getMerchantStoreNo()
{
return $this->merchantStoreNo;
}
/**
* Sets merchantStoreNo
* @param string $merchantStoreNo
* @return ApiPayRequest
*/
public function setMerchantStoreNo($merchantStoreNo)
{
$this->merchantStoreNo = $merchantStoreNo;
return $this;
}
/**
* Gets userIp
* @return string
*/
public function getUserIp()
{
return $this->userIp;
}
/**
* Sets userIp
* @param string $userIp
* @return ApiPayRequest
*/
public function setUserIp($userIp)
{
$this->userIp = $userIp;
return $this;
}
/**
* Gets extParamMap
* @return string
*/
public function getExtParamMap()
{
return $this->extParamMap;
}
/**
* Sets extParamMap
* @param string $extParamMap
* @return ApiPayRequest
*/
public function setExtParamMap($extParamMap)
{
$this->extParamMap = $extParamMap;
return $this;
}
/**
* Gets userNo
* @return string
*/
public function getUserNo()
{
return $this->userNo;
}
/**
* Sets userNo
* @param string $userNo
* @return ApiPayRequest
*/
public function setUserNo($userNo)
{
$this->userNo = $userNo;
return $this;
}
/**
* Gets userType
* @return string
*/
public function getUserType()
{
return $this->userType;
}
/**
* Sets userType
* @param string $userType
* @return ApiPayRequest
*/
public function setUserType($userType)
{
$this->userType = $userType;
return $this;
}
public static function getOperationId()
{
return 'apiPay';
}
}

View File

@@ -0,0 +1,129 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Nccashierapi\Model;
use Yeepay\Yop\Sdk\Http\Headers;
use Yeepay\Yop\Sdk\Internal\DefaultRequest;
use Yeepay\Yop\Sdk\Internal\Request;
use Yeepay\Yop\Sdk\Model\Transform\RequestMarshaller;
use Yeepay\Yop\Sdk\Utils\ObjectSerializer;
use Yeepay\Yop\Sdk\Utils\UUIDUtils;
class ApiPayRequestMarshaller implements RequestMarshaller
{
/**
* @var ApiPayRequestMarshaller
*/
private static $instance;
public static function __init()
{
self::$instance = new ApiPayRequestMarshaller();
}
/**
* @return ApiPayRequestMarshaller
*/
public static function getInstance()
{
return self::$instance;
}
/**
* @var string
*/
private $serviceName = 'Nccashierapi';
/**
* @var string
*/
private $httpMethod = 'POST';
/**
* @var string
*/
private $resourcePath = '/rest/v1.0/nccashierapi/api/pay';
/**
* @var string
*/
private $contentType = 'application/x-www-form-urlencoded';
/**
* @param ApiPayRequest $request
* @return Request
*/
public function marshal($request)
{
$internalRequest = new DefaultRequest($this->serviceName);
$internalRequest->setResourcePath($this->resourcePath);
$internalRequest->setHttpMethod($this->httpMethod);
if (!empty($request->getRequestConfig()) && !empty($request->getRequestConfig()->getCustomRequestHeaders())) {
foreach ($request->getRequestConfig()->getCustomRequestHeaders() as $name => $value) {
$internalRequest->addHeader($name, $value);
}
}
if (!isset($internalRequest->getHeaders()[Headers::YOP_REQUEST_ID])) {
$internalRequest->addHeader(Headers::YOP_REQUEST_ID, UUIDUtils::uuid());
}
if ($request->getPayTool() != null) {
$internalRequest->addParameter('payTool',
ObjectSerializer::sanitizeForSerialization($request->getPayTool(), 'string'));
}
if ($request->getPayType() != null) {
$internalRequest->addParameter('payType',
ObjectSerializer::sanitizeForSerialization($request->getPayType(), 'string'));
}
if ($request->getToken() != null) {
$internalRequest->addParameter('token',
ObjectSerializer::sanitizeForSerialization($request->getToken(), 'string'));
}
if ($request->getAppId() != null) {
$internalRequest->addParameter('appId',
ObjectSerializer::sanitizeForSerialization($request->getAppId(), 'string'));
}
if ($request->getOpenId() != null) {
$internalRequest->addParameter('openId',
ObjectSerializer::sanitizeForSerialization($request->getOpenId(), 'string'));
}
if ($request->getVersion() != null) {
$internalRequest->addParameter('version',
ObjectSerializer::sanitizeForSerialization($request->getVersion(), 'string'));
}
if ($request->getPayEmpowerNo() != null) {
$internalRequest->addParameter('payEmpowerNo',
ObjectSerializer::sanitizeForSerialization($request->getPayEmpowerNo(), 'string'));
}
if ($request->getMerchantTerminalId() != null) {
$internalRequest->addParameter('merchantTerminalId',
ObjectSerializer::sanitizeForSerialization($request->getMerchantTerminalId(), 'string'));
}
if ($request->getMerchantStoreNo() != null) {
$internalRequest->addParameter('merchantStoreNo',
ObjectSerializer::sanitizeForSerialization($request->getMerchantStoreNo(), 'string'));
}
if ($request->getUserIp() != null) {
$internalRequest->addParameter('userIp',
ObjectSerializer::sanitizeForSerialization($request->getUserIp(), 'string'));
}
if ($request->getExtParamMap() != null) {
$internalRequest->addParameter('extParamMap',
ObjectSerializer::sanitizeForSerialization($request->getExtParamMap(), 'string'));
}
if ($request->getUserNo() != null) {
$internalRequest->addParameter('userNo',
ObjectSerializer::sanitizeForSerialization($request->getUserNo(), 'string'));
}
if ($request->getUserType() != null) {
$internalRequest->addParameter('userType',
ObjectSerializer::sanitizeForSerialization($request->getUserType(), 'string'));
}
$internalRequest->addHeader(Headers::CONTENT_TYPE, $this->contentType);
return $internalRequest;
}
}
ApiPayRequestMarshaller::__init();

View File

@@ -0,0 +1,36 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Nccashierapi\Model;
use Yeepay\Yop\Sdk\Model\BaseResponse;
class ApiPayResponse extends BaseResponse
{
/**
* @var ApiPayUnifiedAPICashierResponseDTOResult
*/
private $result;
function getResultClass()
{
return '\Yeepay\Yop\Sdk\Service\Nccashierapi\Model\ApiPayUnifiedAPICashierResponseDTOResult';
}
/**
* @param ApiPayUnifiedAPICashierResponseDTOResult $result
*/
function setResult($result)
{
$this->result = $result;
}
/**
* @return ApiPayUnifiedAPICashierResponseDTOResult
*/
function getResult()
{
return $this->result;
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Nccashierapi\Model;
use Yeepay\Yop\Sdk\Model\Transform\BaseResponseUnMarshaller;
class ApiPayResponseUnMarshaller extends BaseResponseUnMarshaller
{
/**
* @var ApiPayResponseUnMarshaller
*/
private static $instance;
public static function __init()
{
self::$instance = new ApiPayResponseUnMarshaller();
}
/**
* @return ApiPayResponseUnMarshaller
*/
public static function getInstance()
{
return self::$instance;
}
/**
* @return ApiPayResponse
*/
protected function getResponseInstance()
{
return new ApiPayResponse();
}
}
ApiPayResponseUnMarshaller::__init();

View File

@@ -0,0 +1,482 @@
<?php
/**
* ApiPayUnifiedAPICashierResponseDTOResult
* PHP version 5
* @author Swagger Codegen team
* @package Yeepay\Yop\Sdk\
* @category Class
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* API收银台
* API收银台包含的所有API接口
* OpenAPI spec version: 1.0.0
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 3.0.13
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
namespace Yeepay\Yop\Sdk\Service\Nccashierapi\Model;
use ArrayAccess;
use Yeepay\Yop\Sdk\Model\ModelInterface;
use Yeepay\Yop\Sdk\Utils\ObjectSerializer;
/**
* ApiPayUnifiedAPICashierResponseDTOResult Class Doc Comment
* @author Swagger Codegen team
* @package Yeepay\Yop\Sdk\
* @category Class
* @link https://github.com/swagger-api/swagger-codegen
*/
class ApiPayUnifiedAPICashierResponseDTOResult implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string
*/
protected static $swaggerModelName = 'ApiPayUnifiedAPICashierResponseDTOResult';
/**
* Array of property to type mappings. Used for (de)serialization
* @var string[]
*/
protected static $swaggerTypes = [
'code' => 'string',
'message' => 'string',
'payTool' => 'string',
'payType' => 'string',
'merchantNo' => 'string',
'token' => 'string',
'resultType' => 'string',
'resultData' => 'string',
'extParamMap' => 'string',
];
/**
* Array of property to format mappings. Used for (de)serialization
* @var string[]
*/
protected static $swaggerFormats = [
'code' => null,
'message' => null,
'payTool' => null,
'payType' => null,
'merchantNo' => null,
'token' => null,
'resultType' => null,
'resultData' => null,
'extParamMap' => null,
];
/**
* Array of property to type mappings. Used for (de)serialization
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
* @var string[]
*/
protected static $attributeMap = [
'code' => 'code',
'message' => 'message',
'payTool' => 'payTool',
'payType' => 'payType',
'merchantNo' => 'merchantNo',
'token' => 'token',
'resultType' => 'resultType',
'resultData' => 'resultData',
'extParamMap' => 'extParamMap',
];
/**
* Array of attributes to setter functions (for deserialization of responses)
* @var string[]
*/
protected static $setters = [
'code' => 'setCode',
'message' => 'setMessage',
'payTool' => 'setPayTool',
'payType' => 'setPayType',
'merchantNo' => 'setMerchantNo',
'token' => 'setToken',
'resultType' => 'setResultType',
'resultData' => 'setResultData',
'extParamMap' => 'setExtParamMap',
];
/**
* Array of attributes to getter functions (for serialization of requests)
* @var string[]
*/
protected static $getters = [
'code' => 'getCode',
'message' => 'getMessage',
'payTool' => 'getPayTool',
'payType' => 'getPayType',
'merchantNo' => 'getMerchantNo',
'token' => 'getToken',
'resultType' => 'getResultType',
'resultData' => 'getResultData',
'extParamMap' => 'getExtParamMap',
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['code'] = isset($data['code']) ? $data['code'] : null;
$this->container['message'] = isset($data['message']) ? $data['message'] : null;
$this->container['payTool'] = isset($data['payTool']) ? $data['payTool'] : null;
$this->container['payType'] = isset($data['payType']) ? $data['payType'] : null;
$this->container['merchantNo'] = isset($data['merchantNo']) ? $data['merchantNo'] : null;
$this->container['token'] = isset($data['token']) ? $data['token'] : null;
$this->container['resultType'] = isset($data['resultType']) ? $data['resultType'] : null;
$this->container['resultData'] = isset($data['resultData']) ? $data['resultData'] : null;
$this->container['extParamMap'] = isset($data['extParamMap']) ? $data['extParamMap'] : null;
}
/**
* Show all the invalid properties with reasons.
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets code
* @return string
*/
public function getCode()
{
return $this->container['code'];
}
/**
* Sets code
* @param string $code 结果编码
* @return $this
*/
public function setCode($code)
{
$this->container['code'] = $code;
return $this;
}
/**
* Gets message
* @return string
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
* @param string $message 结果信息
* @return $this
*/
public function setMessage($message)
{
$this->container['message'] = $message;
return $this;
}
/**
* Gets payTool
* @return string
*/
public function getPayTool()
{
return $this->container['payTool'];
}
/**
* Sets payTool
* @param string $payTool 支付工具
* @return $this
*/
public function setPayTool($payTool)
{
$this->container['payTool'] = $payTool;
return $this;
}
/**
* Gets payType
* @return string
*/
public function getPayType()
{
return $this->container['payType'];
}
/**
* Sets payType
* @param string $payType 支付类型
* @return $this
*/
public function setPayType($payType)
{
$this->container['payType'] = $payType;
return $this;
}
/**
* Gets merchantNo
* @return string
*/
public function getMerchantNo()
{
return $this->container['merchantNo'];
}
/**
* Sets merchantNo
* @param string $merchantNo 商户编号
* @return $this
*/
public function setMerchantNo($merchantNo)
{
$this->container['merchantNo'] = $merchantNo;
return $this;
}
/**
* Gets token
* @return string
*/
public function getToken()
{
return $this->container['token'];
}
/**
* Sets token
* @param string $token 订单token
* @return $this
*/
public function setToken($token)
{
$this->container['token'] = $token;
return $this;
}
/**
* Gets resultType
* @return string
*/
public function getResultType()
{
return $this->container['resultType'];
}
/**
* Sets resultType
* @param string $resultType 返回结果类型
* @return $this
*/
public function setResultType($resultType)
{
$this->container['resultType'] = $resultType;
return $this;
}
/**
* Gets resultData
* @return string
*/
public function getResultData()
{
return $this->container['resultData'];
}
/**
* Sets resultData
* @param string $resultData 返回数据
* @return $this
*/
public function setResultData($resultData)
{
$this->container['resultData'] = $resultData;
return $this;
}
/**
* Gets extParamMap
* @return string
*/
public function getExtParamMap()
{
return $this->container['extParamMap'];
}
/**
* Sets extParamMap
* @param string $extParamMap 支付扩展参数
* @return $this
*/
public function setExtParamMap($extParamMap)
{
$this->container['extParamMap'] = $extParamMap;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
* @param integer $offset Offset
* @return boolean
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
* @param integer $offset Offset
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
* @param integer $offset Offset
* @param mixed $value Value to be set
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
* @param integer $offset Offset
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Nccashierapi;
use Yeepay\Yop\Sdk\Client\ClientExecutionParams;
use Yeepay\Yop\Sdk\Client\ClientHandler;
use Yeepay\Yop\Sdk\Client\ClientParams;
use Yeepay\Yop\Sdk\Exception\YopClientException;
use Yeepay\Yop\Sdk\Service\Nccashierapi\Model as Model;
class NccashierapiClient
{
/**
* @var ClientHandler
*/
private $clientHandler;
/**
* NccashierapiClient constructor.
* @param ClientParams $clientParams
*/
function __construct(ClientParams $clientParams)
{
$this->clientHandler = new ClientHandler($clientParams);
}
/**
* @param Model\ApiPayRequest $request
* @return Model\ApiPayResponse
* @throws YopClientException
*/
public function apiPay(Model\ApiPayRequest $request)
{
if ($request == null) {
throw new YopClientException("request is required.");
}
$clientExecutionParams = new ClientExecutionParams($request, Model\ApiPayRequestMarshaller::getInstance(),
Model\ApiPayResponseUnMarshaller::getInstance());
return $this->clientHandler->execute($clientExecutionParams);
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Nccashierapi;
use Yeepay\Yop\Sdk\Auth\AuthorityReqRegistryImpl;
use Yeepay\Yop\Sdk\Auth\AuthorizationReqRegistry;
use Yeepay\Yop\Sdk\Auth\AuthorizationReqSupport;
use Yeepay\Yop\Sdk\Client\ClientParams;
use Yeepay\Yop\Sdk\Client\Support\ClientParamsSupport;
use Yeepay\Yop\Sdk\Config\AppSdkConfig;
use Yeepay\Yop\Sdk\Config\AppSdkConfigProvider;
use Yeepay\Yop\Sdk\Config\DefaultAppSdkConfigProvider;
use Yeepay\Yop\Sdk\Exception\YopClientException;
class NccashierapiClientBuilder
{
/**
* @var AuthorizationReqRegistry
*/
private static $authorizationReqRegistry;
public static function __init()
{
self::$authorizationReqRegistry = new AuthorityReqRegistryImpl();
self::$authorizationReqRegistry->register('apiPay',
AuthorizationReqSupport::getAuthorizationReq('YOP-RSA2048-SHA256'));
}
/**
* @var ClientParams
*/
private $clientParams;
/**
* NccashierapiClientBuilder constructor.
* @param ClientParams $clientParams
*/
public function __construct(ClientParams $clientParams)
{
$this->clientParams = $clientParams;
}
public function build()
{
return new NccashierapiClient($this->clientParams);
}
/**
* @param $config AppSdkConfig|array|AppSdkConfigProvider
* @return NccashierapiClientBuilder
* @throws YopClientException
*/
public static function builder($config)
{
$appSdkConfigProvider = null;
if ($config instanceof AppSdkConfigProvider) {
$appSdkConfigProvider = $config;
} else {
$appSdkConfigProvider = new DefaultAppSdkConfigProvider($config);
}
$clientParams = ClientParamsSupport::generateClientParams($appSdkConfigProvider);
$clientParams->setAuthorizationReqRegistry(self::$authorizationReqRegistry);
return new NccashierapiClientBuilder($clientParams);
}
}
NccashierapiClientBuilder::__init();