本文整理汇总了PHP中c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_response方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_response方法的具体用法?PHP c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_response怎么用?PHP c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_response使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_paypal_utilities
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_response方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: payflow_cancel_billing_agreement
/**
* Cancels a Payflow Billing Agreement.
*
* @package s2Member\PayPal
* @since 130510
*
* @param string $baid A Billing Agreement ID (aka: BAID).
* @return boolean True if the agreement was cancelled, else false.
*/
public static function payflow_cancel_billing_agreement($baid = FALSE)
{
$payflow["ACTION"] = "U";
$payflow["TENDER"] = "P";
$payflow["BAID"] = $baid;
$payflow["BA_STATUS"] = "cancel";
if (($cancellation = c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_response($payflow)) && empty($cancellation["__error"])) {
return true;
}
return false;
}
示例2: paypal_checkout
//.........这里部分代码省略.........
if (!($paypal_set_xco = array())) {
if ($use_recurring_profile) {
$paypal_set_xco["TRXTYPE"] = "A";
$paypal_set_xco["ACTION"] = "S";
$paypal_set_xco["TENDER"] = "P";
$paypal_set_xco["RETURNURL"] = $return_url;
$paypal_set_xco["CANCELURL"] = $cancel_url;
$paypal_set_xco["PAGESTYLE"] = $post_vars["attr"]["ps"];
$paypal_set_xco["LOCALECODE"] = $post_vars["attr"]["lc"];
$paypal_set_xco["NOSHIPPING"] = $post_vars["attr"]["ns"];
$paypal_set_xco["ALLOWNOTE"] = "0";
$paypal_set_xco["AMT"] = "0.00";
$paypal_set_xco["CURRENCY"] = $cost_calculations["cur"];
$paypal_set_xco["PAYMENTTYPE"] = "any";
$paypal_set_xco["INVNUM"] = $reference;
$paypal_set_xco["BILLINGTYPE"] = "RecurringBilling";
// When this is present an amount of 0.00 is not allowed for whatever reason.
// $paypal_set_xco["L_BILLINGTYPE0"] = "RecurringBilling";
$paypal_set_xco["ORDERDESC"] = $cost_calculations["desc"];
$paypal_set_xco["BA_DESC"] = $cost_calculations["desc"];
// This is required to get the description to show up during checkout; and in `mb_desc` via IPNs.
$paypal_set_xco["L_BILLINGAGREEMENTDESCRIPTION0"] = $cost_calculations["desc"];
$paypal_set_xco["CUSTOM"] = $_SERVER["HTTP_HOST"];
$paypal_set_xco["BA_CUSTOM"] = $_SERVER["HTTP_HOST"];
$paypal_set_xco["L_BILLINGAGREEMENTCUSTOM0"] = $_SERVER["HTTP_HOST"];
$paypal_set_xco["ADDROVERRIDE"] = "1";
$paypal_set_xco["SHIPTONAME"] = $post_vars["name"];
$paypal_set_xco["SHIPTOSTREET"] = $post_vars["street"];
$paypal_set_xco["SHIPTOCITY"] = $post_vars["city"];
$paypal_set_xco["SHIPTOSTATE"] = $post_vars["state"];
$paypal_set_xco["SHIPTOCOUNTRY"] = $post_vars["country"];
$paypal_set_xco["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_payflow_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 {
$paypal_set_xco["METHOD"] = "SetExpressCheckout";
$paypal_set_xco["RETURNURL"] = $return_url;
$paypal_set_xco["CANCELURL"] = $cancel_url;
$paypal_set_xco["PAGESTYLE"] = $post_vars["attr"]["ps"];
$paypal_set_xco["LOCALECODE"] = $post_vars["attr"]["lc"];
$paypal_set_xco["NOSHIPPING"] = $post_vars["attr"]["ns"];
$paypal_set_xco["ALLOWNOTE"] = "0";
// No notes.
$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";
// 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"];
示例3: payflow_cancel_billing_agreement
/**
* Cancels a Payflow Billing Agreement.
*
* @package s2Member\PayPal
* @since 130510
*
* @param string $baid A Billing Agreement ID (aka: BAID).
*
* @return boolean True if the agreement was cancelled, else false.
*/
public static function payflow_cancel_billing_agreement($baid = '')
{
$payflow['ACTION'] = 'U';
$payflow['TENDER'] = 'P';
$payflow['BAID'] = $baid;
$payflow['BA_STATUS'] = 'cancel';
if (($cancellation = c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_response($payflow)) && empty($cancellation['__error'])) {
return TRUE;
}
return FALSE;
}
示例4: paypal_update
/**
* Handles processing of Pro-Form billing updates.
*
* @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_update()
{
if (!empty($_POST["s2member_pro_paypal_update"]["nonce"]) && ($nonce = $_POST["s2member_pro_paypal_update"]["nonce"]) && wp_verify_nonce($nonce, "s2member-pro-paypal-update")) {
$GLOBALS["ws_plugin__s2member_pro_paypal_update_response"] = array();
// This holds the global response details.
$global_response =& $GLOBALS["ws_plugin__s2member_pro_paypal_update_response"];
// This is a shorter reference.
$post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST["s2member_pro_paypal_update"]));
$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_update_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 (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_paypal_responses::paypal_form_attr_validation_errors($post_vars["attr"])) {
if (!($error = c_ws_plugin__s2member_pro_paypal_responses::paypal_form_submission_validation_errors("update", $post_vars))) {
if ($post_vars["card_type"] === "PayPal") {
$global_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 (is_user_logged_in() && ($user = wp_get_current_user()) && ($user_id = $user->ID)) {
if ($cur__subscr_id = get_user_option("s2member_subscr_id")) {
if (($paypal = c_ws_plugin__s2member_pro_paypal_utilities::payflow_get_profile($cur__subscr_id)) && $paypal["TENDER"] !== "P" && preg_match("/^(Active|ActiveProfile)\$/i", $paypal["STATUS"])) {
$paypal = array();
// Reset the PayPal array.
$paypal["TRXTYPE"] = "R";
$paypal["ACTION"] = "M";
$paypal["ORIGPROFILEID"] = $cur__subscr_id;
$paypal["EMAIL"] = $user->user_email;
$paypal["FIRSTNAME"] = $user->first_name;
$paypal["LASTNAME"] = $user->last_name;
$paypal["TENDER"] = "C";
$paypal["ACCT"] = preg_replace("/[^0-9]/", "", $post_vars["card_number"]);
if (preg_match("/^(?P<month>[0-9]{2})\\/[0-9]{2}(?P<year_suffix>[0-9]{2})\$/", $post_vars["card_expiration"], $_m)) {
$paypal["EXPDATE"] = $_m["month"] . $_m["year_suffix"];
}
$paypal["CVV2"] = $post_vars["card_verification"];
if (in_array($post_vars["card_type"], array("Maestro", "Solo"))) {
if (preg_match("/^(?P<month>[0-9]{2})\\/[0-9]{2}(?P<year>[0-9]{2})\$/", $post_vars["card_start_date_issue_number"], $_m)) {
$paypal["CARDSTART"] = $_m["month"] . $_m["year"];
} else {
$paypal["CARDISSUE"] = $post_vars["card_start_date_issue_number"];
}
unset($_m);
}
$paypal["STREET"] = $post_vars["street"];
$paypal["CITY"] = $post_vars["city"];
$paypal["STATE"] = $post_vars["state"];
$paypal["COUNTRY"] = $post_vars["country"];
$paypal["ZIP"] = $post_vars["zip"];
if (($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_response($paypal)) && empty($paypal["__error"])) {
$global_response = array("response" => _x('<strong>Confirmed.</strong> Your billing information has been updated.', "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" => $paypal["__error"], "error" => true);
}
} else {
if ($paypal && $paypal["TENDER"] !== "P" && !preg_match("/^(Active|ActiveProfile)\$/i", $paypal["STATUS"])) {
$global_response = array("response" => _x('<strong>Unable to update.</strong> 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 ($paypal && $paypal["TENDER"] === "P") {
$global_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 {
$global_response = array("response" => _x('<strong>Unknown error.</strong> Please contact Support for assistance.', "s2member-front", "s2member"), "error" => true);
}
}
}
} else {
$global_response = array("response" => _x('<strong>No Subscr. ID.</strong> Please contact Support for assistance.', "s2member-front", "s2member"), "error" => true);
}
} else {
$global_response = array("response" => _x('You\'re <strong>NOT</strong> logged in.', "s2member-front", "s2member"), "error" => true);
}
}
} else {
$global_response = $error;
}
}
}
}