Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions src/Banking/Operation.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

declare(strict_types=1);
Expand Down Expand Up @@ -35,6 +35,7 @@
private readonly ?string $currencyCode,
private readonly ?string $rejectCode,
private readonly ?string $exemptCode,
private readonly ?string $bankOperationReference,
) {
$this->details = [];
}
Expand Down Expand Up @@ -103,6 +104,11 @@
{
return $this->amount;
}

public function getBankOperationReference(): ?string
{
return $this->bankOperationReference;
}

public function addDetails(OperationDetail $details): self
{
Expand Down
5 changes: 3 additions & 2 deletions src/Parser/Cfonb120/Line04Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct()
'exempt_code' => new RegexParts(LineParser::ALL, 1),
'_unused_3' => new RegexParts(LineParser::ALL, 1),
'amount' => new RegexParts(LineParser::AMOUNT, 13),
'_unused_5' => new RegexParts(LineParser::ALL, 16),
'bank_operation_reference' => new RegexParts(LineParser::ALPHANUMERIC_BLANK, 16),
]);
}

Expand All @@ -71,7 +71,8 @@ public function parse(string $content, bool $strict): Operation
$regexMatch->getStringOrNull('internal_code'),
$regexMatch->getStringOrNull('currency_code'),
$regexMatch->getStringOrNull('reject_code'),
$regexMatch->getStringOrNull('exempt_code')
$regexMatch->getStringOrNull('exempt_code'),
$regexMatch->getStringOrNull('bank_operation_reference')
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Parser/RegexMatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
use function strlen;

/** @internal */
class RegexMatch

Choose a reason for hiding this comment

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

Why these changes in this class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, that change wasn't necessary. I've just rolled it back.

readonly class RegexMatch
{
/** @var array<string, string|null> */
private readonly array $values;
private array $values;

/**
* @param array<string, RegexParts> $regexParts
Expand Down
6 changes: 4 additions & 2 deletions tests/Banking/OperationTest.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

declare(strict_types=1);
Expand Down Expand Up @@ -40,9 +40,10 @@
'test7',
'test8',
'test9',
'test10'
'test10',
'test11',
);

self::assertSame('test', $sUT->getBankCode());
self::assertSame('test2', $sUT->getDeskCode());
self::assertSame('test3', $sUT->getAccountNumber());
Expand All @@ -56,6 +57,7 @@
self::assertSame('test8', $sUT->getCurrencyCode());
self::assertSame('test9', $sUT->getRejectCode());
self::assertSame('test10', $sUT->getExemptCode());
self::assertSame('test11', $sUT->getBankOperationReference());
self::assertCount(0, $sUT->getDetails());

$detail = $this->createMock(OperationDetail::class);
Expand Down