-
Notifications
You must be signed in to change notification settings - Fork 47
Support for Verification of Payee #499
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
Draft
ampaze
wants to merge
5
commits into
nemiah:master
Choose a base branch
from
ampaze:verification-of-payee
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b0c9991
Check if VoP is supported and required by the bank
ampaze 22fb299
Send the VoP reqeust along with the SEPA transfer request
ampaze b6f1a57
Coding style and documentation
ampaze 868560f
Handling the VoP response WIP
ampaze ce4245a
Handling the VoP response WIP
ampaze File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
|
||
namespace Fhp\Action; | ||
|
||
use Fhp\Protocol\BPD; | ||
use Fhp\Protocol\Message; | ||
use Fhp\Protocol\UPD; | ||
use Fhp\Segment\HIRMS\Rueckmeldungscode; | ||
use Fhp\Segment\VPP\HIVPPSv1; | ||
use Fhp\Segment\VPP\HIVPPv1; | ||
use Fhp\Segment\VPP\HKVPPv1; | ||
use Fhp\UnsupportedException; | ||
|
||
/** | ||
* Initiates an outgoing wire transfer in SEPA format (PAIN XML) with VoP. | ||
* @see FinTS_3.0_Messages_Geschaeftsvorfaelle_VOP_1.01_2025_06_27_FV.pdf | ||
*/ | ||
class SendSEPATransferVoP extends SendSEPATransfer | ||
{ | ||
protected $vopRequired = false; | ||
protected $vopIsPending = false; | ||
protected $vopNeedsConfirmation = false; | ||
|
||
protected function createRequest(BPD $bpd, ?UPD $upd) | ||
{ | ||
$requestSegment = parent::createRequest($bpd, $upd); | ||
$requestSegments = [$requestSegment]; | ||
|
||
// Check if VoP is supported by the bank | ||
|
||
/** @var HIVPPSv1 $hivpps */ | ||
if ($hivpps = $bpd->getLatestSupportedParameters('HIVPPS')) { | ||
// Check if the request segment is in the list of VoP-supported segments | ||
if (in_array($requestSegment->getName(), $hivpps->parameter->vopPflichtigerZahlungsverkehrsauftrag)) { | ||
|
||
$this->vopRequired = true; | ||
|
||
$hkvpp = HKVPPv1::createEmpty(); | ||
|
||
// For now just pretend we support all formats | ||
$supportedFormats = explode(';', $hivpps->parameter->unterstuetztePaymentStatusReportDatenformate); | ||
$hkvpp->unterstuetztePaymentStatusReports->paymentStatusReportDescriptor = $supportedFormats; | ||
|
||
// VoP before the transfer request | ||
$requestSegments = [$hkvpp, $requestSegment]; | ||
} | ||
} | ||
|
||
return $requestSegments; | ||
} | ||
|
||
public function processResponse(Message $response) | ||
{ | ||
// The bank accepted the request as is. | ||
if ($response->findRueckmeldung(Rueckmeldungscode::ENTGEGENGENOMMEN) !== null || $response->findRueckmeldung(Rueckmeldungscode::AUSGEFUEHRT) !== null) { | ||
parent::processResponse($response); | ||
return; | ||
} | ||
|
||
// The Bank does not want a separate HKVPA ("VoP Ausführungsauftrag"). | ||
if ($response->findRueckmeldung(Rueckmeldungscode::VOP_AUSFUEHRUNGSAUFTRAG_NICHT_BENOETIGT) !== null) { | ||
parent::processResponse($response); | ||
return; | ||
} | ||
|
||
if ($response->findRueckmeldung(Rueckmeldungscode::VOP_NAMENSABGLEICH_IST_NOCH_IN_BEARBEITUNG) !== null) { | ||
$this->vopIsPending = true; | ||
return; | ||
} | ||
|
||
// The user needs to check the result of the name check. | ||
if ($response->findRueckmeldung(Rueckmeldungscode::VOP_ERGEBNIS_NAMENSABGLEICH_PRUEFEN) !== null) { | ||
|
||
$this->vopNeedsConfirmation = true; | ||
/** @var HIVPPv1 $hivpp */ | ||
$hivpp = $response->findSegment(HIVPPv1::class); | ||
|
||
throw new UnsupportedException('The user needs to check the result of the name check. This is not implemented yet.'); | ||
} | ||
} | ||
|
||
public function needsTime() | ||
{ | ||
return $this->vopIsPending; | ||
} | ||
|
||
public function needsConfirmation() | ||
{ | ||
return $this->vopNeedsConfirmation; | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
lib/Fhp/Segment/VPP/ErgebnisVopPruefungEinzeltransaktion.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Fhp\Segment\VPP; | ||
|
||
class ErgebnisVopPruefungEinzeltransaktion | ||
{ | ||
public string $ibanEmpfaenger; | ||
|
||
public ?string $ibanZusatzinformationen = null; | ||
|
||
public ?string $abweichenderEmpfängername = null; | ||
|
||
public ?string $anderesIdentifikationmerkmal = null; | ||
|
||
/** Allowed values: RVMC, RCVC, RVNM, RVNA, PDNG */ | ||
public string $vopPruefergebnis; | ||
|
||
public ?string $grundRVNA = null; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Fhp\Segment\VPP; | ||
|
||
use Fhp\Segment\BaseGeschaeftsvorfallparameter; | ||
|
||
/** | ||
* Segment: Namensabgleich Prüfauftrag Parameter | ||
* | ||
* @see FinTS_3.0_Messages_Geschaeftsvorfaelle_VOP_1.01_2025_06_27_FV.pdf | ||
* Section: C.10.7.1 c) | ||
*/ | ||
class HIVPPSv1 extends BaseGeschaeftsvorfallparameter | ||
{ | ||
public ParameterNamensabgleichPruefauftrag $parameter; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Fhp\Segment\VPP; | ||
|
||
use Fhp\Segment\BaseSegment; | ||
use Fhp\Segment\Common\Tsp; | ||
use Fhp\Syntax\Bin; | ||
|
||
/** | ||
* Segment: Namensabgleich Prüfergebnis | ||
* | ||
* @see FinTS_3.0_Messages_Geschaeftsvorfaelle_VOP_1.01_2025_06_27_FV.pdf | ||
* Section: C.10.7.1 b) | ||
*/ | ||
class HIVPPv1 extends BaseSegment | ||
{ | ||
public ?Bin $vopId = null; | ||
|
||
public ?Tsp $vopIdGueltigBis = null; | ||
|
||
public ?Bin $pollingId = null; | ||
|
||
public ?string $paymentStatusReportDescriptor = null; | ||
|
||
public ?Bin $paymentStatusReport = null; | ||
|
||
public ?ErgebnisVopPruefungEinzeltransaktion $ergebnisVopPruefungEinzeltransaktion = null; | ||
|
||
public ?string $aufklaerungstextAutorisierungTrotzAbweichung = null; | ||
|
||
// This value is in seconds | ||
public ?int $wartezeitVorNaechsterAbfrage = null; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Fhp\Segment\VPP; | ||
|
||
use Fhp\Segment\BaseSegment; | ||
use Fhp\Syntax\Bin; | ||
|
||
/** | ||
* Segment: Namensabgleich Prüfauftrag | ||
* | ||
* @see FinTS_3.0_Messages_Geschaeftsvorfaelle_VOP_1.01_2025_06_27_FV.pdf | ||
* Section: C.10.7.1 a) | ||
*/ | ||
class HKVPPv1 extends BaseSegment | ||
{ | ||
public UnterstuetztePaymentStatusReports $unterstuetztePaymentStatusReports; | ||
|
||
public ?Bin $pollingId = null; | ||
|
||
/** Only allowed if {@link ParameterNamensabgleichPruefauftrag::$eingabeAnzahlEintraegeErlaubt} says so. */ | ||
public ?int $maximaleAnzahlEintraege = null; | ||
|
||
/** For pagination. Max length: 35 */ | ||
public ?string $aufsetzpunkt = null; | ||
} |
22 changes: 22 additions & 0 deletions
22
lib/Fhp/Segment/VPP/ParameterNamensabgleichPruefauftrag.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Fhp\Segment\VPP; | ||
|
||
class ParameterNamensabgleichPruefauftrag | ||
{ | ||
public int $maximaleAnzahlCreditTransferTransactionInformationOptIn; | ||
|
||
public bool $aufklaerungstextStrukturiert; | ||
|
||
/** Allowed values: V, S */ | ||
public string $artDerLieferungPaymentStatusReport; | ||
|
||
public bool $sammelzahlungenMitEinemAuftragErlaubt; | ||
|
||
public bool $eingabeAnzahlEintraegeErlaubt; | ||
|
||
public string $unterstuetztePaymentStatusReportDatenformate; | ||
|
||
/** @var string[] @Max(N) Max length each: 6 */ | ||
public array $vopPflichtigerZahlungsverkehrsauftrag; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Fhp\Segment\VPP; | ||
|
||
use Fhp\Segment\BaseDeg; | ||
|
||
class UnterstuetztePaymentStatusReports extends BaseDeg | ||
{ | ||
/** @var string[] @Max(99) Max length each: 256 */ | ||
public array $paymentStatusReportDescriptor; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.