function smarty_function_country_options($params, &$smarty) { global $db; $ret = ""; foreach (db_getCountryList($add_empty = true) as $c => $t) { $sel = $c == $params['selected'] ? 'selected="selected"' : ''; $ret .= "<option value='" . htmlspecialchars($c) . "' {$sel}>" . htmlspecialchars($t) . "</option>\n"; } return $ret; }
add_product_field('trial1_price', 'Trial 1 Price', 'money', 'set 0 for free trial'); add_product_field('rebill_times', 'Recurring Times', 'text', 'Recurring Times. This is the number of payments which<br /> will occur at the regular rate. If omitted, payment will<br /> continue to recur at the regular rate until the subscription<br /> is cancelled.<br /> NOTE: not for all payment processing this option is working'); add_product_field('authorize_currency', 'PayReady Currency', 'select', 'valid only for PayReady processing.<br /> You should not change it<br /> if you use another payment processors', '', array('options' => array('' => 'USD', 'GBP' => 'GBP', 'EUR' => 'EUR', 'CAD' => 'CAD', 'JPY' => 'JPY'))); global $config; $config['cc_type_options'] = array('1' => 'VISA', '2' => 'Master Card', '3' => 'American Express', '4' => 'Discover Card'); add_member_field('cc_type', 'Credit Card Type', 'select', '', '', array('options' => $config['cc_type_options'])); add_member_field('cc_street', 'Billing Street Address', 'text', "", '', array('hidden_anywhere' => 1)); add_member_field('cc_city', 'Billing City', 'text', "", ''); add_member_field('cc_state', 'Billing State', 'select', "", '', array('options' => db_getStatesForCountry('US', true))); add_member_field('cc_zip', 'Billing ZIP', 'text', "", ''); add_member_field('cc_country', 'Billing Country', 'select', "", '', array('options' => db_getCountryList(true))); add_member_field('cc_name_f', 'Billing First Name', 'text', ''); add_member_field('cc_name_l', 'Billing Last Name', 'text', ''); if ($config['payment']['payready']['wells_fargo']) { add_member_field('cc_company', 'Billing Company', 'text', ''); add_member_field('cc_phone', 'Billing Company', 'text', ''); } add_member_field('cc', 'Credit Card # (visible)', 'readonly', "credit card number (read-only)", '', array('hidden_anywhere' => 1)); add_member_field('cc-hidden', 'Credit Card # (crypted)', 'hidden', '', '', array('hidden_anywhere' => 1)); add_member_field('cc-expire', 'Credit Card Expire', 'readonly', 'Expiration date (mmyy)', '', array('hidden_anywhere' => 1)); add_paysystem_to_list(array('paysys_id' => 'payready', 'title' => $config['payment']['payready']['title'] ? $config['payment']['payready']['title'] : _PLUG_PAY_PAYRDY_TITLE, 'description' => $config['payment']['payready']['description'] ? $config['payment']['payready']['description'] : _PLUG_PAY_PAYRDY_DESC, 'public' => 1, 'recurring' => 1)); class payment_payready extends payment { function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars) { global $config;
function cc_core_init($plugin) { global $config, $cc_core; // get features array $pl =& instantiate_plugin('payment', $plugin); $features = $pl->get_plugin_features(); $cc_core[$plugin] =& $pl; /// add_paysystem_to_list(array('paysys_id' => $plugin, 'title' => $pl->config['title'] ? $pl->config['title'] : $features['title'], 'description' => $pl->config['description'] ? $pl->config['description'] : $features['description'], 'public' => 1, 'recurring' => $features['no_recurring'] ? 0 : 1)); // add product fields if (!$features['no_recurring']) { add_product_field('is_recurring', 'Recurring Billing', 'checkbox', 'should user be charged automatically<br /> when subscription expires', ''); add_product_field('trial1_days', 'Trial 1 Duration', 'period', 'Trial 1 duration', 'validate_period'); add_product_field('trial1_price', 'Trial 1 Price', 'money', 'set 0 for free trial', ''); add_product_field('trial_group', 'Trial Group', 'text', "If this field is filled-in, user will be unable to order the product<br />\n twice. It is extermelly useful for any trial product. This field<br />\n can have different values for different products, then 'trial history'<br />\n will be separate for these groups of products.<br />\n If your site offers only one level of membership,<br />\n just enter \"1\" to this field. \n "); add_product_field('rebill_times', 'Recurring Times', 'text', 'Recurring Times. This is the number of payments which<br /> will occur including first payment. If omitted, payment will<br /> continue to recur at the regular rate until the subscription<br /> is cancelled.<br /> NOTE: not for all payment processing this option is working'); } if ($features['currency']) { add_product_field($plugin . '_currency', $pl->config['title'] . " Currency", 'select', "valid only for {$plugin} payments", '', array('options' => $features['currency'])); } /// add member fields add_member_field('cc_country', 'Billing Country', 'select', "", '', array('options' => db_getCountryList(true))); add_member_field('cc_street', 'Billing Street Address', 'text', "", '', array('hidden_anywhere' => 1)); add_member_field('cc_city', 'Billing City', 'text', "", ''); add_member_field('cc_state', 'Billing State', 'state', "", '', array('options' => array(), 'require_value' => array(array('name' => 'cc_country')))); add_member_field('cc_zip', 'Billing ZIP', 'text', "", ''); if ($features['name_f']) { add_member_field('cc_name_f', 'Billing First Name', 'text', ''); add_member_field('cc_name_l', 'Billing Last Name', 'text', ''); } elseif ($features['name']) { add_member_field('cc_name', 'Billing Name', 'text', ''); } if ($features['company']) { add_member_field('cc_company', 'Billing Company', 'text', ''); } if ($features['phone']) { add_member_field('cc_phone', 'Billing Phone#', 'text', ''); } if ($features['housenumber']) { add_member_field('cc_housenumber', 'Billing Housenumber', 'text', ''); } add_member_field('cc', 'Credit Card # (visible)', 'readonly', 'credit card number', '', array('hidden_anywhere' => 1)); add_member_field('cc-hidden', 'Credit Card # (crypted)', 'hidden', '', '', array('hidden_anywhere' => 1)); add_member_field('cc-expire', 'Credit Card Expire', 'readonly', 'Expiration date (mmyy)', '', array('hidden_anywhere' => 1)); if ($features['code'] == 2) { add_member_field('cc_code', 'Credit Card Code (crypted)', 'hidden', '', '', array('hidden_anywhere' => 1)); } if ($features['province_outside_of_us']) { add_member_field('cc_province', 'Billing International Province', 'text', "for international provinces outside of US & Canada include the province name here", ''); } if ($features['maestro_solo_switch']) { add_member_field('cc_issuenum', 'Card Issue #', 'text', "is required for Maestro/Solo/Switch credit cards only", ''); add_member_field('cc_startdate', 'Card Start Date', 'text', "is required for Maestro/Solo/Switch credit cards only", ''); } if ($features['type_options']) { add_member_field('cc_type', 'CC Type', 'select', 'credit card type', '', array('options' => $features['type_options'])); } /// setup hooks if (!$features['no_recurring']) { setup_plugin_hook('get_member_links', $plugin . '_get_member_links'); setup_plugin_hook('hourly', $plugin . '_rebill'); } }