Skip to content
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

Add setting to optionally process payment on free orders #1526

Merged

Conversation

johnnynotsolucky
Copy link
Contributor

We have a payment processor which maintains customer balances and customers can have a positive balance. When the customer makes a purchase, the processor uses this balance as part of the payment. In Craft, we have an adjuster which fetches the existing balance and applies it like a discount on the order.

In some (rare) cases, customers can have enough credit that their balance covers the cost of the order. In these instances, Commerce applies the adjustment, but as the order doesn't have an outstanding balance, it completes the order without forwarding to the payment processor. The customers balance in the processor remains the same and they can keep placing orders below that amount.

This PR adds a configuration option to allow users to prevent "free" orders from being completed, and instead forwarded to the payment gateway. It still defaults to complete.

I'm not sure if this is the best way to do this, or whether there is another way around it without code changes.

@sjcallender
Copy link
Contributor

@lukeholder Would you be able to take a look at this and tell us if this looks like something you'd be willing to add soonish? We'd prefer a first-party solution, but can roll a temporary hack sooner if we know you are not prioritizing this.

/**
* @var bool
*/
public $mergeLastCartOnLogin = true;
Copy link
Member

Choose a reason for hiding this comment

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

Merged thsi PR, but mergeLastCartOnLogin is an old config setting from commerce 2 which I removed.

Thanks.

@lukeholder
Copy link
Member

@sjcallender Will be in the next Commerce release. Thanks.

@sjcallender
Copy link
Contributor

Thank you, @lukeholder.

@johnnynotsolucky johnnynotsolucky deleted the free-order-payment-strategy branch July 20, 2020 11:29
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.

None yet

3 participants