本文整理汇总了PHP中c_ws_plugin__s2member_paypal_utilities类的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_paypal_utilities类的具体用法?PHP c_ws_plugin__s2member_paypal_utilities怎么用?PHP c_ws_plugin__s2member_paypal_utilities使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了c_ws_plugin__s2member_paypal_utilities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sc_paypal_button_encryption
/**
* Handles PayPal® Button encryption.
*
* This uses the PayPal® API. s2Member will NOT attempt to encrypt Buttons until there is at least a Business Email Address and API Username configured.
* s2Member also maintains a log of communication with the PayPal® API. If logging is enabled, check: `/wp-content/plugins/s2member-logs/paypal-api.log`.
*
* @package s2Member\PayPal
* @since 3.5
*
* @param str $code The PayPal® Button Code before encryption.
* @param array $vars An array of defined variables in the scope of the calling Filter.
* @return str The Resulting PayPal® Button Code *( possibly encrypted, depending on configuration )*.
*/
public static function sc_paypal_button_encryption($code = FALSE, $vars = FALSE)
{
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_before_sc_paypal_button_encryption", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_btn_encryption"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"]) {
$cache = apply_filters("ws_plugin__s2member_sc_paypal_button_encryption_cache", true, get_defined_vars());
/**/
eval('$_code = $vars["_code"]; $attr = $vars["attr"];');
/* Let's unpack ( i.e. use shorter references ) to these two important vars. */
/**/
if ($cache && ($transient = "s2m_btn_" . md5($code . c_ws_plugin__s2member_utilities::ver_checksum())) && ($cache = get_transient($transient))) {
$code = $cache;
} else {
if (is_array($inputs = c_ws_plugin__s2member_utils_forms::form_whips_2_array($_code)) && !empty($inputs)) {
$paypal = array("METHOD" => "BMCreateButton", "BUTTONCODE" => "ENCRYPTED", "BUTTONTYPE" => $attr["sp"] || $attr["rr"] === "BN" ? "BUYNOW" : "SUBSCRIBE");
/**/
$i = 0;
/* Initialize incremental variable counter. PayPal® wants these numbered using L_BUTTONVAR{n}; where {n} starts at zero. */
foreach ($inputs as $input => $value) {
/* Now run through each of the input variables that we parsed from the Full Button Code */
if (!preg_match("/^cmd\$/i", $input)) {
/* The PayPal® API method `BMCreateButton` expects (amount|a1|a3) to include 2 decimal places. */
if (preg_match("/^(amount|a1|a3)\$/i", $input)) {
$value = number_format($value, 2, ".", "");
}
/**/
$paypal["L_BUTTONVAR" . $i] = $input . "=" . $value;
$i++;
/* Increment variable counter. */
}
}
/**/
if (($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal)) && empty($paypal["__error"]) && !empty($paypal["WEBSITECODE"]) && ($code = $paypal["WEBSITECODE"])) {
$default_image = "https://www.paypal.com/" . _x("en_US", "s2member-front paypal-button-lang-code", "s2member") . "/i/btn/btn_xpressCheckout.gif";
/**/
$code = preg_replace("/\\<img[^\\>]+\\>/i", "", $code);
/* Remove the 1x1 pixel tracking image that PayPal® sticks in there. */
$code = preg_replace("/(\\<input)([^\\>]+)(\\>)/ie", "'\\1'.rtrim(stripslashes('\\2'),'/').' /\\3'", $code);
/* Use XHTML! */
/**/
$code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
/**/
$code = $attr["output"] === "anchor" ? '<a href="' . esc_attr(c_ws_plugin__s2member_utils_forms::form_whips_2_url($code)) . '"><img src="' . esc_attr($attr["image"] && $attr["image"] !== "default" ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal®" /></a>' : $code;
$code = $attr["output"] === "url" ? c_ws_plugin__s2member_utils_forms::form_whips_2_url($code) : $code;
/**/
$cache && $transient ? set_transient($transient, $code, apply_filters("ws_plugin__s2member_sc_paypal_button_encryption_cache_exp_time", 3600, get_defined_vars())) : null;
/* Caching? */
}
}
}
}
/* No WordPress® Filters apply here. */
/* Instead, use: `ws_plugin__s2member_sc_paypal_button`. */
return $code;
/* Button Code. Possibly w/ API encryption now. */
}
示例2: cp
/**
* s2Member's PayPal® IPN handler ( inner processing routine ).
*
* @package s2Member\PayPal
* @since 110720
*
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
* @return array|bool The original ``$paypal`` array passed in ( extracted ) from ``$vars``, or false when conditions do NOT apply.
*/
public static function cp($vars = array())
{
extract($vars);
/* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */
/**/
if (!empty($paypal["txn_type"]) && preg_match("/^(subscr_failed|recurring_payment_failed|recurring_payment_skipped)\$/i", $paypal["txn_type"]) && ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal))) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"])) && (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id($paypal))) && (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name($paypal))) && (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with($paypal["subscr_id"])))) {
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_failed", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
if (!get_transient($transient_ipn = "s2m_ipn_" . md5("s2member_transient_" . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `subscr_failed|recurring_payment_failed|recurring_payment_skipped` ).";
/**/
$processing = $during = true;
/* Yes, we ARE processing this. */
/**/
$paypal["s2member_log"][] = "This `txn_type` does not require any action on the part of s2Member.";
$paypal["s2member_log"][] = "s2Member does NOT respond to individual failed payments, only multiple consecutive failed payments.";
$paypal["s2member_log"][] = "When multiple consecutive payments fail, a special IPN response will be triggered.";
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_failed", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
} else {
$paypal["s2member_log"][] = "Not processing. Duplicate IPN.";
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `subscr_failed|recurring_payment_failed|recurring_payment_skipped` ).";
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
}
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_failed", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level", $paypal, get_defined_vars());
} else {
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level", false, get_defined_vars());
}
}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:50,代码来源:paypal-notify-in-subscr-or-rp-payment-failed-w-level.inc.php
示例3: cp
/**
* s2Member's PayPal® IPN handler ( inner processing routine ).
*
* @package s2Member\PayPal
* @since 110720
*
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
* @return array|bool The original ``$paypal`` array passed in ( extracted ) from ``$vars``, or false when conditions do NOT apply.
*/
public static function cp($vars = array())
{
extract($vars);
/* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */
/**/
if (!empty($paypal["txn_type"]) && preg_match("/^recurring_payment_profile_created\$/i", $paypal["txn_type"]) && ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal))) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"])) && (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id($paypal))) && (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name($paypal))) && (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with($paypal["subscr_id"])))) {
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_before_recurring_payment_profile_created", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
if (!get_transient($transient_ipn = "s2m_ipn_" . md5("s2member_transient_" . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `recurring_payment_profile_created` ).";
/**/
$processing = $during = true;
/* Yes, we ARE processing this. */
/**/
$paypal["s2member_log"][] = "The `txn_type` does not require any action on the part of s2Member.";
$paypal["s2member_log"][] = "s2Member Pro handles this event on-site, with an IPN proxy.";
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_during_recurring_payment_profile_created", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
} else {
$paypal["s2member_log"][] = "Not processing. Duplicate IPN.";
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `recurring_payment_profile_created` ).";
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
}
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_after_recurring_payment_profile_created", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level", $paypal, get_defined_vars());
} else {
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level", false, get_defined_vars());
}
}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:49,代码来源:paypal-notify-in-rec-profile-creation-w-level.inc.php
示例4: s2member_pro_paypal_rbp_for_user
function s2member_pro_paypal_rbp_for_user($user_id = FALSE)
{
$user_id = (int) $user_id;
$user_id = $user_id ? $user_id : get_current_user_id();
if (!$user_id) {
return array();
}
$user_subscr_id = get_user_option('s2member_subscr_id', $user_id);
if (!$user_subscr_id) {
return array();
}
$paypal['METHOD'] = 'GetRecurringPaymentsProfileDetails';
$paypal['PROFILEID'] = $user_subscr_id;
if (is_array($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal)) && empty($paypal['__error'])) {
return $paypal;
}
return array();
}
示例5: authnet_checkout
/**
* Handles processing of Pro Form checkouts.
*
* @package s2Member\AuthNet
* @since 1.5
*
* @attaches-to ``add_action("init");``
*
* @return null Or exits script execution after a custom URL redirection.
*
* @todo Build in routine to void first payment if Recurring Profile creation fails for some reason? Seems logical, even though highly unlikely.
*/
public static function authnet_checkout()
{
if (!empty($_POST["s2member_pro_authnet_checkout"]["nonce"]) && ($nonce = $_POST["s2member_pro_authnet_checkout"]["nonce"]) && wp_verify_nonce($nonce, "s2member-pro-authnet-checkout")) {
$GLOBALS["ws_plugin__s2member_pro_authnet_checkout_response"] = array();
// This holds the global response details.
$global_response =& $GLOBALS["ws_plugin__s2member_pro_authnet_checkout_response"];
// This is a shorter reference.
$post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST["s2member_pro_authnet_checkout"]));
$post_vars["attr"] = unserialize(c_ws_plugin__s2member_utils_encryption::decrypt($post_vars["attr"]));
// And Filter.
$post_vars["attr"] = apply_filters("ws_plugin__s2member_pro_authnet_checkout_post_attr", $post_vars["attr"], get_defined_vars());
$post_vars["recaptcha_challenge_field"] = !$post_vars["recaptcha_challenge_field"] ? trim(stripslashes($_POST["recaptcha_challenge_field"])) : $post_vars["recaptcha_challenge_field"];
$post_vars["recaptcha_response_field"] = !$post_vars["recaptcha_response_field"] ? trim(stripslashes($_POST["recaptcha_response_field"])) : $post_vars["recaptcha_response_field"];
$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());
$post_vars["username"] = is_multisite() ? strtolower($post_vars["username"]) : $post_vars["username"];
// Force lowercase.
$post_vars["username"] = preg_replace("/\\s+/", "", sanitize_user($post_vars["_o_username"] = $post_vars["username"], is_multisite()));
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"];
}
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("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($cp_attr["ta"], $cp_attr["ra"], $post_vars["state"], $post_vars["country"], $post_vars["zip"], $cp_attr["cc"], $cp_attr["desc"]);
if ($cost_calculations["total"] <= 0 && $post_vars["attr"]["tp"] && $cost_calculations["trial_total"] > 0) {
$post_vars["attr"]["tp"] = "0";
// Ditch the trial period completely.
$cost_calculations["sub_total"] = $cost_calculations["trial_sub_total"];
// Use as regular sub-total (ditch trial sub-total).
$cost_calculations["tax"] = $cost_calculations["trial_tax"];
// Use as regular tax (ditch trial tax).
$cost_calculations["tax_per"] = $cost_calculations["trial_tax_per"];
// Use as regular tax (ditch trial tax).
$cost_calculations["total"] = $cost_calculations["trial_total"];
// Use as regular total (ditch trial).
$cost_calculations["trial_sub_total"] = "0.00";
// Ditch the initial total (using as grand total).
$cost_calculations["trial_tax"] = "0.00";
// Ditch this calculation now also.
$cost_calculations["trial_tax_per"] = "";
// Ditch this calculation now also.
$cost_calculations["trial_total"] = "0.00";
// Ditch this calculation now also.
}
$use_recurring_profile = $post_vars["attr"]["rr"] === "BN" || !$post_vars["attr"]["tp"] && !$post_vars["attr"]["rr"] ? false : true;
$is_independent_ccaps_sale = $post_vars["attr"]["level"] === "*" ? true : false;
// Selling Independent Custom Capabilities?
if ($use_recurring_profile && $cost_calculations["trial_total"] <= 0 && $cost_calculations["total"] <= 0) {
if (!$post_vars["attr"]["rr"] && $post_vars["attr"]["rt"] !== "L") {
if (substr_count($post_vars["attr"]["level_ccaps_eotper"], ":") === 1) {
$post_vars["attr"]["level_ccaps_eotper"] .= ":" . $post_vars["attr"]["rp"] . " " . $post_vars["attr"]["rt"];
} else {
if (substr_count($post_vars["attr"]["level_ccaps_eotper"], ":") === 0) {
$post_vars["attr"]["level_ccaps_eotper"] .= "::" . $post_vars["attr"]["rp"] . " " . $post_vars["attr"]["rt"];
}
}
} else {
if ($post_vars["attr"]["rr"] && $post_vars["attr"]["rrt"] && $post_vars["attr"]["rt"] !== "L") {
if (substr_count($post_vars["attr"]["level_ccaps_eotper"], ":") === 1) {
$post_vars["attr"]["level_ccaps_eotper"] .= ":" . $post_vars["attr"]["rp"] * $post_vars["attr"]["rrt"] . " " . $post_vars["attr"]["rt"];
} else {
if (substr_count($post_vars["attr"]["level_ccaps_eotper"], ":") === 0) {
$post_vars["attr"]["level_ccaps_eotper"] .= "::" . $post_vars["attr"]["rp"] * $post_vars["attr"]["rrt"] . " " . $post_vars["attr"]["rt"];
}
}
}
}
}
if ($use_recurring_profile && is_user_logged_in() && is_object($user = wp_get_current_user()) && ($user_id = $user->ID)) {
$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_authnet_utilities::authnet_start_time($period1) : c_ws_plugin__s2member_pro_authnet_utilities::authnet_start_time($period3);
// Or next billing cycle.
$reference = $start_time . ":" . $period1 . ":" . $period3 . "~" . $_SERVER["HTTP_HOST"] . "~" . $post_vars["attr"]["level_ccaps_eotper"] . "~" . $cost_calculations["cur"];
update_user_meta($user_id, "first_name", $post_vars["first_name"]) . update_user_meta($user_id, "last_name", $post_vars["last_name"]);
if (!($_authnet = array()) && (!$post_vars["attr"]["tp"] || $post_vars["attr"]["tp"] && $cost_calculations["trial_total"] > 0)) {
$_authnet["x_type"] = "AUTH_CAPTURE";
$_authnet["x_method"] = "CC";
$_authnet["x_email"] = $user->user_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_initial_payment"] = "1";
// Initial.
$_authnet["s2_invoice"] = $post_vars["attr"]["level_ccaps_eotper"];
//.........这里部分代码省略.........
示例6: paypal_form_attr_validation_errors
/**
* Validates the configuration of the current form.
*
* Free Registration Forms do NOT require API Credentials.
*
* @package s2Member\PayPal
* @since 1.5
*
* @param array $attr An array of Pro-Form Attributes.
* @return null|array Null if there are no errors, else a response array.
*/
public static function paypal_form_attr_validation_errors($attr = FALSE)
{
if (!($response = c_ws_plugin__s2member_pro_paypal_responses::paypal_form_api_validation_errors($attr)) || !empty($attr["register"])) {
if ($attr["cancel"]) {
if (!is_user_logged_in()) {
$response = array("response" => sprintf(_x('You must <a href="%s" rel="nofollow">log in</a> to cancel your account.', "s2member-front", "s2member"), esc_attr(wp_login_url($_SERVER["REQUEST_URI"]))), "error" => true);
} else {
if (!is_object($user = wp_get_current_user()) || !($user_id = $user->ID) || !($subscr_id = get_user_option("s2member_subscr_id", $user_id))) {
$response = array("response" => _x('Nothing to cancel. You\'re NOT a paid Member.', "s2member-front", "s2member"), "error" => true);
} else {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_username"]) {
if (!($paypal = c_ws_plugin__s2member_pro_paypal_utilities::payflow_get_profile($subscr_id))) {
$response = array("response" => _x('Nothing to cancel. You have NO recurring fees.', "s2member-front", "s2member"), "error" => true);
} else {
if (!empty($paypal["STATUS"]) && preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
$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 {
if (empty($paypal["STATUS"]) || !preg_match("/^(Active|ActiveProfile|Suspended|SuspendedProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('Nothing to cancel. You have NO recurring fees.', "s2member-front", "s2member"), "error" => true);
}
}
}
} else {
if (is_array($paypal = array("PROFILEID" => $subscr_id, "METHOD" => "GetRecurringPaymentsProfileDetails"))) {
if (!($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal)) || !empty($paypal["__error"])) {
if ($paypal && !empty($paypal["__error"]) && !empty($paypal["L_ERRORCODE0"]) && $paypal["L_ERRORCODE0"] === "11592") {
$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&alias=" . urlencode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"]))), "error" => true);
} else {
$response = array("response" => _x('Nothing to cancel. You have NO recurring fees.', "s2member-front", "s2member"), "error" => true);
}
} else {
if (!empty($paypal["STATUS"]) && preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
$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 {
if (empty($paypal["STATUS"]) || !preg_match("/^(Active|ActiveProfile|Suspended|SuspendedProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('Nothing to cancel. You have NO recurring fees.', "s2member-front", "s2member"), "error" => true);
}
}
}
}
}
}
}
} else {
if ($attr["update"]) {
if (!is_user_logged_in()) {
$response = array("response" => sprintf(_x('You must <a href="%s" rel="nofollow">log in</a> to update your billing information.', "s2member-front", "s2member"), esc_attr(wp_login_url($_SERVER["REQUEST_URI"]))), "error" => true);
} else {
if (!is_object($user = wp_get_current_user()) || !($user_id = $user->ID) || !($subscr_id = get_user_option("s2member_subscr_id", $user_id))) {
$response = array("response" => _x('Nothing to update. You\'re NOT a paid Member.', "s2member-front", "s2member"), "error" => true);
} else {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_username"]) {
if (!($paypal = c_ws_plugin__s2member_pro_paypal_utilities::payflow_get_profile($subscr_id))) {
$response = array("response" => _x('Nothing to update. You have NO recurring fees. Or, your billing profile is no longer active. Please contact Support if you need assistance.', "s2member-front", "s2member"), "error" => true);
} else {
if (!empty($paypal["TENDER"]) && strtoupper($paypal["TENDER"]) === "P") {
$response = array("response" => sprintf(_x('Please <a href="%s" rel="nofollow">log in at PayPal</a> to update your billing information.', "s2member-front", "s2member"), esc_attr("https://" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com") . "/")), "error" => true);
} else {
if (!empty($paypal["STATUS"]) && preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('<strong>Unable to update at this time.</strong> Your account is pending other changes. Please try again in 15 minutes.', "s2member-front", "s2member"), "error" => true);
} else {
if (empty($paypal["STATUS"]) || !preg_match("/^(Active|ActiveProfile|Suspended|SuspendedProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('Nothing to update. You have NO recurring fees. Or, your billing profile is no longer active. Please contact Support if you need assistance.', "s2member-front", "s2member"), "error" => true);
}
}
}
}
} else {
if (is_array($paypal = array("PROFILEID" => $subscr_id, "METHOD" => "GetRecurringPaymentsProfileDetails"))) {
if (!($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal)) || !empty($paypal["__error"]) || empty($paypal["ACCT"]) || strlen($paypal["ACCT"]) !== 4) {
if ($paypal && empty($paypal["__error"]) && (empty($paypal["ACCT"]) || strlen($paypal["ACCT"]) !== 4)) {
$response = array("response" => sprintf(_x('Please <a href="%s" rel="nofollow">log in at PayPal</a> to update your billing information.', "s2member-front", "s2member"), esc_attr("https://" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com") . "/")), "error" => true);
} else {
if ($paypal && !empty($paypal["__error"]) && !empty($paypal["L_ERRORCODE0"]) && $paypal["L_ERRORCODE0"] === "11592") {
$response = array("response" => sprintf(_x('Please <a href="%s" rel="nofollow">log in at PayPal</a> to update your billing information.', "s2member-front", "s2member"), esc_attr("https://" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com") . "/")), "error" => true);
} else {
$response = array("response" => _x('Nothing to update. You have NO recurring fees. Or, your billing profile is no longer active. Please contact Support if you need assistance.', "s2member-front", "s2member"), "error" => true);
}
}
} else {
if (!empty($paypal["STATUS"]) && preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('<strong>Unable to update at this time.</strong> Your account is pending other changes. Please try again in 15 minutes.', "s2member-front", "s2member"), "error" => true);
} else {
if (empty($paypal["STATUS"]) || !preg_match("/^(Active|ActiveProfile|Suspended|SuspendedProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('Nothing to update. You have NO recurring fees. Or, your billing profile is no longer active. Please contact Support if you need assistance.', "s2member-front", "s2member"), "error" => true);
}
}
}
}
//.........这里部分代码省略.........
示例7: paypal_checkout
//.........这里部分代码省略.........
$paypal_set_xco["L_PAYMENTREQUEST_0_NAME0"] = $cost_calculations["desc"];
$paypal_set_xco["L_PAYMENTREQUEST_0_NUMBER0"] = $post_vars["attr"]["level_ccaps_eotper"];
$paypal_set_xco["L_PAYMENTREQUEST_0_AMT0"] = $cost_calculations["sub_total"];
}
}
} else {
$paypal_set_xco["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
/**/
$paypal_set_xco["PAYMENTREQUEST_0_DESC"] = $cost_calculations["desc"];
$paypal_set_xco["PAYMENTREQUEST_0_CUSTOM"] = $post_vars["attr"]["custom"];
/**/
$paypal_set_xco["PAYMENTREQUEST_0_CURRENCYCODE"] = $cost_calculations["cur"];
$paypal_set_xco["PAYMENTREQUEST_0_ITEMAMT"] = $cost_calculations["sub_total"];
$paypal_set_xco["PAYMENTREQUEST_0_TAXAMT"] = $cost_calculations["tax"];
$paypal_set_xco["PAYMENTREQUEST_0_AMT"] = $cost_calculations["total"];
/**/
$paypal_set_xco["L_PAYMENTREQUEST_0_QTY0"] = "1";
/* Always (1). */
$paypal_set_xco["L_PAYMENTREQUEST_0_NAME0"] = $cost_calculations["desc"];
$paypal_set_xco["L_PAYMENTREQUEST_0_NUMBER0"] = $post_vars["attr"]["level_ccaps_eotper"];
$paypal_set_xco["L_PAYMENTREQUEST_0_AMT0"] = $cost_calculations["sub_total"];
}
/**/
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTONAME"] = $post_vars["name"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOSTREET"] = $post_vars["street"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOCITY"] = $post_vars["city"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOSTATE"] = $post_vars["state"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE"] = $post_vars["country"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOZIP"] = $post_vars["zip"];
/**/
$paypal_set_xco["EMAIL"] = $user ? $user->user_email : $post_vars["email"];
}
/**/
if (($paypal_set_xco = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal_set_xco)) && empty($paypal_set_xco["__error"])) {
set_transient("s2m_" . md5("s2member_transient_express_checkout_" . $paypal_set_xco["TOKEN"]), $post_vars, 10800);
/**/
$endpoint = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com";
/**/
wp_redirect(add_query_arg("token", urlencode($paypal_set_xco["TOKEN"]), "https://" . $endpoint . "/cgi-bin/webscr?cmd=_express-checkout"));
/**/
exit;
/* Clean exit. */
} else {
$global_response = array("response" => $paypal_set_xco["__error"], "error" => true);
}
} else {
if ($use_recurring_profile && is_user_logged_in() && is_object($user = wp_get_current_user()) && ($user_id = $user->ID)) {
if (!($cur__subscr_id = get_user_option("s2member_subscr_id")) || !($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response(array("METHOD" => "GetRecurringPaymentsProfileDetails", "PROFILEID" => $cur__subscr_id))) || !empty($paypal["__error"]) || !preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
$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);
/* Or next billing cycle. */
/**/
$reference = $start_time . ":" . $period1 . ":" . $period3 . "~" . $_SERVER["HTTP_HOST"] . "~" . $post_vars["attr"]["level_ccaps_eotper"];
/**/
update_user_meta($user_id, "first_name", $post_vars["first_name"]) . update_user_meta($user_id, "last_name", $post_vars["last_name"]);
/**/
if (!($_paypal = array()) && (!$post_vars["attr"]["tp"] || $post_vars["attr"]["tp"] && $cost_calculations["trial_total"] > 0)) {
if ($_GET["s2member_paypal_xco"] === "s2member_pro_paypal_checkout_return" && !empty($_GET["token"]) && ($_paypal_xco_details = array("METHOD" => "GetExpressCheckoutDetails", "TOKEN" => $_GET["token"])) && ($_paypal_xco_details = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($_paypal_xco_details)) && empty($_paypal_xco_details["__error"])) {
$_paypal["METHOD"] = "DoExpressCheckoutPayment";
/**/
$_paypal["TOKEN"] = $_paypal_xco_details["TOKEN"];
$_paypal["PAYERID"] = $_paypal_xco_details["PAYERID"];
/**/
$_paypal["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
示例8: paypal_pro_period3
/**
* Get `period3` from either an array with `PROFILEREFERENCE|rp_invoice_id|period3`, or use an existing string.
*
* This will also convert `1 Day`, into `1 D`, and so on.
* This will also convert `1 SemiMonth`, into `2 W`, and so on.
* The Regular Period can never be less than 1 day ( `1 D` ).
*
* @package s2Member\PayPal
* @since 3.5
*
* @param string|array $array_or_string Either an array of PayPal post vars, or a string.
* If it's a string, we make sure it is a valid `period term` combination.
* @param string $default Optional. Value if unavailable. Defaults to `1 D`.
* @return string A `period3` string if possible, or defaults to `1 D`.
*/
public static function paypal_pro_period3($array_or_string = FALSE, $default = "1 D")
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_paypal_pro_period3", get_defined_vars());
unset($__refs, $__v);
if (is_array($array_or_string) && isset($array_or_string["PROFILENAME"])) {
$array_or_string["PROFILEREFERENCE"] = $array_or_string["PROFILENAME"];
}
if (is_array($array = $array_or_string) && !empty($array["period3"])) {
$_period3 = trim($array["period3"]);
} else {
if (is_array($array = $array_or_string) && (!empty($array["PROFILEREFERENCE"]) || !empty($array["rp_invoice_id"]))) {
list($_reference, $_domain, $_item_number) = array_map("trim", preg_split("/~/", !empty($array["PROFILEREFERENCE"]) ? $array["PROFILEREFERENCE"] : $array["rp_invoice_id"], 3));
list($_start_time, $_period1, $_period3) = array_map("trim", preg_split("/\\:/", $_reference, 3));
} else {
if (is_array($array = $array_or_string) && !empty($array["mp_id"]) && ($ipn_signup_var_period3 = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("period3", FALSE, $array["mp_id"]))) {
$_period3 = trim($ipn_signup_var_period3);
} else {
if (is_string($string = $array_or_string) && !empty($string)) {
$_period3 = trim($string);
}
}
}
}
if (!empty($_period3)) {
list($num, $span) = array_map("trim", preg_split("/ /", $_period3, 2));
if (strtoupper($span) === "SEMIMONTH" && is_numeric($num) && $num >= 1) {
$num = "2";
$span = "W";
}
if (strlen($span) !== 1) {
$span = c_ws_plugin__s2member_paypal_utilities::paypal_std_term($span);
}
$span = preg_match("/^[DWMY]\$/i", $span) ? $span : "";
$num = $span && is_numeric($num) && $num >= 0 ? $num : "";
$period3 = $num && $span ? $num . " " . strtoupper($span) : $default;
return apply_filters("ws_plugin__s2member_paypal_pro_period3", $period3, get_defined_vars());
} else {
return apply_filters("ws_plugin__s2member_paypal_pro_period3", $default, get_defined_vars());
}
}
示例9: 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"];
/**/
//.........这里部分代码省略.........
示例10: 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 />— 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 {
//.........这里部分代码省略.........
示例11: cp
/**
* s2Member's PayPal IPN handler (inner processing routine).
*
* @package s2Member\PayPal
* @since 110720
*
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
*
* @todo Optimize with ``empty()`` and ``isset()``.
*/
public static function cp($vars = array())
{
extract($vars);
// Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
if ((!empty($paypal["txn_type"]) && preg_match("/^new_case\$/i", $paypal["txn_type"]) && !empty($paypal["case_type"]) && preg_match("/^chargeback\$/i", $paypal["case_type"]) || !empty($paypal["payment_status"]) && preg_match("/^(refunded|reversed|reversal)\$/i", $paypal["payment_status"])) && ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal))) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $paypal["item_number"])) && (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name($paypal)) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"])) && !empty($paypal["payer_email"]) && !empty($paypal["parent_txn_id"])) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_paypal_notify_before_sp_refund_reversal", get_defined_vars());
unset($__refs, $__v);
if (!get_transient($transient_ipn = "s2m_ipn_" . md5("s2member_transient_" . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `[empty or irrelevant]` ) w/ `payment_status` ( `refunded|reversed|reversal` ) - or - `new_case` w/ `case_type` ( `chargeback` ).";
$paypal["ip"] = preg_match("/ip address/i", $paypal["option_name2"]) && $paypal["option_selection2"] ? $paypal["option_selection2"] : "";
$paypal["ip"] = !$paypal["ip"] && preg_match("/^[a-z0-9]+~[0-9\\.]+\$/i", $paypal["invoice"]) ? preg_replace("/^[a-z0-9]+~/i", "", $paypal["invoice"]) : $paypal["ip"];
$processing = $during = true;
// Yes, we ARE processing this.
/*
Refunds and chargeback reversals. This is excluded from the processing check.
In other words, s2Member sends `Refund/Reversal` Notifications ANYTIME a Refund/Reversal occurs; even if s2Member did not process it otherwise.
Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
If you're writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
*/
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_urls"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_urls"]) as $url) {
if (($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace("/%%parent_txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["parent_txn_id"])), $url))) {
if (($url = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_number"])), $url)) && ($url = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_name"])), $url))) {
if (($url = preg_replace("/%%-amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["mc_gross"])), $url)) && ($url = preg_replace("/%%-fee%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["mc_fee"])), $url))) {
if (($url = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["first_name"])), $url)) && ($url = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["last_name"])), $url))) {
if ($url = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(trim($paypal["first_name"] . " " . $paypal["last_name"]))), $url)) {
if ($url = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["payer_email"])), $url)) {
if ($url = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["ip"])), $url)) {
if ($url = trim(preg_replace("/%%(.+?)%%/i", "", $url))) {
c_ws_plugin__s2member_utils_urls::remote($url);
}
}
}
}
}
}
}
}
}
$paypal["s2member_log"][] = "Specific Post/Page ~ Refund/Reversal Notification URLs have been processed.";
}
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_recipients"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
$msg = $sbj = "(s2Member / API Notification Email) - Specific Post/Page ~ Refund/Reversal";
$msg .= "\n\n";
// Spacing in the message body.
$msg .= "parent_txn_id: %%parent_txn_id%%\n";
$msg .= "item_number: %%item_number%%\n";
$msg .= "item_name: %%item_name%%\n";
$msg .= "-amount: %%-amount%%\n";
$msg .= "-fee: %%-fee%%\n";
$msg .= "first_name: %%first_name%%\n";
$msg .= "last_name: %%last_name%%\n";
$msg .= "full_name: %%full_name%%\n";
$msg .= "payer_email: %%payer_email%%\n";
$msg .= "user_ip: %%user_ip%%\n";
$msg .= "cv0: %%cv0%%\n";
$msg .= "cv1: %%cv1%%\n";
$msg .= "cv2: %%cv2%%\n";
$msg .= "cv3: %%cv3%%\n";
$msg .= "cv4: %%cv4%%\n";
$msg .= "cv5: %%cv5%%\n";
$msg .= "cv6: %%cv6%%\n";
$msg .= "cv7: %%cv7%%\n";
$msg .= "cv8: %%cv8%%\n";
$msg .= "cv9: %%cv9%%";
if (($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace("/%%parent_txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["parent_txn_id"]), $msg))) {
if (($msg = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $msg)) && ($msg = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $msg))) {
if (($msg = preg_replace("/%%-amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $msg)) && ($msg = preg_replace("/%%-fee%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_fee"]), $msg))) {
if (($msg = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $msg)) && ($msg = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $msg))) {
if ($msg = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $msg)) {
if ($msg = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $msg)) {
if ($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["ip"]), $msg)) {
if ($sbj && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) {
// Still have a ``$sbj`` and a ``$msg``?
foreach (c_ws_plugin__s2member_utils_strings::parse_emails($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_recipients"]) as $recipient) {
wp_mail($recipient, apply_filters("ws_plugin__s2member_sp_ref_rev_notification_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_sp_ref_rev_notification_email_msg", $msg, get_defined_vars()), "Content-Type: text/plain; charset=UTF-8");
}
}
}
}
}
}
}
}
}
$paypal["s2member_log"][] = "Specific Post/Page ~ Refund/Reversal Notification Emails have been processed.";
//.........这里部分代码省略.........
示例12: paypal_checkout
//.........这里部分代码省略.........
$paypal_set_xco["ALLOWNOTE"] = "0";
if ($use_recurring_profile) {
$paypal_set_xco["L_BILLINGTYPE0"] = "RecurringPayments";
$paypal_set_xco["L_BILLINGAGREEMENTDESCRIPTION0"] = $cost_calculations["desc"];
if ($post_vars["attr"]["tp"] && $cost_calculations["trial_total"] > 0) {
$paypal_set_xco["MAXAMT"] = $cost_calculations["trial_total"];
} else {
$paypal_set_xco["MAXAMT"] = $cost_calculations["total"];
}
$paypal_set_xco["PAYMENTREQUEST_0_CURRENCYCODE"] = $cost_calculations["cur"];
} else {
$paypal_set_xco["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
$paypal_set_xco["MAXAMT"] = $cost_calculations["total"];
$paypal_set_xco["PAYMENTREQUEST_0_DESC"] = $cost_calculations["desc"];
$paypal_set_xco["PAYMENTREQUEST_0_CUSTOM"] = $post_vars["attr"]["custom"];
$paypal_set_xco["PAYMENTREQUEST_0_CURRENCYCODE"] = $cost_calculations["cur"];
$paypal_set_xco["PAYMENTREQUEST_0_ITEMAMT"] = $cost_calculations["sub_total"];
$paypal_set_xco["PAYMENTREQUEST_0_TAXAMT"] = $cost_calculations["tax"];
$paypal_set_xco["PAYMENTREQUEST_0_AMT"] = $cost_calculations["total"];
$paypal_set_xco["L_PAYMENTREQUEST_0_QTY0"] = "1";
$paypal_set_xco["L_PAYMENTREQUEST_0_NAME0"] = $cost_calculations["desc"];
$paypal_set_xco["L_PAYMENTREQUEST_0_NUMBER0"] = $post_vars["attr"]["level_ccaps_eotper"];
$paypal_set_xco["L_PAYMENTREQUEST_0_AMT0"] = $cost_calculations["sub_total"];
}
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTONAME"] = $post_vars["name"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOSTREET"] = $post_vars["street"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOCITY"] = $post_vars["city"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOSTATE"] = $post_vars["state"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE"] = $post_vars["country"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOZIP"] = $post_vars["zip"];
$paypal_set_xco["EMAIL"] = $user ? $user->user_email : $post_vars["email"];
$paypal_set_xco = apply_filters('ws_plugin__s2member_pro_paypal_set_xco_vars', $paypal_set_xco, get_defined_vars());
}
if (($paypal_set_xco = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal_set_xco)) && empty($paypal_set_xco["__error"])) {
set_transient("s2m_" . md5("s2member_transient_express_checkout_" . $paypal_set_xco["TOKEN"]), $_POST, 10800);
$endpoint = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com";
wp_redirect(add_query_arg("token", urlencode($paypal_set_xco["TOKEN"]), "https://" . $endpoint . "/cgi-bin/webscr?cmd=_express-checkout"));
exit;
} else {
$global_response = array("response" => $paypal_set_xco["__error"], "error" => true);
}
} else {
if ($use_recurring_profile && is_user_logged_in() && is_object($user = wp_get_current_user()) && ($user_id = $user->ID)) {
if (!($cur__subscr_id = get_user_option("s2member_subscr_id")) || !($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response(array("METHOD" => "GetRecurringPaymentsProfileDetails", "PROFILEID" => $cur__subscr_id))) || !empty($paypal["__error"]) || !preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
$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"];
update_user_meta($user_id, "first_name", $post_vars["first_name"]) . update_user_meta($user_id, "last_name", $post_vars["last_name"]);
if (!($paypal = array())) {
$paypal["METHOD"] = "CreateRecurringPaymentsProfile";
$paypal["EMAIL"] = $user->user_email;
$paypal["FIRSTNAME"] = $post_vars["first_name"];
$paypal["LASTNAME"] = $post_vars["last_name"];
$paypal["SUBSCRIBERNAME"] = $post_vars["name"];
$paypal["DESC"] = $cost_calculations["desc"];
$paypal["PROFILEREFERENCE"] = $reference;
if (!$post_vars["attr"]["tp"] || $post_vars["attr"]["tp"] && $cost_calculations["trial_total"] > 0) {
$paypal["INITAMT"] = $post_vars["attr"]["tp"] ? $cost_calculations["trial_total"] : $cost_calculations["total"];
$paypal["FAILEDINITAMTACTION"] = "CancelOnFailure";
}
$paypal["CURRENCYCODE"] = $cost_calculations["cur"];
$paypal["AMT"] = $cost_calculations["sub_total"];
$paypal["TAXAMT"] = $cost_calculations["tax"];
$paypal["MAXFAILEDPAYMENTS"] = $post_vars["attr"]["rra"];
$paypal["AUTOBILLOUTAMT"] = apply_filters("ws_plugin__s2member_pro_paypal_auto_bill_op", "AddToNextBilling", get_defined_vars());
示例13: 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"];
/* This is a shorter reference. */
/**/
$post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST["s2member_pro_authnet_cancellation"]));
$post_vars["attr"] = unserialize(c_ws_plugin__s2member_utils_encryption::decrypt($post_vars["attr"]));
/* And run a Filter. */
$post_vars["attr"] = apply_filters("ws_plugin__s2member_pro_authnet_cancellation_post_attr", $post_vars["attr"], get_defined_vars());
/**/
$post_vars["recaptcha_challenge_field"] = !$post_vars["recaptcha_challenge_field"] ? trim(stripslashes($_POST["recaptcha_challenge_field"])) : $post_vars["recaptcha_challenge_field"];
$post_vars["recaptcha_response_field"] = !$post_vars["recaptcha_response_field"] ? trim(stripslashes($_POST["recaptcha_response_field"])) : $post_vars["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("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 (!($ipn = array())) {
/* With Authorize.Net®, we need their IPN signup vars. */
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_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));
}
}
/**/
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;
}
}
} else {
$global_response = array("response" => _x('You\'re <strong>NOT</strong> logged in.', "s2member-front", "s2member"), "error" => true);
}
} else {
$global_response = $error;
}
}
}
//.........这里部分代码省略.........
示例14: stripe_sp_checkout
/**
* Handles processing of Pro-Forms for Specific Post/Page checkout.
*
* @package s2Member\Stripe
* @since 140617
*
* @attaches-to ``add_action('init');``
*
* @return null Or exits script execution after a custom URL redirection.
*/
public static function stripe_sp_checkout()
{
if (!empty($_POST['s2member_pro_stripe_sp_checkout']['nonce']) && ($nonce = $_POST['s2member_pro_stripe_sp_checkout']['nonce']) && wp_verify_nonce($nonce, 's2member-pro-stripe-sp-checkout')) {
$GLOBALS['ws_plugin__s2member_pro_stripe_sp_checkout_response'] = array();
// This holds the global response details.
$global_response =& $GLOBALS['ws_plugin__s2member_pro_stripe_sp_checkout_response'];
$post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST['s2member_pro_stripe_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_stripe_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());
$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_stripe_responses::stripe_form_attr_validation_errors($post_vars['attr'])) {
if (!($form_submission_validation_errors = c_ws_plugin__s2member_pro_stripe_responses::stripe_form_submission_validation_errors('sp-checkout', $post_vars))) {
unset($_POST['s2member_pro_stripe_sp_checkout']['source_token']);
// Good one-time only.
unset($_POST['s2member_pro_stripe_sp_checkout']['source_token_summary']);
// Good one-time only.
$is_bitcoin = !empty($post_vars['source_token']) && stripos($post_vars['source_token'], 'btcrcv_') === 0;
$cp_attr = c_ws_plugin__s2member_pro_stripe_utilities::apply_coupon($post_vars['attr'], $post_vars['coupon'], 'attr', array('affiliates-silent-post'));
$cost_calculations = c_ws_plugin__s2member_pro_stripe_utilities::cost(NULL, $cp_attr['ra'], $post_vars['state'], $post_vars['country'], $post_vars['zip'], $cp_attr['cc'], $cp_attr['desc'], $is_bitcoin);
if (!$global_response) {
if ($cost_calculations['total'] > 0) {
if (!is_object($stripe_customer = c_ws_plugin__s2member_pro_stripe_utilities::get_customer(get_current_user_id(), $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))) {
$global_response = array('response' => $stripe_customer, 'error' => TRUE);
} else {
if (!is_object($stripe_charge = c_ws_plugin__s2member_pro_stripe_utilities::create_customer_charge($stripe_customer->id, $cost_calculations['total'], $cost_calculations['cur'], $cost_calculations['desc'], array(), $post_vars, $cost_calculations))) {
$global_response = array('response' => $stripe_charge, 'error' => TRUE);
} else {
$new__txn_cid = $stripe_customer->id;
$new__txn_id = $stripe_charge->id;
}
}
}
}
}
if (!$global_response) {
if (empty($new__txn_cid)) {
$new__txn_cid = strtoupper('free-' . uniqid());
}
if (empty($new__txn_id)) {
$new__txn_id = strtoupper('free-' . uniqid());
}
$ipn['txn_type'] = 'web_accept';
$ipn['txn_cid'] = $new__txn_cid;
$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'] = 'stripe';
$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_stripe_proxy_return_url'] = trim(c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20)));
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);
if ($sp_access_url = c_ws_plugin__s2member_sp_access::sp_access_link_gen($post_vars['attr']['ids'], $post_vars['attr']['exp'])) {
$global_response = array('response' => sprintf(_x('<strong>Thank you.</strong> Your purchase has been approved.<br />— 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_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 {
$global_response = array('response' => _x('<strong>Oops.</strong> Unable to generate Access Link. Please contact Support for assistance.', 's2member-front', 's2member'), 'error' => TRUE);
}
}
} else {
// Input form field validation errors.
$global_response = $form_submission_validation_errors;
}
}
}
//.........这里部分代码省略.........
示例15: ccbill_datalink
/**
* Connect to and process DataLink information for ccBill.
*
* 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_ccbill_datalink_ipns_per_process");``.
*
* @package s2Member\ccBill
* @since 1.5
*
* @attaches-to ``add_action("ws_plugin__s2member_after_auto_eot_system");``
*
* @param array $vars Expects an array of defined variables passed in by the Action Hook.
* @return null
*/
public static function ccbill_datalink($vars = FALSE)
{
global $wpdb;
global $current_site, $current_blog;
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"]) {
$mst_time_10m_ago = time() - 6 * 3600 - 600;
$datalink = "https://datalink.ccbill.com/data/main.cgi";
if (!($last = get_transient("s2m_" . md5("s2member_pro_ccbill_last_datalink"))) || $last < $mst_time_10m_ago - 86400) {
$start = $last && $last >= $mst_time_10m_ago - (86400 + 43200) ? $last : $mst_time_10m_ago - 86400;
$end = $last = $start + 86400 <= $mst_time_10m_ago ? $start + 86400 : $mst_time_10m_ago;
$dl_types = "REBILL" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_dl_cancellations"] || apply_filters("ws_plugin__s2member_pro_ccbill_datalink_pulls_cancellations", false) ? ",CANCELLATION" : "") . ",EXPIRE,REFUND,CHARGEBACK";
$qvrs = array("startTime" => date("YmdHis", $start), "endTime" => date("YmdHis", $end), "transactionTypes" => $dl_types, "clientAccnum" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"], "clientSubacc" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_sid"], "username" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_dl_user"], "password" => $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_dl_pass"]);
if (($unprocessed_ipn_lines = trim(c_ws_plugin__s2member_utils_urls::remote($datalink = add_query_arg(urlencode_deep($qvrs), $datalink)))) && !preg_match("/^Error\\:/i", $unprocessed_ipn_lines)) {
$ccbill["s2member_log"][] = "Storing last DataLink time: " . date("D M j, Y g:i:s a T", $last);
set_transient("s2m_" . md5("s2member_pro_ccbill_last_datalink"), $last, 31556926);
$ccbill["s2member_log"][] = "Storing new DataLink IPNs into a Transient Queue.";
$ccbill["s2member_log"][] = $datalink;
$ccbill["s2member_log"][] = $unprocessed_ipn_lines;
set_transient("s2m_" . md5("s2member_pro_ccbill_datalink_ipns"), trim(trim(get_transient("s2m_" . md5("s2member_pro_ccbill_datalink_ipns"))) . "\n" . $unprocessed_ipn_lines), 31556926);
} else {
if (!preg_match("/^Error\\:/i", $unprocessed_ipn_lines)) {
$ccbill["s2member_log"][] = "Storing last DataLink time: " . date("D M j, Y g:i:s a T", $last);
set_transient("s2m_" . md5("s2member_pro_ccbill_last_datalink"), $last, 31556926);
$ccbill["s2member_log"][] = "No new Datalink IPNs at this time: " . date("D M j, Y g:i:s a T");
$ccbill["s2member_log"][] = $datalink;
$ccbill["s2member_log"][] = $unprocessed_ipn_lines;
} else {
$ccbill["s2member_log"][] = "Storing last DataLink time: " . date("D M j, Y g:i:s a T", $last);
set_transient("s2m_" . md5("s2member_pro_ccbill_last_datalink"), $last, 31556926);
$ccbill["s2member_log"][] = "Recording DataLink error at: " . date("D M j, Y g:i:s a T");
$ccbill["s2member_log"][] = "Recording server IP address: " . $_SERVER["SERVER_ADDR"];
$ccbill["s2member_log"][] = $datalink;
$ccbill["s2member_log"][] = $unprocessed_ipn_lines;
}
}
$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() ? "ccbill-dl-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "ccbill-dl.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()) {
file_put_contents($logs_dir . "/" . $log2, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($ccbill, true)) . "\n\n", FILE_APPEND);
}
}
}
} else {
if ($unprocessed_ipn_lines = trim(get_transient("s2m_" . md5("s2member_pro_ccbill_datalink_ipns")))) {
$per_process = apply_filters("ws_plugin__s2member_pro_ccbill_datalink_ipns_per_process", $vars["per_process"], get_defined_vars());
foreach ($unprocessed_lines = preg_split("/[\r\n]+/", $unprocessed_ipn_lines) as $line => $unprocessed_line) {
unset($ccbill, $processing, $processed, $ipn, $log4, $_log4, $log2, $logs_dir);
if (($unprocessed_line = trim($unprocessed_line)) && ($counter = (int) $counter + 1)) {
$ccbill["s2member_log"][] = "DataLink IPN processed on: " . date("D M j, Y g:i:s a T");
$ccbill["dl_ipn"] = c_ws_plugin__s2member_utils_strings::trim_dq_deep(preg_split("/\",\"/", $unprocessed_line));
if (is_array($ccbill["dl_ipn_signup_vars"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(false, $ccbill["dl_ipn"][3]))) {
if (preg_match("/^REBILL\$/i", $ccbill["dl_ipn"][0])) {
$ccbill["s2member_log"][] = "ccBill transaction identified as (SUBSCRIPTION PAYMENT).";
$ccbill["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal processor as txn_type (subscr_payment).";
$ccbill["s2member_log"][] = "Please check PayPal IPN logs for further processing details.";
$processing = $processed = true;
$ipn = array();
$ipn["txn_type"] = "subscr_payment";
$ipn["subscr_id"] = $ccbill["dl_ipn_signup_vars"]["subscr_id"];
$ipn["custom"] = $ccbill["dl_ipn_signup_vars"]["custom"];
$ipn["txn_id"] = $ccbill["dl_ipn"][5];
$ipn["mc_gross"] = number_format($ccbill["dl_ipn"][6], 2, ".", "");
$ipn["mc_currency"] = strtoupper("USD");
$ipn["tax"] = number_format("0.00", 2, ".", "");
$ipn["payer_email"] = $ccbill["dl_ipn_signup_vars"]["payer_email"];
$ipn["first_name"] = $ccbill["dl_ipn_signup_vars"]["first_name"];
$ipn["last_name"] = $ccbill["dl_ipn_signup_vars"]["last_name"];
$ipn["option_name1"] = $ccbill["dl_ipn_signup_vars"]["option_name1"];
$ipn["option_selection1"] = $ccbill["dl_ipn_signup_vars"]["option_selection1"];
$ipn["option_name2"] = $ccbill["dl_ipn_signup_vars"]["option_name2"];
$ipn["option_selection2"] = $ccbill["dl_ipn_signup_vars"]["option_selection2"];
$ipn["item_number"] = $ccbill["dl_ipn_signup_vars"]["item_number"];
$ipn["item_name"] = $ccbill["dl_ipn_signup_vars"]["item_name"];
$ipn["s2member_paypal_proxy"] = "ccbill";
$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(site_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
//.........这里部分代码省略.........