-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8739c4
commit eda41f1
Showing
5 changed files
with
222 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
src/Model/Request/Reports/WalletHistoryReportRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<?php | ||
|
||
namespace KassaCom\SDK\Model\Request\Reports; | ||
|
||
|
||
use KassaCom\SDK\Model\Request\AbstractRequest; | ||
use KassaCom\SDK\Model\Traits\RecursiveRestoreTrait; | ||
|
||
class WalletHistoryReportRequest extends AbstractRequest | ||
{ | ||
use RecursiveRestoreTrait; | ||
|
||
/** | ||
* Начала периода, в формате datetime | ||
* | ||
* @var \DateTime | ||
*/ | ||
private $datetimeFrom; | ||
|
||
/** | ||
* Завершение периода, в формате datetime | ||
* | ||
* @var \DateTime | ||
*/ | ||
private $datetimeTo; | ||
|
||
/** | ||
* Идентификатор кошелька | ||
* | ||
* @var integer | ||
*/ | ||
private $walletId; | ||
|
||
/** | ||
* Фильтр по типам записей в истории. | ||
* | ||
* @var array|null | ||
*/ | ||
private $operationType; | ||
|
||
/** | ||
* @return \DateTime | ||
*/ | ||
public function getDatetimeFrom() | ||
{ | ||
return $this->datetimeFrom; | ||
} | ||
|
||
/** | ||
* @param \DateTime $datetimeFrom | ||
*/ | ||
public function setDatetimeFrom($datetimeFrom) | ||
{ | ||
$this->datetimeFrom = $datetimeFrom; | ||
} | ||
|
||
/** | ||
* @return \DateTime | ||
*/ | ||
public function getDatetimeTo() | ||
{ | ||
return $this->datetimeTo; | ||
} | ||
|
||
/** | ||
* @param \DateTime $datetimeTo | ||
*/ | ||
public function setDatetimeTo($datetimeTo) | ||
{ | ||
$this->datetimeTo = $datetimeTo; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getWalletId() | ||
{ | ||
return $this->walletId; | ||
} | ||
|
||
/** | ||
* @param int $walletId | ||
*/ | ||
public function setWalletId($walletId) | ||
{ | ||
$this->walletId = $walletId; | ||
} | ||
|
||
/** | ||
* @return array|null | ||
*/ | ||
public function getOperationType() | ||
{ | ||
return $this->operationType; | ||
} | ||
|
||
/** | ||
* @param array|null $operationType | ||
*/ | ||
public function setOperationType($operationType) | ||
{ | ||
$this->operationType = $operationType; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getRequiredFields() | ||
{ | ||
return [ | ||
'datetime_from' => self::TYPE_DATE, | ||
'datetime_to' => self::TYPE_DATE, | ||
'wallet_id' => self::TYPE_INTEGER, | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getOptionalFields() | ||
{ | ||
return [ | ||
'operation_type' => [self::TYPE_STRING], | ||
]; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/Model/Request/Reports/WalletHistoryReportSerializer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace KassaCom\SDK\Model\Request\Reports; | ||
|
||
use KassaCom\SDK\Model\Request\AbstractRequestSerializer; | ||
|
||
class WalletHistoryReportSerializer extends AbstractRequestSerializer | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getSerializedData() | ||
{ | ||
/** @var WalletHistoryReportRequest $request */ | ||
$request = $this->request; | ||
|
||
$data = [ | ||
'datetime_from' => $request->getDatetimeFrom()->format('c'), | ||
'datetime_to' => $request->getDatetimeTo()->format('c'), | ||
'wallet_id' => $request->getWalletId(), | ||
]; | ||
|
||
if ($request->getOperationType() !== null) { | ||
$data['operation_type'] = $request->getOperationType(); | ||
} | ||
|
||
return $data; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/Model/Request/Reports/WalletHistoryReportTransport.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace KassaCom\SDK\Model\Request\Reports; | ||
|
||
use KassaCom\SDK\Model\Request\AbstractRequestTransport; | ||
use KassaCom\SDK\Transport\AbstractApiTransport; | ||
|
||
class WalletHistoryReportTransport extends AbstractRequestTransport | ||
{ | ||
const PATH = 'report/wallet/registry.csv'; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getPath() | ||
{ | ||
return self::PATH; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getMethod() | ||
{ | ||
return AbstractApiTransport::METHOD_GET; | ||
} | ||
|
||
public function getBodyForRequest() | ||
{ | ||
return $this->getBody(); | ||
} | ||
} |