Source Code Documentation


Field Summary | Method Summary | Field Detail | Method Detail

Package s2Member\PayPal

s2member\includes\classes\paypal-utilities.inc.php at line #28

Class c_ws_plugin__s2member_paypal_utilities

c_ws_plugin__s2member_paypal_utilities

public class c_ws_plugin__s2member_paypal_utilities

PayPal® utilities.

Since:

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 D|W|M|Y into Payflow® format.

public static array|bool

paypal_postvars()

Get $_POST or $_REQUEST vars from PayPal®.

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.

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.

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.

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.

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.

public static bool|str

paypal_pro_term(str $term)

Converts a term D|W|M|Y into PayPal® Pro format.

public static str

paypal_proxy_key_gen()

Generates a PayPal® Proxy Key, for simulated IPN responses.

public static bool|str

paypal_std_term(str $term)

Converts a term Day|Week|Month|Year into PayPal® Standard format.

( 16 Methods )
Method Detail

s2member\includes\classes\paypal-utilities.inc.php at line #223

_paypal_api_response_filters()

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.

Since:

3.5

Parameters:

array $response - Expects an array of response variables returned by the PayPal® API.

Returns:

array - An array of variables returned by the PayPal® API, after $response["__error"] is Filtered.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #360

_paypal_payflow_api_response_filters()

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.

Since:

120514

Parameters:

array $response - Expects an array of response variables returned by the Payflow® API.

Returns:

array - An array of variables returned by the Payflow® API, after $response["__error"] is Filtered.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #252

paypal_api_nv_cleanup()

public static string paypal_api_nv_cleanup(string $key, string $value)

Cleans up values passed through PayPal® NVP strings.

Since:

121202

Parameters:

string $key - Expects a string value.

string $value - Expects a string value.

Returns:

string - Cleaned string value.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #150

paypal_api_response()

public static array paypal_api_response(array $post_vars)

Calls upon the PayPal® API, and returns the response.

Since:

3.5

Parameters:

array $post_vars - An array of variables to send through the PayPal® API call.

Returns:

array - An array of variables returned by the PayPal® API.

Todo:

Optimize this routine with empty() and isset().

Possibly integrate this API: http://msdn.microsoft.com/en-us/library/ff512417.aspx.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #384

paypal_payflow_api_nv_cleanup()

public static string paypal_payflow_api_nv_cleanup(string $key, string $value)

Cleans up values passed through PayPal® text/namevalue strings.

Since:

121202

Parameters:

string $key - Expects a string value.

string $value - Expects a string value.

Returns:

string - Cleaned string value.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #273

paypal_payflow_api_response()

public static array paypal_payflow_api_response(array $post_vars)

Calls upon the PayPal® PayFlow API, and returns the response.

Since:

120514

Parameters:

array $post_vars - An array of variables to send through the PayPal® PayFlow API call.

Returns:

array - An array of variables returned by the PayPal® PayFlow API.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #429

paypal_payflow_term()

public static bool|str paypal_payflow_term(str $term, str $period)

Converts a term D|W|M|Y into Payflow® format.

Since:

120514

Parameters:

str $term - Expects one of D|W|M|Y.

str $period - Expects a numeric value.

Returns:

bool|str - A full singular description of the term ( i.e. DAY|WEEK|BIWK|MONT|QTER|SMYR|YEAR ), else false.

Note:

Payflow® unfortunately does NOT support daily and/or bi-monthly billing.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #38

paypal_postvars()

public static array|bool paypal_postvars()

Get $_POST or $_REQUEST vars from PayPal®.

Since:

3.5

Returns:

array|bool - An array of verified $_POST or $_REQUEST variables, else false.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #545

paypal_pro_item_name()

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.

Since:

3.5

Parameters:

str|array $array_or_string - Either an array of PayPal® post vars, or a string.

Returns:

str|bool - An item_name string if non-empty, else false.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #507

paypal_pro_item_number()

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.

Since:

3.5

Parameters:

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.

Returns:

str|bool - An item_number string if non-empty, else false.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #579

paypal_pro_period1()

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.

Since:

3.5

Parameters:

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.

Returns:

str - A period1 string if possible, or defaults to 0 D.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #633

paypal_pro_period3()

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 ).

Since:

3.5

Parameters:

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.

Returns:

str - A period3 string if possible, or defaults to 1 D.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #480

paypal_pro_subscr_id()

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.

Since:

3.5

Parameters:

str|array $array_or_string - Either an array of PayPal® post vars, or a string.

Returns:

str|bool - A subscr_id string if non-empty, else false.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #405

paypal_pro_term()

public static bool|str paypal_pro_term(str $term)

Converts a term D|W|M|Y into PayPal® Pro format.

Since:

3.5

Parameters:

str $term - Expects one of D|W|M|Y.

Returns:

bool|str - A full singular description of the term ( i.e. Day|Week|Month|Year ), else false.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #122

paypal_proxy_key_gen()

public static str paypal_proxy_key_gen()

Generates a PayPal® Proxy Key, for simulated IPN responses.

Since:

3.5

Returns:

str - A Proxy Key. It's an MD5 Hash, 32 chars, URL-safe.

[ back to top ]

s2member\includes\classes\paypal-utilities.inc.php at line #459

paypal_std_term()

public static bool|str paypal_std_term(str $term)

Converts a term Day|Week|Month|Year into PayPal® Standard format.

Since:

3.5

Parameters:

str $term - Expects one of Day|Week|Month|Year.

Returns:

bool|str - A term code ( i.e. D|W|M|Y ), else false.

[ back to top ]

Source Code Documentation


Field Summary | Method Summary | Field Detail | Method Detail