function manual_cc_mail($cc_info, $member, $payment, $charge_type) { global $config, $db; $features = $this->get_plugin_features(); $product = $db->get_product($payment['product_id']); $admin_url = $config['root_url'] . '/admin'; if ($charge_type != CC_CHARGE_TYPE_RECURRING) { $mail_subject = "*** New Manual Credit Card Signup ***"; } else { $mail_subject = "*** New Manual Credit Card Recurring Billing ***"; } $t =& new_smarty(); $t->assign(array('this_config' => $cc_info, 'currency' => $config['currency'], 'member' => $member, 'product' => $product, 'charge_type' => $charge_type, 'payment' => $payment, 'admin_url' => $admin_url, 'cc_info' => $cc_info, 'cc_type' => $features['type_options'][$cc_info['cc_type']], 'cc_number' => get_visible_cc_number($cc_info["cc_number"]), 'cc_expire' => sprintf('%02d%02d', $cc_info['cc_expire_Month'], substr($cc_info['cc_expire_Year'], 2, 2)))); $mail_body = $t->fetch($config['root_dir'] . "/plugins/payment/manual_cc/email.html"); mail_admin($mail_body, $mail_subject); }
function signup_moderator_mail($payment_id, $signup) { global $config, $db; $payment = $db->get_payment($payment_id); $member = $db->get_user($payment['member_id']); $manual_euro = $member["data"]; $product = $db->get_product($payment['product_id']); $admin_url = $config['root_url'] . '/admin'; $manual_euro_config = $this->manual_euro_get_config(); if ($signup) { $mail_subject = _PLUG_PAY_MANUAL_EURO_BANK_MAIL_SUBJ_NEW; } else { $mail_subject = _PLUG_PAY_MANUAL_EURO_BANK_MAIL_SUBJ_REBILL; } $t =& new_smarty(); $t->assign(array('currency' => $config['currency'], 'manual_euro' => $manual_euro, 'member' => $member, 'product' => $product, 'signup' => $signup, 'payment' => $payment, 'admin_url' => $admin_url, 'required_address' => $this->config['required_address'], 'manual_euro_config' => $manual_euro_config)); $mail_body = $t->fetch($config['root_dir'] . "/plugins/payment/manual_euro_bank/email.html"); mail_admin($mail_body, $mail_subject); }
} if ($vars['action'] == 'renew') { do_renew(); } elseif ($vars['action'] == 'cancel_recurring') { $p = $db->get_payment($vars['payment_id']); if ($p['member_id'] != $_amember_id) { die(_MEMBER_ID_NOT_MATCH); } $p['data']['CANCELLED']++; $db->update_payment($vars['payment_id'], $p); $t->assign('title', _MEMBER_SUBSCR_CANCELLED); $t->assign('msg', _MEMBER_RSUB_CANCELLED); $t->display("msg_close.html"); if ($config['send_cancel_admin']) { $u = $_SESSION['_amember_user']; mail_admin(sprintf(_MEMBER_MAIL_ADMIN, $u[login], $vars[payment_id]), _MEMBER_MAIL_THEME); } exit; } elseif ($vars['do_agreement']) { if (!$vars['i_agree']) { global $error; $error[] = _MEMBER_ERROR; display_agreement($vars['data']); exit; } $vars = unserialize($vars['data']); $vars['i_agree']++; do_renew(); } // common processing // get product list (to fill $_product_id also)
function signup_moderator_mail($payment_id, $member_id, &$vars) { global $config, $db; $admin_url = $config['root_url'] . '/admin'; mail_admin("\n New user was signed up today. \n Please login and check it:\n {$admin_url}/users.php?action=edit_payment&payment_id={$payment_id}&member_id={$member_id}\n ", "*** New Signup ***"); }
function mail_template_admin($t, $et) { global $db, $config, $_AMEMBER_TEMPLATE; $t->assign('config', $config); $et->lang = get_default_lang(); // load and find templated if (!$et->find_applicable()) { trigger_error("Cannot find applicable e-mail template for [{$et->name},{$et->lang},{$et->product_id},{$et->day}]", E_USER_WARNING); return false; } $_AMEMBER_TEMPLATE['text'] = $et->get_smarty_template(); $parsed_mail = $t->fetch('memory:text'); unset($_AMEMBER_TEMPLATE['text']); mail_admin($parsed_mail, ""); }
function ccbill_datalink() { global $config, $db; $this_config = $config['payment']['ccbill']; // if (!$this_config['datalink_user'] || !$this_config['datalink_pass']) { mail_admin("You have not configured DataLink access parameters.\n Please follow instructions at aMember CP -> Setup -> ccBill\n ", "ccBill DataLink Problems (aMember Pro)"); $db->log_error("ccBill DataLink parameters not entered"); return; } // define('CCBILL_TIME_OFFSET', -8 * 3600); $last_run = $this_config['last_run']; if (!$last_run || $last_run < 19700101033324) { $last_run = gmdate('YmdHis', time() - 15 * 3600 * 24 + CCBILL_TIME_OFFSET); } $now_run = gmdate('YmdHis', time() + CCBILL_TIME_OFFSET); $last_run_tm = strtotime(ccbill_time_to_sql($last_run)); $now_run_tm = strtotime(ccbill_time_to_sql($now_run)); # print "$last_run_tm;$last_run<br />$now_run_tm;$now_run<br />"; if ($now_run_tm - $last_run_tm > 3600 * 24) { $now_run_tm = $last_run_tm + 3600 * 24; } $now_run = date('YmdHis', $now_run_tm); # print "$last_run;$now_run\n"; // now lets retrieve info $vars = array('startTime' => $last_run, 'endTime' => $now_run, 'transactionTypes' => 'REBILL,REFUND,EXPIRE,CHARGEBACK', 'clientAccnum' => $this_config['account'], 'clientSubacc' => $this_config['sub_account'], 'username' => $this_config['datalink_user'], 'password' => $this_config['datalink_pass']); foreach ($vars as $k => $v) { $vars1[] = $k . '=' . $v; } $res = ccbill_get_url($s = "https://datalink.ccbill.com/data/main.cgi?" . join('&', $vars1)); $db->log_error("ccBill datalink debug ({$last_run}, {$now_run}):<br />\n{$s}<br />\n" . $res); // $res = 'REFUND, "925422","001", "123123123", "123", '.(time()-3600*48).', 155'. "\n"; // $res .= '"EXPIRE", "925422","000", "123123123", "12312312", "12312312"'. "\n"; if (preg_match('/Error:(.+)/m', $res, $regs)) { $e = $regs[1]; $db->log_error("ccBill datalink error: {$e}"); mail_admin("ccBill datalink error: {$e}", "ccBill DataLink Error"); return; } if ($res == "1") { // no lines found, and ccBill returned "1" } else { // handle ccbill output foreach (preg_split('/[\\r\\n]+/', $res) as $line_orig) { $line = trim($line_orig); if (!strlen($line)) { continue; } $line = preg_split('/,/', $line); foreach ($line as $k => $v) { $line[$k] = preg_replace('/^\\s*"(.+?)"\\s*$/', '\\1', $v); } $payment = ccbill_find_payment($line[3]); if (!$payment) { $db->log_error("Cannot find payment by ccBill datalink reference: {$line_orig}"); continue; } switch ($line[0]) { case 'EXPIRE': ccbill_expire($payment, $line); break; case 'REFUND': ccbill_refund($payment, $line); break; case 'CHARGEBACK': ccbill_refund($payment, $line); break; case 'RENEW': case 'REBILL': case 'REBill': $np = ccbill_find_payment($line[5]); if (!$np) { ccbill_renew($payment, $line); } break; default: $db->log_error("Unknown record in ccBill datalink: {$line_orig}"); } } } // set last run time at end $db->config_set('payment.ccbill.last_run', $now_run, 0); }
function process_postback($vars) { global $db, $config; $is_recurring = $GLOBALS['amember_is_recurring']; if (get_magic_quotes_gpc()) { foreach ($vars as $k => $v) { $vars[$k] = stripslashes($v); } } /// resend postback if necessary if ($this->config['resend_postback']) { foreach (preg_split('/\\s+/', $this->config['resend_postback']) as $url) { $url = trim($url); if ($url == '') { continue; } $this->resend_postback($url, $vars); } } // validate if it is true PayPal IPN if (($err = $this->paypal_validate_ipn($vars)) != '') { $this->postback_error(sprintf(_PLUG_PAY_PAYPALR_ERROR3, $err)); } // check business $emails = array_merge(array($this->config['business']), (array) preg_split('/\\r\\n/', $this->config['alt_business'])); $products = $db->get_products_list(); foreach ($products as $pr) { if ($pr['paypal_other_account']) { $emails[] = $pr['paypal_other_account']; } } $email_ok = 0; foreach ($emails as $e) { if ($e != '' && !strcasecmp($e, $vars['receiver_email'])) { $email_ok++; } } if (!$email_ok && $vars['receiver_email']) { $emails_text = join("\n", $emails); $inv = intval($vars['invoice']); mail_admin("Dear Admin,\n There is probably a problem with PayPal plugin coniguration in aMember Pro\n {$config['root_url']}/admin/\n\n PayPal sent a payment record with primary email address:\n {$vars['receiver_email']}\n However, you have only the following e-mail addresses configured in\n aMember Pro CP -> Setup/Configuration -> PayPal\n {$emails_text}\n\n If it is really your transaction and your primary PayPal email address\n is {$vars['receiver_email']}, go to aMember CP -> Setup -> PayPal\n and set configure PayPal email address as {$vars['receiver_email']}\n\n This payment won't be handled automatically. Please go to\n aMember CP -> Payments, find payment #{$inv}, click Edit and mark it as\n Paid. Also, if it is recurring transaction, set expiration date to\n Dec/31/2012. Expiration date will be corrected automatically when\n subscription will be expired or terminated.\n\n --\n Your aMember Pro script\n P.S. If you have any questions, resend this email to support@cgi-central.net\n with server access details.", "*** aMember - PayPal payment error"); $this->postback_error(sprintf(_PLUG_PAY_PAYPALR_ERROR4, $vars[receiver_email]) . sprintf(_PLUG_PAY_PAYPALR_ERROR5, $vars[receiver_email])); } if ($is_recurring) { return $this->process_recurring_postback($vars); } else { return $this->process_not_recurring_postback($vars); } }