Skip to content

[API] Payment Request fix default action when IRI is given#18722

Merged
TheMilek merged 7 commits intoSylius:2.1from
Prometee:fix-default-action
Jan 16, 2026
Merged

[API] Payment Request fix default action when IRI is given#18722
TheMilek merged 7 commits intoSylius:2.1from
Prometee:fix-default-action

Conversation

@Prometee
Copy link
Copy Markdown
Contributor

Q A
Branch? 2.0
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets none
License MIT

Description

This PR improves the handling of payment request actions by also handling IRI payment method.

Changes

1. Remove explicit action parameter from Behat tests

  • Removed the hardcoded action field from payment request context in Behat tests
  • The action is already automatically determined based on the payment method configuration

2. Enhanced PaymentRequestActionAwareContextBuilder

  • Added IRI to identifier conversion support for paymentMethodCode parameter
  • Injected IriToIdentifierConverterInterface to handle IRI format payment method codes
  • When paymentMethodCode is provided as an IRI (e.g., /api/v2/shop/payment-methods/code), it's automatically converted to the identifier before determining the default action
  • This ensures the default action provider can correctly resolve the action based on the payment method configuration

Benefits

  • Improved flexibility: Supports both direct payment method codes and IRI references
  • Better consistency: The default action is always determined from the payment method configuration, reducing potential mismatches
  • Cleaner code: Removes redundant action specifications from tests and API calls

Technical Details

The PaymentRequestActionAwareContextBuilder now:

  1. Checks if the paymentMethodCode is an IRI
  2. Converts it to an identifier if needed

This change maintains backward compatibility while adding support for IRI-based payment method references.

@Prometee Prometee requested review from a team as code owners January 14, 2026 22:20
@probot-autolabeler probot-autolabeler bot added the API APIs related issues and PRs. label Jan 14, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 14, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 14, 2026

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment

@Prometee Prometee changed the title Fix default action [API] Payment Request fix default action when IRI given Jan 14, 2026
@Prometee Prometee changed the title [API] Payment Request fix default action when IRI given [API] Payment Request fix default action when IRI is given Jan 14, 2026
@probot-autolabeler probot-autolabeler bot added Docker Docker-related issues and PRs. Maintenance CI configurations, READMEs, releases, etc. labels Jan 15, 2026
@Prometee Prometee changed the base branch from 2.0 to 2.1 January 15, 2026 09:49
Prometee and others added 3 commits January 15, 2026 12:58
…equestActionAwareContextBuilder.php

Co-authored-by: Dmitri Perunov <diimpp@gmail.com>
@TheMilek TheMilek merged commit 2ede166 into Sylius:2.1 Jan 16, 2026
66 of 67 checks passed
@Prometee Prometee deleted the fix-default-action branch January 16, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API APIs related issues and PRs. Docker Docker-related issues and PRs. Maintenance CI configurations, READMEs, releases, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants