Skip to content

Conversation

LeftoversTodayAppAdmin
Copy link
Contributor

@LeftoversTodayAppAdmin LeftoversTodayAppAdmin commented Mar 16, 2025

Description

Please include a summary of the changes and the related issue.
A change was introduced to use the default context instead of the channel specific context to change state to arranging payment in the stripe plugin:
#3072

This however causes issues when requiring channel specific context as noted here:
#3139

Instead of choosing just one or the other, a compromise will be to first try to use the channel specific context, if it fails then try to use the default context and if it still fails then throw an error.

This

Breaking changes

Does this PR include any breaking changes we should be aware of?

No breaking changes.

Screenshots

You can add screenshots here if applicable.

Checklist

📌 Always:

  • I have set a clear title
  • My PR is small and contains a single feature
  • I have checked my own PR

👍 Most of the time:

  • I have added or updated test cases
  • I have updated the README if needed

Summary by CodeRabbit

  • Bug Fixes

    • Improved order state transition reliability during payment processing by adding a fallback mechanism that retries with a default channel if the initial attempt fails.
  • Style

    • Minor formatting adjustment for code consistency.

…nnel-specific contexts and default channel as a fallback
Copy link

vercel bot commented Mar 16, 2025

@LeftoversTodayAppAdmin is attempting to deploy a commit to the Vendure Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@michaelbromley michaelbromley added this to the v3.2.0 milestone Mar 21, 2025
@dlhck dlhck modified the milestones: v3.2.0, v3.3.0 Apr 2, 2025
@dlhck dlhck moved this to 📅 Planned in Vendure OS Roadmap Apr 2, 2025
@LeftoversTodayAppAdmin
Copy link
Contributor Author

Hey @dlhck and @michaelbromley

Any updated on this PR? I see its been moved to a future release and is planned, please let me know what that means in terms of timeline.

Best regards
Shri

@michaelbromley michaelbromley modified the milestones: v3.3.0, v3.4.0 May 12, 2025
@michaelbromley
Copy link
Member

Hi @LeftoversTodayAppAdmin, unfortunately we didn't have time to get it into the feature release v3.3, so I have assigned it to the next feature release.

@LeftoversTodayAppAdmin
Copy link
Contributor Author

Thank you @michaelbromley ! Looking forward to getting a my pending PRs in so I can finally upgrade from v3.0.3!
-Shri

@LeftoversTodayAppAdmin LeftoversTodayAppAdmin changed the base branch from master to minor May 21, 2025 04:47
Copy link

vercel bot commented Jul 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Jul 31, 2025 8:07am

Copy link
Contributor

coderabbitai bot commented Jul 15, 2025

Walkthrough

The StripeController class's webhook method was updated to include a fallback mechanism for transitioning an order's state. The method now first attempts the transition with the original context and, upon failure, retries once using a default channel context before logging an error. No public interfaces were changed.

Changes

Cohort / File(s) Change Summary
Stripe Controller
packages/payments-plugin/src/stripe/stripe.controller.ts
Added fallback logic in the webhook method to retry order state transition with a default context upon failure; minor formatting update in constructor.

Sequence Diagram(s)

sequenceDiagram
    participant Stripe as Stripe Webhook
    participant StripeController as StripeController
    participant OrderService as OrderService

    Stripe->>StripeController: webhook(event)
    StripeController->>OrderService: transitionOrderToState(ctx, 'ArrangingPayment')
    alt Success
        OrderService-->>StripeController: Success
    else OrderStateTransitionError
        StripeController->>OrderService: transitionOrderToState(ctxWithDefaultChannel, 'ArrangingPayment')
        alt Success
            OrderService-->>StripeController: Success
        else OrderStateTransitionError
            StripeController->>StripeController: Log error
        end
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70126da and 3ea8d81.

📒 Files selected for processing (1)
  • packages/payments-plugin/src/stripe/stripe.controller.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/payments-plugin/src/stripe/stripe.controller.ts

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb8b3c2 and 54584cf.

📒 Files selected for processing (1)
  • packages/payments-plugin/src/stripe/stripe.controller.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: e2e tests (22.x, mysql)
  • GitHub Check: e2e tests (24.x, postgres)
  • GitHub Check: e2e tests (24.x, mysql)
  • GitHub Check: e2e tests (24.x, sqljs)
  • GitHub Check: e2e tests (20.x, sqljs)
  • GitHub Check: codegen / codegen
  • GitHub Check: unit tests (22.x)
  • GitHub Check: unit tests (20.x)
  • GitHub Check: publish_install (macos-latest, 24.x)
  • GitHub Check: build (24.x)
  • GitHub Check: build (20.x)
  • GitHub Check: build (22.x)
  • GitHub Check: publish_install (ubuntu-latest, 24.x)
  • GitHub Check: publish_install (macos-latest, 20.x)
  • GitHub Check: publish_install (windows-latest, 22.x)
  • GitHub Check: publish_install (windows-latest, 20.x)
  • GitHub Check: publish_install (windows-latest, 24.x)
  • GitHub Check: publish_install (macos-latest, 22.x)
  • GitHub Check: publish_install (ubuntu-latest, 22.x)
  • GitHub Check: publish_install (ubuntu-latest, 20.x)
🔇 Additional comments (2)
packages/payments-plugin/src/stripe/stripe.controller.ts (2)

39-39: Minor formatting change approved.

The spacing adjustment in the constructor is a formatting improvement with no functional impact.


117-124: Fallback mechanism implementation approved.

The logic correctly implements the intended fallback behavior: first attempting with the channel-specific context (ctx), then falling back to the default channel context if needed. This addresses the issue described in #3072 while maintaining backward compatibility.

…y if required.

Updating to resolve the comment: 
vendure-ecommerce#3420 (comment)

Moving default channel context into the if statement where it is required.
Copy link

@dlhck dlhck merged commit 4f29f0a into vendure-ecommerce:minor Jul 31, 2025
33 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants