first commit
This commit is contained in:
49
lib/Service/Bill/BillClient.php
Normal file
49
lib/Service/Bill/BillClient.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Yeepay\Yop\Sdk\Service\Bill;
|
||||
|
||||
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\Model\YosDownloadResponse;
|
||||
use Yeepay\Yop\Sdk\Model\YosDownloadResponseUnMarshaller;
|
||||
use Yeepay\Yop\Sdk\Service\Bill\Model as Model;
|
||||
|
||||
class BillClient
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ClientHandler
|
||||
*/
|
||||
private $clientHandler;
|
||||
|
||||
/**
|
||||
* BillClient constructor.
|
||||
* @param ClientParams $clientParams
|
||||
*/
|
||||
function __construct(ClientParams $clientParams)
|
||||
{
|
||||
$this->clientHandler = new ClientHandler($clientParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model\DownloadRequest $request
|
||||
* @return YosDownloadResponse
|
||||
* @throws YopClientException
|
||||
*/
|
||||
public function download(Model\DownloadRequest $request)
|
||||
{
|
||||
if ($request == null) {
|
||||
throw new YopClientException("request is required.");
|
||||
}
|
||||
if ($request->getBizType() == null) {
|
||||
throw new YopClientException("request.bizType is required.");
|
||||
}
|
||||
$clientExecutionParams = new ClientExecutionParams($request, Model\DownloadRequestMarshaller::getInstance(),
|
||||
YosDownloadResponseUnMarshaller::getInstance());
|
||||
|
||||
return $this->clientHandler->execute($clientExecutionParams);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user