Source Code Documentation


Field Summary | Method Summary | Field Detail | Method Detail

Package s2Member\PayPal

pro\s2member-pro\includes\classes\gateways\paypal\paypal-utilities.inc.php at line #44

Class c_ws_plugin__s2member_pro_paypal_utilities

c_ws_plugin__s2member_pro_paypal_utilities

public class c_ws_plugin__s2member_pro_paypal_utilities

PayPal® utilities.

Since:

1.5


( 9 Methods )
Method Summary
public static boolean

payflow_cancel_billing_agreement(string $baid)

Cancels a Payflow® Billing Agreement.

public static boolean

payflow_cancel_profile(string $subscr_id, string $baid)

Cancels a Payflow® recurring profile.

public static array|false

payflow_get_profile(string $subscr_id)

Gets a Payflow® recurring profile.

public static null

paypal_ajax_tax()

Handles the return of Tax for Pro Forms, via AJAX; through a JSON object.

public static array|str

paypal_apply_coupon(array $attr, str $coupon_code, str $return, array $process)

Checks to see if a Coupon Code was supplied, and if so; what does it provide?

public static array

paypal_cost(int|str $trial_sub_total, int|str $sub_total, str $state, str $country, int|str $zip, str $currency, str $desc)

Handles all cost calculations for PayPal®.

public static array

paypal_maestro_solo_2gbp(array $attr, str $card_type)

Handles currency conversions for Maestro/Solo cards.

public static int

paypal_start_time(str $period1, str $period3)

Calculates start date for a Recurring Payment Profile.

public static bool

paypal_tax_may_apply()

Determines whether or not Tax may apply.

( 9 Methods )
Method Detail

pro\s2member-pro\includes\classes\gateways\paypal\paypal-utilities.inc.php at line #182

payflow_cancel_billing_agreement()

public static boolean payflow_cancel_billing_agreement(string $baid)

Cancels a Payflow® Billing Agreement.

Since:

130510

Parameters:

string $baid - A Billing Agreement ID (aka: BAID).

Returns:

boolean - True if the agreement was cancelled, else false.

[ back to top ]

pro\s2member-pro\includes\classes\gateways\paypal\paypal-utilities.inc.php at line #155

payflow_cancel_profile()

public static boolean payflow_cancel_profile(string $subscr_id, string $baid)

Cancels a Payflow® recurring profile.

Since:

110531

Parameters:

string $subscr_id - A paid subscription ID (aka: Recurring Profile ID).

string $baid - A Billing Agreement ID (aka: BAID).

Returns:

boolean - True if the profile was cancelled, else false.

[ back to top ]

pro\s2member-pro\includes\classes\gateways\paypal\paypal-utilities.inc.php at line #129

payflow_get_profile()

public static array|false payflow_get_profile(string $subscr_id)

Gets a Payflow® recurring profile.

Since:

110531

Parameters:

string $subscr_id - A paid subscription ID (aka: Recurring Profile ID).

Returns:

array|false - Array of profile details, else false.

[ back to top ]

pro\s2member-pro\includes\classes\gateways\paypal\paypal-utilities.inc.php at line #234

paypal_ajax_tax()

public static null paypal_ajax_tax()

Handles the return of Tax for Pro Forms, via AJAX; through a JSON object.

Since:

1.5

Returns:

null - Or exits script execution after returning data for AJAX caller.

Todo:

Check the use of strip_tags() in this routine?

Continue optimizing this routine with empty() and isset().

Candidate for the use of ifsetor()?

[ back to top ]

pro\s2member-pro\includes\classes\gateways\paypal\paypal-utilities.inc.php at line #431

paypal_apply_coupon()

public static array|str paypal_apply_coupon(array $attr, str $coupon_code, str $return, array $process)

Checks to see if a Coupon Code was supplied, and if so; what does it provide?

Since:

1.5

Parameters:

array $attr - An array of Pro Form Attributes.

str $coupon_code - Optional. A possible Coupon Code supplied by the Customer.

str $return - Optional. Return type. One of response|attr. Defaults to attr.

array $process - Optional. An array of additional processing routines to run here. One or more of these values: affiliates-1px-response|affiliates-silent-post|notifications.

Returns:

array|str - Original array, with prices and description modified when/if a Coupon Code is accepted. Or, if $return === "response", return a string response, indicating status.

Todo:

See if it's possible to simplify this routine.

Add support for tracking Coupon Code usage.

Add support for a fixed number of uses.

[ back to top ]

pro\s2member-pro\includes\classes\gateways\paypal\paypal-utilities.inc.php at line #290

paypal_cost()

public static array paypal_cost(int|str $trial_sub_total, int|str $sub_total, str $state, str $country, int|str $zip, str $currency, str $desc)

Handles all cost calculations for PayPal®.

Returns an associative array with a possible Percentage Rate, along with the calculated Tax Amount. Tax calculations are based on State/Province, Country, and/or Zip Code. Updated to support multiple data fields in it's return value.

Since:

1.5

Parameters:

int|str $trial_sub_total - Optional. A numeric Amount/cost of a possible Initial/Trial being offered.

int|str $sub_total - Optional. A numeric Amount/cost of the purchase and/or Regular Period.

str $state - Optional. The State/Province where the Customer is billed.

str $country - Optional. The Country where the Customer is billed.

int|str $zip - Optional. The Postal/Zip Code where the Customer is billed.

str $currency - Optional. Expects a 3 character Currency Code.

str $desc - Optional. Description of the sale.

Returns:

array - Array of calculations.

Todo:

Add support for Zip + 4 syntax?

[ back to top ]

pro\s2member-pro\includes\classes\gateways\paypal\paypal-utilities.inc.php at line #212

paypal_maestro_solo_2gbp()

public static array paypal_maestro_solo_2gbp(array $attr, str $card_type)

Handles currency conversions for Maestro/Solo cards.

PayPal® requires Maestro/Solo to be charged in GBP. So if a site owner is using another currency (i.e. something NOT in GBP), we have to convert all of the charge amounts dynamically.

Coupon Codes should always be applied before this conversion takes place. That way a site owner's configuration remains adequate.

Tax rates should be applied after this conversion takes place.

Since:

110531

Parameters:

array $attr - An array of PayPal® Pro Form Attributes.

str $card_type - The Card Type (i.e. Billing Method) selected.

Returns:

array - The same array of Pro Form Attributes, with possible currency conversions.

[ back to top ]

pro\s2member-pro\includes\classes\gateways\paypal\paypal-utilities.inc.php at line #56

paypal_start_time()

public static int paypal_start_time(str $period1, str $period3)

Calculates start date for a Recurring Payment Profile.

Since:

1.5

Parameters:

str $period1 - Optional. A "Period Term" combination. Defaults to 0 D.

str $period3 - Optional. A "Period Term" combination. Defaults to 0 D.

Returns:

int - The start time, a Unix timestamp.

[ back to top ]

pro\s2member-pro\includes\classes\gateways\paypal\paypal-utilities.inc.php at line #110

paypal_tax_may_apply()

public static bool paypal_tax_may_apply()

Determines whether or not Tax may apply.

Since:

1.5

Returns:

bool - True if Tax may apply, else false.

[ back to top ]

Source Code Documentation


Field Summary | Method Summary | Field Detail | Method Detail