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

Add disposalDate property in InvoiceSummary items #66

Merged
merged 4 commits into from
Dec 14, 2023
Merged
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
8 changes: 8 additions & 0 deletions src/Bookkeeping/InvoiceSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ final class InvoiceSummary
private DateTimeImmutable $createdAt;
private DateTimeImmutable $modifiedAt;
private DateTimeImmutable $paidAt;
private DateTimeImmutable $disposalDate;
private InvoicePaymentMethod $paymentMethod;

public function __construct(
Expand All @@ -32,6 +33,7 @@ public function __construct(
DateTimeImmutable $createdAt,
DateTimeImmutable $modifiedAt,
DateTimeImmutable $paidAt,
DateTimeImmutable $disposalDate,
InvoicePaymentMethod $paymentMethod
) {
$this->identifier = $identifier;
Expand All @@ -42,6 +44,7 @@ public function __construct(
$this->createdAt = $createdAt;
$this->modifiedAt = $modifiedAt;
$this->paidAt = $paidAt;
$this->disposalDate = $disposalDate;
$this->paymentMethod = $paymentMethod;
}

Expand Down Expand Up @@ -85,6 +88,11 @@ public function getPaidAt(): DateTimeImmutable
return $this->paidAt;
}

public function getDisposalDate(): DateTimeImmutable
{
return $this->disposalDate;
}

public function getPaymentMethod(): InvoicePaymentMethod
{
return $this->paymentMethod;
Expand Down
1 change: 1 addition & 0 deletions src/Wfirma/Invoice/Factory/InvoiceSummaryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function getSummaryFromApiData(array $data): InvoiceSummary
new DateTimeImmutable($data['created']),
new DateTimeImmutable($data['modified']),
new DateTimeImmutable($data['paymentdate']),
new DateTimeImmutable($data['disposaldate']),
new InvoicePaymentMethod($data['paymentmethod'])
);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/Bookkeeping/InvoiceSummaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function testGettersReturnProperValues(): void
new \DateTimeImmutable('2023-05-10'),
new \DateTimeImmutable('2023-05-11'),
new \DateTimeImmutable('2023-05-12'),
new \DateTimeImmutable('2023-05-16'),
new InvoicePaymentMethod('transfer')
);
$this->assertEquals('123', (string) $summary->getIdentifier());
Expand All @@ -36,6 +37,7 @@ public function testGettersReturnProperValues(): void
$this->assertEquals('2023-05-10', $summary->getCreatedAt()->format('Y-m-d'));
$this->assertEquals('2023-05-11', $summary->getModifiedAt()->format('Y-m-d'));
$this->assertEquals('2023-05-12', $summary->getPaidAt()->format('Y-m-d'));
$this->assertEquals('2023-05-16', $summary->getDisposalDate()->format('Y-m-d'));
$this->assertTrue($summary->getPaymentMethod()->isTransfer());
}
}