first commit
This commit is contained in:
67
lib/Service/Bill/Model/DownloadRequest.php
Normal file
67
lib/Service/Bill/Model/DownloadRequest.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Yeepay\Yop\Sdk\Service\Bill\Model;
|
||||
|
||||
use Yeepay\Yop\Sdk\Model\BaseRequest;
|
||||
|
||||
class DownloadRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $bizType;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $billDate;
|
||||
|
||||
/**
|
||||
* Gets bizType
|
||||
* @return string
|
||||
*/
|
||||
public function getBizType()
|
||||
{
|
||||
return $this->bizType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets bizType
|
||||
* @param string $bizType
|
||||
* @return DownloadRequest
|
||||
*/
|
||||
public function setBizType($bizType)
|
||||
{
|
||||
$this->bizType = $bizType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets billDate
|
||||
* @return string
|
||||
*/
|
||||
public function getBillDate()
|
||||
{
|
||||
return $this->billDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets billDate
|
||||
* @param string $billDate
|
||||
* @return DownloadRequest
|
||||
*/
|
||||
public function setBillDate($billDate)
|
||||
{
|
||||
$this->billDate = $billDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public static function getOperationId()
|
||||
{
|
||||
return 'download';
|
||||
}
|
||||
|
||||
}
|
||||
77
lib/Service/Bill/Model/DownloadRequestMarshaller.php
Normal file
77
lib/Service/Bill/Model/DownloadRequestMarshaller.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Yeepay\Yop\Sdk\Service\Bill\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\UUIDUtils;
|
||||
|
||||
class DownloadRequestMarshaller implements RequestMarshaller
|
||||
{
|
||||
|
||||
/**
|
||||
* @var DownloadRequestMarshaller
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
public static function __init()
|
||||
{
|
||||
self::$instance = new DownloadRequestMarshaller();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DownloadRequestMarshaller
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $serviceName = 'Bill';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $httpMethod = 'GET';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $resourcePath = '/yos/v1.0/bill/download';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $contentType = 'application/x-www-form-urlencoded';
|
||||
|
||||
/**
|
||||
* @param DownloadRequest $request
|
||||
* @return Request
|
||||
*/
|
||||
public function marshal($request)
|
||||
{
|
||||
$internalRequest = new DefaultRequest($this->serviceName);
|
||||
$internalRequest->setResourcePath($this->resourcePath);
|
||||
$internalRequest->setHttpMethod($this->httpMethod);
|
||||
$internalRequest->setYosFlag(true);
|
||||
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());
|
||||
}
|
||||
$internalRequest->addHeader(Headers::CONTENT_TYPE, $this->contentType);
|
||||
|
||||
return $internalRequest;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DownloadRequestMarshaller::__init();
|
||||
Reference in New Issue
Block a user