0

There is a rule that comes with Commerce Paypal, commerce_payment_paypal_wpp, it implements an Action: "PayPal WPP - Credit Card", which provides an admin interface to configuring the PayPal WPP, with API Username, password, etc. We've implemented our settings for this, as with other rules, as commerce_paypal_wpp.rules_defaults.inc.

The problem is that, in this case, commerce_paypal_wpp.rules_defaults.inc is not loaded for some reason when the rule is installed. After installation, we have to log in, navigate to that admin form, open it and press save, no changes, just press save.

We tried without success:

function MODULE_default_rules_configuration_alter(&$configs) {
  $configs['commerce_payment_paypal_wpp']->active = TRUE;
  $rule = rules_config_load('commerce_payment_paypal_wpp');
  $rule->save;
}

What do we need to do in code that would do the work of clicking that save button? This is the last obstacle to a zero-touch installation, would really like to get that in. Any ideas?

0

Your question is a bit confusing, because the default Rule in question is defined by the Payment module in commerce_payment.rules_defaults.inc, not by the PayPal module. It sounds to me like a general case of cache trouble, though in my testing and development of the PayPal module I've never seen any issues with it. If what you mean is simply that the payment method rule is disabled by default, that's just how we've built the modules - enabling it like you show with your custom code will just be a necessary step.

  • The issue is, after running our the kickstart install profile, and our extensions, when the site is first up, attempting to transact the wpp rule returns "This payment method must be configured by an administrator before it can be used." We can easily fix this by logging-in as admin, navigating to the wpp rule action admin form and clicking "Save", then it works. We just need to be able to do that in code, as part of the install, without having to log-in as admin. When we can do this in code, then we can bring the site up in an automation environment, with no admin login required. – August1914 Apr 3 '13 at 1:27
  • Let me put it another way, then: how should one go about configuring the commerce_payment_paypal_wpp settings (API username, etc) in code? Should we be creating a ..rules_defaults.inc, or setting values in an install hook or just setting variables? – August1914 Apr 9 '13 at 19:15
  • If you've been saving the settings manually in code, perhaps you haven't been clearing the Rules cache after setting them? – Ryan Szrama Apr 9 '13 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.