c_ws_plugin__s2member_pro_paypal_utilities
public class c_ws_plugin__s2member_pro_paypal_utilities
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 | 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 | Determines whether or not Tax may apply. |
public static boolean payflow_cancel_billing_agreement(string $baid)
Cancels a Payflow® Billing Agreement.
130510
string $baid - A Billing Agreement ID (aka: BAID).
boolean - True if the agreement was cancelled, else false.
public static boolean payflow_cancel_profile(string $subscr_id, string $baid)
Cancels a Payflow® recurring profile.
110531
string $subscr_id - A paid subscription ID (aka: Recurring Profile ID).
string $baid - A Billing Agreement ID (aka: BAID).
boolean - True if the profile was cancelled, else false.
public static array|false payflow_get_profile(string $subscr_id)
Gets a Payflow® recurring profile.
110531
string $subscr_id - A paid subscription ID (aka: Recurring Profile ID).
array|false - Array of profile details, else false.
public static null paypal_ajax_tax()
Handles the return of Tax for Pro Forms, via AJAX; through a JSON object.
1.5
null - Or exits script execution after returning data for AJAX caller.
Check the use of strip_tags()
in this routine?
Continue optimizing this routine with empty()
and isset()
.
Candidate for the use of ifsetor()
?
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?
1.5
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
.
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.
See if it's possible to simplify this routine.
Add support for tracking Coupon Code usage.
Add support for a fixed number of uses.
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.
1.5
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.
array - Array of calculations.
Add support for Zip + 4
syntax?
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.
110531
array $attr - An array of PayPal® Pro Form Attributes.
str $card_type - The Card Type (i.e. Billing Method) selected.
array - The same array of Pro Form Attributes, with possible currency conversions.
public static int paypal_start_time(str $period1, str $period3)
Calculates start date for a Recurring Payment Profile.
1.5
str $period1 - Optional. A "Period Term" combination. Defaults to 0 D
.
str $period3 - Optional. A "Period Term" combination. Defaults to 0 D
.
int - The start time, a Unix timestamp.
public static bool paypal_tax_may_apply()
Determines whether or not Tax may apply.
1.5
bool - True if Tax may apply, else false.
PayPal® utilities.