diff --git a/src/Message/AIMAuthorizeRequest.php b/src/Message/AIMAuthorizeRequest.php index 79ba07a7..8489f6f3 100644 --- a/src/Message/AIMAuthorizeRequest.php +++ b/src/Message/AIMAuthorizeRequest.php @@ -10,6 +10,21 @@ */ class AIMAuthorizeRequest extends AIMAbstractRequest { + const MARKET_TYPE_ECOMMERCE = '0'; + const MARKET_TYPE_MOTO = '1'; + const MARKET_TYPE_RETAIL = '2'; + + const DEVICE_TYPE_UNKNOWN = '1'; + const DEVICE_TYPE_UNATTENDED_TERMINAL = '2'; + const DEVICE_TYPE_SELF_SERVICE_TERMINAL = '3'; + const DEVICE_TYPE_ELECTRONIC_CASH_REGISTER = '4'; + const DEVICE_TYPE_PC_BASED_TERMINAL = '5'; + const DEVICE_TYPE_AIRPAY = '6'; + const DEVICE_TYPE_WIRELESS_POS = '7'; + const DEVICE_TYPE_WEBSITE = '8'; + const DEVICE_TYPE_DIAL_TERMINAL = '9'; + const DEVICE_TYPE_VIRTUAL_TERMINAL = '10'; + protected $action = 'authOnlyTransaction'; public function getData() @@ -71,14 +86,29 @@ protected function addRetail(\SimpleXMLElement $data) } if (isset($deviceType) && !isset($marketType)) { - $marketType = "2"; + $marketType = static::MARKET_TYPE_RETAIL; } - if (!in_array($deviceType, [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ])) { + if (!in_array($deviceType, [ + static::DEVICE_TYPE_UNKNOWN, + static::DEVICE_TYPE_UNATTENDED_TERMINAL, + static::DEVICE_TYPE_SELF_SERVICE_TERMINAL, + static::DEVICE_TYPE_ELECTRONIC_CASH_REGISTER, + static::DEVICE_TYPE_PC_BASED_TERMINAL, + static::DEVICE_TYPE_AIRPAY, + static::DEVICE_TYPE_WIRELESS_POS, + static::DEVICE_TYPE_WEBSITE, + static::DEVICE_TYPE_DIAL_TERMINAL, + static::DEVICE_TYPE_VIRTUAL_TERMINAL, + ])) { throw new InvalidRequestException("deviceType `{$deviceType}` is invalid"); } - if (!in_array($marketType, [ "0", "1", "2" ])) { + if (!in_array($marketType, [ + static::MARKET_TYPE_ECOMMERCE, + static::MARKET_TYPE_MOTO, + static::MARKET_TYPE_RETAIL, + ])) { throw new InvalidRequestException("marketType `{$marketType}` is invalid"); }