当前位置: 首页>>代码示例>>PHP>>正文


PHP c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen方法代码示例

本文整理汇总了PHP中c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen方法的具体用法?PHP c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen怎么用?PHP c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在c_ws_plugin__s2member_paypal_utilities的用法示例。


在下文中一共展示了c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: stripe_notify

 /**
  * Handles Stripe Webhook/IPN event processing.
  *
  * @package s2Member\Stripe
  * @since 140617
  *
  * @attaches-to ``add_action('init');``
  */
 public static function stripe_notify()
 {
     global $current_site, $current_blog;
     if (!empty($_GET['s2member_pro_stripe_notify']) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_stripe_api_secret_key']) {
         $stripe = array();
         // Initialize array of Webhook/IPN event data and s2Member log details.
         @ignore_user_abort(TRUE);
         // Continue processing even if/when connection is broken.
         require_once dirname(__FILE__) . '/stripe-sdk/lib/Stripe.php';
         Stripe::setApiKey($GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_stripe_api_secret_key']);
         if (is_object($event = c_ws_plugin__s2member_pro_stripe_utilities::get_event()) && ($stripe['event'] = $event)) {
             switch ($event->type) {
                 case 'invoice.payment_succeeded':
                     // Subscription payments.
                     if (!empty($event->data->object) && ($stripe_invoice = $event->data->object) instanceof Stripe_Invoice && !empty($stripe_invoice->customer) && !empty($stripe_invoice->subscription) && ($stripe_invoice_total = number_format(c_ws_plugin__s2member_pro_stripe_utilities::cents_to_dollar_amount($stripe_invoice->total, $stripe_invoice->currency), 2, '.', '')) > 0 && is_object($stripe_subscription = c_ws_plugin__s2member_pro_stripe_utilities::get_customer_subscription($stripe_invoice->customer, $stripe_invoice->subscription)) && ($ipn_signup_vars = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(0, $stripe_subscription->id))) {
                         $processing = TRUE;
                         $ipn['txn_type'] = 'subscr_payment';
                         $ipn['txn_id'] = $stripe_invoice->id;
                         $ipn['txn_cid'] = $ipn_signup_vars['subscr_cid'];
                         $ipn['subscr_cid'] = $ipn_signup_vars['subscr_cid'];
                         $ipn['subscr_id'] = $ipn_signup_vars['subscr_id'];
                         $ipn['custom'] = $ipn_signup_vars['custom'];
                         $ipn['mc_gross'] = $stripe_invoice_total;
                         $ipn['mc_currency'] = strtoupper($stripe_invoice->currency);
                         $ipn['tax'] = number_format(0, 2, '.', '');
                         $ipn['period1'] = $ipn_signup_vars['period1'];
                         $ipn['period3'] = $ipn_signup_vars['period3'];
                         $ipn['payer_email'] = $ipn_signup_vars['payer_email'];
                         $ipn['first_name'] = $ipn_signup_vars['first_name'];
                         $ipn['last_name'] = $ipn_signup_vars['last_name'];
                         $ipn['option_name1'] = $ipn_signup_vars['option_name1'];
                         $ipn['option_selection1'] = $ipn_signup_vars['option_selection1'];
                         $ipn['option_name2'] = $ipn_signup_vars['option_name2'];
                         $ipn['option_selection2'] = $ipn_signup_vars['option_selection2'];
                         $ipn['item_name'] = $ipn_signup_vars['item_name'];
                         $ipn['item_number'] = $ipn_signup_vars['item_number'];
                         $ipn['s2member_paypal_proxy'] = 'stripe';
                         $ipn['s2member_paypal_proxy_use'] = 'pro-emails';
                         $ipn['s2member_paypal_proxy_verification'] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                         c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
                         $stripe['s2member_log'][] = 'Stripe Webhook/IPN event type identified as: `' . $event->type . '` on: ' . date('D M j, Y g:i:s a T');
                         if ($maybe_end_subscription = self::_maybe_end_subscription_after_payment($stripe_invoice->customer, $stripe_subscription)) {
                             $stripe['s2member_log'][] = $maybe_end_subscription;
                         }
                         $stripe['s2member_log'][] = 'Webhook/IPN event `' . $event->type . '` reformulated. Piping through s2Member\'s core gateway processor as `txn_type` (`' . $ipn['txn_type'] . '`).';
                         $stripe['s2member_log'][] = 'Please check core IPN logs for further processing details.';
                     }
                     break;
                     // Break switch handler.
                 // Break switch handler.
                 case 'invoice.payment_failed':
                     // Subscription payment failures.
                     if (!empty($event->data->object) && ($stripe_invoice = $event->data->object) instanceof Stripe_Invoice && !empty($stripe_invoice->customer) && !empty($stripe_invoice->subscription) && ($stripe_invoice_total = number_format(c_ws_plugin__s2member_pro_stripe_utilities::cents_to_dollar_amount($stripe_invoice->total, $stripe_invoice->currency), 2, '.', '')) > 0 && is_object($stripe_subscription = c_ws_plugin__s2member_pro_stripe_utilities::get_customer_subscription($stripe_invoice->customer, $stripe_invoice->subscription)) && ($ipn_signup_vars = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(0, $stripe_subscription->id))) {
                         $processing = TRUE;
                         $stripe['s2member_log'][] = 'Stripe Webhook/IPN event type identified as: `' . $event->type . '` on: ' . date('D M j, Y g:i:s a T');
                         if ($maybe_end_subscription = self::_maybe_end_subscription_after_payment($stripe_invoice->customer, $stripe_subscription)) {
                             $stripe['s2member_log'][] = $maybe_end_subscription;
                         }
                         $stripe['s2member_log'][] = 'Ignoring `' . $event->type . '`. s2Member does NOT respond to individual payment failures; only to subscription cancellations.';
                         $stripe['s2member_log'][] = 'You may control the behavior(s) associated w/ subscription payment failures from your Stripe Dashboard please.';
                     }
                     break;
                     // Break switch handler.
                 // Break switch handler.
                 case 'customer.deleted':
                     // Customer deletions.
                     if (!empty($event->data->object) && ($stripe_customer = $event->data->object) instanceof Stripe_Customer && ($ipn_signup_vars = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(0, $stripe_customer->id))) {
                         $processing = TRUE;
                         $ipn['txn_type'] = 'subscr_eot';
                         $ipn['subscr_cid'] = $ipn_signup_vars['subscr_cid'];
                         $ipn['subscr_id'] = $ipn_signup_vars['subscr_id'];
                         $ipn['custom'] = $ipn_signup_vars['custom'];
                         $ipn['period1'] = $ipn_signup_vars['period1'];
                         $ipn['period3'] = $ipn_signup_vars['period3'];
                         $ipn['payer_email'] = $ipn_signup_vars['payer_email'];
                         $ipn['first_name'] = $ipn_signup_vars['first_name'];
                         $ipn['last_name'] = $ipn_signup_vars['last_name'];
                         $ipn['option_name1'] = $ipn_signup_vars['option_name1'];
                         $ipn['option_selection1'] = $ipn_signup_vars['option_selection1'];
                         $ipn['option_name2'] = $ipn_signup_vars['option_name2'];
                         $ipn['option_selection2'] = $ipn_signup_vars['option_selection2'];
                         $ipn['item_name'] = $ipn_signup_vars['item_name'];
                         $ipn['item_number'] = $ipn_signup_vars['item_number'];
                         $ipn['s2member_paypal_proxy'] = 'stripe';
                         $ipn['s2member_paypal_proxy_use'] = 'pro-emails';
                         $ipn['s2member_paypal_proxy_verification'] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                         c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
                         $stripe['s2member_log'][] = 'Stripe Webhook/IPN event type identified as: `' . $event->type . '` on: ' . date('D M j, Y g:i:s a T');
                         $stripe['s2member_log'][] = 'Webhook/IPN event `' . $event->type . '` reformulated. Piping through s2Member\'s core gateway processor as `txn_type` (`' . $ipn['txn_type'] . '`).';
                         $stripe['s2member_log'][] = 'Please check core IPN logs for further processing details.';
                     }
                     break;
//.........这里部分代码省略.........
开发者ID:SollyNZ,项目名称:damn-plugins,代码行数:101,代码来源:stripe-notify-in.inc.php

示例2: stripe_checkout


//.........这里部分代码省略.........
                         if (empty($new__subscr_cid)) {
                             $new__subscr_cid = strtoupper('free-' . uniqid());
                         }
                         if (empty($new__subscr_id)) {
                             $new__subscr_id = strtoupper('free-' . uniqid());
                         }
                         $ipn['txn_type'] = 'subscr_signup';
                         $ipn['subscr_cid'] = $new__subscr_cid;
                         $ipn['subscr_id'] = $new__subscr_id;
                         $ipn['custom'] = $post_vars['attr']['custom'];
                         $ipn['txn_cid'] = !empty($new__txn_cid) ? $new__txn_cid : $new__subscr_cid;
                         $ipn['txn_id'] = !empty($new__txn_id) ? $new__txn_id : $new__subscr_id;
                         $ipn['period1'] = $period1;
                         $ipn['period3'] = $period3;
                         $ipn['mc_amount1'] = $cost_calculations['trial_total'];
                         $ipn['mc_amount3'] = $cost_calculations['total'];
                         $ipn['mc_gross'] = preg_match('/^[1-9]/', $ipn['period1']) ? $ipn['mc_amount1'] : $ipn['mc_amount3'];
                         $ipn['mc_currency'] = $cost_calculations['cur'];
                         $ipn['tax'] = $cost_calculations['tax'];
                         $ipn['recurring'] = $post_vars['attr']['rr'] ? '1' : '';
                         $ipn['payer_email'] = $user->user_email;
                         $ipn['first_name'] = $post_vars['first_name'];
                         $ipn['last_name'] = $post_vars['last_name'];
                         $ipn['option_name1'] = 'Referencing Customer ID';
                         $ipn['option_selection1'] = $old__subscr_or_wp_id;
                         $ipn['option_name2'] = 'Customer IP Address';
                         $ipn['option_selection2'] = $_SERVER['REMOTE_ADDR'];
                         $ipn['item_name'] = $cost_calculations['desc'];
                         $ipn['item_number'] = $post_vars['attr']['level_ccaps_eotper'];
                         $ipn['s2member_paypal_proxy'] = 'stripe';
                         $ipn['s2member_paypal_proxy_use'] = 'pro-emails';
                         $ipn['s2member_paypal_proxy_use'] .= $ipn['mc_gross'] > 0 ? ',subscr-signup-as-subscr-payment' : '';
                         $ipn['s2member_paypal_proxy_coupon'] = array('coupon_code' => $cp_attr['_coupon_code'], 'full_coupon_code' => $cp_attr['_full_coupon_code'], 'affiliate_id' => $cp_attr['_coupon_affiliate_id']);
                         $ipn['s2member_paypal_proxy_verification'] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                         $ipn['s2member_paypal_proxy_return_url'] = $post_vars['attr']['success'];
                         $ipn['s2member_stripe_proxy_return_url'] = trim(c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20)));
                         if (!empty($stripe_subscription_failed_charge_succeeded)) {
                             update_user_option($user_id, 's2member_auto_eot_time', $start_time);
                         }
                         if ($old__subscr_cid && $old__subscr_id && apply_filters('s2member_pro_cancels_old_rp_before_new_rp', TRUE, get_defined_vars())) {
                             c_ws_plugin__s2member_pro_stripe_utilities::cancel_customer_subscription($old__subscr_cid, $old__subscr_id, FALSE);
                         }
                         c_ws_plugin__s2member_list_servers::process_list_servers_against_current_user((bool) @$post_vars['custom_fields']['opt_in'], TRUE, TRUE);
                         setcookie('s2member_tracking', $s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($new__subscr_id), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie('s2member_tracking', $s2member_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE['s2member_tracking'] = $s2member_tracking);
                         $global_response = array('response' => sprintf(_x('<strong>Thank you.</strong> Your account has been updated :-)', 's2member-front', 's2member'), esc_attr(wp_login_url())));
                         if ($post_vars['attr']['success'] && substr($ipn['s2member_stripe_proxy_return_url'], 0, 2) === substr($post_vars['attr']['success'], 0, 2) && ($custom_success_url = str_ireplace(array('%%s_response%%', '%%response%%'), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response['response'])), urlencode($global_response['response'])), $ipn['s2member_stripe_proxy_return_url'])) && ($custom_success_url = trim(preg_replace('/%%(.+?)%%/i', '', $custom_success_url)))) {
                             wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, 's2p-v')) . exit;
                         }
                     }
                 } else {
                     if ($use_subscription && !is_user_logged_in()) {
                         $plan_attr = $cp_attr;
                         // For the subscription plan.
                         $plan_attr['ta'] = $cost_calculations['trial_total'];
                         $plan_attr['ra'] = $cost_calculations['total'];
                         $plan_attr['desc'] = $cost_calculations['desc'];
                         $period1 = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1($post_vars['attr']['tp'] . ' ' . $post_vars['attr']['tt']);
                         $period3 = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($post_vars['attr']['rp'] . ' ' . $post_vars['attr']['rt']);
                         $start_time = $post_vars['attr']['tp'] ? c_ws_plugin__s2member_pro_stripe_utilities::start_time($period1) : c_ws_plugin__s2member_pro_stripe_utilities::start_time($period3);
                         // Or next billing cycle.
                         if (!$global_response) {
                             if ($post_vars['attr']['tp'] && $cost_calculations['trial_total'] > 0 || !$post_vars['attr']['tp'] && $cost_calculations['total'] > 0) {
                                 if (!is_object($stripe_customer = c_ws_plugin__s2member_pro_stripe_utilities::get_customer(0, $post_vars['email'], $post_vars['first_name'], $post_vars['last_name'], array(), $post_vars))) {
                                     $global_response = array('response' => $stripe_customer, 'error' => TRUE);
                                 } else {
                                     if (!is_object($stripe_customer = $stripe_customer_with_source = c_ws_plugin__s2member_pro_stripe_utilities::set_customer_source($stripe_customer->id, $post_vars['source_token'], $post_vars, $post_vars['attr']['reject_prepaid']))) {
开发者ID:NClaus,项目名称:Ambrose,代码行数:67,代码来源:stripe-checkout-in.inc.php

示例3: sp_checkout


//.........这里部分代码省略.........
                             $paypal["PAYMENTREQUEST_0_TAXAMT"] = $cost_calculations["tax"];
                             $paypal["PAYMENTREQUEST_0_AMT"] = $cost_calculations["total"];
                             $paypal["L_PAYMENTREQUEST_0_QTY0"] = "1";
                             // Always (1).
                             $paypal["L_PAYMENTREQUEST_0_NAME0"] = $cost_calculations["desc"];
                             $paypal["L_PAYMENTREQUEST_0_NUMBER0"] = $post_vars["attr"]["sp_ids_exp"];
                             $paypal["L_PAYMENTREQUEST_0_AMT0"] = $cost_calculations["sub_total"];
                         } else {
                             $paypal["METHOD"] = "DoDirectPayment";
                             $paypal["PAYMENTACTION"] = "Sale";
                             $paypal["EMAIL"] = $post_vars["email"];
                             $paypal["FIRSTNAME"] = $post_vars["first_name"];
                             $paypal["LASTNAME"] = $post_vars["last_name"];
                             $paypal["IPADDRESS"] = $_SERVER["REMOTE_ADDR"];
                             $paypal["DESC"] = $cost_calculations["desc"];
                             $paypal["CUSTOM"] = $post_vars["attr"]["custom"];
                             $paypal["INVNUM"] = $post_vars["attr"]["invoice"];
                             $paypal["CURRENCYCODE"] = $cost_calculations["cur"];
                             $paypal["ITEMAMT"] = $cost_calculations["sub_total"];
                             $paypal["TAXAMT"] = $cost_calculations["tax"];
                             $paypal["AMT"] = $cost_calculations["total"];
                             $paypal["L_QTY0"] = "1";
                             // Always (1).
                             $paypal["L_NAME0"] = $cost_calculations["desc"];
                             $paypal["L_NUMBER0"] = $post_vars["attr"]["sp_ids_exp"];
                             $paypal["L_AMT0"] = $cost_calculations["sub_total"];
                             $paypal["CREDITCARDTYPE"] = $post_vars["card_type"];
                             $paypal["ACCT"] = preg_replace("/[^0-9]/", "", $post_vars["card_number"]);
                             $paypal["EXPDATE"] = preg_replace("/[^0-9]/", "", $post_vars["card_expiration"]);
                             $paypal["CVV2"] = $post_vars["card_verification"];
                             if (in_array($post_vars["card_type"], array("Maestro", "Solo"))) {
                                 if (preg_match("/^[0-9]{2}\\/[0-9]{4}\$/", $post_vars["card_start_date_issue_number"])) {
                                     $paypal["STARTDATE"] = preg_replace("/[^0-9]/", "", $post_vars["card_start_date_issue_number"]);
                                 } else {
                                     // Otherwise, we assume they provided an Issue Number instead.
                                     $paypal["ISSUENUMBER"] = $post_vars["card_start_date_issue_number"];
                                 }
                             }
                             $paypal["STREET"] = $post_vars["street"];
                             $paypal["CITY"] = $post_vars["city"];
                             $paypal["STATE"] = $post_vars["state"];
                             $paypal["COUNTRYCODE"] = $post_vars["country"];
                             $paypal["ZIP"] = $post_vars["zip"];
                         }
                     }
                     if ($cost_calculations["total"] <= 0 || ($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal)) && empty($paypal["__error"])) {
                         if ($cost_calculations["total"] <= 0) {
                             $new__txn_id = strtoupper('free-' . uniqid());
                         } else {
                             $new__txn_id = !empty($paypal["PAYMENTINFO_0_TRANSACTIONID"]) ? $paypal["PAYMENTINFO_0_TRANSACTIONID"] : false;
                             $new__txn_id = !$new__txn_id && !empty($paypal["TRANSACTIONID"]) ? $paypal["TRANSACTIONID"] : $new__txn_id;
                         }
                         if (!($ipn = array())) {
                             $ipn["txn_type"] = "web_accept";
                             $ipn["txn_id"] = $new__txn_id;
                             $ipn["custom"] = $post_vars["attr"]["custom"];
                             $ipn["invoice"] = $post_vars["attr"]["invoice"];
                             $ipn["mc_gross"] = $cost_calculations["total"];
                             $ipn["mc_currency"] = $cost_calculations["cur"];
                             $ipn["tax"] = $cost_calculations["tax"];
                             $ipn["payer_email"] = $post_vars["email"];
                             $ipn["first_name"] = $post_vars["first_name"];
                             $ipn["last_name"] = $post_vars["last_name"];
                             if (is_user_logged_in() && ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id())) {
                                 $ipn["option_name1"] = "Referencing Customer ID";
                                 $ipn["option_selection1"] = $referencing;
                             } else {
                                 $ipn["option_name1"] = "Originating Domain";
                                 $ipn["option_selection1"] = $_SERVER["HTTP_HOST"];
                             }
                             $ipn["option_name2"] = "Customer IP Address";
                             $ipn["option_selection2"] = $_SERVER["REMOTE_ADDR"];
                             $ipn["item_name"] = $cost_calculations["desc"];
                             $ipn["item_number"] = $post_vars["attr"]["sp_ids_exp"];
                             $ipn["s2member_paypal_proxy"] = "paypal";
                             $ipn["s2member_paypal_proxy_use"] = "pro-emails";
                             $ipn["s2member_paypal_proxy_coupon"] = array("coupon_code" => $cp_attr["_coupon_code"], "full_coupon_code" => $cp_attr["_full_coupon_code"], "affiliate_id" => $cp_attr["_coupon_affiliate_id"]);
                             $ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                             $ipn["s2member_paypal_proxy_return_url"] = $post_vars["attr"]["success"];
                             $ipn["s2member_paypal_proxy_return_url"] = trim(c_ws_plugin__s2member_utils_urls::remote(home_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20)));
                         }
                         if ($sp_access_url = c_ws_plugin__s2member_sp_access::sp_access_link_gen($post_vars["attr"]["ids"], $post_vars["attr"]["exp"])) {
                             setcookie("s2member_sp_tracking", $s2member_sp_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($new__txn_id), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_sp_tracking", $s2member_sp_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_sp_tracking"] = $s2member_sp_tracking);
                             $global_response = array("response" => sprintf(_x('<strong>Thank you.</strong> Your purchase has been approved.<br />&mdash; Please <a href="%s" rel="nofollow">click here</a> to proceed.', "s2member-front", "s2member"), esc_attr($sp_access_url)));
                             if ($post_vars["attr"]["success"] && substr($ipn["s2member_paypal_proxy_return_url"], 0, 2) === substr($post_vars["attr"]["success"], 0, 2) && ($custom_success_url = str_ireplace(array("%%s_response%%", "%%response%%"), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response["response"])), urlencode($global_response["response"])), $ipn["s2member_paypal_proxy_return_url"])) && ($custom_success_url = trim(preg_replace("/%%(.+?)%%/i", "", $custom_success_url)))) {
                                 wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, "s2p-v")) . exit;
                             }
                         } else {
                             $global_response = array("response" => _x('<strong>Oops.</strong> Unable to generate Access Link. Please contact Support for assistance.', "s2member-front", "s2member"), "error" => true);
                         }
                     } else {
                         $global_response = array("response" => $paypal["__error"], "error" => true);
                     }
                 }
             } else {
                 $global_response = $error;
             }
         }
     }
 }
开发者ID:codeforest,项目名称:s2member-pro,代码行数:101,代码来源:paypal-sp-checkout-in.inc.php

示例4: authnet_sp_checkout

 /**
  * Handles processing of Pro-Forms for Specific Post/Page checkout.
  *
  * @package s2Member\AuthNet
  * @since 1.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after a custom URL redirection.
  */
 public static function authnet_sp_checkout()
 {
     if (!empty($_POST["s2member_pro_authnet_sp_checkout"]["nonce"]) && ($nonce = $_POST["s2member_pro_authnet_sp_checkout"]["nonce"]) && wp_verify_nonce($nonce, "s2member-pro-authnet-sp-checkout")) {
         $GLOBALS["ws_plugin__s2member_pro_authnet_sp_checkout_response"] = array();
         // This holds the global response details.
         $global_response =& $GLOBALS["ws_plugin__s2member_pro_authnet_sp_checkout_response"];
         // This is a shorter reference.
         $post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST["s2member_pro_authnet_sp_checkout"]));
         $post_vars["attr"] = !empty($post_vars["attr"]) ? (array) unserialize(c_ws_plugin__s2member_utils_encryption::decrypt($post_vars["attr"])) : array();
         $post_vars["attr"] = apply_filters("ws_plugin__s2member_pro_authnet_sp_checkout_post_attr", $post_vars["attr"], get_defined_vars());
         $post_vars["name"] = trim($post_vars["first_name"] . " " . $post_vars["last_name"]);
         $post_vars["email"] = apply_filters("user_registration_email", sanitize_email($post_vars["email"]), get_defined_vars());
         if (empty($post_vars["card_expiration"]) && isset($post_vars["card_expiration_month"], $post_vars["card_expiration_year"])) {
             $post_vars["card_expiration"] = $post_vars["card_expiration_month"] . "/" . $post_vars["card_expiration_year"];
         }
         $post_vars["recaptcha_challenge_field"] = isset($_POST["recaptcha_challenge_field"]) ? trim(stripslashes($_POST["recaptcha_challenge_field"])) : "";
         $post_vars["recaptcha_response_field"] = isset($_POST["recaptcha_response_field"]) ? trim(stripslashes($_POST["recaptcha_response_field"])) : "";
         if (!c_ws_plugin__s2member_pro_authnet_responses::authnet_form_attr_validation_errors($post_vars["attr"])) {
             if (!($error = c_ws_plugin__s2member_pro_authnet_responses::authnet_form_submission_validation_errors("sp-checkout", $post_vars))) {
                 $cp_attr = c_ws_plugin__s2member_pro_authnet_utilities::authnet_apply_coupon($post_vars["attr"], $post_vars["coupon"], "attr", array("affiliates-silent-post"));
                 $cost_calculations = c_ws_plugin__s2member_pro_authnet_utilities::authnet_cost(null, $cp_attr["ra"], $post_vars["state"], $post_vars["country"], $post_vars["zip"], $cp_attr["cc"], $cp_attr["desc"]);
                 if (!($authnet = array())) {
                     $authnet["x_type"] = "AUTH_CAPTURE";
                     $authnet["x_method"] = "CC";
                     $authnet["x_email"] = $post_vars["email"];
                     $authnet["x_first_name"] = $post_vars["first_name"];
                     $authnet["x_last_name"] = $post_vars["last_name"];
                     $authnet["x_customer_ip"] = $_SERVER["REMOTE_ADDR"];
                     $authnet["x_invoice_num"] = "s2-" . uniqid();
                     $authnet["x_description"] = $cost_calculations["desc"];
                     $authnet["s2_invoice"] = $post_vars["attr"]["sp_ids_exp"];
                     $authnet["s2_custom"] = $post_vars["attr"]["custom"];
                     $authnet["x_tax"] = $cost_calculations["tax"];
                     $authnet["x_amount"] = $cost_calculations["total"];
                     $authnet["x_currency_code"] = $cost_calculations["cur"];
                     $authnet["x_card_num"] = preg_replace("/[^0-9]/", "", $post_vars["card_number"]);
                     $authnet["x_exp_date"] = c_ws_plugin__s2member_pro_authnet_utilities::authnet_exp_date($post_vars["card_expiration"]);
                     $authnet["x_card_code"] = $post_vars["card_verification"];
                     #if (in_array($post_vars["card_type"], array("Maestro", "Solo")))
                     #	if (preg_match ("/^[0-9]{2}\/[0-9]{4}$/", $post_vars["card_start_date_issue_number"]))
                     #		$authnet["x_card_start_date"] = preg_replace ("/[^0-9]/", "", $post_vars["card_start_date_issue_number"]);
                     #	else // Otherwise, we assume they provided an issue number instead.
                     #		$authnet["x_card_issue_number"] = $post_vars["card_start_date_issue_number"];
                     $authnet["x_address"] = $post_vars["street"];
                     $authnet["x_city"] = $post_vars["city"];
                     $authnet["x_state"] = $post_vars["state"];
                     $authnet["x_country"] = $post_vars["country"];
                     $authnet["x_zip"] = $post_vars["zip"];
                 }
                 if ($cost_calculations["total"] <= 0 || ($authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_aim_response($authnet)) && empty($authnet["__error"])) {
                     if ($cost_calculations["total"] <= 0) {
                         $new__txn_id = strtoupper('free-' . uniqid());
                     } else {
                         $new__txn_id = $authnet["transaction_id"];
                     }
                     if (!($ipn = array())) {
                         $ipn["txn_type"] = "web_accept";
                         $ipn["txn_id"] = $new__txn_id;
                         $ipn["custom"] = $post_vars["attr"]["custom"];
                         $ipn["mc_gross"] = $cost_calculations["total"];
                         $ipn["mc_currency"] = $cost_calculations["cur"];
                         $ipn["tax"] = $cost_calculations["tax"];
                         $ipn["payer_email"] = $post_vars["email"];
                         $ipn["first_name"] = $post_vars["first_name"];
                         $ipn["last_name"] = $post_vars["last_name"];
                         if (is_user_logged_in() && ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id())) {
                             $ipn["option_name1"] = "Referencing Customer ID";
                             $ipn["option_selection1"] = $referencing;
                         } else {
                             $ipn["option_name1"] = "Originating Domain";
                             $ipn["option_selection1"] = $_SERVER["HTTP_HOST"];
                         }
                         $ipn["option_name2"] = "Customer IP Address";
                         $ipn["option_selection2"] = $_SERVER["REMOTE_ADDR"];
                         $ipn["item_name"] = $cost_calculations["desc"];
                         $ipn["item_number"] = $post_vars["attr"]["sp_ids_exp"];
                         $ipn["s2member_paypal_proxy"] = "authnet";
                         $ipn["s2member_paypal_proxy_use"] = "pro-emails";
                         $ipn["s2member_paypal_proxy_coupon"] = array("coupon_code" => $cp_attr["_coupon_code"], "full_coupon_code" => $cp_attr["_full_coupon_code"], "affiliate_id" => $cp_attr["_coupon_affiliate_id"]);
                         $ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                         $ipn["s2member_paypal_proxy_return_url"] = $post_vars["attr"]["success"];
                         $ipn["s2member_authnet_proxy_return_url"] = trim(c_ws_plugin__s2member_utils_urls::remote(home_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20)));
                     }
                     if ($sp_access_url = c_ws_plugin__s2member_sp_access::sp_access_link_gen($post_vars["attr"]["ids"], $post_vars["attr"]["exp"])) {
                         setcookie("s2member_sp_tracking", $s2member_sp_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($new__txn_id), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_sp_tracking", $s2member_sp_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_sp_tracking"] = $s2member_sp_tracking);
                         $global_response = array("response" => sprintf(_x('<strong>Thank you.</strong> Your purchase has been approved.<br />&mdash; Please <a href="%s" rel="nofollow">click here</a> to proceed.', "s2member-front", "s2member"), esc_attr($sp_access_url)));
                         if ($post_vars["attr"]["success"] && substr($ipn["s2member_authnet_proxy_return_url"], 0, 2) === substr($post_vars["attr"]["success"], 0, 2) && ($custom_success_url = str_ireplace(array("%%s_response%%", "%%response%%"), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response["response"])), urlencode($global_response["response"])), $ipn["s2member_authnet_proxy_return_url"])) && ($custom_success_url = trim(preg_replace("/%%(.+?)%%/i", "", $custom_success_url)))) {
                             wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, "s2p-v")) . exit;
                         }
                     } else {
//.........这里部分代码省略.........
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:101,代码来源:authnet-sp-checkout-in.inc.php

示例5: authnet_arb_service

 /**
  * Connect to and process ARB service information for Authorize.Net®.
  *
  * s2Member's Auto EOT System must be enabled for this to work properly.
  *
  * If you have a HUGE userbase, increase the max IPNs per process.
  * But NOTE, this runs ``$per_process`` *( per Blog )* on a Multisite Network.
  * To increase, use: ``add_filter ("ws_plugin__s2member_pro_arb_service_ipns_per_process");``.
  *
  * @package s2Member\AuthNet
  * @since 1.5
  *
  * @attaches-to ``add_action("ws_plugin__s2member_after_auto_eot_system");``
  *
  * @param array $vars Expects an array of defined variables to be passed in by the Action Hook.
  * @return null
  */
 public static function authnet_arb_service($vars = FALSE)
 {
     global $wpdb;
     /* Need global DB obj. */
     global $current_site, $current_blog;
     /* For Multisite support. */
     /**/
     if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_authnet_api_login_id"]) {
         $scan_time = apply_filters("ws_plugin__s2member_pro_arb_service_status_scan_time", strtotime("-1 day"), get_defined_vars());
         $per_process = apply_filters("ws_plugin__s2member_pro_arb_service_ipns_per_process", $vars["per_process"], get_defined_vars());
         /**/
         if (is_array($objs = $wpdb->get_results("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_gateway' AND `meta_value` = 'authnet' AND `user_id` NOT IN(SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_last_status_scan' AND `meta_value` > '" . esc_sql($scan_time) . "')"))) {
             foreach ($objs as $obj) {
                 if (($user_id = $obj->ID) && ($counter = (int) $counter + 1)) {
                     unset($authnet, $subscr_id, $ipn_sv, $processing, $processed, $ipn, $ipn_q, $log4, $_log4, $log2, $logs_dir);
                     /* Unset these. */
                     /**/
                     if (($authnet = array("x_method" => "status")) && ($authnet["x_subscription_id"] = $subscr_id = get_user_option("s2member_subscr_id", $user_id))) {
                         if (!get_user_option("s2member_auto_eot_time", $user_id) && is_array($ipn_sv = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(false, $subscr_id))) {
                             if (($authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_arb_response($authnet)) && empty($authnet["__error"]) && $authnet["subscription_status"] && is_array($authnet["arb_ipn_signup_vars"] = $ipn_sv)) {
                                 if (preg_match("/^expired\$/i", $authnet["subscription_status"])) {
                                     $authnet["s2member_log"][] = "Authorize.Net® ARB/IPN processed on: " . date("D M j, Y g:i:s a T");
                                     /**/
                                     $authnet["s2member_log"][] = "Authorize.Net® transaction identified as ( `SUBSCRIPTION EXPIRATION` ).";
                                     $authnet["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal® processor as `txn_type` ( `subscr_eot` ).";
                                     $authnet["s2member_log"][] = "Please check PayPal® IPN logs for further processing details.";
                                     /**/
                                     $processing = $processed = true;
                                     $ipn = array();
                                     /* Reset. */
                                     /**/
                                     $ipn["txn_type"] = "subscr_eot";
                                     $ipn["subscr_id"] = $authnet["arb_ipn_signup_vars"]["subscr_id"];
                                     /**/
                                     $ipn["custom"] = $authnet["arb_ipn_signup_vars"]["custom"];
                                     /**/
                                     $ipn["period1"] = $authnet["arb_ipn_signup_vars"]["period1"];
                                     $ipn["period3"] = $authnet["arb_ipn_signup_vars"]["period3"];
                                     /**/
                                     $ipn["payer_email"] = $authnet["arb_ipn_signup_vars"]["payer_email"];
                                     $ipn["first_name"] = $authnet["arb_ipn_signup_vars"]["first_name"];
                                     $ipn["last_name"] = $authnet["arb_ipn_signup_vars"]["last_name"];
                                     /**/
                                     $ipn["option_name1"] = $authnet["arb_ipn_signup_vars"]["option_name1"];
                                     $ipn["option_selection1"] = $authnet["arb_ipn_signup_vars"]["option_selection1"];
                                     /**/
                                     $ipn["option_name2"] = $authnet["arb_ipn_signup_vars"]["option_name2"];
                                     $ipn["option_selection2"] = $authnet["arb_ipn_signup_vars"]["option_selection2"];
                                     /**/
                                     $ipn["item_number"] = $authnet["arb_ipn_signup_vars"]["item_number"];
                                     $ipn["item_name"] = $authnet["arb_ipn_signup_vars"]["item_name"];
                                     /**/
                                     $ipn_q = "&s2member_paypal_proxy=authnet&s2member_paypal_proxy_use=pro-emails";
                                     $ipn_q .= "&s2member_paypal_proxy_verification=" . urlencode(c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen());
                                     /**/
                                     c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1" . $ipn_q), $ipn, array("timeout" => 20));
                                 } else {
                                     if (preg_match("/^(suspended|canceled|terminated)\$/i", $authnet["subscription_status"])) {
                                         $authnet["s2member_log"][] = "Authorize.Net® ARB/IPN processed on: " . date("D M j, Y g:i:s a T");
                                         /**/
                                         $authnet["s2member_log"][] = "Authorize.Net® transaction identified as ( `SUBSCRIPTION " . strtoupper($authnet["subscription_status"]) . "` ).";
                                         $authnet["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal® processor as `txn_type` ( `subscr_cancel` ).";
                                         $authnet["s2member_log"][] = "Please check PayPal® IPN logs for further processing details.";
                                         /**/
                                         $processing = $processed = true;
                                         $ipn = array();
                                         /* Reset. */
                                         /**/
                                         $ipn["txn_type"] = "subscr_cancel";
                                         $ipn["subscr_id"] = $authnet["arb_ipn_signup_vars"]["subscr_id"];
                                         /**/
                                         $ipn["custom"] = $authnet["arb_ipn_signup_vars"]["custom"];
                                         /**/
                                         $ipn["period1"] = $authnet["arb_ipn_signup_vars"]["period1"];
                                         $ipn["period3"] = $authnet["arb_ipn_signup_vars"]["period3"];
                                         /**/
                                         $ipn["payer_email"] = $authnet["arb_ipn_signup_vars"]["payer_email"];
                                         $ipn["first_name"] = $authnet["arb_ipn_signup_vars"]["first_name"];
                                         $ipn["last_name"] = $authnet["arb_ipn_signup_vars"]["last_name"];
                                         /**/
                                         $ipn["option_name1"] = $authnet["arb_ipn_signup_vars"]["option_name1"];
                                         $ipn["option_selection1"] = $authnet["arb_ipn_signup_vars"]["option_selection1"];
                                         /**/
//.........这里部分代码省略.........
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:101,代码来源:authnet-arb.inc.php

示例6: clickbank_notify

 /**
  * Handles ClickBank IPN URL processing.
  *
  * @package s2Member\ClickBank
  * @since 1.5
  *
  * @attaches-to ``add_action('init');``
  */
 public static function clickbank_notify()
 {
     global $current_site, $current_blog;
     // For Multisite support.
     if (!empty($_GET['s2member_pro_clickbank_notify']) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_clickbank_username']) {
         @ignore_user_abort(TRUE);
         // Continue processing even if/when connection is broken by the sender.
         if (is_array($clickbank = c_ws_plugin__s2member_pro_clickbank_utilities::clickbank_postvars_v2_1()) && ($_clickbank = $clickbank)) {
             $clickbank['s2member_log'][] = 'IPN received on: ' . date('D M j, Y g:i:s a T');
             $clickbank['s2member_log'][] = 's2Member POST vars verified with ClickBank.';
             $s2vars = c_ws_plugin__s2member_pro_clickbank_utilities::clickbank_parse_s2vars_v2_1($clickbank['cvendthru'], $clickbank['ctransaction']);
             if (isset($s2vars['s2_p1'], $s2vars['s2_p3']) && $s2vars['s2_p1'] === '0 D') {
                 // No Trial defaults to Regular Period.
                 $s2vars['s2_p1'] = $s2vars['s2_p3'];
             }
             // Initial Period. No Trial defaults to Regular Period.
             $clickbank['s2vars'] = $s2vars;
             // So they appear in the log entry for this Notification.
             if (strcasecmp($clickbank['ccustfirstname'] . ' ' . $clickbank['ccustlastname'], $clickbank['ccustfullname']) !== 0 && preg_match('/(?:[^ ]+)(?: +)(?:[^ ]+)/', $clickbank['ccustfullname'])) {
                 list($clickbank['ccustfirstname'], $clickbank['ccustlastname']) = preg_split('/ +/', $clickbank['ccustfullname'], 2);
             }
             if (preg_match('/^(?:TEST_)?SALE$/i', $clickbank['ctransaction']) && preg_match('/^STANDARD$/i', $clickbank['cprodtype'])) {
                 $clickbank['s2member_log'][] = 'ClickBank transaction identified as ( `SALE/STANDARD` ).';
                 $clickbank['s2member_log'][] = 'IPN reformulated. Piping through s2Member\'s core/standard PayPal processor as `txn_type` ( `web_accept` ).';
                 $clickbank['s2member_log'][] = 'Please check PayPal IPN logs for further processing details.';
                 $processing = $processed = TRUE;
                 $ipn = array();
                 // Reset.
                 $ipn['txn_type'] = 'web_accept';
                 $ipn['txn_id'] = $clickbank['ctransreceipt'];
                 $ipn['custom'] = $s2vars['s2_custom'];
                 $ipn['mc_gross'] = number_format($clickbank['corderamount'] / 100, 2, '.', '');
                 $ipn['mc_currency'] = strtoupper($clickbank['ccurrency']);
                 $ipn['tax'] = number_format('0.00', 2, '.', '');
                 $ipn['payer_email'] = $clickbank['ccustemail'];
                 $ipn['first_name'] = ucwords(strtolower($clickbank['ccustfirstname']));
                 $ipn['last_name'] = ucwords(strtolower($clickbank['ccustlastname']));
                 $ipn['option_name1'] = $s2vars['s2_referencing'] ? 'Referencing Customer ID' : 'Originating Domain';
                 $ipn['option_selection1'] = $s2vars['s2_referencing'] ? $s2vars['s2_referencing'] : $_SERVER['HTTP_HOST'];
                 $ipn['option_name2'] = 'Customer IP Address';
                 $ipn['option_selection2'] = $s2vars['s2_customer_ip'];
                 $ipn['item_number'] = $s2vars['s2_invoice'];
                 $ipn['item_name'] = $s2vars['s2_desc'];
                 $ipn['s2member_paypal_proxy'] = 'clickbank';
                 $ipn['s2member_paypal_proxy_use'] = 'standard-emails';
                 $ipn['s2member_paypal_proxy_verification'] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                 c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
             } else {
                 if (preg_match('/^(?:TEST_)?SALE$/i', $clickbank['ctransaction']) && preg_match('/^RECURRING$/i', $clickbank['cprodtype'])) {
                     $clickbank['s2member_log'][] = 'ClickBank transaction identified as ( `SALE/RECURRING` ).';
                     $clickbank['s2member_log'][] = 'IPN reformulated. Piping through s2Member\'s core/standard PayPal processor as `txn_type` ( `subscr_signup` ).';
                     $clickbank['s2member_log'][] = 'Please check PayPal IPN logs for further processing details.';
                     $processing = $processed = TRUE;
                     $ipn = array();
                     // Reset.
                     $ipn['txn_type'] = 'subscr_signup';
                     $ipn['subscr_id'] = $s2vars['s2_subscr_id'];
                     $ipn['recurring'] = $clickbank['cfuturepayments'] > 1 ? '1' : '0';
                     $ipn['txn_id'] = $clickbank['ctransreceipt'];
                     $ipn['custom'] = $s2vars['s2_custom'];
                     $ipn['period1'] = $s2vars['s2_p1'];
                     $ipn['period3'] = $s2vars['s2_p3'];
                     $ipn['mc_amount1'] = number_format($clickbank['corderamount'] / 100, 2, '.', '');
                     $ipn['mc_amount3'] = number_format($clickbank['crebillamnt'] / 100, 2, '.', '');
                     $ipn['mc_gross'] = preg_match('/^[1-9]/', $ipn['period1']) ? $ipn['mc_amount1'] : $ipn['mc_amount3'];
                     $ipn['mc_currency'] = strtoupper($clickbank['ccurrency']);
                     $ipn['tax'] = number_format('0.00', 2, '.', '');
                     $ipn['payer_email'] = $clickbank['ccustemail'];
                     $ipn['first_name'] = ucwords(strtolower($clickbank['ccustfirstname']));
                     $ipn['last_name'] = ucwords(strtolower($clickbank['ccustlastname']));
                     $ipn['option_name1'] = $s2vars['s2_referencing'] ? 'Referencing Customer ID' : 'Originating Domain';
                     $ipn['option_selection1'] = $s2vars['s2_referencing'] ? $s2vars['s2_referencing'] : $_SERVER['HTTP_HOST'];
                     $ipn['option_name2'] = 'Customer IP Address';
                     $ipn['option_selection2'] = $s2vars['s2_customer_ip'];
                     $ipn['item_number'] = $s2vars['s2_invoice'];
                     $ipn['item_name'] = $s2vars['s2_desc'];
                     $ipn['s2member_paypal_proxy'] = 'clickbank';
                     $ipn['s2member_paypal_proxy_use'] = 'standard-emails';
                     $ipn['s2member_paypal_proxy_use'] .= $ipn['mc_gross'] > 0 ? ',subscr-signup-as-subscr-payment' : '';
                     $ipn['s2member_paypal_proxy_verification'] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                     c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
                 } else {
                     if (preg_match('/^(?:TEST_)?BILL$/i', $clickbank['ctransaction']) && preg_match('/^RECURRING$/i', $clickbank['cprodtype'])) {
                         $clickbank['s2member_log'][] = 'ClickBank transaction identified as ( `BILL/RECURRING` ).';
                         $clickbank['s2member_log'][] = 'IPN reformulated. Piping through s2Member\'s core/standard PayPal processor as `txn_type` ( `subscr_payment` ).';
                         $clickbank['s2member_log'][] = 'Please check PayPal IPN logs for further processing details.';
                         $processing = $processed = TRUE;
                         $ipn = array();
                         // Reset.
                         $ipn['txn_type'] = 'subscr_payment';
                         $ipn['subscr_id'] = $s2vars['s2_subscr_id'];
                         $ipn['txn_id'] = $clickbank['ctransreceipt'];
//.........这里部分代码省略.........
开发者ID:SollyNZ,项目名称:damn-plugins,代码行数:101,代码来源:clickbank-notify-v2-1-in.inc.php

示例7: configure_user_registration


//.........这里部分代码省略.........
                                                 $user->add_cap("access_s2member_ccap_" . $ccap);
                                             }
                                         }
                                     }
                                     if (!($fields = array()) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) {
                                         foreach (json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field) {
                                             $field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
                                             $field_id_class = preg_replace("/_/", "-", $field_var);
                                             if (isset($_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var])) {
                                                 $fields[$field_var] = $_pmr["ws_plugin__s2member_custom_reg_field_" . $field_var];
                                             }
                                         }
                                     }
                                     unset($field, $field_var, $field_id_class);
                                     // Housekeeping.
                                     if (!empty($fields)) {
                                         // Only if NOT empty.
                                         update_user_option($user_id, "s2member_custom_fields", $fields);
                                     }
                                     if ($level > 0) {
                                         $pr_times = get_user_option("s2member_paid_registration_times", $user_id);
                                         $pr_times["level"] = empty($pr_times["level"]) ? time() : $pr_times["level"];
                                         $pr_times["level" . $level] = empty($pr_times["level" . $level]) ? time() : $pr_times["level" . $level];
                                         update_user_option($user_id, "s2member_paid_registration_times", $pr_times);
                                         // Update now.
                                     }
                                     if (($transient = "s2m_" . md5("s2member_transient_ipn_signup_vars_" . $subscr_id)) && is_array($ipn_signup_vars = get_transient($transient))) {
                                         update_user_option($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars);
                                         // For future reference.
                                         delete_transient($transient);
                                         // This can be deleted now.
                                     }
                                     if (($transient = "s2m_" . md5("s2member_transient_ipn_subscr_payment_" . $subscr_id)) && is_array($subscr_payment = get_transient($transient)) && !empty($subscr_payment["subscr_gateway"])) {
                                         $proxy = array("s2member_paypal_proxy" => stripslashes((string) $subscr_payment["subscr_gateway"]), "s2member_paypal_proxy_verification" => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen());
                                         c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1"), array_merge(stripslashes_deep($subscr_payment), $proxy), array("timeout" => 20));
                                         delete_transient($transient);
                                         // This can be deleted now.
                                     }
                                     if (($transient = "s2m_" . md5("s2member_transient_ipn_subscr_eot_" . $subscr_id)) && is_array($subscr_eot = get_transient($transient)) && !empty($subscr_eot["subscr_gateway"])) {
                                         $proxy = array("s2member_paypal_proxy" => stripslashes((string) $subscr_eot["subscr_gateway"]), "s2member_paypal_proxy_verification" => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen());
                                         c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1"), array_merge(stripslashes_deep($subscr_eot), $proxy), array("timeout" => 20));
                                         delete_transient($transient);
                                         // This can be deleted now.
                                     }
                                     if (!headers_sent()) {
                                         // Only if headers are NOT yet sent. Here we establish both Signup and Payment Tracking Cookies.
                                         @setcookie("s2member_tracking", $s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($subscr_id), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie("s2member_tracking", $s2member_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_tracking"] = $s2member_tracking);
                                     }
                                     foreach (array_keys(get_defined_vars()) as $__v) {
                                         $__refs[$__v] =& ${$__v};
                                     }
                                     do_action("ws_plugin__s2member_during_configure_user_registration_front_side_paid", get_defined_vars());
                                     do_action("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars());
                                     unset($__refs, $__v);
                                 } else {
                                     if (!is_admin() && (!c_ws_plugin__s2member_utils_conds::pro_is_installed() || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op("create_user"))) {
                                         /* This routine could be processed through `/wp-login.php?action=register`, `/wp-activate.php`, or `/activate` via BuddyPress`.
                                         			This may also be processed through a standard BuddyPress installation, or another plugin calling `user_register`.
                                         			If processed through `/wp-activate.php`, it could've originated inside the admin, via `/user-new.php`. */
                                         $processed = "yes";
                                         // Mark this as yes.
                                         $current_role = c_ws_plugin__s2member_user_access::user_access_role($user);
                                         $role = "";
                                         // Initialize ``$role`` to an empty string here, before processing.
                                         $role = !$role && ($level = (string) @$_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) > 0 ? "s2member_level" . $level : $role;
                                         $role = !$role && ($level = (string) @$_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) === "0" ? "subscriber" : $role;
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:67,代码来源:registrations.inc.php

示例8: authnet_cancellation

 /**
  * Handles processing of Pro-Form cancellations.
  *
  * @package s2Member\AuthNet
  * @since 1.5
  *
  * @attaches-to ``add_action('init');``
  *
  * @return null Or exits script execution after a custom URL redirection.
  */
 public static function authnet_cancellation()
 {
     if (!empty($_POST['s2member_pro_authnet_cancellation']['nonce']) && ($nonce = $_POST['s2member_pro_authnet_cancellation']['nonce']) && wp_verify_nonce($nonce, 's2member-pro-authnet-cancellation')) {
         $GLOBALS['ws_plugin__s2member_pro_authnet_cancellation_response'] = array();
         // This holds the global response details.
         $global_response =& $GLOBALS['ws_plugin__s2member_pro_authnet_cancellation_response'];
         $post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST['s2member_pro_authnet_cancellation']));
         $post_vars['attr'] = !empty($post_vars['attr']) ? (array) unserialize(c_ws_plugin__s2member_utils_encryption::decrypt($post_vars['attr'])) : array();
         $post_vars['attr'] = apply_filters('ws_plugin__s2member_pro_authnet_cancellation_post_attr', $post_vars['attr'], get_defined_vars());
         $post_vars = c_ws_plugin__s2member_utils_captchas::recaptcha_post_vars($post_vars);
         // Collect reCAPTCHA™ post vars.
         if (!c_ws_plugin__s2member_pro_authnet_responses::authnet_form_attr_validation_errors($post_vars['attr'])) {
             if (!($error = c_ws_plugin__s2member_pro_authnet_responses::authnet_form_submission_validation_errors('cancellation', $post_vars))) {
                 if (is_user_logged_in() && is_object($user = wp_get_current_user()) && ($user_id = $user->ID)) {
                     if (($authnet = array('x_method' => 'status')) && ($authnet['x_subscription_id'] = $cur__subscr_id = get_user_option('s2member_subscr_id'))) {
                         if (($authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_arb_response($authnet)) && empty($authnet['__error']) && $authnet['subscription_status']) {
                             if (preg_match('/^(active|suspended)$/i', $authnet['subscription_status'])) {
                                 if (is_array($ipn_signup_vars = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars())) {
                                     $ipn['txn_type'] = 'subscr_cancel';
                                     $ipn['subscr_id'] = $ipn_signup_vars['subscr_id'];
                                     $ipn['custom'] = $ipn_signup_vars['custom'];
                                     $ipn['period1'] = $ipn_signup_vars['period1'];
                                     $ipn['period3'] = $ipn_signup_vars['period3'];
                                     $ipn['payer_email'] = $ipn_signup_vars['payer_email'];
                                     $ipn['first_name'] = $ipn_signup_vars['first_name'];
                                     $ipn['last_name'] = $ipn_signup_vars['last_name'];
                                     $ipn['option_name1'] = $ipn_signup_vars['option_name1'];
                                     $ipn['option_selection1'] = $ipn_signup_vars['option_selection1'];
                                     $ipn['option_name2'] = $ipn_signup_vars['option_name2'];
                                     $ipn['option_selection2'] = $ipn_signup_vars['option_selection2'];
                                     $ipn['item_name'] = $ipn_signup_vars['item_name'];
                                     $ipn['item_number'] = $ipn_signup_vars['item_number'];
                                     $ipn['s2member_paypal_proxy'] = 'authnet';
                                     $ipn['s2member_paypal_proxy_use'] = 'pro-emails';
                                     $ipn['s2member_paypal_proxy_verification'] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                                     c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
                                 }
                                 if ($authnet = array('x_method' => 'cancel', 'x_subscription_id' => $cur__subscr_id)) {
                                     c_ws_plugin__s2member_pro_authnet_utilities::authnet_arb_response($authnet);
                                     $global_response = array('response' => _x('<strong>Billing termination confirmed.</strong> Your account has been cancelled.', 's2member-front', 's2member'));
                                     if ($post_vars['attr']['success'] && ($custom_success_url = str_ireplace(array('%%s_response%%', '%%response%%'), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response['response'])), urlencode($global_response['response'])), $post_vars['attr']['success'])) && ($custom_success_url = trim(preg_replace('/%%(.+?)%%/i', '', $custom_success_url)))) {
                                         wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, 's2p-v')) . exit;
                                     }
                                 }
                             } else {
                                 $global_response = array('response' => _x('<strong>Billing terminated.</strong> Your account has been cancelled.', 's2member-front', 's2member'));
                                 if ($post_vars['attr']['success'] && ($custom_success_url = str_ireplace(array('%%s_response%%', '%%response%%'), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response['response'])), urlencode($global_response['response'])), $post_vars['attr']['success'])) && ($custom_success_url = trim(preg_replace('/%%(.+?)%%/i', '', $custom_success_url)))) {
                                     wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, 's2p-v')) . exit;
                                 }
                             }
                         } else {
                             $global_response = array('response' => _x('<strong>Billing terminated.</strong> Your account has been cancelled.', 's2member-front', 's2member'));
                             if ($post_vars['attr']['success'] && ($custom_success_url = str_ireplace(array('%%s_response%%', '%%response%%'), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response['response'])), urlencode($global_response['response'])), $post_vars['attr']['success'])) && ($custom_success_url = trim(preg_replace('/%%(.+?)%%/i', '', $custom_success_url)))) {
                                 wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, 's2p-v')) . exit;
                             }
                         }
                     } else {
                         $global_response = array('response' => _x('<strong>Billing terminated.</strong> Your account has been cancelled.', 's2member-front', 's2member'));
                         if ($post_vars['attr']['success'] && ($custom_success_url = str_ireplace(array('%%s_response%%', '%%response%%'), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response['response'])), urlencode($global_response['response'])), $post_vars['attr']['success'])) && ($custom_success_url = trim(preg_replace('/%%(.+?)%%/i', '', $custom_success_url)))) {
                             wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, 's2p-v')) . exit;
                         }
                     }
                     if ($post_vars['attr']['unsub']) {
                         c_ws_plugin__s2member_list_servers::process_list_server_removals_against_current_user(TRUE);
                     }
                 } else {
                     $global_response = array('response' => _x('You\'re <strong>NOT</strong> logged in.', 's2member-front', 's2member'), 'error' => TRUE);
                 }
             } else {
                 $global_response = $error;
             }
         }
     }
 }
开发者ID:codeforest,项目名称:s2member-pro,代码行数:84,代码来源:authnet-cancellation-in.inc.php

示例9: payflow_service

 /**
  * Connect to and process cancellations/refunds/chargebacks/etc via Payflow.
  *
  * s2Member's Auto EOT System must be enabled for this to work properly.
  *
  * If you have a HUGE userbase, increase the max IPNs per process.
  * But NOTE, this runs ``$per_process`` *(per Blog)* on a Multisite Network.
  * To increase, use: ``add_filter ("ws_plugin__s2member_pro_payflow_ipns_per_process");``.
  *
  * @package s2Member\PayPal
  * @since 120514
  *
  * @attaches-to ``add_action("ws_plugin__s2member_after_auto_eot_system");``
  *
  * @param array $vars Expects an array of defined variables to be passed in by the Action Hook.
  * @return null
  */
 public static function payflow_service($vars = FALSE)
 {
     global $wpdb;
     // Need global DB obj.
     global $current_site, $current_blog;
     if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_username"]) {
         $scan_time = apply_filters("ws_plugin__s2member_pro_payflow_status_scan_time", strtotime("-1 day"), get_defined_vars());
         $per_process = apply_filters("ws_plugin__s2member_pro_payflow_ipns_per_process", $vars["per_process"], get_defined_vars());
         if (is_array($objs = $wpdb->get_results("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_gateway' AND `meta_value` = 'paypal' AND `user_id` NOT IN(SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_last_status_scan' AND `meta_value` > '" . esc_sql($scan_time) . "')"))) {
             foreach ($objs as $obj) {
                 if (($user_id = $obj->ID) && ($counter = (int) $counter + 1)) {
                     unset($paypal, $subscr_id, $ipn_sv, $processing, $processed, $ipn, $log4, $_log4, $log2, $logs_dir);
                     if (($subscr_id = get_user_option("s2member_subscr_id", $user_id)) && !get_user_option("s2member_auto_eot_time", $user_id)) {
                         if (is_array($ipn_sv = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(false, $subscr_id)) && ($paypal = c_ws_plugin__s2member_pro_paypal_utilities::payflow_get_profile($subscr_id)) && is_array($paypal["ipn_signup_vars"] = $ipn_sv)) {
                             if (preg_match("/expired/i", $paypal["STATUS"])) {
                                 $paypal["s2member_log"][] = "Payflow IPN via polling, processed on: " . date("D M j, Y g:i:s a T");
                                 $paypal["s2member_log"][] = "Payflow transaction identified as ( `SUBSCRIPTION EXPIRATION` ).";
                                 $paypal["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal processor as `txn_type` ( `subscr_eot` ).";
                                 $paypal["s2member_log"][] = "Please check PayPal IPN logs for further processing details.";
                                 $processing = $processed = true;
                                 $ipn = array();
                                 // Reset.
                                 $ipn["txn_type"] = "subscr_eot";
                                 $ipn["subscr_id"] = $paypal["ipn_signup_vars"]["subscr_id"];
                                 $ipn["custom"] = $paypal["ipn_signup_vars"]["custom"];
                                 $ipn["period1"] = $paypal["ipn_signup_vars"]["period1"];
                                 $ipn["period3"] = $paypal["ipn_signup_vars"]["period3"];
                                 $ipn["payer_email"] = $paypal["ipn_signup_vars"]["payer_email"];
                                 $ipn["first_name"] = $paypal["ipn_signup_vars"]["first_name"];
                                 $ipn["last_name"] = $paypal["ipn_signup_vars"]["last_name"];
                                 $ipn["option_name1"] = $paypal["ipn_signup_vars"]["option_name1"];
                                 $ipn["option_selection1"] = $paypal["ipn_signup_vars"]["option_selection1"];
                                 $ipn["option_name2"] = $paypal["ipn_signup_vars"]["option_name2"];
                                 $ipn["option_selection2"] = $paypal["ipn_signup_vars"]["option_selection2"];
                                 $ipn["item_number"] = $paypal["ipn_signup_vars"]["item_number"];
                                 $ipn["item_name"] = $paypal["ipn_signup_vars"]["item_name"];
                                 $ipn["s2member_paypal_proxy"] = "paypal";
                                 $ipn["s2member_paypal_proxy_use"] = "pro-emails";
                                 $ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                                 c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
                             } else {
                                 if (preg_match("/(suspended|canceled|terminated|deactivated)/i", $paypal["STATUS"])) {
                                     $paypal["s2member_log"][] = "Payflow IPN via polling, processed on: " . date("D M j, Y g:i:s a T");
                                     $paypal["s2member_log"][] = "Payflow transaction identified as ( `SUBSCRIPTION " . strtoupper($paypal["STATUS"]) . "` ).";
                                     $paypal["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal processor as `txn_type` ( `subscr_cancel` ).";
                                     $paypal["s2member_log"][] = "Please check PayPal IPN logs for further processing details.";
                                     $processing = $processed = true;
                                     $ipn = array();
                                     // Reset.
                                     $ipn["txn_type"] = "subscr_cancel";
                                     $ipn["subscr_id"] = $paypal["ipn_signup_vars"]["subscr_id"];
                                     $ipn["custom"] = $paypal["ipn_signup_vars"]["custom"];
                                     $ipn["period1"] = $paypal["ipn_signup_vars"]["period1"];
                                     $ipn["period3"] = $paypal["ipn_signup_vars"]["period3"];
                                     $ipn["payer_email"] = $paypal["ipn_signup_vars"]["payer_email"];
                                     $ipn["first_name"] = $paypal["ipn_signup_vars"]["first_name"];
                                     $ipn["last_name"] = $paypal["ipn_signup_vars"]["last_name"];
                                     $ipn["option_name1"] = $paypal["ipn_signup_vars"]["option_name1"];
                                     $ipn["option_selection1"] = $paypal["ipn_signup_vars"]["option_selection1"];
                                     $ipn["option_name2"] = $paypal["ipn_signup_vars"]["option_name2"];
                                     $ipn["option_selection2"] = $paypal["ipn_signup_vars"]["option_selection2"];
                                     $ipn["item_number"] = $paypal["ipn_signup_vars"]["item_number"];
                                     $ipn["item_name"] = $paypal["ipn_signup_vars"]["item_name"];
                                     $ipn["s2member_paypal_proxy"] = "paypal";
                                     $ipn["s2member_paypal_proxy_use"] = "pro-emails";
                                     $ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                                     c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
                                 } else {
                                     if (!$processed) {
                                         // If nothing was processed, here we add a message to the logs indicating the status; which is being ignored.
                                         $paypal["s2member_log"][] = "Ignoring this status ( `" . $paypal["STATUS"] . "` ). It does NOT require any action on the part of s2Member.";
                                     }
                                 }
                             }
                             $logt = c_ws_plugin__s2member_utilities::time_details();
                             $logv = c_ws_plugin__s2member_utilities::ver_details();
                             $logm = c_ws_plugin__s2member_utilities::mem_details();
                             $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
                             $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
                             $log2 = is_multisite() && !is_main_site() ? "paypal-payflow-ipn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "paypal-payflow-ipn.log";
                             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) {
                                 if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])) {
                                     if (is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files()) {
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:paypal-payflow-poll.inc.php

示例10: google_notify

 /**
  * Handles Google IPN URL processing.
  *
  * @package s2Member\Google
  * @since 1.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after handling the Notification.
  */
 public static function google_notify()
 {
     global $current_site, $current_blog;
     if (!empty($_GET["s2member_pro_google_notify"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_merchant_id"]) {
         @ignore_user_abort(true);
         // Continue processing even if/when connection is broken by the sender.
         if (is_array($google = c_ws_plugin__s2member_pro_google_utilities::google_postvars()) && ($_google = $google)) {
             $google["s2member_log"][] = "IPN received on: " . date("D M j, Y g:i:s a T");
             $google["s2member_log"][] = "s2Member POST vars verified with Google.";
             if (!empty($google["typ"]) && preg_match('/^google\\/payments\\/inapp\\/item\\/v[0-9]+\\/postback\\/buy$/i', $google["typ"]) && is_array($s2vars = c_ws_plugin__s2member_pro_google_utilities::google_parse_s2vars($google)) && !empty($google["response"]["orderId"])) {
                 $google["s2member_log"][] = "Google transaction identified as ( `SALE/BUY-NOW` ).";
                 $google["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal processor as `txn_type` ( `web_accept` ).";
                 $google["s2member_log"][] = "Please check PayPal IPN logs for further processing details.";
                 $processing = $processed = true;
                 $ipn = array();
                 // Reset.
                 $ipn["txn_type"] = "web_accept";
                 $ipn["txn_id"] = $google["response"]["orderId"];
                 $ipn["custom"] = $s2vars["cs"];
                 $ipn["mc_gross"] = number_format($google["request"]["price"], 2, ".", "");
                 $ipn["mc_currency"] = strtoupper($google["request"]["currencyCode"]);
                 $ipn["tax"] = number_format((double) @$google["request"]["tax"], 2, ".", "");
                 $ipn["payer_email"] = $s2vars["em"];
                 $ipn["first_name"] = $s2vars["fn"];
                 $ipn["last_name"] = $s2vars["ln"];
                 $ipn["option_name1"] = $s2vars["rf"] ? "Referencing Customer ID" : "Originating Domain";
                 $ipn["option_selection1"] = $s2vars["rf"] ? $s2vars["rf"] : $_SERVER["HTTP_HOST"];
                 $ipn["option_name2"] = "Customer IP Address";
                 // IP Address.
                 $ipn["option_selection2"] = $s2vars["ip"];
                 $ipn["item_number"] = $s2vars["in"];
                 $ipn["item_name"] = $google["request"]["description"];
                 $ipn["s2member_paypal_proxy"] = "google";
                 $ipn["s2member_paypal_proxy_use"] = "standard-emails";
                 $ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                 c_ws_plugin__s2member_utils_urls::remote(home_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
             } else {
                 if (!empty($google["typ"]) && preg_match('/^google\\/payments\\/inapp\\/subscription\\/v[0-9]+\\/postback\\/buy$/i', $google["typ"]) && is_array($s2vars = c_ws_plugin__s2member_pro_google_utilities::google_parse_s2vars($google)) && !empty($google["response"]["orderId"])) {
                     $google["s2member_log"][] = "Google transaction identified as ( `SALE/SUBSCRIPTION` ).";
                     $google["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal processor as `txn_type` ( `subscr_signup` ).";
                     $google["s2member_log"][] = "Please check PayPal IPN logs for further processing details.";
                     $processing = $processed = true;
                     $ipn = array();
                     // Reset.
                     $ipn["txn_type"] = "subscr_signup";
                     $ipn["subscr_id"] = $google["response"]["orderId"];
                     $ipn["txn_id"] = $google["response"]["orderId"];
                     $ipn["recurring"] = $s2vars["rr"];
                     $ipn["custom"] = $s2vars["cs"];
                     $ipn["period1"] = $s2vars["p1"];
                     $ipn["period3"] = $s2vars["p3"];
                     $ipn["mc_amount1"] = $ipn["mc_gross"] = number_format($google["request"]["initialPayment"]["price"], 2, ".", "");
                     $ipn["mc_currency"] = strtoupper($google["request"]["initialPayment"]["currencyCode"]);
                     $ipn["tax"] = number_format((double) @$google["request"]["initialPayment"]["tax"], 2, ".", "");
                     $ipn["mc_amount3"] = number_format($google["request"]["recurrence"]["price"], 2, ".", "");
                     $ipn["payer_email"] = $s2vars["em"];
                     $ipn["first_name"] = $s2vars["fn"];
                     $ipn["last_name"] = $s2vars["ln"];
                     $ipn["option_name1"] = $s2vars["rf"] ? "Referencing Customer ID" : "Originating Domain";
                     $ipn["option_selection1"] = $s2vars["rf"] ? $s2vars["rf"] : $_SERVER["HTTP_HOST"];
                     $ipn["option_name2"] = "Customer IP Address";
                     // IP Address.
                     $ipn["option_selection2"] = $s2vars["ip"];
                     $ipn["item_number"] = $s2vars["in"];
                     $ipn["item_name"] = $google["request"]["description"];
                     $ipn["s2member_paypal_proxy"] = "google";
                     $ipn["s2member_paypal_proxy_use"] = "standard-emails";
                     $ipn["s2member_paypal_proxy_use"] .= $ipn["mc_gross"] > 0 ? ",subscr-signup-as-subscr-payment" : "";
                     $ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                     c_ws_plugin__s2member_utils_urls::remote(home_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
                 } else {
                     if (!empty($google["typ"]) && preg_match('/^google\\/payments\\/inapp\\/subscription\\/v[0-9]+\\/canceled$/i', $google["typ"]) && !empty($google["response"]["statusCode"]) && preg_match("/^SUBSCRIPTION_CANCELED\$/i", $google["response"]["statusCode"]) && !empty($google["response"]["orderId"]) && ($ipn_signup_vars = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(false, $google["response"]["orderId"]))) {
                         $google["s2member_log"][] = "Google transaction identified as ( `SUBSCRIPTION_CANCELED` ).";
                         $google["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal processor as `txn_type` ( `subscr_cancel` ).";
                         $google["s2member_log"][] = "Please check PayPal IPN logs for further processing details.";
                         $processing = $processed = true;
                         $ipn = array();
                         // Reset.
                         $ipn["txn_type"] = "subscr_cancel";
                         $ipn["subscr_id"] = $google["response"]["orderId"];
                         $ipn["custom"] = $ipn_signup_vars["custom"];
                         $ipn["period1"] = $ipn_signup_vars["period1"];
                         $ipn["period3"] = $ipn_signup_vars["period3"];
                         $ipn["payer_email"] = $ipn_signup_vars["payer_email"];
                         $ipn["first_name"] = $ipn_signup_vars["first_name"];
                         $ipn["last_name"] = $ipn_signup_vars["last_name"];
                         $ipn["option_name1"] = $ipn_signup_vars["option_name1"];
                         $ipn["option_selection1"] = $ipn_signup_vars["option_selection1"];
                         $ipn["option_name2"] = $ipn_signup_vars["option_name2"];
                         $ipn["option_selection2"] = $ipn_signup_vars["option_selection2"];
//.........这里部分代码省略.........
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:101,代码来源:google-notify-in.inc.php

示例11: authnet_notify

 /**
  * Handles Authorize.Net IPN URL processing.
  *
  * @package s2Member\AuthNet
  * @since 1.5
  *
  * @attaches-to ``add_action('init');``
  */
 public static function authnet_notify()
 {
     global $current_site, $current_blog;
     // For Multisite support.
     if (!empty($_GET['s2member_pro_authnet_notify']) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_authnet_api_login_id']) {
         @ignore_user_abort(TRUE);
         // Continue processing even if/when connection is broken by the sender.
         if (is_array($authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_postvars()) && ($_authnet = $authnet)) {
             $processing = $processed = FALSE;
             // Initialize these flags.
             $authnet['s2member_log'][] = 'IPN received on: ' . date('D M j, Y g:i:s a T');
             $authnet['s2member_log'][] = 's2Member POST vars verified with Authorize.Net.';
             if ($authnet['x_subscription_id'] && $authnet['x_subscription_paynum'] && $authnet['x_response_code'] === '1') {
                 if (($_authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_parse_arb_desc($authnet)) && ($authnet = $_authnet)) {
                     $authnet['s2member_log'][] = 'Authorize.Net transaction identified as (`ARB / PAYMENT #' . $authnet['x_subscription_paynum'] . '`).';
                     if ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($authnet['x_subscription_id'])) {
                         delete_user_option($user_id, 's2member_authnet_payment_failures');
                         $authnet['s2member_log'][] = 'Successful payment. Resetting payment failures to `0` for this subscription.';
                     }
                     $authnet['s2member_log'][] = 'IPN reformulated. Piping through s2Member\'s core/standard PayPal processor as `txn_type` (`subscr_payment`).';
                     $authnet['s2member_log'][] = 'Please check PayPal IPN logs for further processing details.';
                     $processing = $processed = TRUE;
                     $ipn = array();
                     // Reset.
                     $ipn['txn_type'] = 'subscr_payment';
                     $ipn['subscr_id'] = $authnet['x_subscription_id'];
                     $ipn['txn_id'] = $authnet['x_trans_id'];
                     $ipn['custom'] = $authnet['s2_custom'];
                     $ipn['mc_gross'] = number_format($authnet['x_amount'], 2, '.', '');
                     $ipn['mc_currency'] = strtoupper(!empty($authnet['s2_currency']) ? $authnet['s2_currency'] : 'USD');
                     $ipn['tax'] = number_format($authnet['x_tax'], 2, '.', '');
                     $ipn['payer_email'] = $authnet['x_email'];
                     $ipn['first_name'] = $authnet['x_first_name'];
                     $ipn['last_name'] = $authnet['x_last_name'];
                     $ipn['option_name1'] = 'Referencing Customer ID';
                     $ipn['option_selection1'] = $authnet['x_subscription_id'];
                     $ipn['option_name2'] = 'Customer IP Address';
                     $ipn['option_selection2'] = NULL;
                     $ipn['item_number'] = $authnet['s2_invoice'];
                     $ipn['item_name'] = $authnet['x_description'];
                     $ipn['s2member_paypal_proxy'] = 'authnet';
                     $ipn['s2member_paypal_proxy_use'] = 'pro-emails';
                     $ipn['s2member_paypal_proxy_verification'] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                     c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
                 } else {
                     $authnet['s2member_log'][] = 'Authorize.Net transaction identified as (`ARB / PAYMENT #' . $authnet['x_subscription_paynum'] . '`).';
                     $authnet['s2member_log'][] = 'Ignoring this IPN. The transaction does NOT contain a valid reference value/desc.';
                 }
             } else {
                 if ($authnet['x_subscription_id'] && $authnet['x_subscription_paynum'] && preg_match('/^(2|3)$/', $authnet['x_response_code'])) {
                     if (($_authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_parse_arb_desc($authnet)) && ($authnet = $_authnet)) {
                         if ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($authnet['x_subscription_id'])) {
                             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_authnet_max_payment_failures'] && ($current_payment_failures = get_user_option('s2member_authnet_payment_failures', $user_id)) + 1 >= $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_authnet_max_payment_failures']) {
                                 $authnet['s2member_log'][] = 'Authorize.Net transaction identified as (`ARB / FAILED PAYMENT`).';
                                 $authnet['s2member_log'][] = 'This subscription has `' . $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_authnet_max_payment_failures'] . '` or more failed payments.';
                                 $authnet['s2member_log'][] = 'Max failed payments. IPN reformulated. Piping through s2Member\'s core/standard PayPal processor as `txn_type` (`subscr_eot`).';
                                 $authnet['s2member_log'][] = 'Please check PayPal IPN logs for further processing details.';
                                 $processing = $processed = TRUE;
                                 $ipn = array();
                                 // Reset.
                                 $ipn['txn_type'] = 'subscr_eot';
                                 $ipn['subscr_id'] = $authnet['x_subscription_id'];
                                 $ipn['custom'] = $authnet['s2_custom'];
                                 $ipn['period1'] = $authnet['s2_p1'];
                                 $ipn['period3'] = $authnet['s2_p3'];
                                 $ipn['payer_email'] = $authnet['x_email'];
                                 $ipn['first_name'] = $authnet['x_first_name'];
                                 $ipn['last_name'] = $authnet['x_last_name'];
                                 $ipn['option_name1'] = 'Referencing Customer ID';
                                 $ipn['option_selection1'] = $authnet['x_subscription_id'];
                                 $ipn['option_name2'] = 'Customer IP Address';
                                 $ipn['option_selection2'] = NULL;
                                 $ipn['item_number'] = $authnet['s2_invoice'];
                                 $ipn['item_name'] = $authnet['x_description'];
                                 $ipn['s2member_paypal_proxy'] = 'authnet';
                                 $ipn['s2member_paypal_proxy_use'] = 'pro-emails';
                                 $ipn['s2member_paypal_proxy_verification'] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                                 c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
                                 c_ws_plugin__s2member_pro_authnet_utilities::authnet_arb_response(array('x_method' => 'cancel', 'x_subscription_id' => $authnet['x_subscription_id']));
                             } else {
                                 $current_payment_failures = get_user_option('s2member_authnet_payment_failures', $user_id);
                                 update_user_option($user_id, 's2member_authnet_payment_failures', $current_payment_failures + 1);
                                 $authnet['s2member_log'][] = 'Bumping payment failures for subscription: `' . $authnet['x_subscription_id'] . '`, to: `' . ($current_payment_failures + 1) . '`';
                                 $authnet['s2member_log'][] = 'Recording number of payment failures only. This does not require any action (at the moment) on the part of s2Member.';
                             }
                         } else {
                             $authnet['s2member_log'][] = 'Authorize.Net transaction identified as (`ARB / FAILED PAYMENT`).';
                             $authnet['s2member_log'][] = 'Ignoring this IPN. The transaction does NOT contain a valid reference to an existing user/member.';
                         }
                     } else {
                         $authnet['s2member_log'][] = 'Authorize.Net transaction identified as (`ARB / FAILED PAYMENT`).';
                         $authnet['s2member_log'][] = 'Ignoring this IPN. The transaction does NOT contain a valid reference value/desc.';
//.........这里部分代码省略.........
开发者ID:codeforest,项目名称:s2member-pro,代码行数:101,代码来源:authnet-notify-in.inc.php

示例12: authnet_notify

 /**
  * Handles Authorize.Net® IPN URL processing.
  *
  * @package s2Member\AuthNet
  * @since 1.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after handling IPN processing.
  */
 public static function authnet_notify()
 {
     global $current_site, $current_blog;
     /* For Multisite support. */
     /**/
     if (!empty($_GET["s2member_pro_authnet_notify"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_authnet_api_login_id"]) {
         @ignore_user_abort(true);
         /* Continue processing even if/when connection is broken by the sender. */
         /**/
         if (is_array($authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_postvars()) && ($_authnet = $authnet)) {
             $authnet["s2member_log"][] = "IPN received on: " . date("D M j, Y g:i:s a T");
             $authnet["s2member_log"][] = "s2Member POST vars verified with Authorize.Net®.";
             /**/
             if ($authnet["x_subscription_id"] && $authnet["x_subscription_paynum"] && $authnet["x_response_code"] === "1") {
                 if (($_authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_parse_arb_desc($authnet)) && ($authnet = $_authnet)) {
                     $authnet["s2member_log"][] = "Authorize.Net® transaction identified as ( `ARB / PAYMENT #" . $authnet["x_subscription_paynum"] . "` ).";
                     $authnet["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal® processor as `txn_type` ( `subscr_payment` ).";
                     $authnet["s2member_log"][] = "Please check PayPal® IPN logs for further processing details.";
                     /**/
                     $processing = $processed = true;
                     $ipn = array();
                     /* Reset. */
                     /**/
                     $ipn["txn_type"] = "subscr_payment";
                     $ipn["subscr_id"] = $authnet["x_subscription_id"];
                     $ipn["txn_id"] = $authnet["x_trans_id"];
                     /**/
                     $ipn["custom"] = $authnet["s2_custom"];
                     /**/
                     $ipn["mc_gross"] = number_format($authnet["x_amount"], 2, ".", "");
                     $ipn["mc_currency"] = strtoupper("USD");
                     /* Auth.Net® uses USD. */
                     $ipn["tax"] = number_format($authnet["x_tax"], 2, ".", "");
                     /**/
                     $ipn["payer_email"] = $authnet["x_email"];
                     $ipn["first_name"] = $authnet["x_first_name"];
                     $ipn["last_name"] = $authnet["x_last_name"];
                     /**/
                     $ipn["option_name1"] = "Referencing Customer ID";
                     $ipn["option_selection1"] = $authnet["x_subscription_id"];
                     /**/
                     $ipn["option_name2"] = "Customer IP Address";
                     $ipn["option_selection2"] = null;
                     /**/
                     $ipn["item_number"] = $authnet["s2_invoice"];
                     $ipn["item_name"] = $authnet["x_description"];
                     /**/
                     $ipn_q = "&s2member_paypal_proxy=authnet&s2member_paypal_proxy_use=pro-emails";
                     $ipn_q .= "&s2member_paypal_proxy_verification=" . urlencode(c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen());
                     /**/
                     c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1" . $ipn_q), $ipn, array("timeout" => 20));
                 } else {
                     $authnet["s2member_log"][] = "Authorize.Net® transaction identified as ( `ARB / PAYMENT #" . $authnet["x_subscription_paynum"] . "` ).";
                     $authnet["s2member_log"][] = "Ignoring this IPN. The transaction does NOT contain a valid reference value/desc.";
                 }
             } else {
                 if ($authnet["x_subscription_id"] && $authnet["x_subscription_paynum"] && preg_match("/^(2|3)\$/", $authnet["x_response_code"])) {
                     if (($_authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_parse_arb_desc($authnet)) && ($authnet = $_authnet)) {
                         $authnet["s2member_log"][] = "Authorize.Net® transaction identified as ( `ARB / FAILED PAYMENT` ).";
                         $authnet["s2member_log"][] = "s2Member does NOT respond to individual failed payment notifications.";
                         $authnet["s2member_log"][] = "When multiple consecutive payments fail, s2Member is notified via ARB services.";
                         $authnet["s2member_log"][] = "This does not require any action ( at the moment ) on the part of s2Member.";
                     } else {
                         $authnet["s2member_log"][] = "Authorize.Net® transaction identified as ( `ARB / FAILED PAYMENT` ).";
                         $authnet["s2member_log"][] = "Ignoring this IPN. The transaction does NOT contain a valid reference value/desc.";
                     }
                 } else {
                     if (!$processed) {
                         /* If nothing was processed, here we add a message to the logs indicating the IPN was ignored. */
                         $authnet["s2member_log"][] = "Ignoring this IPN. The transaction does NOT require any action on the part of s2Member.";
                     }
                 }
             }
         } else {
             $authnet["s2member_log"][] = "Unable to verify POST vars. This is most likely related to an invalid Authorize.Net® configuration. Please check: s2Member -> Authorize.Net® Options.";
             $authnet["s2member_log"][] = "If you're absolutely SURE that your Authorize.Net® configuration is valid, you may want to run some tests on your server, just to be sure \$_POST variables are populated, and that your server is able to connect to Authorize.Net® over an HTTPS connection.";
             $authnet["s2member_log"][] = "s2Member uses the WP_Http class for remote connections; which will try to use cURL first, and then fall back on the FOPEN method when cURL is not available. On a Windows® server, you may have to disable your cURL extension. Instead, set allow_url_fopen = yes in your php.ini file. The cURL extension (usually) does NOT support SSL connections on a Windows® server.";
             $authnet["s2member_log"][] = var_export($_REQUEST, true);
             /* Recording _POST + _GET vars for analysis and debugging. */
         }
         /*
         If debugging/logging is enabled; we need to append $authnet to the log file.
         	Logging now supports Multisite Networking as well.
         */
         $logv = c_ws_plugin__s2member_utilities::ver_details();
         $logm = c_ws_plugin__s2member_utilities::mem_details();
         $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
         $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
         $log2 = is_multisite() && !is_main_site() ? "authnet-ipn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "authnet-ipn.log";
         /**/
//.........这里部分代码省略.........
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:101,代码来源:authnet-notify-in.inc.php

示例13: paypal_cancellation

 /**
  * Handles processing of Pro-Form cancellations.
  *
  * @package s2Member\PayPal
  * @since 1.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after a custom URL redirection.
  */
 public static function paypal_cancellation()
 {
     if (!empty($_POST["s2member_pro_paypal_cancellation"]["nonce"]) && ($nonce = $_POST["s2member_pro_paypal_cancellation"]["nonce"]) && wp_verify_nonce($nonce, "s2member-pro-paypal-cancellation")) {
         $GLOBALS["ws_plugin__s2member_pro_paypal_cancellation_response"] = array();
         // This holds the global response details.
         $global_response =& $GLOBALS["ws_plugin__s2member_pro_paypal_cancellation_response"];
         // This is a shorter reference.
         $post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST["s2member_pro_paypal_cancellation"]));
         $post_vars["attr"] = !empty($post_vars["attr"]) ? (array) unserialize(c_ws_plugin__s2member_utils_encryption::decrypt($post_vars["attr"])) : array();
         $post_vars["attr"] = apply_filters("ws_plugin__s2member_pro_paypal_cancellation_post_attr", $post_vars["attr"], get_defined_vars());
         $post_vars = c_ws_plugin__s2member_utils_captchas::recaptcha_post_vars($post_vars);
         // Collect reCAPTCHA™ post vars.
         if (!c_ws_plugin__s2member_pro_paypal_responses::paypal_form_attr_validation_errors($post_vars["attr"])) {
             if (!($error = c_ws_plugin__s2member_pro_paypal_responses::paypal_form_submission_validation_errors("cancellation", $post_vars))) {
                 if (is_user_logged_in() && is_object($user = wp_get_current_user()) && ($user_id = $user->ID)) {
                     if (($paypal = array("METHOD" => "GetRecurringPaymentsProfileDetails")) && ($paypal["PROFILEID"] = $cur__subscr_id = get_user_option("s2member_subscr_id"))) {
                         if (($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal)) && empty($paypal["__error"])) {
                             if (preg_match("/^(Active|ActiveProfile|Suspended|SuspendedProfile)\$/i", $paypal["STATUS"])) {
                                 if (!($ipn = array())) {
                                     $ipn["txn_type"] = "subscr_cancel";
                                     $ipn["subscr_id"] = $paypal["PROFILEID"];
                                     $ipn["custom"] = get_user_option("s2member_custom");
                                     $ipn["period1"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1($paypal);
                                     $ipn["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($paypal);
                                     $ipn["payer_email"] = $paypal["EMAIL"];
                                     $ipn["first_name"] = $paypal["FIRSTNAME"];
                                     $ipn["last_name"] = $paypal["LASTNAME"];
                                     $ipn["option_name1"] = "Referencing Customer ID";
                                     $ipn["option_selection1"] = $paypal["PROFILEID"];
                                     $ipn["option_name2"] = "Customer IP Address";
                                     // IP Address.
                                     $ipn["option_selection2"] = get_user_option("s2member_registration_ip");
                                     $ipn["item_name"] = $paypal["DESC"];
                                     $ipn["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal);
                                     $ipn["s2member_paypal_proxy"] = "paypal";
                                     $ipn["s2member_paypal_proxy_use"] = "pro-emails";
                                     $ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                                     c_ws_plugin__s2member_utils_urls::remote(home_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
                                 }
                                 if ($paypal = array("METHOD" => "ManageRecurringPaymentsProfileStatus", "ACTION" => "Cancel", "PROFILEID" => $cur__subscr_id)) {
                                     c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal);
                                     $global_response = array("response" => _x('<strong>Billing termination confirmed.</strong> Your account has been cancelled.', "s2member-front", "s2member"));
                                     if ($post_vars["attr"]["success"] && ($custom_success_url = str_ireplace(array("%%s_response%%", "%%response%%"), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response["response"])), urlencode($global_response["response"])), $post_vars["attr"]["success"])) && ($custom_success_url = trim(preg_replace("/%%(.+?)%%/i", "", $custom_success_url)))) {
                                         wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, "s2p-v")) . exit;
                                     }
                                 }
                             } else {
                                 if (preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
                                     $global_response = array("response" => _x('<strong>Unable to cancel at this time.</strong> Your account is pending other changes. Please try again in 15 minutes.', "s2member-front", "s2member"), "error" => true);
                                 } else {
                                     $global_response = array("response" => _x('<strong>Billing terminated.</strong> Your account has been cancelled.', "s2member-front", "s2member"));
                                     if ($post_vars["attr"]["success"] && ($custom_success_url = str_ireplace(array("%%s_response%%", "%%response%%"), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response["response"])), urlencode($global_response["response"])), $post_vars["attr"]["success"])) && ($custom_success_url = trim(preg_replace("/%%(.+?)%%/i", "", $custom_success_url)))) {
                                         wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, "s2p-v")) . exit;
                                     }
                                 }
                             }
                         } else {
                             if ($paypal && !empty($paypal["__error"]) && $paypal["L_ERRORCODE0"] === "11592") {
                                 $global_response = array("response" => sprintf(_x('Please <a href="%s" rel="nofollow">log in at PayPal</a> to cancel your Subscription.', "s2member-front", "s2member"), esc_attr("https://" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com") . "/cgi-bin/webscr?cmd=_subscr-find&amp;alias=" . urlencode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"]))), "error" => true);
                             } else {
                                 $global_response = array("response" => _x('<strong>Billing terminated.</strong> Your account has been cancelled.', "s2member-front", "s2member"));
                                 if ($post_vars["attr"]["success"] && ($custom_success_url = str_ireplace(array("%%s_response%%", "%%response%%"), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response["response"])), urlencode($global_response["response"])), $post_vars["attr"]["success"])) && ($custom_success_url = trim(preg_replace("/%%(.+?)%%/i", "", $custom_success_url)))) {
                                     wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, "s2p-v")) . exit;
                                 }
                             }
                         }
                     } else {
                         $global_response = array("response" => _x('<strong>Billing terminated.</strong> Your account has been cancelled.', "s2member-front", "s2member"));
                         if ($post_vars["attr"]["success"] && ($custom_success_url = str_ireplace(array("%%s_response%%", "%%response%%"), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response["response"])), urlencode($global_response["response"])), $post_vars["attr"]["success"])) && ($custom_success_url = trim(preg_replace("/%%(.+?)%%/i", "", $custom_success_url)))) {
                             wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, "s2p-v")) . exit;
                         }
                     }
                     if ($post_vars["attr"]["unsub"]) {
                         c_ws_plugin__s2member_list_servers::process_list_server_removals_against_current_user(TRUE);
                     }
                 } else {
                     $global_response = array("response" => _x('You\'re <strong>NOT</strong> logged in.', "s2member-front", "s2member"), "error" => true);
                 }
             } else {
                 $global_response = $error;
             }
         }
     }
 }
开发者ID:codeforest,项目名称:s2member-pro,代码行数:94,代码来源:paypal-cancellation-in.inc.php

示例14: payflow_service

 /**
  * Connect to and process cancellations/refunds/chargebacks/etc via Payflow.
  *
  * s2Member's Auto EOT System must be enabled for this to work properly.
  *
  * If you have a HUGE userbase, increase the max IPNs per process.
  * But NOTE, this runs ``$per_process`` *(per Blog)* on a Multisite Network.
  * To increase, use: ``add_filter ('ws_plugin__s2member_pro_payflow_ipns_per_process');``.
  *
  * @package s2Member\PayPal
  * @since 120514
  *
  * @attaches-to ``add_action('ws_plugin__s2member_after_auto_eot_system');``
  *
  * @param array $vars Expects an array of defined variables to be passed in by the Action Hook.
  */
 public static function payflow_service($vars)
 {
     global $wpdb;
     /** @var $wpdb \wpdb */
     global $current_site, $current_blog;
     $counter = 0;
     // Initialize counter at zero.
     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_payflow_api_username']) {
         $scan_time = apply_filters('ws_plugin__s2member_pro_payflow_status_scan_time', strtotime('-1 day'), get_defined_vars());
         $per_process = apply_filters('ws_plugin__s2member_pro_payflow_ipns_per_process', $vars['per_process'], get_defined_vars());
         if (is_array($objs = $wpdb->get_results("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_gateway' AND `meta_value` = 'paypal' AND `user_id` NOT IN(SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_last_status_scan' AND `meta_value` > '" . esc_sql($scan_time) . "')"))) {
             foreach ($objs as $obj) {
                 if (($user_id = $obj->ID) && ($counter = (int) $counter + 1)) {
                     $processed = FALSE;
                     // Initialize and/or reset all of these variables.
                     unset($paypal, $subscr_id, $processing, $ipn, $log4, $_log4, $log2, $logs_dir);
                     if (($subscr_id = get_user_option('s2member_subscr_id', $user_id)) && !get_user_option('s2member_auto_eot_time', $user_id)) {
                         if ($paypal = c_ws_plugin__s2member_pro_paypal_utilities::payflow_get_profile($subscr_id)) {
                             $paypal['ipn_signup_vars'] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(FALSE, $subscr_id);
                             if ($paypal['ipn_signup_vars'] && preg_match('/expired|too many failures/i', $paypal['STATUS'])) {
                                 $paypal['s2member_log'][] = 'Payflow IPN via polling, processed on: ' . date('D M j, Y g:i:s a T');
                                 $paypal['s2member_log'][] = 'Payflow transaction identified as ( `SUBSCRIPTION EXPIRATION` ).';
                                 $paypal['s2member_log'][] = 'IPN reformulated. Piping through s2Member\'s core/standard PayPal processor as `txn_type` ( `subscr_eot` ).';
                                 $paypal['s2member_log'][] = 'Please check PayPal IPN logs for further processing details.';
                                 $processing = $processed = TRUE;
                                 $ipn = array();
                                 // Reset.
                                 $ipn['txn_type'] = 'subscr_eot';
                                 $ipn['subscr_id'] = $paypal['ipn_signup_vars']['subscr_id'];
                                 $ipn['custom'] = $paypal['ipn_signup_vars']['custom'];
                                 $ipn['period1'] = $paypal['ipn_signup_vars']['period1'];
                                 $ipn['period3'] = $paypal['ipn_signup_vars']['period3'];
                                 $ipn['payer_email'] = $paypal['ipn_signup_vars']['payer_email'];
                                 $ipn['first_name'] = $paypal['ipn_signup_vars']['first_name'];
                                 $ipn['last_name'] = $paypal['ipn_signup_vars']['last_name'];
                                 $ipn['option_name1'] = $paypal['ipn_signup_vars']['option_name1'];
                                 $ipn['option_selection1'] = $paypal['ipn_signup_vars']['option_selection1'];
                                 $ipn['option_name2'] = $paypal['ipn_signup_vars']['option_name2'];
                                 $ipn['option_selection2'] = $paypal['ipn_signup_vars']['option_selection2'];
                                 $ipn['item_number'] = $paypal['ipn_signup_vars']['item_number'];
                                 $ipn['item_name'] = $paypal['ipn_signup_vars']['item_name'];
                                 $ipn['s2member_paypal_proxy'] = 'paypal';
                                 $ipn['s2member_paypal_proxy_use'] = 'pro-emails';
                                 $ipn['s2member_paypal_proxy_verification'] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                                 c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
                             } else {
                                 if ($paypal['ipn_signup_vars'] && preg_match('/(suspended|canceled|terminated|deactivated)/i', $paypal['STATUS'])) {
                                     $paypal['s2member_log'][] = 'Payflow IPN via polling, processed on: ' . date('D M j, Y g:i:s a T');
                                     $paypal['s2member_log'][] = 'Payflow transaction identified as ( `SUBSCRIPTION ' . strtoupper($paypal['STATUS']) . '` ).';
                                     $paypal['s2member_log'][] = 'IPN reformulated. Piping through s2Member\'s core/standard PayPal processor as `txn_type` ( `subscr_cancel` ).';
                                     $paypal['s2member_log'][] = 'Please check PayPal IPN logs for further processing details.';
                                     $processing = $processed = TRUE;
                                     $ipn = array();
                                     // Reset.
                                     $ipn['txn_type'] = 'subscr_cancel';
                                     $ipn['subscr_id'] = $paypal['ipn_signup_vars']['subscr_id'];
                                     $ipn['custom'] = $paypal['ipn_signup_vars']['custom'];
                                     $ipn['period1'] = $paypal['ipn_signup_vars']['period1'];
                                     $ipn['period3'] = $paypal['ipn_signup_vars']['period3'];
                                     $ipn['payer_email'] = $paypal['ipn_signup_vars']['payer_email'];
                                     $ipn['first_name'] = $paypal['ipn_signup_vars']['first_name'];
                                     $ipn['last_name'] = $paypal['ipn_signup_vars']['last_name'];
                                     $ipn['option_name1'] = $paypal['ipn_signup_vars']['option_name1'];
                                     $ipn['option_selection1'] = $paypal['ipn_signup_vars']['option_selection1'];
                                     $ipn['option_name2'] = $paypal['ipn_signup_vars']['option_name2'];
                                     $ipn['option_selection2'] = $paypal['ipn_signup_vars']['option_selection2'];
                                     $ipn['item_number'] = $paypal['ipn_signup_vars']['item_number'];
                                     $ipn['item_name'] = $paypal['ipn_signup_vars']['item_name'];
                                     $ipn['s2member_paypal_proxy'] = 'paypal';
                                     $ipn['s2member_paypal_proxy_use'] = 'pro-emails';
                                     $ipn['s2member_paypal_proxy_verification'] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                                     c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
                                 } else {
                                     if (!$processed && !$paypal['ipn_signup_vars']) {
                                         $paypal['s2member_log'][] = 'Ignoring status (`' . $paypal['STATUS'] . '`).' . ' The user has no IPN Signup Vars recorded on-site by s2Member.';
                                     } else {
                                         if (!$processed) {
                                             $paypal['s2member_log'][] = 'Ignoring status (`' . $paypal['STATUS'] . '`).' . ' It does NOT require any action on the part of s2Member.';
                                         }
                                     }
                                 }
                             }
                             $logt = c_ws_plugin__s2member_utilities::time_details();
                             $logv = c_ws_plugin__s2member_utilities::ver_details();
//.........这里部分代码省略.........
开发者ID:SollyNZ,项目名称:damn-plugins,代码行数:101,代码来源:paypal-payflow-poll.inc.php

示例15: paypal_checkout


//.........这里部分代码省略.........
                                 $old__subscr_or_wp_id = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id();
                                 $old__subscr_id = get_user_option("s2member_subscr_id");
                                 if ($cost_calculations["trial_total"] <= 0 && $cost_calculations["total"] <= 0) {
                                     $new__subscr_id = strtoupper('free-' . uniqid());
                                 } else {
                                     $new__subscr_id = $paypal["PROFILEID"];
                                 }
                                 if (!($ipn = array())) {
                                     $ipn["txn_type"] = "subscr_signup";
                                     $ipn["subscr_id"] = $new__subscr_id;
                                     $ipn["custom"] = $post_vars["attr"]["custom"];
                                     $ipn["txn_id"] = $new__subscr_id;
                                     $ipn["period1"] = $period1;
                                     $ipn["period3"] = $period3;
                                     $ipn["mc_amount1"] = $cost_calculations["trial_total"];
                                     $ipn["mc_amount3"] = $cost_calculations["total"];
                                     $ipn["mc_gross"] = preg_match("/^[1-9]/", $ipn["period1"]) ? $ipn["mc_amount1"] : $ipn["mc_amount3"];
                                     $ipn["mc_currency"] = $cost_calculations["cur"];
                                     $ipn["tax"] = $cost_calculations["tax"];
                                     $ipn["recurring"] = $post_vars["attr"]["rr"] ? "1" : "";
                                     $ipn["payer_email"] = $user->user_email;
                                     $ipn["first_name"] = $post_vars["first_name"];
                                     $ipn["last_name"] = $post_vars["last_name"];
                                     $ipn["option_name1"] = "Referencing Customer ID";
                                     $ipn["option_selection1"] = $old__subscr_or_wp_id;
                                     $ipn["option_name2"] = "Customer IP Address";
                                     $ipn["option_selection2"] = $_SERVER["REMOTE_ADDR"];
                                     $ipn["item_name"] = $cost_calculations["desc"];
                                     $ipn["item_number"] = $post_vars["attr"]["level_ccaps_eotper"];
                                     $ipn["s2member_paypal_proxy"] = "paypal";
                                     $ipn["s2member_paypal_proxy_use"] = "pro-emails";
                                     $ipn["s2member_paypal_proxy_use"] .= $ipn["mc_gross"] > 0 ? ",subscr-signup-as-subscr-payment" : "";
                                     $ipn["s2member_paypal_proxy_coupon"] = array("coupon_code" => $cp_attr["_coupon_code"], "full_coupon_code" => $cp_attr["_full_coupon_code"], "affiliate_id" => $cp_attr["_coupon_affiliate_id"]);
                                     $ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                                     $ipn["s2member_paypal_proxy_return_url"] = $post_vars["attr"]["success"];
                                     $ipn["s2member_paypal_proxy_return_url"] = trim(c_ws_plugin__s2member_utils_urls::remote(home_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20)));
                                 }
                                 if (!($paypal = array()) && ($paypal["PROFILEID"] = $old__subscr_id) && apply_filters("s2member_pro_cancels_old_rp_before_new_rp", TRUE, get_defined_vars())) {
                                     $paypal["METHOD"] = "ManageRecurringPaymentsProfileStatus";
                                     $paypal["ACTION"] = "Cancel";
                                     c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal);
                                 }
                                 c_ws_plugin__s2member_list_servers::process_list_servers_against_current_user((bool) @$post_vars["custom_fields"]["opt_in"], TRUE, TRUE);
                                 setcookie("s2member_tracking", $s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($new__subscr_id), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_tracking", $s2member_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_tracking"] = $s2member_tracking);
                                 $global_response = array("response" => _x('<strong>Thank you.</strong> Your account has been updated.', "s2member-front", "s2member"));
                                 if ($post_vars["attr"]["success"] && substr($ipn["s2member_paypal_proxy_return_url"], 0, 2) === substr($post_vars["attr"]["success"], 0, 2) && ($custom_success_url = str_ireplace(array("%%s_response%%", "%%response%%"), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response["response"])), urlencode($global_response["response"])), $ipn["s2member_paypal_proxy_return_url"])) && ($custom_success_url = trim(preg_replace("/%%(.+?)%%/i", "", $custom_success_url)))) {
                                     wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, "s2p-v")) . exit;
                                 }
                             } else {
                                 $global_response = array("response" => $paypal["__error"], "error" => true);
                             }
                         } else {
                             $global_response = array("response" => _x('<strong>Sorry.</strong> Your account is pending other changes. Please try again in 15 minutes.', "s2member-front", "s2member"), "error" => true);
                         }
                     } else {
                         if ($use_recurring_profile && !is_user_logged_in()) {
                             $period1 = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1($post_vars["attr"]["tp"] . " " . $post_vars["attr"]["tt"]);
                             $period3 = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($post_vars["attr"]["rp"] . " " . $post_vars["attr"]["rt"]);
                             $start_time = $post_vars["attr"]["tp"] ? c_ws_plugin__s2member_pro_paypal_utilities::paypal_start_time($period1) : c_ws_plugin__s2member_pro_paypal_utilities::paypal_start_time($period3);
                             $reference = $start_time . ":" . $period1 . ":" . $period3 . "~" . $_SERVER["HTTP_HOST"] . "~" . $post_vars["attr"]["level_ccaps_eotper"];
                             if (!($paypal = array())) {
                                 $paypal["METHOD"] = "CreateRecurringPaymentsProfile";
                                 $paypal["EMAIL"] = $post_vars["email"];
                                 $paypal["FIRSTNAME"] = $post_vars["first_name"];
                                 $paypal["LASTNAME"] = $post_vars["last_name"];
                                 $paypal["SUBSCRIBERNAME"] = $post_vars["name"];
开发者ID:codeforest,项目名称:s2member-pro,代码行数:67,代码来源:paypal-checkout-in.inc.php


注:本文中的c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。