From 1358fd8fb8d8d0cfe1879dba7dc1857ec438fa3f Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 23 Jan 2017 10:51:41 -0500 Subject: [PATCH] Updating the Live URL's Using ws6 relay. --- anet_php_sdk/lib/AuthorizeNetAIM.php | 78 ++++++++++++++-------------- anet_php_sdk/lib/AuthorizeNetDPM.php | 21 ++++---- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/anet_php_sdk/lib/AuthorizeNetAIM.php b/anet_php_sdk/lib/AuthorizeNetAIM.php index e7aae63..9c4a821 100755 --- a/anet_php_sdk/lib/AuthorizeNetAIM.php +++ b/anet_php_sdk/lib/AuthorizeNetAIM.php @@ -23,7 +23,7 @@ * * Note: To send requests to the live gateway, either define this: * define("AUTHORIZENET_SANDBOX", false); - * -- OR -- + * -- OR -- * $sale = new AuthorizeNetAIM; * $sale->setSandbox(false); * @@ -32,7 +32,7 @@ * @link http://www.authorize.net/support/AIM_guide.pdf AIM Guide */ - + /** * Builds and sends an AuthorizeNet AIM Request. * @@ -41,38 +41,38 @@ */ class AuthorizeNetAIM extends AuthorizeNetRequest { - - const LIVE_URL = 'https://secure.authorize.net/gateway/transact.dll'; + const LIVE_URL = 'http://ws6.gaslightmedia.com/AuthorizeNetRelay/glmAuthNetRelay/AuthNetRelayProduction.php'; + //const LIVE_URL = 'https://secure.authorize.net/gateway/transact.dll'; const SANDBOX_URL = 'https://test.authorize.net/gateway/transact.dll'; - + /** - * Holds all the x_* name/values that will be posted in the request. + * Holds all the x_* name/values that will be posted in the request. * Default values are provided for best practice fields. */ protected $_x_post_fields = array( - "version" => "3.1", + "version" => "3.1", "delim_char" => ",", "delim_data" => "TRUE", "relay_response" => "FALSE", "encap_char" => "|", ); - + /** * Only used if merchant wants to send multiple line items about the charge. */ private $_additional_line_items = array(); - + /** * Only used if merchant wants to send custom fields. */ private $_custom_fields = array(); - + /** * Checks to make sure a field is actually in the API before setting. * Set to false to skip this check. */ public $verify_x_fields = true; - + /** * A list of all fields in the AIM API. * Used to warn user if they try to set a field not offered in the API. @@ -91,10 +91,10 @@ class AuthorizeNetAIM extends AuthorizeNetRequest "split_tender_id","state","tax","tax_exempt","test_request","tran_key", "trans_id","type","version","zip" ); - + /** - * Do an AUTH_CAPTURE transaction. - * + * Do an AUTH_CAPTURE transaction. + * * Required "x_" fields: card_num, exp_date, amount * * @param string $amount The dollar amount to charge @@ -111,7 +111,7 @@ class AuthorizeNetAIM extends AuthorizeNetRequest $this->type = "AUTH_CAPTURE"; return $this->_sendRequest(); } - + /** * Do a PRIOR_AUTH_CAPTURE transaction. * @@ -168,7 +168,7 @@ class AuthorizeNetAIM extends AuthorizeNetRequest $this->type = "VOID"; return $this->_sendRequest(); } - + /** * Do a CAPTURE_ONLY transaction. * @@ -190,7 +190,7 @@ class AuthorizeNetAIM extends AuthorizeNetRequest $this->type = "CAPTURE_ONLY"; return $this->_sendRequest(); } - + /** * Do a CREDIT transaction. * @@ -210,7 +210,7 @@ class AuthorizeNetAIM extends AuthorizeNetRequest $this->type = "CREDIT"; return $this->_sendRequest(); } - + /** * Alternative syntax for setting x_ fields. * @@ -219,11 +219,11 @@ class AuthorizeNetAIM extends AuthorizeNetRequest * @param string $name * @param string $value */ - public function __set($name, $value) + public function __set($name, $value) { $this->setField($name, $value); } - + /** * Quickly set multiple fields. * @@ -239,7 +239,7 @@ class AuthorizeNetAIM extends AuthorizeNetRequest $this->setField($key, $value); } } - + /** * Quickly set multiple custom fields. * @@ -252,10 +252,10 @@ class AuthorizeNetAIM extends AuthorizeNetRequest $this->setCustomField($key, $value); } } - + /** * Add a line item. - * + * * @param string $item_id * @param string $item_name * @param string $item_description @@ -273,7 +273,7 @@ class AuthorizeNetAIM extends AuthorizeNetRequest } $this->_additional_line_items[] = $line_item; } - + /** * Use ECHECK as payment type. */ @@ -291,7 +291,7 @@ class AuthorizeNetAIM extends AuthorizeNetRequest ) ); } - + /** * Set an individual name/value pair. This will append x_ to the name * before posting. @@ -312,7 +312,7 @@ class AuthorizeNetAIM extends AuthorizeNetRequest $this->_x_post_fields[$name] = $value; } } - + /** * Set a custom field. Note: the x_ prefix will not be added to * your custom field if you use this method. @@ -324,7 +324,7 @@ class AuthorizeNetAIM extends AuthorizeNetRequest { $this->_custom_fields[$name] = $value; } - + /** * Unset an x_ field. * @@ -334,19 +334,19 @@ class AuthorizeNetAIM extends AuthorizeNetRequest { unset($this->_x_post_fields[$name]); } - + /** * * * @param string $response - * + * * @return AuthorizeNetAIM_Response */ protected function _handleResponse($response) { return new AuthorizeNetAIM_Response($response, $this->_x_post_fields['delim_char'], $this->_x_post_fields['encap_char'], $this->_custom_fields); } - + /** * @return string */ @@ -354,7 +354,7 @@ class AuthorizeNetAIM extends AuthorizeNetRequest { return ($this->_sandbox ? self::SANDBOX_URL : self::LIVE_URL); } - + /** * Converts the x_post_fields array into a string suitable for posting. */ @@ -399,7 +399,7 @@ class AuthorizeNetAIM_Response extends AuthorizeNetResponse public function __construct($response, $delimiter, $encap_char, $custom_fields) { if ($response) { - + // Split Array $this->response = $response; if ($encap_char) { @@ -407,7 +407,7 @@ class AuthorizeNetAIM_Response extends AuthorizeNetResponse } else { $this->_response_array = explode($delimiter, $response); } - + /** * If AuthorizeNet doesn't return a delimited response. */ @@ -417,9 +417,9 @@ class AuthorizeNetAIM_Response extends AuthorizeNetResponse $this->error_message = "Unrecognized response from AuthorizeNet: $response"; return; } - - - + + + // Set all fields $this->response_code = $this->_response_array[0]; $this->response_subcode = $this->_response_array[1]; @@ -466,12 +466,12 @@ class AuthorizeNetAIM_Response extends AuthorizeNetResponse $this->split_tender_id = $this->_response_array[52]; $this->requested_amount = $this->_response_array[53]; $this->balance_on_card = $this->_response_array[54]; - + $this->approved = ($this->response_code == self::APPROVED); $this->declined = ($this->response_code == self::DECLINED); $this->error = ($this->response_code == self::ERROR); $this->held = ($this->response_code == self::HELD); - + // Set custom fields if ($count = count($custom_fields)) { $custom_fields_response = array_slice($this->_response_array, -$count, $count); @@ -481,7 +481,7 @@ class AuthorizeNetAIM_Response extends AuthorizeNetResponse $i++; } } - + if ($this->error) { $this->error_message = "AuthorizeNet Error: Response Code: ".$this->response_code." diff --git a/anet_php_sdk/lib/AuthorizeNetDPM.php b/anet_php_sdk/lib/AuthorizeNetDPM.php index 5e693cc..d42379f 100755 --- a/anet_php_sdk/lib/AuthorizeNetDPM.php +++ b/anet_php_sdk/lib/AuthorizeNetDPM.php @@ -27,7 +27,8 @@ class AuthorizeNetDPM extends AuthorizeNetSIM_Form { - const LIVE_URL = 'https://secure.authorize.net/gateway/transact.dll'; + const LIVE_URL = 'http://ws6.gaslightmedia.com/AuthorizeNetRelay/glmAuthNetRelay/AuthNetRelayProduction.php'; + //const LIVE_URL = 'https://secure.authorize.net/gateway/transact.dll'; const SANDBOX_URL = 'https://test.authorize.net/gateway/transact.dll'; /** @@ -36,7 +37,7 @@ class AuthorizeNetDPM extends AuthorizeNetSIM_Form */ public static function directPostDemo($url, $api_login_id, $transaction_key, $amount = "0.00", $md5_setting = "") { - + // Step 1: Show checkout form to customer. if (!count($_POST) && !count($_GET)) { @@ -44,15 +45,15 @@ class AuthorizeNetDPM extends AuthorizeNetSIM_Form echo AuthorizeNetDPM::getCreditCardForm($amount, $fp_sequence, $url, $api_login_id, $transaction_key); } // Step 2: Handle AuthorizeNet Transaction Result & return snippet. - elseif (count($_POST)) + elseif (count($_POST)) { $response = new AuthorizeNetSIM($api_login_id, $md5_setting); - if ($response->isAuthorizeNet()) + if ($response->isAuthorizeNet()) { - if ($response->approved) + if ($response->approved) { // Do your processing here. - $redirect_url = $url . '?response_code=1&transaction_id=' . $response->transaction_id; + $redirect_url = $url . '?response_code=1&transaction_id=' . $response->transaction_id; } else { @@ -80,7 +81,7 @@ class AuthorizeNetDPM extends AuthorizeNetSIM_Form } } } - + /** * A snippet to send to AuthorizeNet to redirect the user back to the * merchant's server. Use this on your relay response page. @@ -98,7 +99,7 @@ class AuthorizeNetDPM extends AuthorizeNetSIM_Form "; } - + /** * Generate a sample form for use in a demo Direct Post implementation. * @@ -129,7 +130,7 @@ class AuthorizeNetDPM extends AuthorizeNetSIM_Form ); $hidden_fields = $sim->getHiddenFieldString(); $post_url = ($test_mode ? self::SANDBOX_URL : self::LIVE_URL); - + $form = '