function process() {
foreach( $this->fields as $key => $value )
$this->field_string .= "$key=" . urlencode( $value ) . "&";
$ch = curl_init($this->gateway_url);
// curl_setopt($ch, CURLOPT_URL, ($this->gateway_url));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $this->field_string, "& " ));
$this->response_string = urldecode(curl_exec($ch));
if (curl_errno($ch)) {
$this->response['Response Reason Text'] = curl_error($ch);
return 3;
}
else curl_close ($ch);
$temp_values = explode('|', $this->response_string);
$temp_keys= array (
"Response Code", "Response Subcode", "Response Reason Code", "Response Reason Text",
"Approval Code", "AVS Result Code", "Transaction ID", "Invoice Number", "Description",
"Amount", "Method", "Transaction Type", "Customer ID", "Cardholder First Name",
"Cardholder Last Name", "Company", "Billing Address", "City", "State",
"Zip", "Country", "Phone", "Fax", "Email", "Ship to First Name", "Ship to Last Name",
"Ship to Company", "Ship to Address", "Ship to City", "Ship to State",
"Ship to Zip", "Ship to Country", "Tax Amount", "Duty Amount", "Freight Amount",
"Tax Exempt Flag", "PO Number", "MD5 Hash", "Card Code (CVV2/CVC2/CID) Response Code",
"Cardholder Authentication Verification Value (CAVV) Response Code"
);
$a->add_field('x_login', '123456');
$a->add_field('x_tran_key', '123456');
$a->add_field('x_version', '3.1');
$a->add_field('x_type', 'AUTH_CAPTURE');
$a->add_field('x_test_request', 'FALSE'); // Just a test transaction
$a->add_field('x_relay_response', 'FALSE');
$a->add_field('x_delim_data', 'TRUE');
$a->add_field('x_delim_char', '|');
$a->add_field('x_encap_char', '');
$a->add_field('x_first_name', $x_Firstname);
$a->add_field('x_last_name', $x_Lastname);
$a->add_field('x_address', $x_Address);
$a->add_field('x_city', $x_City);
$a->add_field('x_state', $x_State);
$a->add_field('x_zip', $x_Zip);
$a->add_field('x_country', $x_Country);
$a->add_field('x_email', $x_Email);
$a->add_field('x_phone', $x_Phone);
$a->add_field('x_method', 'CC');
$a->add_field('x_card_num', $x_Card_No);
$a->add_field('x_amount', '5.95');
$a->add_field('x_exp_date', $x_Expiry);
$a->add_field('x_card_code', $x_Card_Code);