Skip to content
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
4 changes: 2 additions & 2 deletions Tests/Unit/Integration/DKB/SendSEPATransferTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ protected function getSendTransferRequest(): string
{
// Note: strlen() is computed instead of hard-coded because it depends on the indentation in this file, which
// may be changed by linters and other tools, and because it contains line breaks, which are different depending
// the platform where this test runs.
return 'HKCCS:3:1+DExxABCDEFGH1234567890:BYLADEM1001:1234567890::280:12030000+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.003.03+@'
// on the platform where this test runs.
return 'HKCCS:3:1+DExxABCDEFGH1234567890:BYLADEM1001+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.003.03+@'
. strlen(self::PAIN_MESSAGE) . '@' . self::PAIN_MESSAGE . "'HKTAN:4:6+4+HKCCS+++++++++SomePhone1'";
}

Expand Down
8 changes: 5 additions & 3 deletions src/Action/GetBalance.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Fhp\Protocol\Message;
use Fhp\Protocol\UnexpectedResponseException;
use Fhp\Protocol\UPD;
use Fhp\Segment\BaseSegment;
use Fhp\Segment\Common\Kti;
use Fhp\Segment\Common\Kto;
use Fhp\Segment\Common\KtvV3;
Expand All @@ -17,6 +16,7 @@
use Fhp\Segment\SAL\HKSALv5;
use Fhp\Segment\SAL\HKSALv6;
use Fhp\Segment\SAL\HKSALv7;
use Fhp\Segment\SPA\HISPAS;
use Fhp\UnsupportedException;

/**
Expand Down Expand Up @@ -98,7 +98,6 @@ public function getBalances()

protected function createRequest(BPD $bpd, ?UPD $upd)
{
/** @var BaseSegment $hisals */
$hisals = $bpd->requireLatestSupportedParameters('HISALS');
switch ($hisals->getVersion()) {
case 4:
Expand All @@ -108,7 +107,10 @@ protected function createRequest(BPD $bpd, ?UPD $upd)
case 6:
return HKSALv6::create(KtvV3::fromAccount($this->account), $this->allAccounts);
case 7:
return HKSALv7::create(Kti::fromAccount($this->account), $this->allAccounts);
/** @var HISPAS $hispas */
$hispas = $bpd->requireLatestSupportedParameters('HISPAS');
$kti = Kti::fromAccount($this->account, $hispas->getParameter()->getNationaleKontoverbindungErlaubt());
return HKSALv7::create($kti, $this->allAccounts);
default:
throw new UnsupportedException('Unsupported HKSAL version: ' . $hisals->getVersion());
}
Expand Down
6 changes: 5 additions & 1 deletion src/Action/GetStatementOfAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Fhp\Segment\KAZ\HKKAZv5;
use Fhp\Segment\KAZ\HKKAZv6;
use Fhp\Segment\KAZ\HKKAZv7;
use Fhp\Segment\SPA\HISPAS;
use Fhp\UnsupportedException;

/**
Expand Down Expand Up @@ -171,7 +172,10 @@ protected function createRequest(BPD $bpd, ?UPD $upd)
case 6:
return HKKAZv6::create(KtvV3::fromAccount($this->account), $this->allAccounts, $this->from, $this->to);
case 7:
return HKKAZv7::create(Kti::fromAccount($this->account), $this->allAccounts, $this->from, $this->to);
/** @var HISPAS $hispas */
$hispas = $bpd->requireLatestSupportedParameters('HISPAS');
$kti = Kti::fromAccount($this->account, $hispas->getParameter()->getNationaleKontoverbindungErlaubt());
return HKKAZv7::create($kti, $this->allAccounts, $this->from, $this->to);
default:
throw new UnsupportedException('Unsupported HKKAZ version: ' . $hikazs->getVersion());
}
Expand Down
8 changes: 7 additions & 1 deletion src/Action/GetStatementOfAccountXML.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Fhp\Segment\CAZ\UnterstuetzteCamtMessages;
use Fhp\Segment\Common\Kti;
use Fhp\Segment\HIRMS\Rueckmeldungscode;
use Fhp\Segment\SPA\HISPAS;
use Fhp\UnsupportedException;

/**
Expand Down Expand Up @@ -139,10 +140,15 @@ protected function createRequest(BPD $bpd, ?UPD $upd)
if ($this->allAccounts && !$hicazs->getParameter()->getAlleKontenErlaubt()) {
throw new \InvalidArgumentException('The bank do not permit the use of allAccounts=true');
}

/** @var HISPAS $hispas */
$hispas = $bpd->requireLatestSupportedParameters('HISPAS');
$kti = Kti::fromAccount($this->account, $hispas->getParameter()->getNationaleKontoverbindungErlaubt());

switch ($hicazs->getVersion()) {
case 1:
$unterstuetzteCamtMessages = UnterstuetzteCamtMessages::create($camtURNs);
return HKCAZv1::create(Kti::fromAccount($this->account), $unterstuetzteCamtMessages, $this->allAccounts, $this->from, $this->to);
return HKCAZv1::create($kti, $unterstuetzteCamtMessages, $this->allAccounts, $this->from, $this->to);
default:
throw new UnsupportedException('Unsupported HKCAZ version: ' . $hicazs->getVersion());
}
Expand Down
8 changes: 7 additions & 1 deletion src/Action/SendInternationalCreditTransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Fhp\Segment\AUB\HIAUBSv9;
use Fhp\Segment\AUB\HKAUBv9;
use Fhp\Segment\Common\Kti;
use Fhp\Segment\SPA\HISPAS;
use Fhp\Syntax\Bin;

class SendInternationalCreditTransfer extends BaseAction
Expand Down Expand Up @@ -76,11 +77,16 @@ public function __unserialize(array $serialized): void

protected function createRequest(BPD $bpd, ?UPD $upd)
{
/** @var HISPAS $hispas */
$hispas = $bpd->requireLatestSupportedParameters('HISPAS');
/** @var HIAUBSv9 $hiaubs */
$hiaubs = $bpd->requireLatestSupportedParameters('HIAUBS');

$hkaub = HKAUBv9::createEmpty();
$hkaub->kontoverbindungInternational = Kti::fromAccount($this->account);
$hkaub->kontoverbindungInternational = Kti::fromAccount(
$this->account,
$hispas->getParameter()->getNationaleKontoverbindungErlaubt()
);
$hkaub->DTAZVHandbuch = $this->dtavzVersion ?? $hiaubs->parameter->DTAZVHandbuch;
$hkaub->DTAZVDatensatz = new Bin($this->dtavzData);
return $hkaub;
Expand Down
9 changes: 6 additions & 3 deletions src/Action/SendSEPADirectDebit.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ protected function createRequest(BPD $bpd, ?UPD $upd)
$useSingleDirectDebit = false;
}

/** @var HISPAS $hispas */
$hispas = $bpd->requireLatestSupportedParameters('HISPAS');
/* @var HIDXES|BaseSegment $hidxes */
$hidxes = $bpd->requireLatestSupportedParameters(GetSEPADirectDebitParameters::getHixxesSegmentName($this->coreType, $useSingleDirectDebit));

Expand All @@ -142,8 +144,6 @@ protected function createRequest(BPD $bpd, ?UPD $upd)

// If there are no SEPA formats available in the HIDXES Parameters, we look to the general formats
if (!is_array($supportedPainNamespaces) || count($supportedPainNamespaces) === 0) {
/** @var HISPAS $hispas */
$hispas = $bpd->requireLatestSupportedParameters('HISPAS');
$supportedPainNamespaces = $hispas->getParameter()->getUnterstuetzteSEPADatenformate();
}

Expand All @@ -163,7 +163,10 @@ protected function createRequest(BPD $bpd, ?UPD $upd)

/** @var HKDMEv2|HKDSEv2|HIDXES $hkdxe */
$hkdxe = $hidxes->createRequestSegment();
$hkdxe->kontoverbindungInternational = Kti::fromAccount($this->account);
$hkdxe->kontoverbindungInternational = Kti::fromAccount(
$this->account,
$hispas->getParameter()->getNationaleKontoverbindungErlaubt()
);
$hkdxe->sepaDescriptor = $this->painNamespace;
$hkdxe->sepaPainMessage = new Bin($this->painMessage);

Expand Down
10 changes: 7 additions & 3 deletions src/Action/SendSEPARealtimeTransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Fhp\Segment\HIRMS\Rueckmeldungscode;
use Fhp\Segment\IPZ\HIIPZSv1;
use Fhp\Segment\IPZ\HIIPZSv2;
use Fhp\Segment\IPZ\HKIPZv1;
use Fhp\Segment\IPZ\HKIPZv2;
use Fhp\Segment\SPA\HISPAS;
use Fhp\Syntax\Bin;
Expand Down Expand Up @@ -95,15 +96,15 @@ public function __unserialize(array $serialized): void

protected function createRequest(BPD $bpd, ?UPD $upd)
{
/** @var HISPAS $hispas */
$hispas = $bpd->requireLatestSupportedParameters('HISPAS');
/** @var HIIPZSv1|HIIPZSv2 $hiipzs */
$hiipzs = $bpd->requireLatestSupportedParameters('HIIPZS');

$supportedSchemas = $hiipzs->parameter->getUnterstuetzteSEPADatenformate();

// If there are no SEPA formats available in the HIIPZS Parameters, we look to the general formats
if (is_null($supportedSchemas)) {
/** @var HISPAS $hispas */
$hispas = $bpd->requireLatestSupportedParameters('HISPAS');
$supportedSchemas = $hispas->getParameter()->getUnterstuetzteSEPADatenformate();
}

Expand All @@ -123,7 +124,10 @@ protected function createRequest(BPD $bpd, ?UPD $upd)

/** @var HKIPZv1|HKIPZv2 $hkipz */
$hkipz = $hiipzs->createRequestSegment();
$hkipz->kontoverbindungInternational = Kti::fromAccount($this->account);
$hkipz->kontoverbindungInternational = Kti::fromAccount(
$this->account,
$hispas->getParameter()->getNationaleKontoverbindungErlaubt()
);
$hkipz->sepaDescriptor = $this->xmlSchema;
$hkipz->sepaPainMessage = new Bin($this->painMessage);
if ($hiipzs instanceof HIIPZSv2) {
Expand Down
5 changes: 4 additions & 1 deletion src/Action/SendSEPATransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ protected function createRequest(BPD $bpd, ?UPD $upd)
. implode(', ', $supportedSchemas));
}

$segment->kontoverbindungInternational = Kti::fromAccount($this->account);
$segment->kontoverbindungInternational = Kti::fromAccount(
$this->account,
$hispas->getParameter()->getNationaleKontoverbindungErlaubt()
);
$segment->sepaDescriptor = $this->xmlSchema;
$segment->sepaPainMessage = new Bin($this->painMessage);

Expand Down
10 changes: 6 additions & 4 deletions src/Segment/Common/Kti.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ public static function create(?string $iban, ?string $bic): Kti
return $result;
}

public static function fromAccount(SEPAAccount $account): Kti
public static function fromAccount(SEPAAccount $account, bool $nationaleKontoverbindungErlaubt): Kti
{
$result = static::create($account->getIban(), $account->getBic());
$result->kontonummer = $account->getAccountNumber();
$result->unterkontomerkmal = $account->getSubAccount();
$result->kreditinstitutskennung = Kik::create($account->getBlz());
if ($nationaleKontoverbindungErlaubt) {
$result->kontonummer = $account->getAccountNumber();
$result->unterkontomerkmal = $account->getSubAccount();
$result->kreditinstitutskennung = Kik::create($account->getBlz());
}
return $result;
}

Expand Down
1 change: 1 addition & 0 deletions src/Segment/SPA/ParameterSepaKontoverbindungAnfordern.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
*/
interface ParameterSepaKontoverbindungAnfordern extends UnterstuetzteSEPADatenformate
{
public function getNationaleKontoverbindungErlaubt(): bool;
}
5 changes: 5 additions & 0 deletions src/Segment/SPA/ParameterSepaKontoverbindungAnfordernV1.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ class ParameterSepaKontoverbindungAnfordernV1 extends BaseDeg implements Paramet
public bool $strukturierterVerwendungszweckErlaubt;
/** @var string[] @Max(99) Max length each: 256 */
public array $unterstuetzteSepaDatenformate;

public function getNationaleKontoverbindungErlaubt(): bool
{
return $this->nationaleKontoverbindungErlaubt;
}
}
5 changes: 5 additions & 0 deletions src/Segment/SPA/ParameterSepaKontoverbindungAnfordernV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ class ParameterSepaKontoverbindungAnfordernV2 extends BaseDeg implements Paramet
public bool $eingabeAnzahlEintraegeErlaubt;
/** @var string[] @Max(99) Max length each: 256 */
public array $unterstuetzteSepaDatenformate;

public function getNationaleKontoverbindungErlaubt(): bool
{
return $this->nationaleKontoverbindungErlaubt;
}
}
5 changes: 5 additions & 0 deletions src/Segment/SPA/ParameterSepaKontoverbindungAnfordernV3.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ class ParameterSepaKontoverbindungAnfordernV3 extends BaseDeg implements Paramet
public int $anzahlReservierterVerwendungszweckstellen;
/** @var string[] @Max(99) Max length each: 256 */
public array $unterstuetzteSepaDatenformate;

public function getNationaleKontoverbindungErlaubt(): bool
{
return $this->nationaleKontoverbindungErlaubt;
}
}
Loading