@@ -109,18 +109,31 @@ public static function checkVopConfirmationRequired(
109109 if ($ hivpp ->ergebnisVopPruefungEinzeltransaktion === null ) {
110110 throw new UnsupportedException ('Missing paymentStatusReport and ergebnisVopPruefungEinzeltransaktion ' );
111111 }
112- $ verificationResultCode = $ hivpp ->ergebnisVopPruefungEinzeltransaktion ->vopPruefergebnis ;
112+ $ verificationResult = VopVerificationResult::parse (
113+ $ hivpp ->ergebnisVopPruefungEinzeltransaktion ->vopPruefergebnis
114+ );
113115 $ verificationNotApplicableReason = $ hivpp ->ergebnisVopPruefungEinzeltransaktion ->grundRVNA ;
114116 } else {
115117 $ report = simplexml_load_string ($ hivpp ->paymentStatusReport ->getData ());
116- $ verificationResultCode = $ report ->CstmrPmtStsRpt ->OrgnlGrpInfAndSts ->GrpSts ?: null ;
118+ $ verificationResult = VopVerificationResult::parse (
119+ $ report ->CstmrPmtStsRpt ->OrgnlGrpInfAndSts ->GrpSts ?: null
120+ );
121+
122+ // For a single transaction, we can do better than "CompletedPartialMatch",
123+ // which can indicate either CompletedCloseMatch or CompletedNoMatch
124+ if (intval ($ report ->CstmrPmtStsRpt ->OrgnlGrpInfAndSts ->OrgnlNbOfTxs ?: 0 ) === 1
125+ && $ verificationResult === VopVerificationResult::CompletedPartialMatch
126+ && $ verificationResultCode = $ report ->CstmrPmtStsRpt ->OrgnlPmtInfAndSts ->TxInfAndSts ?->TxSts
127+ ) {
128+ $ verificationResult = VopVerificationResult::parse ($ verificationResultCode );
129+ }
117130 }
118131
119132 return new VopConfirmationRequestImpl (
120133 $ hivpp ->vopId ,
121134 $ hivpp ->vopIdGueltigBis ?->asDateTime(),
122135 $ hivpp ->aufklaerungstextAutorisierungTrotzAbweichung ,
123- VopVerificationResult:: parse ( $ verificationResultCode ) ,
136+ $ verificationResult ,
124137 $ verificationNotApplicableReason ,
125138 );
126139 }
0 commit comments