Needs work
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Payment
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
14 Feb 2011 at 16:23 UTC
Updated:
19 Jun 2015 at 10:49 UTC
Jump to comment: Most recent
When a payment module is disabled, it should disable the payment rules related to it so user doesn't have to manually do so.
Comments
Comment #1
recidive commentedI added a hook_modules_disabled() implementation to disable the rules.
This was a bit tricky, since commerce_payment_methods() wasn't returning the methods declared by the module being disabled.
https://github.com/recidive/drupalcommerce/tree/1061318
Comment #2
rszrama commentedTwo follow-up questions:
Comment #3
recidive commentedI've added some code to delete the rule if it's wasn't overriden, so it doesn't display as disabled in the payments admin screen and get enabled automatically when the payment module is re-enabled.
It looks like we can't hide disabled rules, so what we can do is delete the rules even if they were overridden. The caveat here is that user will loose their settings by just disabling and re-enabling the module, if they have overrode the rule.
Comment #4
rszrama commentedI'm going to move this back to needs work for the time being, as it's not clear to me if it's up to date with current code / if recidive's GitHub repo is based on the d.o repo. To summarize the discussion above, I don't think we should destructively delete payment method rules on disable, only uninstall. This is the expected behavior, I believe - if you were to disable for an update or something, you would lose valuable configuration even though you didn't explicitly uninstall.
It looks like the second commit on that branch added something for this, but we will need some way to hide these Rules in the UI. If someone were to edit a Rule enabling a disabled payment method, I'm guessing Rules would choke because of missing data.
Part of me thinks we just shouldn't do anything... but if I had to pick one thing for us to implement, it would be to only delete the default payment rule when a payment method module is uninstalled. It's worth mentioning, too, that there may be other instances of an action enabling a disable payment method than just in the default rule we create.
Comment #5
svendecabootersubscribing since this is being requested for the payment method i wrote: #1179826: delete the rule
Comment #6
corentin.crouvisier commentedImportant process to set up, especially for the manual management of transactions and orders (create/edit/delete in admin).Not the good place for this.