Source Code Documentation


Field Summary | Method Summary | Field Detail | Method Detail

Package s2Member\AuthNet

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

Class c_ws_plugin__s2member_pro_authnet_utilities

c_ws_plugin__s2member_pro_authnet_utilities

public class c_ws_plugin__s2member_pro_authnet_utilities

Authorize.Net® utilities.

Since:

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

authnet_ajax_tax()

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

authnet_postvars()

Get $_POST or $_REQUEST vars from Authorize.Net®.

public static int

authnet_start_time(str $period1, str $period3)

Calculates start date for a Recurring Payment Profile.

public static bool

authnet_tax_may_apply()

Determines whether or not Tax may apply.

( 14 Methods )
Method Detail

pro\s2member-pro\includes\classes\gateways\authnet\authnet-utilities.inc.php at line #137

_authnet_aim_response_filters()

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.

Since:

1.5

Parameters:

array $response - An array of response variables.

Returns:

array - An array of response variables; possibly modified by this routine.

[ back to top ]

pro\s2member-pro\includes\classes\gateways\authnet\authnet-utilities.inc.php at line #405

_authnet_arb_response_filters()

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.

Since:

1.5

Parameters:

array $response - An array of response variables.

Returns:

array - An array of response variables; possibly modified by this routine.

[ back to top ]

pro\s2member-pro\includes\classes\gateways\authnet\authnet-utilities.inc.php at line #367

_authnet_parse_arb_response()

public static array _authnet_parse_arb_response(str $xml)

A sort of callback function that parses Authorize.Net® ARB responses.

Since:

1.5

Parameters:

str $xml - XML markup returned by the ARB call.

Returns:

array - An array of response variables, parsed by s2Member.

[ back to top ]

pro\s2member-pro\includes\classes\gateways\authnet\authnet-utilities.inc.php at line #57

authnet_aim_response()

public static array authnet_aim_response(array $post_vars)

Calls upon Authorize.Net® AIM, and returns the response.

Since:

1.5

Parameters:

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

Returns:

array - An array of variables returned from the API call.

Todo:

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

[ back to top ]

pro\s2member-pro\includes\classes\gateways\authnet\authnet-utilities.inc.php at line #605

authnet_ajax_tax()

public static null authnet_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\authnet\authnet-utilities.inc.php at line #802

authnet_apply_coupon()

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?

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\authnet\authnet-utilities.inc.php at line #152

authnet_arb_response()

public static array authnet_arb_response(array $post_vars)

Calls upon Authorize.Net® ARB, and returns the response.

Since:

1.5

Parameters:

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

Returns:

array - An array of variables returned from the API call.

Todo:

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

[ back to top ]

pro\s2member-pro\includes\classes\gateways\authnet\authnet-utilities.inc.php at line #661

authnet_cost()

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.

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\authnet\authnet-utilities.inc.php at line #537

authnet_exp_date()

public static str authnet_exp_date(str $exp)

Re-formats credit card expiration dates for Authorize.Net®.

Since:

1.5

Parameters:

str $exp - Expects a credit card expiration date in mm/yyyy format.

Returns:

str - A credit card expiration date in yyyy-mm format for Authorize.Net®.

[ back to top ]

pro\s2member-pro\includes\classes\gateways\authnet\authnet-utilities.inc.php at line #558

authnet_parse_arb_desc()

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.

Since:

1.5

Parameters:

array $array - Expects an array of details returned by an Authorize.Net® Silent Post.

Returns:

array|bool - The same $array, but with additional details filled by this routine; else false.

Todo:

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

Candidate for the use of ifsetor()?

[ back to top ]

pro\s2member-pro\includes\classes\gateways\authnet\authnet-utilities.inc.php at line #514

authnet_per_term_2_days()

public static int authnet_per_term_2_days(int|str $period, str $term)

Calculates period in days for Authorize.Net® ARB integration.

Since:

1.5

Parameters:

int|str $period - Optional. A numeric Period that coincides with $term.

str $term - Optional. A Term that coincides with $period.

Returns:

int - A "Period Term", in days. Defaults to 0.

[ back to top ]

pro\s2member-pro\includes\classes\gateways\authnet\authnet-utilities.inc.php at line #423

authnet_postvars()

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.

Since:

1.5

Returns:

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

Todo:

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

Candidate for the use of ifsetor()?

Update to use strcasecmp().

[ back to top ]

pro\s2member-pro\includes\classes\gateways\authnet\authnet-utilities.inc.php at line #458

authnet_start_time()

public static int authnet_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\authnet\authnet-utilities.inc.php at line #583

authnet_tax_may_apply()

public static bool authnet_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