function cc_bill($cc_info, $member, $amount, $currency, $product_description, $charge_type, $invoice, $payment)
 {
     global $config, $db;
     $log = array();
     if (!$this->config["notification"]) {
         $this->config["notification"] = 3;
     }
     if ($this->config["notification"] == 1 || $this->config["notification"] == 3) {
         $this->manual_cc_mail($cc_info, $member, $payment, $charge_type);
     }
     if ($this->config["notification"] == 2 || $this->config["notification"] == 3) {
         if ($charge_type != CC_CHARGE_TYPE_RECURRING) {
             save_cc_info($cc_info, $member, $payment['paysys_id']);
         }
     }
     if ($charge_type != CC_CHARGE_TYPE_RECURRING) {
         $t =& new_smarty();
         $product = $db->get_product($payment['product_id']);
         $t->assign('payment', $payment);
         $t->assign('product', $product);
         $t->assign('user', $member);
         if (!($prices = $payment['data'][0]['BASKET_PRICES'])) {
             $prices = array($payment['product_id'] => $payment['amount']);
         }
         $pr = array();
         $subtotal = 0;
         foreach ($prices as $product_id => $price) {
             $v = $db->get_product($product_id);
             $subtotal += $v['price'];
             $pr[$product_id] = $v;
         }
         $t->assign('subtotal', $subtotal);
         $t->assign('total', array_sum($prices));
         $t->assign('products', $pr);
         $t->display($config['root_dir'] . "/plugins/payment/manual_cc/thanks.html");
         exit;
     }
     return array(CC_RESULT_IGNORE, "", "", array());
 }
Esempio n. 2
0
            mail_template_admin($t, $et);
        }
        if ($config['mail_cancel_member']) {
            $t->assign('user', $member);
            $t->assign('payment', $p);
            $t->assign('product', $db->get_product($p['product_id']));
            $et =& new aMemberEmailTemplate();
            $et->name = "mail_cancel_member";
            mail_template_user($t, $et, $member);
        }
        $t->assign('title', _PLUG_PAY_CC_CORE_SBSCNCL);
        $t->assign('msg', _PLUG_PAY_CC_CORE_SBSCNCL2);
        $t->display("msg_close.html");
        break;
    case 'renew_cc':
        // make first payment
        if ($vars['do_cc']) {
            $errors = validate_cc_info($member, array('paysys_id' => $vars['paysys_id']), $vars);
            if (!$errors) {
                save_cc_info($vars, $member, $vars['paysys_id']);
                html_redirect("{$config['root_surl']}/member.php?cc_renew_done=1", 0, _PLUG_PAY_CC_CORE_CCINFOCHNG, _PLUG_PAY_CC_CORE_REDIR);
            } else {
                ask_cc_info($member, array('paysys_id' => $vars['paysys_id']), $vars, 1, $errors);
            }
        } else {
            ask_cc_info($member, array('paysys_id' => $vars['paysys_id']), $vars, 1, $errors);
        }
        break;
    default:
        fatal_error(_PLUG_PAY_CC_CORE_FERROR7);
}
 function cc_bill($cc_info, $member, $amount, $currency, $product_description, $charge_type, $invoice, $payment)
 {
     global $config;
     $log = array();
     //////////////////////// cc_bill /////////////////////////
     if ($charge_type == CC_CHARGE_TYPE_TEST) {
         return array(CC_RESULT_SUCCESS, "", "", array('test transaction' => 'no validation'));
     }
     $vars = array('requestType' => 'BACKEND', 'errorPage' => $config['root_surl'] . "/cancel.php?payment_id={$payment[payment_id]}", 'merchant_id' => $this->config['merchant_id'], 'username' => $this->config['username'], 'password' => $this->config['password'], 'trnCardOwner' => $cc_info['cc_name_f'] . " " . $cc_info['cc_name_l'], 'trnCardNumber' => $cc_info['cc_number'], 'trnExpMonth' => substr($cc_info['cc-expire'], 0, 2), 'trnExpYear' => substr($cc_info['cc-expire'], 2, 2), 'trnOrderNumber' => $invoice, 'trnAmount' => $amount, 'ordEmailAddress' => $member['email'], 'ordName' => $member['name_f'] . " " . $member['name_l'], 'ordPhoneNumber' => $cc_info['cc_phone'], 'ordAddress1' => $cc_info['cc_street'], 'ordCity' => $cc_info['cc_city'], 'ordProvince' => $cc_info['cc_state'], 'ordPostalCode' => $cc_info['cc_zip'], 'ordCountry' => $cc_info['cc_country'], 'trnComments' => $product_description, 'vbvEnabled' => 0);
     // VBV
     if ($charge_type != CC_CHARGE_TYPE_RECURRING) {
         $vars['TermURL'] = $config['root_surl'] . "/plugins/payment/beanstream/vbv.php?payment_id={$invoice}";
         $vars['vbvEnabled'] = 1;
     }
     if ($cc_info['cc_code']) {
         $vars['trnCardCvd'] = $cc_info['cc_code'];
     }
     // prepare log record
     $vars_l = $vars;
     $vars_l['trnCardNumber'] = $cc_info['cc'];
     if ($vars['trnCardCvd']) {
         $vars_l['trnCardCvd'] = preg_replace('/./', '*', $vars['trnCardCvd']);
     }
     $vars_l['password'] = preg_replace('/./', '*', $vars['password']);
     $log[] = $vars_l;
     /////
     foreach ($vars as $kk => $vv) {
         $v = urlencode($vv);
         $k = urlencode($kk);
         $vars1[] = "{$k}={$v}";
     }
     $vars1 = join('&', $vars1);
     $ret = cc_core_get_url("https://www.beanstream.com/scripts/process_transaction.asp?{$vars1}");
     parse_str($ret, $res);
     $log[] = $res;
     if ($res['trnApproved']) {
         return array(CC_RESULT_SUCCESS, "", $res['trnId'], $log);
     } else {
         if ($res['responseType'] == 'R') {
             if ($charge_type == CC_CHARGE_TYPE_RECURRING) {
                 return array(CC_RESULT_INTERNAL_ERROR, "VBV response returned for recurring transaction", "", $log);
             }
             global $db;
             $res['pageContents'] = str_replace('\\"', '"', $res['pageContents']);
             echo $res['pageContents'];
             $payment = $db->get_payment(intval($invoice));
             $log[count($log) - 1]['pageContents'] = str_replace(array('<', '>'), array('&lt;', '&gt;'), $log[count($log) - 1]['pageContents']);
             foreach ($log as $v) {
                 $payment['data'][] = $v;
             }
             $payment['data']['vbv_redirect'] = 1;
             $db->update_payment(intval($invoice), $payment);
             $vars = get_input_vars();
             $member = $db->get_user($payment['member_id']);
             if ($charge_type != CC_CHARGE_TYPE_REGULAR && $charge_type != CC_CHARGE_TYPE_RECURRING) {
                 save_cc_info($vars, $member, $payment['paysys_id']);
             }
             exit;
         } elseif ($res['errorType'] == 'S') {
             return array(CC_RESULT_INTERNAL_ERROR, $res['messageText'], "", $log);
         } else {
             return array(CC_RESULT_DECLINE_PERM, $res['messageText'], "", $log);
         }
     }
 }