c_ws_plugin__s2member_paypal_utilities
public class c_ws_plugin__s2member_paypal_utilities
3.5
( 16 Methods ) Method Summary | |
---|---|
public static array | _paypal_api_response_filters(array $response) A sort of callback function that Filters PayPal® responses. |
public static array | _paypal_payflow_api_response_filters(array $response) A sort of callback function that Filters Payflow® responses. |
public static string | paypal_api_nv_cleanup(string $key, string $value) Cleans up values passed through PayPal® NVP strings. |
public static array | paypal_api_response(array $post_vars) Calls upon the PayPal® API, and returns the response. |
public static string | paypal_payflow_api_nv_cleanup(string $key, string $value) Cleans up values passed through PayPal® text/namevalue strings. |
public static array | paypal_payflow_api_response(array $post_vars) Calls upon the PayPal® PayFlow API, and returns the response. |
public static bool|str | paypal_payflow_term(str $term, str $period) Converts a term |
public static array|bool | Get |
public static str|bool | paypal_pro_item_name(str|array $array_or_string) Get |
public static str|bool | paypal_pro_item_number(str|array $array_or_string) Get |
public static str | paypal_pro_period1(str|array $array_or_string, str $default) Get |
public static str | paypal_pro_period3(str|array $array_or_string, str $default) Get |
public static str|bool | paypal_pro_subscr_id(str|array $array_or_string) Get |
public static bool|str | paypal_pro_term(str $term) Converts a term |
public static str | Generates a PayPal® Proxy Key, for simulated IPN responses. |
public static bool|str | paypal_std_term(str $term) Converts a term |
public static array _paypal_api_response_filters(array $response)
A sort of callback function that Filters PayPal® responses.
Provides alternative explanations in some cases that require special attention.
3.5
array $response - Expects an array of response variables returned by the PayPal® API.
array - An array of variables returned by the PayPal® API, after $response["__error"]
is Filtered.
public static array _paypal_payflow_api_response_filters(array $response)
A sort of callback function that Filters Payflow® responses.
Provides alternative explanations in some cases that require special attention.
120514
array $response - Expects an array of response variables returned by the Payflow® API.
array - An array of variables returned by the Payflow® API, after $response["__error"]
is Filtered.
public static string paypal_api_nv_cleanup(string $key, string $value)
Cleans up values passed through PayPal® NVP strings.
121202
string $key - Expects a string value.
string $value - Expects a string value.
string - Cleaned string value.
public static array paypal_api_response(array $post_vars)
Calls upon the PayPal® API, and returns the response.
3.5
array $post_vars - An array of variables to send through the PayPal® API call.
array - An array of variables returned by the PayPal® API.
Optimize this routine with empty()
and isset()
.
Possibly integrate this API: http://msdn.microsoft.com/en-us/library/ff512417.aspx.
public static string paypal_payflow_api_nv_cleanup(string $key, string $value)
Cleans up values passed through PayPal® text/namevalue strings.
121202
string $key - Expects a string value.
string $value - Expects a string value.
string - Cleaned string value.
public static array paypal_payflow_api_response(array $post_vars)
Calls upon the PayPal® PayFlow API, and returns the response.
120514
array $post_vars - An array of variables to send through the PayPal® PayFlow API call.
array - An array of variables returned by the PayPal® PayFlow API.
public static bool|str paypal_payflow_term(str $term, str $period)
Converts a term D|W|M|Y
into Payflow® format.
120514
str $term - Expects one of D|W|M|Y
.
str $period - Expects a numeric value.
bool|str - A full singular description of the term ( i.e. DAY|WEEK|BIWK|MONT|QTER|SMYR|YEAR
), else false.
Payflow® unfortunately does NOT support daily and/or bi-monthly billing.
public static array|bool paypal_postvars()
Get $_POST
or $_REQUEST
vars from PayPal®.
3.5
array|bool - An array of verified $_POST
or $_REQUEST
variables, else false.
public static str|bool paypal_pro_item_name(str|array $array_or_string)
Get item_name
from either an array with product_name|item_name1|item_name
, or use an existing string.
3.5
str|array $array_or_string - Either an array of PayPal® post vars, or a string.
str|bool - An item_name
string if non-empty, else false.
public static str|bool paypal_pro_item_number(str|array $array_or_string)
Get item_number
from either an array with PROFILEREFERENCE|rp_invoice_id|item_number1|item_number
, or use an existing string.
3.5
str|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 level:ccaps:eotper
or sp:ids:expiration
combination.
str|bool - An item_number
string if non-empty, else false.
public static str paypal_pro_period1(str|array $array_or_string, str $default)
Get period1
from either an array with PROFILEREFERENCE|rp_invoice_id|period1
, 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.
3.5
str|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.
str $default - Optional. Value if unavailable. Defaults to 0 D
.
str - A period1
string if possible, or defaults to 0 D
.
public static str paypal_pro_period3(str|array $array_or_string, str $default)
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
).
3.5
str|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.
str $default - Optional. Value if unavailable. Defaults to 1 D
.
str - A period3
string if possible, or defaults to 1 D
.
public static str|bool paypal_pro_subscr_id(str|array $array_or_string)
Get subscr_id
from either an array with recurring_payment_id|subscr_id
, or use an existing string.
3.5
str|array $array_or_string - Either an array of PayPal® post vars, or a string.
str|bool - A subscr_id
string if non-empty, else false.
public static bool|str paypal_pro_term(str $term)
Converts a term D|W|M|Y
into PayPal® Pro format.
3.5
str $term - Expects one of D|W|M|Y
.
bool|str - A full singular description of the term ( i.e. Day|Week|Month|Year
), else false.
public static str paypal_proxy_key_gen()
Generates a PayPal® Proxy Key, for simulated IPN responses.
3.5
str - A Proxy Key. It's an MD5 Hash, 32 chars, URL-safe.
public static bool|str paypal_std_term(str $term)
Converts a term Day|Week|Month|Year
into PayPal® Standard format.
3.5
str $term - Expects one of Day|Week|Month|Year
.
bool|str - A term code ( i.e. D|W|M|Y
), else false.
PayPal® utilities.