Exemple #1
0
function awpcp_paypal_supports_currency($currency_code)
{
    $currency_codes = awpcp_paypal_supported_currencies();
    if (!in_array($currency_code, $currency_codes)) {
        return false;
    }
    return true;
}
Exemple #2
0
 /**
  * Payment Settings checks
  * XXX: Referenced in FAQ: http://awpcp.com/forum/faq/why-doesnt-my-currency-code-change-when-i-set-it/
  */
 public function validate_payment_settings($options, $group)
 {
     $setting = 'paypalcurrencycode';
     if (isset($options[$setting]) && !awpcp_paypal_supports_currency($options[$setting])) {
         $currency_codes = awpcp_paypal_supported_currencies();
         $message = __('There is a problem with the PayPal Currency Code you have entered. It does not match any of the codes in our list of curencies supported by PayPal.', 'AWPCP');
         $message .= '<br/><br/><strong>' . __('The available currency codes are', 'AWPCP') . '</strong>:<br/>';
         $message .= join(' | ', $currency_codes);
         awpcp_flash($message);
         $options[$setting] = 'USD';
     }
     $setting = 'enable-credit-system';
     if (isset($options[$setting]) && $options[$setting] == 1 && !get_awpcp_option('requireuserregistration')) {
         awpcp_flash(__('Require Registration setting was enabled automatically because you activated the Credit System.', 'AWPCP'));
         $options['requireuserregistration'] = 1;
     }
     if (isset($options[$setting]) && $options[$setting] == 1 && !get_awpcp_option('freepay')) {
         awpcp_flash(__('Charge Listing Fee setting was enabled automatically because you activated the Credit System.', 'AWPCP'));
         $options['freepay'] = 1;
     }
     $setting = 'freepay';
     if (isset($options[$setting]) && $options[$setting] == 0 && get_awpcp_option('enable-credit-system')) {
         awpcp_flash(__('Credit System was disabled automatically because you disabled Charge Listing Fee.', 'AWPCP'));
         $options['enable-credit-system'] = 0;
     }
     return $options;
 }