Skip to content

handle iframeAllowed parameter from order request response#46

Merged
konradkozaczenko merged 3 commits into
mainfrom
continue-3ds-http-redirect
Mar 18, 2026
Merged

handle iframeAllowed parameter from order request response#46
konradkozaczenko merged 3 commits into
mainfrom
continue-3ds-http-redirect

Conversation

@konradkozaczenko

@konradkozaczenko konradkozaczenko commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

@konradkozaczenko konradkozaczenko force-pushed the continue-3ds-http-redirect branch from 36de0c5 to fe04f92 Compare March 16, 2026 13:00
@konradkozaczenko konradkozaczenko force-pushed the continue-3ds-http-redirect branch from fe04f92 to 29d625c Compare March 16, 2026 13:06
@konradkozaczenko konradkozaczenko marked this pull request as ready for review March 17, 2026 09:10
@lukasz-falda lukasz-falda requested a review from Copilot March 17, 2026 09:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds handling for the iframeAllowed parameter returned in the PayU order creation response, which is used for 3DS authentication iframe handling. The new Continue3DsHttpRedirect reply class extends HttpRedirect to carry the iframeAllowed flag so consumers can determine whether to render the 3DS redirect in an iframe.

Changes:

  • Added iframeAllowed field to OrderCreatedResponse value object to capture the API response parameter.
  • Introduced Continue3DsHttpRedirect reply class that wraps HttpRedirect with an iframeAllowed boolean property.
  • Updated CaptureAction to throw Continue3DsHttpRedirect instead of HttpRedirect for 3DS redirects, passing the iframe-allowed state.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/ValueObject/Response/OrderCreatedResponse.php Added iframeAllowed property and included it in fromResponse and toArray
src/Core/Reply/Continue3DsHttpRedirect.php New reply class extending HttpRedirect with iframeAllowed flag
src/Action/CaptureAction.php Changed 3DS redirect to use Continue3DsHttpRedirect with iframeAllowed
tests/Integration/Action/CaptureActionTest.php Added iframeAllowed to expected response arrays in test assertions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/Action/CaptureAction.php Outdated
Comment thread src/ValueObject/Response/OrderCreatedResponse.php Outdated
Comment thread src/Core/Reply/Continue3DsHttpRedirect.php Outdated
Comment thread src/Action/CaptureAction.php Outdated
$request->setModel($model);

throw new HttpRedirect($orderCreatedResponse->redirectUri);
throw new Continue3DsHttpRedirect(!(null === $orderCreatedResponse->iframeAllowed), $orderCreatedResponse->redirectUri);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you need this specific redirect?

Handle the iframeAllowed flag in the set/get methods of the \Answear\Payum\PayU\Model\Model class, such as setOrderId(), and simply retrieve this flag where needed using

$model = Model::ensureArrayObject($payment->getDetails());
$model->iframeAllowed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iframeAllowed is strictly related to the redirect. You handle the redirect by catching the exception. When the exception is an instance of Continue3DsHttpRedirect, you can check the iframeAllowed parameter. It's part of the redirect process, not a model object that holds data about the payment, buyer, etc

Comment thread src/Action/CaptureAction.php Outdated
$request->setModel($model);

throw new HttpRedirect($orderCreatedResponse->redirectUri);
throw new Continue3DsHttpRedirect($orderCreatedResponse->iframeAllowed ?? false, $orderCreatedResponse->redirectUri);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iframeAllowed is strictly related to the redirect

agree

So maybe IframeHttpRedirect extends HttpRedirect and here

return match($orderCreatedResponse->iframeAllowed)
  true => new IframeHttpRedirect($orderCreatedResponse->redirectUri),
  false => new HttpRedirect($orderCreatedResponse->redirectUri)

You will have generic exception for iframe without any flags.

public string $orderId,
public ?string $extOrderId = null,
public ?array $payMethods = null,
public ?bool $iframeAllowed = null,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep here default false, will be match better for handling


use Payum\Core\Reply\HttpRedirect;

class Continue3DsHttpRedirect extends HttpRedirect

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

już zapomniałem, że tu się steruje exceptionami :)

@konradkozaczenko konradkozaczenko force-pushed the continue-3ds-http-redirect branch from e9319b2 to 8f6e685 Compare March 18, 2026 09:02
@konradkozaczenko konradkozaczenko force-pushed the continue-3ds-http-redirect branch from 8f6e685 to dc54e4b Compare March 18, 2026 09:10
@konradkozaczenko konradkozaczenko merged commit 11b5b32 into main Mar 18, 2026
3 checks passed
@konradkozaczenko konradkozaczenko deleted the continue-3ds-http-redirect branch March 18, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants