コード例 #1
0
 function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
 {
     global $config, $db;
     $amount = sprintf("%d", $price * 100);
     $parm = "merchant_id=" . $this->config["merchant"] . " merchant_country=fr amount={$amount} currency_code=978";
     $parm .= " pathfile=" . $this->config["pathfile"] . " transaction_id={$payment_id}";
     $parm .= " normal_return_url={$config['root_url']}/thanks.php";
     $parm .= " cancel_return_url={$config['root_url']}/cancel.php";
     $parm = "{$parm} automatic_response_url={$config['root_url']}/plugins/payment/webaffair/ipn.php";
     $result = exec($this->config["path_bin"] . " {$parm}");
     $tableau = explode("!", "{$result}");
     $code = $tableau[1];
     $error = $tableau[2];
     $message = $tableau[3];
     $t =& new_smarty();
     if ($code == "" && $error == "") {
         $output = "<BR><CENTER>erreur appel request</CENTER><BR>executable request non trouve " . $this->config["path_bin"];
     } elseif ($code != 0) {
         $output = "<center><b><h2>Erreur appel API de paiement.</h2></center></b><br><br><br>message erreur : {$error} <br>";
     } else {
         $output = "<br><br>{$error}<br>{$message} <br>";
     }
     $t->assign('output', $output);
     $t->display(dirname(__FILE__) . '/webaffair.html');
     exit;
 }
コード例 #2
0
 function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
 {
     global $config, $db, $plugin_config;
     $payment = $db->get_payment($payment_id);
     $member = $db->get_user($member_id);
     $product =& get_product($product_id);
     $this_config = $plugin_config['payment']['gate2shop'];
     if ($this_config['testing']) {
         // currently HTTP POST requests use version=3.0.0 while HTTP GET requests use version=1.0.0
         $version = '1.0.0';
     } else {
         $version = '3.0.0';
     }
     $time_stamp = gmdate("Y-m-d.H:i:s");
     // current GMT time in the following format: YYYY-MM-DD.HH:MM:SS
     $vars = array('version' => $version, 'merchant_id' => $this_config['merchant_id'], 'merchant_site_id' => $this_config['site_id'], 'currency' => $product->config['gate2shop_currency'] ? $product->config['gate2shop_currency'] : 'USD', 'numberofitems' => '1', 'item_name_1' => $product->config['title'], 'item_amount_1' => $product->config['price'], 'item_quantity_1' => 1, 'total_amount' => $price, 'time_stamp' => $time_stamp, 'total_tax' => $payment['data']['TAX_AMOUNT'], 'productId' => $product_id, 'merchantLocale' => 'en_US', 'userid' => $member['member_id'], 'first_name' => $member['name_f'], 'last_name' => $member['name_l'], 'address1' => $member['street'], 'city' => $member['city'], 'state' => $member['state'], 'country' => $member['country'], 'zip' => $member['zip'], 'email' => $member['email'], 'invoice_id' => $payment['payment_id'] . "-" . $this->get_rand(3), 'customField1' => $payment['payment_id'], 'customData' => $payment['payment_id']);
     $vars['checksum'] = md5($this_config['secret'] . $vars['merchant_id'] . $vars['currency'] . $vars['total_amount'] . $vars['item_name_1'] . $vars['item_amount_1'] . $vars['item_quantity_1'] . $vars['time_stamp']);
     if ($this_config['method'] == 'GET') {
         $this->encode_and_redirect('https://secure.Gate2Shop.com/ppp/purchase.do', $vars);
         exit;
     } else {
         $t =& new_smarty();
         $t->assign('vars', $vars);
         $t->display(str_replace("c:\\", '/', dirname(__FILE__) . '/form.html'));
         exit;
     }
 }
コード例 #3
0
ファイル: rebill.php プロジェクト: subashemphasize/test_site
function do_rebill($vars)
{
    global $config;
    $d = strftime($config['date_format'], strtotime($vars['date']));
    $d1 = strftime($config['date_format'], strtotime($vars['date1']));
    $d2 = strftime($config['date_format'], strtotime($vars['date2']));
    $ds = date('Y-m-d', strtotime($vars['date']));
    $t = new_smarty();
    $t->display('admin/header.inc.html');
    print "<h1>Running Rebill for [{$d}], please wait patiently...</h1>";
    print "<p>Rebilling dates from [{$d1}] to [{$d2}].</p>";
    ob_end_flush();
    cc_core_rebill($vars['paysys_id'], $vars['date'], $from_cron = false);
    /// next
    $vars['date'] = date('Y-m-d', strtotime($vars['date']) + 3600 * 24);
    if ($vars['date'] > $vars['date2']) {
        print "<font size=3>Rebilling Finished! <a href='rebill.php'>Back to the form</a></font>";
        $t->display('admin/footer.inc.html');
        return;
    }
    $d = strftime($config['date_format'], strtotime($vars['date']));
    print <<<CUT
\t<form method=post>
\t<input type=submit name=confirm value="Process next date[{$d}]" />
\t<input type=hidden name=date value='{$vars['date']}' />
\t<input type=hidden name=date1 value='{$vars['date1']}' />
\t<input type=hidden name=date2 value='{$vars['date2']}' />
\t<input type=hidden name=paysys_id value='{$vars['paysys_id']}' />
\t</form>
CUT;
    $t->display('admin/footer.inc.html');
}
コード例 #4
0
 function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
 {
     global $config, $db;
     $payment = $db->get_payment($payment_id);
     $products = array();
     if (is_array($product_ids = $payment['data'][0]['BASKET_PRODUCTS'])) {
         foreach ($product_ids as $pid) {
             $pr = $db->get_product($pid);
             $pr['price'] = $payment['data'][0]['BASKET_PRICES'][$pid];
             $products[] = $pr;
         }
     } else {
         $products = array($db->get_product($product_id));
     }
     $t =& new_smarty();
     $t->template_dir = dirname(__FILE__);
     $t->assign('product', $products[0]);
     $t->assign('products', $products);
     $t->assign('payment', $payment);
     $t->assign('member', $db->get_user($member_id));
     $t->assign('price', $price);
     $t->assign('begin_date', $begin_date);
     $t->assign('expire_date', $expire_date);
     $t->assign('vars', $vars);
     $t->assign('config', $config);
     $t->display("offline.html");
     exit;
 }
コード例 #5
0
 function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
 {
     global $db, $config, $plugin_config;
     $t =& new_smarty();
     $t->assign(array('this_config' => $this->config, 'member' => $db->get_user($member_id), 'payment' => $pm = $db->get_payment($payment_id), 'product' => $db->get_product($pm['product_id'])));
     $t->display(dirname(__FILE__) . '/paycom.html');
     exit;
 }
コード例 #6
0
 function do_bill($amount, $title, $products, $member, $invoice)
 {
     global $config, $db;
     $product =& get_product($products[0]['product_id']);
     $vars = array('SITE_ID' => $this->config['site_id'], 'PRICING_ID' => $product->config['zombaio_id'], 'LANG' => $this->config['lang'], 'FirstName' => $member['name_f'], 'LastName' => $member['name_l'], 'Address' => $member['street'], 'Postal' => $member['zip'], 'City' => $member['city'], 'Email' => $member['email'], 'Username' => $member['login'], 'Password' => $member['pass'], 'INVOICE' => $invoice);
     $t =& new_smarty();
     $t->assign('vars', $vars);
     $t->display(dirname(__FILE__) . '/zombaio.html');
 }
コード例 #7
0
ファイル: 4cs.inc.php プロジェクト: subashemphasize/test_site
 function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
 {
     global $config;
     global $db;
     $product =& get_product($product_id);
     $vars = array('MERCHKEY' => $this->config['merchkey'], 'TRANPAGE' => $this->config['tranpage'], 'TRANTYPE' => 'AUTHPOST', 'AMT' => sprintf("%.2f", $price), 'CURR' => $this->config['currency'], 'INVOICE' => $payment_id, 'TRANID' => "AMEMBER" . $payment_id, 'URLAPPROVED' => $config['root_url'] . "/thanks.php?member_id={$member_id}&{$product_id}={$product_id}&paysys_id=4cs&res=#RC#&fres=#FC#&ac=#APP#&ref=#REF#&tran=#TRANID#&payment_id=#INVOICE#&err=#EM#", 'URLOTHER' => $config['root_url'] . "/plugins/payment/4cs/cancel.php");
     $t =& new_smarty();
     $t->assign('vars', $vars);
     $t->display(dirname(__FILE__) . '/iframe.html');
 }
コード例 #8
0
 function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
 {
     global $config, $db, $plugin_config;
     $payment = $db->get_payment($payment_id);
     $member = $db->get_user($member_id);
     $product =& get_product($product_id);
     $this_config = $plugin_config['payment']['gtbill'];
     $vars = array('merchant_id' => $this_config['merchant_id'], 'site_id' => $this_config['site_id'], 'price_id' => $product->config['gtbill_price_id'], 'currency_id' => $product->config['gtbill_currency'] ? $product->config['gtbill_currency'] : 'USD', 'name_f' => $member['name_f'], 'name_l' => $member['name_l'], 'street' => $member['street'], 'city' => $member['city'], 'state' => $member['state'], 'country' => $member['country'], 'zip' => $member['zip'], 'email' => $member['email'], 'login' => $member['login'] . '-' . $this->get_rand(3), 'pass' => $member['pass'], 'payment_id' => $payment['payment_id']);
     $t =& new_smarty();
     $t->assign('vars', $vars);
     $t->display(str_replace("c:\\", '/', dirname(__FILE__) . '/form.html'));
     exit;
 }
コード例 #9
0
 function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
 {
     global $db, $config, $plugin_config;
     $t =& new_smarty();
     $t->template_dir = dirname(__FILE__);
     $page_id = $this->config['page_id'];
     if (isset($vars['action']) && $vars['action'] == 'renew') {
         $page_id = $this->config['page_id2'];
     }
     $t->assign(array('header' => $config['root_dir'] . '/templates/header.html', 'footer' => $config['root_dir'] . '/templates/footer.html', 'this_config' => $this->config, 'page_id' => $page_id, 'member' => $db->get_user($member_id), 'payment' => $pm = $db->get_payment($payment_id), 'product' => $db->get_product($pm['product_id'])));
     $t->display('multicards.html');
     exit;
 }
コード例 #10
0
 function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
 {
     global $config;
     global $db;
     $product =& get_product($product_id);
     $member = $db->get_user($member_id);
     if (!$product->config['icepay_currency']) {
         $product->config['icepay_currency'] = "GBP";
     }
     $vars = array('merchant' => $this->config['merchkey'], 'amount' => intval($price * 100), 'currency' => $product->config['icepay_currency'], 'ic_country' => $member['country'], 'orderid' => $payment_id, 'reference' => "AMEMBER" . $payment_id, 'description' => $product->config['title'], 'visa_checksum' => sha1($this->config['secret'] . "|" . $this->config['merchkey'] . "|" . intval($price * 100) . "|" . $product->config['icepay_currency'] . "|" . $payment_id . "|CREDITCARD|VISA"), 'master_checksum' => sha1($this->config['secret'] . "|" . $this->config['merchkey'] . "|" . intval($price * 100) . "|" . $product->config['icepay_currency'] . "|" . $payment_id . "|CREDITCARD|MASTER"), 'amex_checksum' => sha1($this->config['secret'] . "|" . $this->config['merchkey'] . "|" . intval($price * 100) . "|" . $product->config['icepay_currency'] . "|" . $payment_id . "|CREDITCARD|AMEX"), 'urlcompleted' => $config['root_url'] . "/plugins/payment/icepay/thanks.php");
     $t =& new_smarty();
     $t->assign('vars', $vars);
     $t->display(dirname(__FILE__) . '/icepay.html');
 }
コード例 #11
0
 function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
 {
     global $config, $db;
     $product = $db->get_product($product_id);
     $vars = array('psb' => 'psb', 'biz' => $this->config['merchant_id'], 'inv' => $payment_id, 'itm' => substr($product['title'], 0, 200), 'amt' => $price, 'reqURL' => $config['root_url'] . "/plugins/payment/paysbuy/ipn.php", 'postURL' => $config['root_url'] . "/plugins/payment/paysbuy/thanks.php");
     if ($this->config['currency']) {
         $vars['currencyCode'] = $this->config['currency'];
     }
     //$db->log_error("PaySbuy SENT: " . paysbuy_get_dump($vars));
     $t =& new_smarty();
     $t->template_dir = dirname(__FILE__);
     $t->assign('vars', $vars);
     $t->display('paysbuy.html');
     exit;
 }
コード例 #12
0
 function do_bill($amount, $title, $products, $u, $invoice)
 {
     global $config, $db, $plugin_config;
     $product = $products[0];
     $payment = $db->get_payment($invoice);
     $this_config = $plugin_config['payment']['realex_redirect'];
     $vars = array('merchant_id' => $this_config['merchant_id'], 'order_id' => $invoice, 'account' => $this_config['account'], 'amount' => $amount, 'currency' => $product['realex_redirect_currency'] ? $product['realex_redirect_currency'] : 'USD', 'timestamp' => date("YmdHis"), 'comment1' => $product['title'], 'cust_num' => $payment['member_id'], 'auto_settle_flag' => '1');
     $hash = $vars['timestamp'] . "." . $vars['merchant_id'] . "." . $vars['order_id'] . "." . $vars['amount'] . "." . $vars['currency'];
     $hash = md5($hash);
     $hash = $hash . "." . $this_config['secret'];
     $hash = md5($hash);
     $vars['md5hash'] = $hash;
     $t =& new_smarty();
     $t->assign('vars', $vars);
     $t->display(str_replace("c:\\", '/', dirname(__FILE__) . '/form.html'));
     exit;
 }
コード例 #13
0
 function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
 {
     global $config;
     global $db;
     $orig_product_id = $product_id;
     if (is_array($product_id)) {
         $product_id = $product_id[0];
     }
     $product =& get_product($product_id);
     if (count($orig_product_id) > 1) {
         $product->config['title'] = $config['multi_title'];
     }
     $vars = array('merchant_id' => $this->config['merchant_id'], 'amount' => sprintf("%.2f", $price), 'currency' => $this->config['currency'], 'language' => 'en', 'display_text' => $product->config['title'], 'token' => md5(strtolower($this->config['merchant_id'] . ":" . sprintf("%.2f", $price) . ":" . $this->config['currency'] . ":") . $this->config['secret']), 'txt1' => $product->config['title'], 'txt2' => $payment_id, 'test_mode' => $this->config['testing']);
     $t =& new_smarty();
     $t->assign('vars', $vars);
     $t->display(dirname(__FILE__) . '/cashu.html');
     exit;
 }
コード例 #14
0
 function process_postback($vars)
 {
     global $db, $t;
     $payment_id = $vars['payment_id'];
     //        if (!preg_match('/secure\.paymentclearing\.com/', $r=$_SERVER['HTTP_REFERER']))
     //            $this->postback_error("Bad Refering URL - $r");
     // process payment
     $err = $db->finish_waiting_payment($payment_id, $this->get_plugin_name(), $invoice, $amount = '', $vars);
     if ($err) {
         $this->postback_error("finish_waiting_payment error: {$err}");
     }
     $t =& new_smarty();
     $pm = $db->get_payment($payment_id);
     $t->assign('payment', $pm);
     $t->assign('product', $pr);
     $t->assign('member', $db->get_user($pm['member_id']));
     $t->display("thanks.html");
 }
コード例 #15
0
 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());
 }
コード例 #16
0
*
*     Author: Alex Scott
*      Email: alex@cgi-central.net
*        Web: http://www.cgi-central.net
*    Details: Affiliate commission
*    FileName $RCSfile$
*    Release: 3.1.8PRO ($Revision: 2029 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*                                                                          
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*/
include "../config.inc.php";
$t = new_smarty();
include "login.inc.php";
admin_check_permissions('affiliates');
$vars = get_input_vars();
function display_banners()
{
    global $db, $t, $config;
    /////
    $links = array();
    foreach ((array) $config['aff']['links'] as $i => $l) {
        $l['url'] = aff_make_url($l['url'], 'l' . $i, -1);
        $l['code'] = "<a href=\"{$l['url']}\">{$l['title']}</a>";
        $links[$i] = $l;
    }
    $t->assign('links', $links);
    /////////
コード例 #17
0
ファイル: thanks.php プロジェクト: subashemphasize/test_site
 if (!$result->isAuthenticated()) {
     //Transaction failed, inform the consumer
     print "Uw bestelling is helaas niet betaald, probeer het nog eens";
     print "<br /><a href=\"javascript:location.reload();\">Please reload this page to update a payment status.</a>";
 } else {
     print "<br />Bedankt voor uw bestelling";
     $transactionID = $result->getTransactionID();
     //Here you should retrieve the order from the database, mark it as "payed"
     //and display the result to your customer.
     print "<br />De bestelling is betaald en wordt naar u opgestuurd";
     // process payment
     $err = $db->finish_waiting_payment($invoice, 'ideal', $txn_id, $payment_gross, $vars);
     if ($err) {
         ideal_error("finish_waiting_payment error: {$err}");
     }
     $t =& new_smarty();
     if ($payment_id) {
         $pm = $db->get_payment($payment_id);
         $t->assign('payment', $pm);
         if ($pm) {
             $t->assign('product', $db->get_product($pm['product_id']));
             $t->assign('member', $db->get_user($pm['member_id']));
         }
         if (!($prices = $pm['data'][0]['BASKET_PRICES'])) {
             $prices = array($pm['product_id'] => $pm['amount']);
         }
         $pr = array();
         $subtotal = 0;
         foreach ($prices as $product_id => $price) {
             $v = $db->get_product($product_id);
             //        $v['price'] = $price;
コード例 #18
0
 function handle_cancel($vars, $mid = 0)
 {
     global $db, $config;
     settype($vars['payment_id'], 'integer');
     $mid = intval($mid);
     if (!$vars['payment_id']) {
         fatal_error("Payment_id empty");
     }
     $payment = $db->get_payment($vars['payment_id']);
     if (!$mid) {
         $mid = $_SESSION['_amember_id'];
     }
     if ($payment['member_id'] != $mid) {
         fatal_error(_PLUG_PAY_CC_CORE_FERROR4);
     }
     $p = $db->get_payment($vars['payment_id']);
     $member = $db->get_user($p['member_id']);
     $url = "https://api.clickbank.com/rest/1.2/tickets/" . $p['receipt_id'];
     $post = "type=cncl&reason=ticket.type.cancel.7&comment=cancellation%20request%20from%20aMember%20user%20(" . $member['login'] . ")";
     $url = $url . "?" . $post;
     $headers = array();
     $headers[] = "Accept: application/xml";
     $headers[] = "Authorization: " . $this->config['developer_key'] . ":" . $this->config['clerk_user_key'];
     $res = $this->get_url($url, $headers);
     $res_body = $res;
     if (preg_match("/\r\n\r\n(.*)/i", $res, $matches)) {
         $res_body = $matches[1];
     }
     $msg = _PLUG_PAY_CC_CORE_SBSCNCL2;
     $title = _PLUG_PAY_CC_CORE_SBSCNCL;
     if (!preg_match("/HTTP\\/1\\.1 200 OK/i", $res)) {
         $msg = "An error occured while cancellation request.";
         if ($res_body) {
             $msg .= "<br /><font color=red><b>" . $res_body . "</b></font>";
         }
         $title = "Subscription cancellation ERROR";
     } else {
         $xml = $this->parse_xml($res_body);
         $p['data'][] = $xml;
         $db->update_payment($p['payment_id'], $p);
         $response = array();
         if ($xml['ticketid']) {
             $response[] = "Ticket: " . $xml['ticketid'];
         }
         if ($xml['type']) {
             $response[] = "Type: " . $xml['type'];
         }
         if ($xml['action']) {
             $response[] = "Action: " . $xml['action'];
         }
         $response = implode("<br />", $response);
         if ($response) {
             $msg .= "<br /><b>Response from Clickbank</b><br />" . $response;
         }
     }
     $t =& new_smarty();
     $member = $db->get_user($p['member_id']);
     // email to member if configured
     if ($config['mail_cancel_admin']) {
         $t->assign('user', $member);
         $t->assign('payment', $p);
         $t->assign('product', $db->get_product($p['product_id']));
         $et =& new aMemberEmailTemplate();
         $et->name = "mail_cancel_admin";
         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 =& new_smarty();
     $t->assign('title', $title);
     $t->assign('msg', $msg);
     $t->display("msg_close.html");
 }
コード例 #19
0
 function process_return($vars)
 {
     global $db, $config;
     $token = $vars['token'];
     if ($token == '') {
         $this->postback_error(_PLUG_PAY_PAYPALPRO_ERROR);
     }
     $details = $this->getExpressCheckoutDetails($token);
     $invoice = $_SESSION[_amember_payment_id];
     $payment = $db->get_payment($invoice);
     if (!$payment) {
         $this->postback_error(sprintf(_PLUG_PAY_PAYPALPRO_ERROR2, $invoice));
     }
     if ($vars['confirm'] <= 0) {
         list($amount, $title, $products, $u, $invoicex) = $this->get_payment_params($invoice);
         $t = new_smarty();
         $t->assign('payment', $payment);
         $t->assign('member', $u);
         $t->assign('products', $products);
         $subtotal = 0;
         foreach ($products as $i => $p) {
             $pr = $db->get_product($p['product_id']);
             $products[$i]['price'] = $pr['price'];
             $subtotal += $pr['price'];
         }
         $t->assign('subtotal', $subtotal);
         $t->assign('total', $payment['amount']);
         $t->display(dirname(__FILE__) . "/confirm.html");
         exit;
     }
     if ($details['AMT'] == 0) {
         list($txn_id, $amt) = array("Free Trial", 0);
     } else {
         list($txn_id, $amt) = $this->doExpressCheckout($invoice, $details);
     }
     if ($txn_id != '') {
         $err = $db->finish_waiting_payment($invoice, $this->get_plugin_name(), $txn_id, $amt, $vars = array());
         if ($err) {
             fatal_error($err);
             return false;
         } else {
             $this->createRecurringBillingProfiles($invoice, $details['TOKEN'], '', $details);
             header("Location: {$config['root_url']}/thanks.php?payment_id={$invoice}");
             return true;
         }
     } else {
         fatal_error(_PLUG_PAY_PAYPALPRO_FERROR8);
         return false;
     }
 }
コード例 #20
0
function member_send_zero_autoresponder($payment_id, $member_id = 0)
{
    global $db, $config;
    $p = $db->get_payment($payment_id);
    $member_id = $p['member_id'];
    $pr = $db->get_product($p['product_id']);
    $t = new_smarty();
    $et =& new aMemberEmailTemplate();
    $et->name = "mail_autoresponder";
    $et->product_id = $pr['product_id'];
    $pl[0] = $pr;
    $pl[0]['autoresponder'] = array_filter($et->find_days(), 'keep_only_zeroes');
    // set global responder
    if ($config['mail_autoresponder']) {
        $et =& new aMemberEmailTemplate();
        $et->name = "mail_autoresponder";
        $days = $et->find_days();
        if ($days) {
            $pl[] = array('product_id' => -1, 'autoresponder' => array_filter($days, 'keep_only_zeroes'), 'autoresponder_renew' => $config['autoresponder_renew']);
        }
    }
    foreach ($pl as $pr) {
        $t =& new_smarty();
        if (!$pr['autoresponder']) {
            continue;
        }
        //        if (!preg_match_all('/^\s*(\d+)\s*\-\s*(.+?)\s*$/m', $pr['autoresponder'], $regs))
        //continue;
        if ($pr['product_id'] > 0) {
            $product_where = "AND p.product_id={$pr['product_id']}";
        } else {
            $product_where = "";
        }
        foreach ($pr['autoresponder'] as $days) {
            $dat = date('Y-m-d', time() - $days * 3600 * 24);
            $today = date('Y-m-d');
            if ($pr['autoresponder_renew']) {
                $q = $db->query($s = "SELECT m.*\n                FROM {$db->config['prefix']}payments p\n                LEFT JOIN {$db->config['prefix']}members m USING (member_id)\n                WHERE m.member_id = '{$member_id}' and p.begin_date='{$dat}' AND p.completed>0\n                    {$product_where}\n                GROUP BY m.member_id ");
            } else {
                $q = $db->query($s = "SELECT m.*\n                FROM {$db->config['prefix']}members m\n                LEFT JOIN {$db->config['prefix']}payments p USING (member_id)\n                WHERE m.member_id = '{$member_id}' and p.completed > 0\n                AND p.begin_date <= '{$today}' {$product_where}\n                GROUP BY m.member_id\n                HAVING\n                SUM(to_days(if(p.expire_date>'{$today}', '{$today}', p.expire_date)) - to_days(p.begin_date)) = {$days}\n                AND\n                MAX(p.expire_date) >= '{$today}'\n                ");
            }
            $et =& new aMemberEmailTemplate();
            $et->name = "mail_autoresponder";
            $et->product_id = $pr['product_id'] > 0 ? $pr['product_id'] : null;
            $et->day = $days;
            while ($u = mysql_fetch_assoc($q)) {
                $u['data'] = $db->decode_data($u['data']);
                $t->assign('user', $u);
                $t->assign('product', $pr);
                $t->assign('login', $u['login']);
                $t->assign('pass', $u['pass']);
                $t->assign('name_f', $u['name_f']);
                $t->assign('name_l', $u['name_l']);
                if ($u['unsubscribed']) {
                    continue;
                }
                mail_template_user($t, $et, $u, true);
            }
        }
    }
}
コード例 #21
0
 function do_payment($payment_id, $member_id, $product_id, $price, $begin_date, $expire_date, &$vars)
 {
     global $config, $db;
     $product =& get_product($product_id);
     $vars = array('subscription' => $product->config['is_recurring'] ? '1' : '0', 'merchantnumber' => $this->config['merchantnumber'], 'amount' => intval($price * 100), 'currency' => $this->config['currency'], 'orderid' => $payment_id, 'md5key' => md5($this->config['currency'] . intval($price * 100) . $payment_id . $this->config['secret']), 'windowstate' => $this->config['windowstate']);
     $t =& new_smarty();
     $t->assign('vars', $vars);
     $t->display(dirname(__FILE__) . '/epayeu.html');
     exit;
 }
コード例 #22
0
 function process_recurring_postback($vars)
 {
     global $db, $config, $t;
     switch ($vars['txn_type']) {
         case '_xclick-subscriptions':
             if ($vars['payment_status'] != 'Completed') {
                 $this->postback_error(sprintf(_PLUG_PAY_PAYPALR_ERROR6, $vars[payment_status]) . _PLUG_PAY_PAYPALR_ERROR7);
             }
             $invoice = intval($vars['invoice']);
             $payment_id = $this->find_last_payment_id($vars['subscr_id'], $invoice);
             $this->get_lock();
             $p = $db->get_payment($payment_id);
             // it is a first payment for this subscription
             // if !payment written, write to current
             //
             mail('*****@*****.**', 'KERYGMA.TV SUBSCRIPTION PAYMENT', serialize($p));
             //   1. set previous payment expire_date to yesterday
             //   2. add a new payment with
             $p['expire_date'] = date('Y-m-d');
             $db->update_payment($p['payment_id'], $p);
             $this->release_lock();
             $pr = get_product($p[product_id]);
             $newp = array();
             $newp['member_id'] = $p['member_id'];
             $newp['product_id'] = $p['product_id'];
             $newp['paysys_id'] = 'epayph';
             $newp['receipt_id'] = $vars['subscr_id'];
             $newp['begin_date'] = date('Y-m-d');
             $newp['expire_date'] = $pr->get_expire(date('Y-m-d'), 'expire_days');
             $newp['amount'] = $p['amount'];
             $newp['completed'] = 1;
             $newp['data'] = array('txn_id' => $vars['txn_id'], 'epayph_vars' => $p['data']['epayph_vars']);
             $newp['tax_amount'] = $p['data']['epayph_vars']['tax3'];
             $newp['data'][] = $vars;
             $db->add_payment($newp);
             break;
         case 'subscr_signup':
             $this->get_lock();
             $invoice = intval($vars['invoice']);
             $payment = $db->get_payment($invoice);
             if (!$payment['payment_id']) {
                 $invoice = $this->create_new_payment($vars);
                 $payment = $db->get_payment($invoice);
             }
             if ($err = $this->check_periods($vars, $payment)) {
                 $this->postback_error($err);
             }
             // update customer e-mail if option enabled
             if ($this->config['rewrite_email'] && $vars['payer_email'] != '') {
                 $u = $db->get_user($payment['member_id']);
                 if (!$u['data']['epayph_email_rewritten']) {
                     $u['data']['epayph_email_rewritten'] = 1;
                     $u['email'] = $vars['payer_email'];
                     $db->update_user($u['member_id'], $u);
                 }
             }
             if (isset($vars['mc_amount1']) && $vars['mc_amount1'] == 0) {
                 // Free trial period, need to activate payment because next subscr_payment will be sent only for first payment.
                 $err = $db->finish_waiting_payment($invoice, $this->get_plugin_name(), $vars['subscr_id'], $vars['mc_gross'], $vars, $vars['payer_id']);
                 if ($err) {
                     $this->postback_error("finish_waiting_payment error: {$err}");
                 }
                 $payment = $db->get_payment($invoice);
                 $payment['data']['txn_id'] = 'subscr_signup';
                 $db->update_payment($invoice, $payment);
             } else {
                 // Just save IPN message for debug;
                 $payment['data'][] = $vars;
                 $db->update_payment($invoice, $payment);
             }
             // handle transaction
             //                $p = $db->get_payment($invoice);
             //                $p['begin_date']  = date('Y-m-d');
             //                $p['expire_date'] = '2012-12-31';
             //                $db->update_payment($invoice, $p);
             $this->release_lock();
             break;
         case 'subscr_eot':
         case 'subscr_failed':
             $payment_id = $this->find_last_payment_id($vars['subscr_id'], $vars['invoice']);
             if (!$payment_id) {
                 $this->postback_error(_PLUG_PAY_PAYPALR_ERROR11);
             }
             $p = $db->get_payment($payment_id);
             $new_expire = date('Y-m-d', time() - 3600 * 24);
             //yesterday date
             if ($p['expire_date'] && $new_expire < $p['expire_date']) {
                 $p['expire_date'] = $new_expire;
                 if (!$p['data']['failed_orig_expiration']) {
                     $p['data']['failed_orig_expiration'] = $p['expire_date'];
                 }
             }
             $p['data'][] = $vars;
             $db->update_payment($payment_id, $p);
             break;
         case 'subscr_cancel':
             $payment_id = $this->find_last_payment_id($vars['subscr_id'], $vars['invoice']);
             if (!$payment_id) {
                 $this->postback_error(_PLUG_PAY_PAYPALR_ERROR11);
             }
             $p = $db->get_payment($payment_id);
             $p['data'][] = $vars;
             $p['data']['CANCELLED'] = 1;
             $p['data']['CANCELLED_AT'] = strftime($config['time_format'], time());
             $db->update_payment($payment_id, $p);
             if (!$t) {
                 $t =& new_smarty();
             }
             if ($config['mail_cancel_admin']) {
                 $t->assign('user', $db->get_user($p[member_id]));
                 $t->assign('payment', $p);
                 $t->assign('product', $db->get_product($p['product_id']));
                 $et =& new aMemberEmailTemplate();
                 $et->name = "mail_cancel_admin";
                 mail_template_admin($t, $et);
             }
             if ($config['mail_cancel_member']) {
                 $t->assign('user', $member = $db->get_user($p[member_id]));
                 $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);
             }
             break;
         case 'subscr_payment':
             if ($vars['payment_status'] != 'Completed') {
                 $this->postback_error(sprintf(_PLUG_PAY_PAYPALR_ERROR6, $vars[payment_status]) . _PLUG_PAY_PAYPALR_ERROR7);
             }
             $invoice = intval($vars['invoice']);
             $payment_id = $this->find_last_payment_id($vars['subscr_id'], $invoice);
             if (!$payment_id) {
                 $payment_id = $this->create_new_payment($vars);
                 $invoice = $payment_id;
             }
             if (!$payment_id) {
                 $this->postback_error(_PLUG_PAY_PAYPALR_ERROR11);
             }
             $this->get_lock();
             $p = $db->get_payment($payment_id);
             // if that is a NEW RECURRING payment,
             if ($p['data']['txn_id'] == $vars['txn_id']) {
                 // just record a payment for debug
                 $p['data'][] = $vars;
                 $db->update_payment($p['payment_id'], $p);
                 $this->release_lock();
                 return true;
             }
             // it is a first payment for this subscription
             // if !payment written, write to current
             //
             if ($p['payment_id'] == $invoice && !$p['data']['txn_id']) {
                 if (!$p['completed']) {
                     $err = $db->finish_waiting_payment($invoice, $this->get_plugin_name(), $vars['subscr_id'], $vars['mc_gross'], $vars, $vars['payer_id']);
                     if ($err) {
                         $this->postback_error("finish_waiting_payment error: {$err}");
                     }
                     $p = $db->get_payment($invoice);
                     $p['data']['txn_id'] = $vars['txn_id'];
                     $db->update_payment($invoice, $p);
                 } else {
                     $p['data'][] = $vars;
                     $p['amount'] = $vars['mc_gross'];
                     $p['data']['txn_id'] = $vars['txn_id'];
                     if ($p['data']['failed_orig_expiration']) {
                         $p['expire_date'] = $p['data']['failed_orig_expiration'];
                         $p['data']['failed_orig_expiration'] = '';
                     }
                     //                    $p['expire_date'] = '2012-12-31'; // set to 'Recurring' again. This can be possible re-try for recently failed payment.
                     $db->update_payment($p['payment_id'], $p);
                 }
                 $this->release_lock();
                 //                    if ($vars['txn_type'] == 'subscr_payment'){
                 //                        add_affiliate_commission($payment_id, $vars['txn_id'], $vars['mc_gross']);
                 //                    }
             } else {
                 //   1. set previous payment expire_date to yesterday
                 //   2. add a new payment with
                 $p['expire_date'] = date('Y-m-d');
                 $db->update_payment($p['payment_id'], $p);
                 $this->release_lock();
                 $pr = get_product($p[product_id]);
                 $newp = array();
                 $newp['member_id'] = $p['member_id'];
                 $newp['product_id'] = $p['product_id'];
                 $newp['paysys_id'] = 'epayph';
                 $newp['receipt_id'] = $vars['subscr_id'];
                 $newp['begin_date'] = date('Y-m-d');
                 $newp['expire_date'] = $pr->get_expire(date('Y-m-d'), 'expire_days');
                 $newp['amount'] = $vars['mc_gross'];
                 $newp['completed'] = 1;
                 $newp['data'] = array('txn_id' => $vars['txn_id'], 'epayph_vars' => $p['data']['epayph_vars']);
                 $newp['tax_amount'] = $p['data']['epayph_vars']['tax3'];
                 $newp['data'][] = $vars;
                 $db->add_payment($newp);
             }
             break;
         default:
             /// handle and register other events
             if (in_array($vars['payment_status'], array('Reversal', 'Refunded'))) {
                 return $this->process_refund($vars, $is_recurring = 1);
             }
             $this->get_lock();
             $payment_id = $this->find_last_payment_id($vars['subscr_id'], $vars['invoice']);
             if (!$payment_id) {
                 $this->postback_error(_PLUG_PAY_PAYPALR_ERROR11);
             }
             $p = $db->get_payment($payment_id);
             $p['data'][] = $vars;
             $data = $db->encode_data($p['data']);
             $data = $db->escape($data);
             $db->query($s = "UPDATE {$db->config[prefix]}payments\n                SET data = '{$data}',\n                    amount = '{$p[amount]}'\n                WHERE payment_id={$payment_id}");
             $this->release_lock();
     }
     return true;
 }
コード例 #23
0
function do_rebill()
{
    global $config, $db;
    $t = new_smarty();
    $vars = get_input_vars();
    if ($vars['dat'] == '') {
        die('[dat] cannot be empty');
    }
    $dat = $vars['dat'];
    if (time() - strtotime($dat) > 3600 * 24 * 30) {
        die("Rebill cannot be called for periods longer than 30 days from nows");
    }
    if (time() - strtotime($dat) < 0) {
        die("Rebill cannot be called for future dates - please wait the date ");
    }
    $t->display('admin/header.inc.html');
    $hdat = strftime($config['date_format'], strtotime($dat));
    if (!$vars['paysys_id']) {
        print "\n\t<h2>Manual CC Rebill {$hdat}</h2>\n\t<br><br><p>Are you sure you want to run rebill process for date {$hdat} ?\n\t<a href='rebill_log.php?do=rebill_stats'>Click here to cancel and back to rebill reports</a>\n\t</p>";
        print "<p><b>Make sure to do not close browser windows and do not start any new rebill processes until it is finished, else it may result to double billing of customers</p></b>";
        $options = "";
        foreach (cc_core_get_plugins(true) as $p) {
            $options .= "<option value='{$p}'>{$p}</option>\n";
        }
        $dat = htmlentities($vars['dat']);
        print "<form method='post' action='rebill_log.php'>\n\t<select name='paysys_id'>\n\t<option value=''>*** Select a Payment System to continue ***</option>\n\t{$options}</select> <br />\n\t<label><input type='checkbox' name='repeat_declined' value='1' />\n\tRe-process payments that were marked as declined\n\t</label><br />\n\t<input type='submit' value='Continue'>\n\t<input type='hidden' name='dat' value='{$dat}'>\n\t<input type='hidden' name='do' value='rebill'>\n\t</form>\n\t";
    } else {
        // do rebill
        print "\n\t\t<h2>Manual CC Rebill {$hdat} - {$vars['paysys_id']}</h2>";
        print "<p><b>Please do not stop/exit your browser, do not run other payment processes until this process is finished!</b></p>";
        for ($i = 0; $i < 100; $i++) {
            print "          \n";
        }
        // to flush browser/apache buffer for sure
        print " Rebilling Process started at " . strftime($config['time_format']) . "....<br />\n";
        ob_end_flush();
        $dat = date('Y-m-d', strtotime($vars['dat']));
        $was = $db->query_one("SELECT COUNT(*) FROM {$db->config[prefix]}rebill_log");
        cc_core_rebill($vars['paysys_id'], $dat, $from_cron = false, intval($vars['repeat_declined']));
        $now = $db->query_one("SELECT COUNT(*) FROM {$db->config[prefix]}rebill_log");
        $added = $now - $was;
        print " Rebilling Process finished at " . strftime($config['time_format']) . ".<br />\n\t\t <b>{$added}</b> transactions processed. <br />\n";
        print "<br /><a href='rebill_log.php?do=rebill_stats'>Go back to Rebilling Stats</a>";
    }
    $t->display('admin/footer.inc.html');
}
コード例 #24
0
function tax_page_get(&$field, &$vars)
{
    global $config;
    $t = new_smarty();
    $t->assign('v', $vars);
    return $t->fetch('admin/setup_tax.html');
}
コード例 #25
0
 function handle_postback($vars)
 {
     global $db, $config;
     $log = array();
     require_once $config['root_dir'] . "/plugins/payment/secpay/lib/nusoap.php";
     if (!isset($vars['MD'])) {
         print "Post error";
         exit;
     }
     if (!isset($_COOKIE[$vars['MD']])) {
         print "Cookie error";
         $db->log_error("Cookie not set for MD=" . $vars['MD']);
         exit;
     }
     $payment_id = $_COOKIE[$vars['MD']];
     if (!$payment_id) {
         print "Payment not found";
         $db->log_error("Payment not found for MD=" . $vars['MD']);
         exit;
     }
     $payment = $db->get_payment($payment_id);
     //write logs
     $log[] = $vars;
     $sendvars = array("mid" => $this->config['id'], "vpn_pswd" => $this->config['pass'], "trans_id" => "AMEMBER{$payment_id}", "md" => $vars['MD'], "paRes" => $vars['PaRes'], "options" => "");
     switch ($this->config['testing']) {
         case 1:
             $sendvars['options'] .= "test_status=true,test_mpi_status=true";
             break;
         case 2:
             $sendvars['options'] .= "test_status=false";
             break;
     }
     $res = $this->run_transaction($sendvars, "threeDSecureAuthorisationRequest");
     $log[] = $sendvars;
     //write logs and payment
     $log[] = $res;
     foreach ($log as $v) {
         $payment['data'][] = $v;
     }
     $db->update_payment($payment_id, $payment);
     if ($res['mpi_status_code'] != 237 || $res['valid'] != "true") {
         print $res['mpi_message'];
         $db->log_error($res['mpi_message'] . " for payment #" . $payment_id);
         exit;
     }
     $invoice = $payment_id;
     // process payment
     $err = $db->finish_waiting_payment($invoice, 'secpay', $vars['MD'], $payment['amount'], $vars);
     if ($err) {
         $this->secpay_error("finish_waiting_payment error: {$err}");
     }
     $t =& new_smarty();
     $t->assign('payment', $payment);
     if ($payment) {
         $t->assign('product', $db->get_product($payment['product_id']));
         $t->assign('member', $db->get_user($payment['member_id']));
     }
     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);
         //        $v['price'] = $price;
         $subtotal += $v['price'];
         $pr[$product_id] = $v;
     }
     $t->assign('subtotal', $subtotal);
     $t->assign('total', array_sum($prices));
     $t->assign('products', $pr);
     $t->display("thanks.html");
 }
コード例 #26
0
 function query($s, $ignore_error = 0)
 {
     global $config;
     if ($this->debug_sql) {
         print "<br /><pre>{$s}</pre>";
     }
     if (defined('AM_SQL_PROFILE')) {
         tmUsage('before_query', false, true);
     }
     if ($res = mysql_query($s, $this->conn)) {
         if (defined('AM_SQL_PROFILE')) {
             tmUsage("QUERY:\n<br \\>{$s}\n<br \\>", false, true);
         }
         return $res;
     } else {
         if ($ignore_error) {
             //                print "<font color=red>MYSQL ERROR:<br />" . mysql_error($this->conn) .
             //                "<br />in query:<br />$s</font>";
         } else {
             $t =& new_smarty();
             $t->assign('is_html', 0);
             $t->assign('error', "MYSQL Error happened, script stopped. Website admin\n                can find more details about the problem at CP -> Error Log");
             $t->assign('admin_email', $config['admin_email']);
             $t->display("fatal_error.html");
             $this->log_error("MYSQL ERROR:<br />" . mysql_error($this->conn) . "<br />in query:<br />" . $s, 1, 1);
             exit;
         }
     }
 }
コード例 #27
0
function admin_html_redirect($url, $title = 'Redirect', $text = '', $target_top = false)
{
    global $t;
    if (!$t) {
        $t =& new_smarty();
    }
    $t->assign('title', $title);
    $t->assign('text', $text);
    $t->assign('url', $url);
    $t->assign('target_top', $target_top);
    $t->display('admin/redirect.html');
}
コード例 #28
0
function _amember_run()
{
    global $affiliates_signup;
    $self = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'];
    if ($_amember_error = _amember_check_access()) {
        /// serialize request variables
        $_amember_prev_request = $_SESSION['_amember_prev_request'];
        //		if (!$_SESSION['_amember_prev_request']){
        $_SESSION['_amember_prev_request'] = $_amember_prev_request = array('GET' => $_GET, 'POST' => $_POST, 'METHOD' => $_SERVER['REQUEST_METHOD']);
        /// display login form
        $t =& new_smarty();
        global $plugin_config;
        if ($_amember_error == _LOGIN_PLEASE_LOGIN && $_POST['login_attempt_id'] == '') {
            $t->assign('error', null);
        } else {
            $t->assign('error', $_amember_error);
        }
        $t->assign('form_action', $self);
        $t->assign('this_config', $plugin_config['protect']['php_include']);
        if (isset($affiliates_signup) && $affiliates_signup == 1) {
            $t->assign('affiliates_signup', '1');
        }
        $t->display('login.html');
        exit;
    } else {
        // auth successfull
        // extract serialized request vars
        global $_amember_prev_request;
        if ($o = $_SESSION['_amember_prev_request']) {
            $_GET = $o['GET'];
            $_POST = $o['POST'];
            unset($_SESSION['_amember_prev_request']);
            /// we don't set global variables here by security reasons
        }
    }
}
コード例 #29
0
ファイル: rebuild.php プロジェクト: subashemphasize/test_site
function showRebuildPage()
{
    $t = new_smarty();
    $t->display("admin/rebuild.html");
}
コード例 #30
0
 function process_thanks(&$vars)
 {
     global $db;
     //$this->log_debug($vars);
     $t = new_smarty();
     $p = $db->get_payment($vars['customerOrderID']);
     $pr = $db->get_payment($p['product_id']);
     $t->assign('payment', $p);
     $t->assign('product', $pr);
     $t->assign('member', $db->get_user($p['member_id']));
     /*if ($vars['intStatus'] != '1'){   
     			$t->display("cancel.html");
     			exit();
     		}*/
     $t->display("thanks.html");
 }