Skip to content

Commit

Permalink
feat: Add FWAV, INFO, ITAV, ITBD and XPCD balance types
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyvdSluijs committed Aug 1, 2024
1 parent 08ff6d7 commit 3fca94c
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/DTO/Balance.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ class Balance

public const TYPE_CLOSING_AVAILABLE = 'closing_available';

public const TYPE_FORWARD_AVAILABLE = 'forward_available';

public const TYPE_INFORMATION = 'information';

public const TYPE_INTERIM = 'interim';

public const TYPE_INTERIM_AVAILABLE = 'interim_available';

public const TYPE_EXPECTED_CREDIT = 'expected_credit';

private Money $amount;

private string $type;
Expand Down Expand Up @@ -64,4 +74,29 @@ public static function closingAvailable(Money $amount, DateTimeImmutable $date):
{
return new self(self::TYPE_CLOSING_AVAILABLE, $amount, $date);
}

public static function forwardAvailable(Money $amount, DateTimeImmutable $date): self
{
return new self(self::TYPE_FORWARD_AVAILABLE, $amount, $date);
}

public static function information(Money $amount, DateTimeImmutable $date): self
{
return new self(self::TYPE_INFORMATION, $amount, $date);
}

public static function interim(Money $amount, DateTimeImmutable $date): self
{
return new self(self::TYPE_INTERIM, $amount, $date);
}

public static function interimAvailable(Money $amount, DateTimeImmutable $date): self
{
return new self(self::TYPE_INTERIM_AVAILABLE, $amount, $date);
}

public static function expectedCredit(Money $amount, DateTimeImmutable $date): self
{
return new self(self::TYPE_EXPECTED_CREDIT, $amount, $date);
}
}
36 changes: 36 additions & 0 deletions src/Decoder/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,42 @@ public function addBalances(RecordWithBalances $record, SimpleXMLElement $xmlRec
$date
));

break;
case 'FWAV':
$record->addBalance(DTO\Balance::forwardAvailable(
$money,
$date
));

break;
case 'INFO':
$record->addBalance(DTO\Balance::information(
$money,
$date
));

break;
case 'ITAV':
$record->addBalance(DTO\Balance::interimAvailable(
$money,
$date
));

break;
case 'ITDB':
$record->addBalance(DTO\Balance::interim(
$money,
$date
));

break;

case 'XPCD':
$record->addBalance(DTO\Balance::expectedCredit(
$money,
$date
));

break;
default:
break;
Expand Down

0 comments on commit 3fca94c

Please sign in to comment.