diff --git a/lib/Fhp/Action/SendSEPATransferVoP.php b/lib/Fhp/Action/SendSEPATransferVoP.php new file mode 100644 index 00000000..e9c7def1 --- /dev/null +++ b/lib/Fhp/Action/SendSEPATransferVoP.php @@ -0,0 +1,92 @@ +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; + } + +} \ No newline at end of file diff --git a/lib/Fhp/BaseAction.php b/lib/Fhp/BaseAction.php index d36dec6a..93662fa0 100644 --- a/lib/Fhp/BaseAction.php +++ b/lib/Fhp/BaseAction.php @@ -144,6 +144,16 @@ public function getTanRequest(): ?TanRequest return $this->tanRequest; } + public function needsConfirmation() + { + return false; + } + + public function needsTime() + { + return false; + } + /** * Throws an exception unless this action has been successfully executed, i.e. in the following cases: * - the action has not been {@link FinTs::execute()}-d at all or the {@link FinTs::execute()} call for it threw an diff --git a/lib/Fhp/Segment/HIRMS/Rueckmeldungscode.php b/lib/Fhp/Segment/HIRMS/Rueckmeldungscode.php index 7a53a5e2..d3a88c31 100644 --- a/lib/Fhp/Segment/HIRMS/Rueckmeldungscode.php +++ b/lib/Fhp/Segment/HIRMS/Rueckmeldungscode.php @@ -79,6 +79,16 @@ public static function isError(int $code): bool */ public const PAGINATION = 3040; + public const VOP_KEINE_NAMENSABWEICHUNG = 0025; + + public const VOP_ERGEBNIS_NAMENSABGLEICH_PRUEFEN = 3090; + + public const VOP_AUSFUEHRUNGSAUFTRAG_NICHT_BENOETIGT = 3091; + + public const VOP_NAMENSABGLEICH_IST_NOCH_IN_BEARBEITUNG = 3093; + + public const VOP_NAMENSABGLEICH_IST_KOMPLETT = 3094; + /** * Zugelassene Ein- und Zwei-Schritt-Verfahren für den Benutzer (+ Rückmeldungsparameter). * The parameters reference the VerfahrensparameterZweiSchrittVerfahren.sicherheitsfunktion values (900..997) from diff --git a/lib/Fhp/Segment/VPP/ErgebnisVopPruefungEinzeltransaktion.php b/lib/Fhp/Segment/VPP/ErgebnisVopPruefungEinzeltransaktion.php new file mode 100644 index 00000000..1b33e14d --- /dev/null +++ b/lib/Fhp/Segment/VPP/ErgebnisVopPruefungEinzeltransaktion.php @@ -0,0 +1,19 @@ +