| @@ 1146-1178 (lines=33) @@ | ||
| 1143 | return $info; |
|
| 1144 | } |
|
| 1145 | ||
| 1146 | function getTestConnectionResult() { |
|
| 1147 | if ( MODULE_PAYMENT_SAGE_PAY_DIRECT_TRANSACTION_SERVER == 'Live' ) { |
|
| 1148 | $gateway_url = 'https://live.sagepay.com/gateway/service/vspdirect-register.vsp'; |
|
| 1149 | } else { |
|
| 1150 | $gateway_url = 'https://test.sagepay.com/gateway/service/vspdirect-register.vsp'; |
|
| 1151 | } |
|
| 1152 | ||
| 1153 | $params = array('VPSProtocol' => $this->api_version, |
|
| 1154 | 'ReferrerID' => 'C74D7B82-E9EB-4FBD-93DB-76F0F551C802', |
|
| 1155 | 'Vendor' => substr(MODULE_PAYMENT_SAGE_PAY_DIRECT_VENDOR_LOGIN_NAME, 0, 15), |
|
| 1156 | 'Amount' => 0, |
|
| 1157 | 'Currency' => DEFAULT_CURRENCY); |
|
| 1158 | ||
| 1159 | $ip_address = HTTP::getIpAddress(); |
|
| 1160 | ||
| 1161 | if ( !empty($ip_address) && (ip2long($ip_address) != -1) && (ip2long($ip_address) != false) ) { |
|
| 1162 | $params['ClientIPAddress']= $ip_address; |
|
| 1163 | } |
|
| 1164 | ||
| 1165 | $post_string = ''; |
|
| 1166 | ||
| 1167 | foreach ($params as $key => $value) { |
|
| 1168 | $post_string .= $key . '=' . urlencode(trim($value)) . '&'; |
|
| 1169 | } |
|
| 1170 | ||
| 1171 | $response = $this->sendTransactionToGateway($gateway_url, $post_string); |
|
| 1172 | ||
| 1173 | if ( $response != false ) { |
|
| 1174 | return 1; |
|
| 1175 | } |
|
| 1176 | ||
| 1177 | return -1; |
|
| 1178 | } |
|
| 1179 | ||
| 1180 | function templateClassExists() { |
|
| 1181 | return class_exists('oscTemplate') && isset($GLOBALS['oscTemplate']) && is_object($GLOBALS['oscTemplate']) && (get_class($GLOBALS['oscTemplate']) == 'oscTemplate'); |
|
| @@ 660-692 (lines=33) @@ | ||
| 657 | return $info; |
|
| 658 | } |
|
| 659 | ||
| 660 | function getTestConnectionResult() { |
|
| 661 | if ( MODULE_PAYMENT_SAGE_PAY_SERVER_TRANSACTION_SERVER == 'Live' ) { |
|
| 662 | $gateway_url = 'https://live.sagepay.com/gateway/service/vspserver-register.vsp'; |
|
| 663 | } else { |
|
| 664 | $gateway_url = 'https://test.sagepay.com/gateway/service/vspserver-register.vsp'; |
|
| 665 | } |
|
| 666 | ||
| 667 | $params = array('VPSProtocol' => $this->api_version, |
|
| 668 | 'ReferrerID' => 'C74D7B82-E9EB-4FBD-93DB-76F0F551C802', |
|
| 669 | 'Vendor' => substr(MODULE_PAYMENT_SAGE_PAY_DIRECT_VENDOR_LOGIN_NAME, 0, 15), |
|
| 670 | 'Amount' => 0, |
|
| 671 | 'Currency' => DEFAULT_CURRENCY); |
|
| 672 | ||
| 673 | $ip_address = HTTP::getIpAddress(); |
|
| 674 | ||
| 675 | if ( !empty($ip_address) && (ip2long($ip_address) != -1) && (ip2long($ip_address) != false) ) { |
|
| 676 | $params['ClientIPAddress']= $ip_address; |
|
| 677 | } |
|
| 678 | ||
| 679 | $post_string = ''; |
|
| 680 | ||
| 681 | foreach ($params as $key => $value) { |
|
| 682 | $post_string .= $key . '=' . urlencode(trim($value)) . '&'; |
|
| 683 | } |
|
| 684 | ||
| 685 | $response = $this->sendTransactionToGateway($gateway_url, $post_string); |
|
| 686 | ||
| 687 | if ( $response != false ) { |
|
| 688 | return 1; |
|
| 689 | } |
|
| 690 | ||
| 691 | return -1; |
|
| 692 | } |
|
| 693 | ||
| 694 | function sendDebugEmail($response = array()) { |
|
| 695 | if (tep_not_null(MODULE_PAYMENT_SAGE_PAY_SERVER_DEBUG_EMAIL)) { |
|