backdrop-contrib / uc_stripe

Ubercart payment gateway module for Stripe.
0 stars 2 forks source link

Missing namespace in Config object name uc_credit #7

Closed bugfolder closed 1 year ago

bugfolder commented 1 year ago

Cross-posted from Ubercart issue https://github.com/backdrop-contrib/ubercart/issues/238.

@laryn wrote:

When enabling the separate uc_stripe module, it says it needs to enable uc_credit. When it tries to do so, it crashes with this error:

Missing namespace in Config object name uc_credit.

Indeed, this happens when we try to set a config value and leave off the .settings part of the config name. So in uc_stripe.install(), we have:

function uc_stripe_install() {
  if (module_exists('uc_recurring')) {
    // This turns ON the uc_recurring cron task to renew. We want this
    // ON because the renewal payments are handled by uc_recurring and NOT the stripe gateway
    config_set('uc_recurring', 'trigger_renewals', TRUE);
  }

  // Stripe does cc validation, so uc_credit must not... especially because
  // uc_credit gets a bogus cc number.
  config_set('uc_credit', 'uc_credit_validate_numbers', FALSE);
}

Should be:

function uc_stripe_install() {
  if (module_exists('uc_recurring')) {
    // This turns ON the uc_recurring cron task to renew. We want this
    // ON because the renewal payments are handled by uc_recurring and NOT the stripe gateway
    config_set('uc_recurring.settings', 'trigger_renewals', TRUE);
  }

  // Stripe does cc validation, so uc_credit must not... especially because
  // uc_credit gets a bogus cc number.
  config_set('uc_credit.settings', 'uc_credit_validate_numbers', FALSE);
}
laryn commented 1 year ago

Thanks @bugfolder! https://github.com/backdrop-contrib/uc_stripe/commit/17d6befe819a991293ca81488aa0756ba558f571