Skip to content

Commit 5d62fc7

Browse files
committed
Merge branch 'device-type' into card-present
2 parents bd3336d + 6b561aa commit 5d62fc7

File tree

5 files changed

+55
-3
lines changed

5 files changed

+55
-3
lines changed

src/AIMGateway.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function getDefaultParameters()
2828
'developerMode' => false,
2929
'liveEndpoint' => 'https://api.authorize.net/xml/v1/request.api',
3030
'developerEndpoint' => 'https://apitest.authorize.net/xml/v1/request.api',
31+
'deviceType' => 1 // Device used to make the transaction. Required for card present. "1" = Unknown.
3132
);
3233
}
3334

@@ -97,6 +98,35 @@ public function setDuplicateWindow($value)
9798
return $this->setParameter('duplicateWindow', $value);
9899
}
99100

101+
public function getDeviceType()
102+
{
103+
return $this->getParameter('deviceType');
104+
}
105+
106+
/**
107+
* Sets the type of device used to collect the credit card data. A device type is required for card present
108+
* transactions.
109+
*
110+
* 1 = Unknown
111+
* 2 = Unattended Terminal
112+
* 3 = Self Service Terminal
113+
* 4 = Electronic Cash Register
114+
* 5 = Personal Computer-Based Terminal
115+
* 6 = AirPay
116+
* 7 = Wireless POS
117+
* 8 = Website
118+
* 9 = Dial Terminal
119+
* 10 = Virtual Terminal
120+
*
121+
* @see http://developer.authorize.net/api/reference/#payment-transactions-charge-a-credit-card
122+
* @param $value
123+
* @return $this
124+
*/
125+
public function setDeviceType($value)
126+
{
127+
return $this->setParameter('deviceType', $value);
128+
}
129+
100130
/**
101131
* @param array $parameters
102132
* @return AIMAuthorizeRequest

src/Message/AIMAbstractRequest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ public function getEndpoint()
100100
return $this->getDeveloperMode() ? $this->getDeveloperEndpoint() : $this->getLiveEndpoint();
101101
}
102102

103+
public function getDeviceType()
104+
{
105+
return $this->getParameter('deviceType');
106+
}
107+
108+
public function setDeviceType($value)
109+
{
110+
return $this->setParameter('deviceType', $value);
111+
}
112+
103113
/**
104114
* @return TransactionReference
105115
*/

src/Message/AIMAuthorizeRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function addRetail(\SimpleXMLElement $data)
5959
if ($this->isCardPresent()) {
6060
// Retail element is required for card present transactions
6161
$data->transactionRequest->retail->marketType = 2;
62-
$data->transactionRequest->retail->deviceType = 1;
62+
$data->transactionRequest->retail->deviceType = $this->getDeviceType();
6363
}
6464
}
6565
}

src/Message/SIMAbstractRequest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ public function getDeveloperEndpoint()
8484
return $this->getParameter('developerEndpoint');
8585
}
8686

87+
public function getDeviceType()
88+
{
89+
return $this->getParameter('deviceType');
90+
}
91+
92+
public function setDeviceType($value)
93+
{
94+
return $this->setParameter('deviceType', $value);
95+
}
96+
8797
/**
8898
* Base data used only for the AIM API.
8999
*/

tests/Message/AIMAuthorizeRequestTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public function testGetDataCardPresentTrack1()
6363
$card['tracks'] = '%B4242424242424242^SMITH/JOHN ^2511126100000000000000444000000?;4242424242424242=25111269999944401?';
6464
$this->request->initialize(array(
6565
'amount' => '12.12',
66-
'card' => $card
66+
'card' => $card,
67+
'deviceType' => 1
6768
));
6869

6970
$data = $this->request->getData();
@@ -83,7 +84,8 @@ public function testGetDataCardPresentTrack2()
8384
$card['tracks'] = ';4242424242424242=25111269999944401?';
8485
$this->request->initialize(array(
8586
'amount' => '12.12',
86-
'card' => $card
87+
'card' => $card,
88+
'deviceType' => 1
8789
));
8890

8991
$data = $this->request->getData();

0 commit comments

Comments
 (0)