when subscription expires', '', array('options' => array('' => 'No', 1 => 'Yes')));
add_product_field('trial1_days', 'Trial 1 Duration', 'period', 'Trial 1 duration');
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)
<?php

/* Smarty version 2.6.2, created on 2010-11-16 06:22:52
   compiled from js.country_state.js */
require_once _SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.load_plugins.php';
smarty_core_load_plugins(array('plugins' => array(array('function', 'root_url', 'js.country_state.js', 29, false))), $this);
?>
<!--<?php 
echo ' --><script type="text/javascript">

';
require_once INC_DIR . '/pear/Services/JSON.php';
$j =& new Services_JSON();
echo "var statesCache = {};\n";
foreach (array('US', 'CA') as $c) {
    echo "statesCache." . $c . " = " . $j->encodeUnsafe(db_getStatesForCountry($c)) . ";\n";
}
echo '


function changeStates(obj) {

        var country = obj.options[obj.selectedIndex].value;
        var nm = (obj.name == \'cc_country\') ? \'#f_cc_state\' : \'#f_state\';
        $(nm).removeOption(/.|^$/).
        addOption(\'\', \'#_TPL_COMMON_SELECT_STATE#\');
        
        if (statesCache[country]){
            $(nm).addOption(statesCache[country]).selectOptions(\'\', true);
            onStatesLoaded();
        } else {
Example #3
0
function smarty_function_state_options($params, &$smarty)
{
    global $db;
    $ret = '';
    $state = db_getStateByCode($country, $state_code);
    $states = db_getStatesForCountry($country, 1);
    foreach ($states as $c => $t) {
        $sel = $c == $params['selected'] ? 'selected="selected"' : '';
        $ret .= "<option value='" . htmlspecialchars($c) . "' {$sel}>" . htmlspecialchars($t) . "</option>\n";
    }
    return $ret;
}
Example #4
0
function display_form($user)
{
    global $t, $config;
    global $_amember_id, $error, $db;
    $email_address = $user['email'];
    $email_confirmation_required = 0;
    if ($config['verify_email_profile']) {
        if ($user['data']['email_new']) {
            if ($user['data']['email_confirm_code_exp'] > time()) {
                $email_address = $user['data']['email_new'];
                $email_confirmation_required = 1;
            } else {
                // Link expired; Change values back and update user record;
                profile_clean_verification_fields($user);
            }
        }
    }
    $user['email'] = $email_address;
    $t->assign("email_confirmation_required", $email_confirmation_required);
    $t->assign('state_options', db_getStatesForCountry($user['country'], 1));
    $t->assign('user', $user);
    if ($config['use_affiliates'] && $user['is_affiliate'] == '2') {
        $additional_fields = get_additional_fields_html($user, 'affiliate_profile', 0, get_active_price_groups());
    } else {
        $additional_fields = get_additional_fields_html($user, 'profile', 0, get_active_price_groups());
    }
    $t->assign('additional_fields_html', $additional_fields);
    $fields_to_change = array();
    foreach ((array) $config['profile_fields'] as $f) {
        $fields_to_change[$f] = 1;
    }
    $t->assign('fields_to_change', $fields_to_change);
    $t->assign('error', $error);
    $t->display('profile.html');
}
Example #5
0
function ajaxGetStates($vars)
{
    return ajaxResponse(db_getStatesForCountry($vars['country']));
}
Example #6
0
function show_payment_form()
{
    global $t;
    global $error;
    global $db, $config, $vars;
    global $signup_scope_allowed;
    $t->assign('error', $error);
    $products = $db->get_products_list();
    if (!count($products)) {
        fatal_error(_SIGNUP_SCRIPT_ERROR);
    }
    foreach ($products as $k => $v) {
        if (!in_array($v['scope'], $signup_scope_allowed)) {
            unset($products[$k]);
        }
        if (is_array($vars['price_group'])) {
            if (!array_intersect($vars['price_group'], split(',', $v['price_group']))) {
                unset($products[$k]);
            }
        } elseif ($vars['price_group']) {
            if (!in_array($vars['price_group'], split(',', $v['price_group']))) {
                unset($products[$k]);
            }
        } elseif ($v['price_group'] < 0) {
            unset($products[$k]);
        }
        if ($products[$k] && $products[$k]['terms'] == '') {
            $pr =& new Product($products[$k]);
            $products[$k]['terms'] = $pr->getSubscriptionTerms();
        }
    }
    $paysystems = get_paysystems_list();
    //remove paysystems such as manual
    foreach ($paysystems as $k => $p) {
        if (!$p['public']) {
            unset($paysystems[$k]);
        }
    }
    //remove free paysystem from select
    if (count($paysystems) > 1) {
        foreach ($paysystems as $k => $p) {
            if ($p['paysys_id'] == 'free') {
                unset($paysystems[$k]);
            }
        }
    }
    plugin_fill_in_signup_form($_REQUEST);
    plugin_fill_in_signup_form($vars);
    // Fill additional fields
    $t->assign('products', $products);
    $t->assign('paysystems', $paysystems);
    $price_group = $vars['price_group'] ? explode(',', $vars['price_group']) : array();
    $t->assign('additional_fields_html', get_additional_fields_html($vars, 'signup', 0, $price_group));
    if ($vars['country']) {
        $t->assign('state_options', db_getStatesForCountry($vars['country'], 1));
    }
    $is_affiliate = '0';
    $newsletter_threads = $db->get_signup_threads_c($is_affiliate);
    $t->assign('newsletter_threads', $newsletter_threads);
    $t->display($config['amember_signup_template'] ? $config['amember_signup_template'] : 'signup.html');
}