-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(payments-plugin): mollie plugin make redirecturl
dynamic
#2094
feat(payments-plugin): mollie plugin make redirecturl
dynamic
#2094
Conversation
Relates to vendure-ecommerce#2093. This commit removes redirectUrl from the payment method and lets it get passed via the Shop API createPaymentIntent mutation. BREAKING CHANGE: `redirectUrl` got removed from the mollie payment method. Consumers of the ecommerce-engine now have to pass `redirectUrl` via the createPaymentIntent mutation.
Hi, congrats on your first PR to Vendure! 🥳 So I'd prefer not to make this a breaking change if we can avoid that. How about we keep the
We discussed this via Slack and the conclusion is to:
|
Oops, this might have been my suggestion. My argument is: The same and more can be accomplished with the redirectUrl via graphql, so why maintain both ways? |
…RedirectUrl option for mollie
Alright well I did the changes as Michael requested them. About this version: Doing the tests for Let me know what you think. |
* For backwards compatibility, by default set to false. | ||
* When enabled, the `redirectUrl` can be passed via the `createPaymentIntent` mutation | ||
* instead of being configured in the Payment Method. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add
@default false
@since 2.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's being merged to minor right? But still only @SInCE 2.0.0 ? Would expect that to be the next minor release actually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There won't be another minor release!
@@ -101,17 +103,32 @@ export class MollieService { | |||
if (!paymentMethod) { | |||
return new PaymentIntentError(`No paymentMethod found with code ${paymentMethodCode}`); | |||
} | |||
if (this.options.useDynamicRedirectUrl == true) { | |||
if (!input.redirectUrl) { | |||
return new InvalidInputError(`Cannot create payment intent without redirectUrlspecified`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a space "redirectUrlspecified"
@martijnvdbrug yeah that's a valid point. My counter-argument was that with v2 there are already lots of breaking changes for people to deal with, so I wanted to avoid another one here. We can certainly deprecate the old way and remove it in a future version though. In fact, @seminarian it is probably worth starting that process now and mentioning that the configArg will be deprecated in the documentation. @seminarian it looks good to me other than the couple of small comments. |
Very understandable! Deprecation is perfect. As long as we can clean it up at some point, I'm a very happy man 😄 |
type: 'string', | ||
label: [{ languageCode: LanguageCode.en, value: 'Redirect URL' }], | ||
description: [ | ||
{ languageCode: LanguageCode.en, value: 'Redirect the client to this URL after payment' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can/should we also add a deprecation message here?
@seminarian Martijn's other Mollie PR is now merged in and the |
@michaelbromley @seminarian @martijnvdbrug Since this PR's goal is to make the redirect URL more dynamic, I would suggest to not append the order code to the end of the incoming It forces the storefront unnecessarily to be able to accept that order code as a last path parameter. Wouldn't it be better to have the storefront decide on what it can or cannot handle? I'm thinking: native mobile apps, less flexible frontend frameworks where query parameters are preferred, ... So basically, the frontend would send the full
|
@StampixSMO Great point, I agree. |
So while working on this, I bumped on another issue that is actually on Mollie's side (and has been there for a while). Issue If you don't specify a payment method, selecting a I have attached a year-old screenshot from a support case where I asked about this bug and what they recommended as solution. Solution The bug is gone if you select a payment method upfront when making a test payment. For example You could have the storefront request a certain payment method already, using the exposed input variables. However, that's not ideal since the storefront has no idea whether Vendure+Mollie is running in test mode or not. I would suggest that we force a payment method when the API key is a test key (can be checked using the Let me know what you think. |
@michaelbromley Could you enlighten me what's actually the role of
Like, does the not maintaining the "correct" Order state have any implications? Is that something we would want to see streamlined/added to the Mollie plugin? |
@martijnvdbrug I've managed to get the same payment multiple times listed in Vendure: I was playing around with introducing exceptions in random places and ended up in place like this. I'd like to add the
And instead of just creating a new
That seems to work to revert things when they go wrong. |
@seminarian That's a good improvement! Just make sure that we can't end up with a scenario where the actual payment has been done through Mollie successfully, but reverted in Vendure. As long as the error boils up to the controller, and thus returning a non-200 to Mollie, we should be good, because Mollie will retry the webhook |
Hi @seminarian & @martijnvdbrug
The original intent is that in this state:
It turns out that there are a wide variety of flows with different payment providers, so e.g. in the Mollie integration we don't require the storefront the do the transition as it is handled internally.
Is any further action needed - do you intend to add the |
@seminarian let me know if there are any open points, could do a short call if needed |
For our usecase, a photo site, it would sure come in handy to hook into
I've pushed the changes! @michaelbromley and @martijnvdbrug perhaps one of you guys could audit my changes or test it.. Thanks! :) |
@michaelbromley & @martijnvdbrug done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Excellent work @seminarian! This will go in the next v2 beta release. |
closes #2093
It's my first contribution, best to check everything well.
Also didn't know if I had to add an
@since
tag somewhere and is the Breaking change in the commit message correct?