public function is_allowed_for_invoice($invoice_id) { if (!self::is_enabled()) { return false; } // check for manually enabled invoice payment method. $invoice_payment_methods = module_invoice::get_invoice_payment_methods($invoice_id); if (isset($invoice_payment_methods['paynl'])) { return $invoice_payment_methods['paynl']['enabled']; } // check if this invoice is in the allowed currency. $invoice_data = module_invoice::get_invoice($invoice_id); $cur = trim(strtolower(module_config::c('payment_method_paynl_currency', ''))); $dollar_limit = module_config::c('payment_method_paynl_limit_type', 'above'); $dollar_value = module_config::c('payment_method_paynl_limit_value', 0); if ($dollar_limit == 'above' && $invoice_data['total_amount_due'] < $dollar_value) { return false; } else { if ($dollar_limit == 'below' && $invoice_data['total_amount_due'] > $dollar_value) { return false; } } if (strlen($cur) > 1) { $allowed_currencies = explode(',', $cur); if (count($allowed_currencies)) { $currency = module_config::get_currency($invoice_data['currency_id']); if (!in_array(strtolower($currency['code']), $allowed_currencies)) { return false; } } } return module_config::c('payment_method_paynl_enabled_default', 1); }
public function is_allowed_for_invoice($invoice_id) { if (!self::is_enabled()) { return false; } $old_default = module_config::c('__inv_google_' . $invoice_id); if ($old_default !== false) { $this->set_allowed_for_invoice($invoice_id, $old_default); delete_from_db('config', 'key', '__inv_google_' . $invoice_id); module_cache::clear('config'); return $old_default; } // check for manually enabled invoice payment method. $invoice_payment_methods = module_invoice::get_invoice_payment_methods($invoice_id); if (isset($invoice_payment_methods['google'])) { return $invoice_payment_methods['google']['enabled']; } return module_config::c('payment_method_google_enabled_default', 1); }
public function is_allowed_for_invoice($invoice_id) { if (!self::is_enabled()) { return false; } $old_default = module_config::c('__inv_coinbase_' . $invoice_id); if ($old_default !== false) { $this->set_allowed_for_invoice($invoice_id, $old_default); delete_from_db('config', 'key', '__inv_coinbase_' . $invoice_id); module_cache::clear('config'); return $old_default; } // check for manually enabled invoice payment method. $invoice_payment_methods = module_invoice::get_invoice_payment_methods($invoice_id); if (isset($invoice_payment_methods['coinbase'])) { return $invoice_payment_methods['coinbase']['enabled']; } // check currency and value amounts $invoice_data = module_invoice::get_invoice($invoice_id); $cur = trim(strtolower(module_config::c('payment_method_coinbase_currency', ''))); $dollar_limit = module_config::c('payment_method_coinbase_limit_type', 'above'); $dollar_value = module_config::c('payment_method_coinbase_limit_value', 0); if ($dollar_limit == 'above' && $invoice_data['total_amount_due'] < $dollar_value) { return false; } else { if ($dollar_limit == 'below' && $invoice_data['total_amount_due'] > $dollar_value) { return false; } } if (strlen($cur) > 1) { $allowed_currencies = explode(',', $cur); if (count($allowed_currencies)) { $currency = module_config::get_currency($invoice_data['currency_id']); if (!in_array(strtolower($currency['code']), $allowed_currencies)) { return false; } } } return module_config::c('payment_method_coinbase_enabled_default', 1); }