Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom date range for order type PTK #193

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/EbicsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,16 +375,21 @@ function ($segmentNumber, $isLastSegment) use ($dateTime) {
* @inheritDoc
* @throws Exceptions\EbicsException
*/
public function PTK(DateTimeInterface $dateTime = null): DownloadOrderResult
{
public function PTK(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that here is another naming.

This naming was before.

   DateTimeInterface $dateTime = null,
        DateTimeInterface $startDateTime = null,
        DateTimeInterface $endDateTime = null

And tests not updated.

DateTimeInterface $startDate = null,
DateTimeInterface $stopDate = null,
DateTimeInterface $dateTime = null
): DownloadOrderResult {
if (null === $dateTime) {
$dateTime = new DateTime();
}

$transaction = $this->downloadTransaction(
function ($segmentNumber, $isLastSegment) use ($dateTime) {
function ($segmentNumber, $isLastSegment) use ($startDate, $stopDate, $dateTime) {
return $this->requestFactory->createPTK(
$dateTime,
$startDate,
$stopDate,
$segmentNumber,
$isLastSegment
);
Expand Down
15 changes: 10 additions & 5 deletions src/Factories/RequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ public function createHKD(
*/
public function createPTK(
DateTimeInterface $dateTime,
DateTimeInterface $startDate = null,
DateTimeInterface $stopDate = null,
int $segmentNumber = null,
bool $isLastSegment = null
): Request {
Expand All @@ -399,20 +401,23 @@ public function createPTK(

$request = $this
->createRequestBuilderInstance()
->addContainerSecured(function (XmlBuilder $builder) use ($context) {
$builder->addHeader(function (HeaderBuilder $builder) use ($context) {
$builder->addStatic(function (StaticBuilder $builder) use ($context) {
->addContainerSecured(function (XmlBuilder $builder) use ($context, $startDate, $stopDate) {
$builder->addHeader(function (HeaderBuilder $builder) use ($context, $startDate, $stopDate) {
$builder->addStatic(function (StaticBuilder $builder) use ($context, $startDate, $stopDate) {
$builder
->addHostId($context->getBank()->getHostId())
->addRandomNonce()
->addTimestamp($context->getDateTime())
->addPartnerId($context->getUser()->getPartnerId())
->addUserId($context->getUser()->getUserId())
->addProduct('Ebics client PHP', 'de')
->addOrderDetails(function (OrderDetailsBuilder $orderDetailsBuilder) {
->addOrderDetails(function (OrderDetailsBuilder $orderDetailsBuilder) use (
$startDate,
$stopDate
) {
$this
->addOrderType($orderDetailsBuilder, 'PTK')
->addStandardOrderParams();
->addStandardOrderParams($startDate, $stopDate);
})
->addBankPubKeyDigests(
$context->getKeyring()->getBankSignatureXVersion(),
Expand Down
Loading