|
8 | 8 | use Fhp\Model\TanRequest; |
9 | 9 | use Fhp\Model\VopConfirmationRequest; |
10 | 10 | use Fhp\Protocol\ActionIncompleteException; |
| 11 | +use Fhp\Protocol\ActionPendingException; |
11 | 12 | use Fhp\Protocol\BPD; |
12 | 13 | use Fhp\Protocol\Message; |
13 | 14 | use Fhp\Protocol\TanRequiredException; |
14 | 15 | use Fhp\Protocol\UnexpectedResponseException; |
15 | 16 | use Fhp\Protocol\UPD; |
| 17 | +use Fhp\Protocol\VopConfirmationRequiredException; |
16 | 18 | use Fhp\Segment\BaseSegment; |
17 | 19 | use Fhp\Segment\HIRMS\Rueckmeldung; |
18 | 20 | use Fhp\Segment\HIRMS\Rueckmeldungscode; |
@@ -171,21 +173,30 @@ public function getVopConfirmationRequest(): ?VopConfirmationRequest |
171 | 173 | * Throws an exception unless this action has been successfully executed, i.e. in the following cases: |
172 | 174 | * - the action has not been {@link FinTs::execute()}-d at all or the {@link FinTs::execute()} call for it threw an |
173 | 175 | * exception, |
174 | | - * - the action is awaiting a TAN/confirmation (as per {@link BaseAction::needsTan()}. |
| 176 | + * - the action is awaiting a TAN/confirmation (as per {@link BaseAction::needsTan()}, |
| 177 | + * - the action is pending a long-running operation on the bank server ({@link BaseAction::needsPollingWait()}), |
| 178 | + * - the action is awaiting the user's confirmation of the Verification of Payee result (as per |
| 179 | + * {@link BaseAction::needsVopConfirmation()}). |
175 | 180 | * |
176 | 181 | * After executing an action, you can use this function to make sure that it succeeded. This is especially useful |
177 | 182 | * for actions that don't have any results (as each result getter would call {@link ensureDone()} internally). |
178 | 183 | * On the other hand, you do not need to call this function if you make sure that (1) you called |
179 | | - * {@link FinTs::execute()} and (2) you checked {@link needsTan()} and, if it returned true, supplied a TAN by |
180 | | - * calling {@ink FinTs::submitTan()}. Note that both exception types thrown from this method are sub-classes of |
181 | | - * {@link \RuntimeException}, so you shouldn't need a try-catch block at the call site for this. |
| 184 | + * {@link FinTs::execute()} and (2) you checked and resolved all other special outcome states documented there. |
| 185 | + * Note that both exception types thrown from this method are sub-classes of {@link \RuntimeException}, so you |
| 186 | + * shouldn't need a try-catch block at the call site for this. |
182 | 187 | * @throws ActionIncompleteException If the action hasn't even been executed. |
| 188 | + * @throws ActionPendingException If the action is pending a long-running server operation that needs polling. |
| 189 | + * @throws VopConfirmationRequiredException If the action requires the user's confirmation for VOP. |
183 | 190 | * @throws TanRequiredException If the action needs a TAN. |
184 | 191 | */ |
185 | | - public function ensureDone() |
| 192 | + public function ensureDone(): void |
186 | 193 | { |
187 | 194 | if ($this->tanRequest !== null) { |
188 | 195 | throw new TanRequiredException($this->tanRequest); |
| 196 | + } elseif ($this->pollingInfo !== null) { |
| 197 | + throw new ActionPendingException($this->pollingInfo); |
| 198 | + } elseif ($this->vopConfirmationRequest !== null) { |
| 199 | + throw new VopConfirmationRequiredException($this->vopConfirmationRequest); |
189 | 200 | } elseif (!$this->isDone()) { |
190 | 201 | throw new ActionIncompleteException(); |
191 | 202 | } |
|
0 commit comments