class AuthnetAIMResponse {
// comment indicates position in delimited response (not zero indexed)
private $rawResponse;
private $responseCode; //1
private $responseSubcode; //2
private $responseReasonCode; //3
private $responseReasonText; //4
private $authorizationCode; //5
private $aVSResponse; //6
private $transactionID; //7
private $invoiceNumber; //8
private $description; //9
private $amount; //10
private $method; //11
private $transactionType; //12
private $customerID; //13
private $firstName; //14
private $lastName; //15
private $company; //16
private $address; //17
private $city; //18
private $state; //19
private $zIPCode; //20
private $country; //21
private $phone; //22
private $fax; //23
private $emailAddress; //24
private $shipToFirstName; //25
private $shipToLastName; //26
private $shipToCompany; //27
private $shipToAddress; //28
private $shipToCity; //29
private $shipToState; //30
private $shipToZIPCode; //31
private $shipToCountry; //32
private $tax; //33
private $duty; //34
private $freight; //35
private $taxExempt; //36
private $purchaseOrderNumber; //37
private $mD5Hash; //38
private $cardCodeResponse; //39
private $cardholderAuthenticationVerification; //40
private $accountNumber; //51
private $cardType; //52
private $splitTenderID; //53
private $requestedAmount; //54
private $balanceOnCard; //55
function AuthnetAIMResponse($rawResponse, $delimiter) {
// split data by delimiter
$responseValues = explode($delimiter, $rawResponse);
// map indexes onto internal variables
$this->rawResponse = $rawResponse;
$this->responseCode = $responseValues[0];
$this->responseSubcode = $responseValues[1];
$this->responseReasonCode = $responseValues[2];
$this->responseReasonText = $responseValues[3];
$this->authorizationCode = $responseValues[4];
$this->aVSResponse = $responseValues[5];
$this->transactionID = $responseValues[6];
$this->invoiceNumber = $responseValues[7];
$this->description = $responseValues[8];
$this->amount = $responseValues[9];
$this->method = $responseValues[10];
$this->transactionType = $responseValues[11];
$this->customerID = $responseValues[12];
$this->firstName = $responseValues[13];
$this->lastName = $responseValues[14];
$this->company = $responseValues[16];
$this->address = $responseValues[16];
$this->city = $responseValues[17];
$this->state = $responseValues[18];
$this->zIPCode = $responseValues[19];
$this->country = $responseValues[20];
$this->phone = $responseValues[21];
$this->fax = $responseValues[22];
$this->emailAddress = $responseValues[23];
$this->shipToFirstName = $responseValues[24];
$this->shipToLastName = $responseValues[25];
$this->shipToCompany = $responseValues[26];
$this->shipToAddress = $responseValues[27];
$this->shipToCity = $responseValues[28];
$this->shipToState = $responseValues[29];
$this->shipToZIPCode = $responseValues[30];
$this->shipToCountry = $responseValues[31];
$this->tax = $responseValues[32];
$this->duty = $responseValues[33];
$this->freight = $responseValues[34];
$this->taxExempt = $responseValues[35];
$this->purchaseOrderNumber = $responseValues[36];
$this->mD5Hash = $responseValues[37];
$this->cardCodeResponse = $responseValues[38];
$this->cardholderAuthenticationVerification = $responseValues[39];
$this->accountNumber = $responseValues[50];
$this->cardType = $responseValues[51];
$this->splitTenderID = $responseValues[52];
$this->requestedAmount = $responseValues[53];
$this->balanceOnCard = $responseValues[54];
}
public function getRawResponse() {
return $this->rawResponse;
}
public function __toString() {
return $this->rawResponse;
}
/**
* The overall status of the transaction
* 1 = Approved
* 2 = Declined
* 3 = Error
* 4 = Held for Review
*/
public function getResponseCode() {
return $this->responseCode;
}
/**
* A code used by the payment gateway for internal transaction tracking
*/
public function getResponseSubcode() {
return $this->responseSubcode;
}
/**
* A code that represents more details about the result of the transaction
* Numeric
* See the Response Code Details section of this document for a listing of response reason codes.
*/
public function getResponseReasonCode() {
return $this->responseReasonCode;
}
/**
* A brief description of the result, which corresponds with the response reason code
* Text
* You can generally use this text to display a transaction result or error
* to the customer. However, please review the Response Code Details
* section of this document to identify any specific texts you do not want
* to pass to the customer.
*/
public function getResponseReasonText() {
return $this->responseReasonText;
}
/**
* The authorization or approval code
* 6 characters
*/
public function getAuthorizationCode() {
return $this->authorizationCode;
}
/**
* The Address Verification Service (AVS) response code
* A = Address (Street) matches, ZIP does not
* B = Address information not provided for AVS check
* E = AVS error
* G = Non-U.S. Card Issuing Bank
* N = No Match on Address (Street) or ZIP
* P = AVS not applicable for this transaction
* R = Retry System unavailable or timed out
* S = Service not supported by issuer
* U = Address information is unavailable
* W = Nine digit ZIP matches, Address (Street) does not
* X = Address (Street) and nine digit ZIP match
* Y = Address (Street) and five digit ZIP match
* Z = Five digit ZIP matches, Address (Street) does not
* Indicates the result of the AVS filter.
* For more information about AVS, see the Merchant Integration Guide at http://www.authorize.net/support/merchant/.
*/
public function getAVSResponse() {
return $this->aVSResponse;
}
/**
* The payment gateway assigned identification number for the transaction
* When x_test_request is set to a positive response, or when Test Mode is
* enabled on the payment gateway, this value will be 0.
* This value must be used for any follow on transactions such as a CREDIT,
* PRIOR_AUTH_CAPTURE or VOID.
*/
public function getTransactionID() {
return $this->transactionID;
}
/**
* The merchant assigned invoice number for the transaction
* Up to 20 characters (no symbols)
*/
public function getInvoiceNumber() {
return $this->invoiceNumber;
}
/**
* The transaction description
* Up to 255 characters (no symbols)
*/
public function getDescription() {
return $this->description;
}
/**
* The amount of the transaction
* Up to 15 digits
*/
public function getAmount() {
return $this->amount;
}
/**
* The payment method
* CC or ECHECK
*/
public function getMethod() {
return $this->method;
}
/**
* The type of credit card transaction
* AUTH_CAPTURE, AUTH_ONLY, CAPTURE_ONLY, CREDIT, PRIOR_AUTH_CAPTUREVOID
*/
public function getTransactionType() {
return $this->transactionType;
}
/**
* The merchant assigned customer ID
* Up to 20 characters (no symbols)
*/
public function getCustomerID() {
return $this->customerID;
}
/**
* The first name associated with the customers billing address
* Up to 50 characters (no symbols)
*/
public function getFirstName() {
return $this->firstName;
}
/**
* The last name associated with the customers billing address
* Up to 50 characters (no symbols)
*/
public function getLastName() {
return $this->lastName;
}
/**
* The company associated with the customers billing
* Up to 50 characters (no symbols)
*/
public function getCompany() {
return $this->company;
}
/**
* The customers billing address
* Up to 60 characters (no symbols)
*/
public function getAddress() {
return $this->address;
}
/**
* The city of the customers billing address
* Up to 40 characters (no symbols)
*/
public function getCity() {
return $this->city;
}
/**
* The state of the customers billing address
* Up to 40 characters (no symbols) or a valid two-character state code
*/
public function getState() {
return $this->state;
}
/**
* The ZIP code of the customers billing address
* Up to 20 characters (no symbols)
*/
public function getZIPCode() {
return $this->zIPCode;
}
public function getCountry() {
return $this->country;
}
public function getPhone() {
return $this->phone;
}
public function getFax() {
return $this->fax;
}
public function getEmailAddress() {
return $this->emailAddress;
}
public function getShipToFirstName() {
return $this->shipToFirstName;
}
public function getShipToLastName() {
return $this->shipToLastName;
}
public function getShipToCompany() {
return $this->shipToCompany;
}
public function getShipToAddress() {
return $this->shipToAddress;
}
public function getShipToCity() {
return $this->shipToCity;
}
public function getShipToState() {
return $this->shipToState;
}
public function getShipToZIPCode() {
return $this->shipToZIPCode;
}
public function getShipToCountry() {
return $this->shipToCountry;
}
public function getTax() {
return $this->tax;
}
public function getDuty() {
return $this->duty;
}
public function getFreight() {
return $this->freight;
}
public function getTaxExempt() {
return $this->taxExempt;
}
public function getPurchaseOrderNumber() {
return $this->purchaseOrderNumber;
}
public function getMD5Hash() {
return $this->mD5Hash;
}
public function getCardCodeResponse() {
return $this->cardCodeResponse;
}
public function getCardholderAuthenticationVerification() {
return $this->cardholderAuthenticationVerification;
}
public function getAccountNumber() {
return $this->accountNumber;
}
public function getCardType() {
return $this->cardType;
}
public function getSplitTenderID() {
return $this->splitTenderID;
}
public function getRequestedAmount() {
return $this->requestedAmount;
}
public function getBalanceOnCard() {
return $this->balanceOnCard;
}
}