c_ws_plugin__s2member_pro_authnet_utilities
public class c_ws_plugin__s2member_pro_authnet_utilities
1.5
( 14 Methods ) Method Summary | |
---|---|
public static array | _authnet_aim_response_filters(array $response) A sort of callback function that Filters Authorize.Net® AIM responses. |
public static array | _authnet_arb_response_filters(array $response) A sort of callback function that Filters Authorize.Net® ARB responses. |
public static array | _authnet_parse_arb_response(str $xml) A sort of callback function that parses Authorize.Net® ARB responses. |
public static array | authnet_aim_response(array $post_vars) Calls upon Authorize.Net® AIM, and returns the response. |
public static null | Handles the return of Tax for Pro Forms, via AJAX; through a JSON object. |
public static array|str | authnet_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 | authnet_arb_response(array $post_vars) Calls upon Authorize.Net® ARB, and returns the response. |
public static array | authnet_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 Authorize.Net®. |
public static str | authnet_exp_date(str $exp) Re-formats credit card expiration dates for Authorize.Net®. |
public static array|bool | authnet_parse_arb_desc(array $array) Parses an Authorize.Net® Silent Post. |
public static int | authnet_per_term_2_days(int|str $period, str $term) Calculates period in days for Authorize.Net® ARB integration. |
public static array|bool | Get |
public static int | authnet_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 array _authnet_aim_response_filters(array $response)
A sort of callback function that Filters Authorize.Net® AIM responses.
Provides alternative explanations in some cases that require special attention.
1.5
array $response - An array of response variables.
array - An array of response variables; possibly modified by this routine.
public static array _authnet_arb_response_filters(array $response)
A sort of callback function that Filters Authorize.Net® ARB responses.
Provides alternative explanations in some cases that require special attention.
1.5
array $response - An array of response variables.
array - An array of response variables; possibly modified by this routine.
public static array _authnet_parse_arb_response(str $xml)
A sort of callback function that parses Authorize.Net® ARB responses.
1.5
str $xml - XML markup returned by the ARB call.
array - An array of response variables, parsed by s2Member.
public static array authnet_aim_response(array $post_vars)
Calls upon Authorize.Net® AIM, and returns the response.
1.5
array $post_vars - An array of variables to send through the Authorize.Net® API call.
array - An array of variables returned from the API call.
Continue optimizing this routine with empty()
and isset()
.
public static null authnet_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 authnet_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 authnet_arb_response(array $post_vars)
Calls upon Authorize.Net® ARB, and returns the response.
1.5
array $post_vars - An array of variables to send through the Authorize.Net® API call.
array - An array of variables returned from the API call.
Continue optimizing this routine with empty()
and isset()
.
public static array authnet_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 Authorize.Net®.
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 str authnet_exp_date(str $exp)
Re-formats credit card expiration dates for Authorize.Net®.
1.5
str $exp - Expects a credit card expiration date in mm/yyyy
format.
str - A credit card expiration date in yyyy-mm
format for Authorize.Net®.
public static array|bool authnet_parse_arb_desc(array $array)
Parses an Authorize.Net® Silent Post.
Parses s2_reference
, s2_domain
, s2_invoice
, s2_start_time
, s2_p1
, s2_p3
, s2_custom
from an Authorize.Net® Silent Post (aka: IPN) response.
1.5
array $array - Expects an array of details returned by an Authorize.Net® Silent Post.
array|bool - The same $array
, but with additional details filled by this routine; else false.
Continue optimizing this routine with empty()
and isset()
.
Candidate for the use of ifsetor()
?
public static int authnet_per_term_2_days(int|str $period, str $term)
Calculates period in days for Authorize.Net® ARB integration.
1.5
int|str $period - Optional. A numeric Period that coincides with $term
.
str $term - Optional. A Term that coincides with $period
.
int - A "Period Term", in days. Defaults to 0
.
public static array|bool authnet_postvars()
Get $_POST
or $_REQUEST
vars from Authorize.Net®.
Authorize.Net® returns x_MD5_Hash
in uppercase format for some reason.
1.5
array|bool - An array of verified $_POST
or $_REQUEST
variables, else false.
Continue optimizing this routine with empty()
and isset()
.
Candidate for the use of ifsetor()
?
Update to use strcasecmp()
.
public static int authnet_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 authnet_tax_may_apply()
Determines whether or not Tax may apply.
1.5
bool - True if Tax may apply, else false.
Authorize.Net® utilities.