Skip to content

Commit bd9523c

Browse files
committed
Merge pull request #34 from anushr/xml-api
Migrate to XML API for AIM + CIM support
2 parents dde369f + e35e615 commit bd9523c

File tree

84 files changed

+3377
-327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+3377
-327
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
composer.lock
33
composer.phar
44
phpunit.xml
5+
.idea

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ And run composer to update your dependencies:
3232
The following gateways are provided by this package:
3333

3434
* AuthorizeNet_AIM
35+
* AuthorizeNet_CIM
3536
* AuthorizeNet_SIM
3637
* AuthorizeNet_DPM
3738

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"psr-4": { "Omnipay\\AuthorizeNet\\" : "src/" }
2929
},
3030
"require": {
31-
"omnipay/common": "~2.0"
31+
"omnipay/common": "~2.2"
3232
},
3333
"require-dev": {
3434
"omnipay/tests": "~2.0"

src/AIMGateway.php

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace Omnipay\AuthorizeNet;
44

5+
use Omnipay\AuthorizeNet\Message\AIMAuthorizeRequest;
6+
use Omnipay\AuthorizeNet\Message\AIMCaptureRequest;
7+
use Omnipay\AuthorizeNet\Message\AIMPurchaseRequest;
8+
use Omnipay\AuthorizeNet\Message\AIMRefundRequest;
9+
use Omnipay\AuthorizeNet\Message\AIMVoidRequest;
510
use Omnipay\Common\AbstractGateway;
611

712
/**
@@ -21,8 +26,8 @@ public function getDefaultParameters()
2126
'transactionKey' => '',
2227
'testMode' => false,
2328
'developerMode' => false,
24-
'liveEndpoint' => 'https://secure2.authorize.net/gateway/transact.dll',
25-
'developerEndpoint' => 'https://test.authorize.net/gateway/transact.dll',
29+
'liveEndpoint' => 'https://api.authorize.net/xml/v1/request.api',
30+
'developerEndpoint' => 'https://apitest.authorize.net/xml/v1/request.api',
2631
);
2732
}
2833

@@ -82,26 +87,56 @@ public function setDeveloperEndpoint($value)
8287
return $this->setParameter('developerEndpoint', $value);
8388
}
8489

90+
public function getDuplicateWindow()
91+
{
92+
return $this->getParameter('duplicateWindow');
93+
}
94+
95+
public function setDuplicateWindow($value)
96+
{
97+
return $this->setParameter('duplicateWindow', $value);
98+
}
99+
100+
/**
101+
* @param array $parameters
102+
* @return AIMAuthorizeRequest
103+
*/
85104
public function authorize(array $parameters = array())
86105
{
87106
return $this->createRequest('\Omnipay\AuthorizeNet\Message\AIMAuthorizeRequest', $parameters);
88107
}
89108

109+
/**
110+
* @param array $parameters
111+
* @return AIMCaptureRequest
112+
*/
90113
public function capture(array $parameters = array())
91114
{
92-
return $this->createRequest('\Omnipay\AuthorizeNet\Message\CaptureRequest', $parameters);
115+
return $this->createRequest('\Omnipay\AuthorizeNet\Message\AIMCaptureRequest', $parameters);
93116
}
94117

118+
/**
119+
* @param array $parameters
120+
* @return AIMPurchaseRequest
121+
*/
95122
public function purchase(array $parameters = array())
96123
{
97124
return $this->createRequest('\Omnipay\AuthorizeNet\Message\AIMPurchaseRequest', $parameters);
98125
}
99126

127+
/**
128+
* @param array $parameters
129+
* @return AIMVoidRequest
130+
*/
100131
public function void(array $parameters = array())
101132
{
102133
return $this->createRequest('\Omnipay\AuthorizeNet\Message\AIMVoidRequest', $parameters);
103134
}
104135

136+
/**
137+
* @param array $parameters
138+
* @return AIMRefundRequest
139+
*/
105140
public function refund(array $parameters = array())
106141
{
107142
return $this->createRequest('\Omnipay\AuthorizeNet\Message\AIMRefundRequest', $parameters);

src/CIMGateway.php

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
namespace Omnipay\AuthorizeNet;
4+
5+
use Omnipay\AuthorizeNet\Message\CIMCreateCardRequest;
6+
7+
/**
8+
* Authorize.Net CIM Class
9+
*/
10+
class CIMGateway extends AIMGateway
11+
{
12+
public function getName()
13+
{
14+
return 'Authorize.Net CIM';
15+
}
16+
17+
public function setForceCardUpdate($forceCardUpdate)
18+
{
19+
return $this->setParameter('forceCardUpdate', $forceCardUpdate);
20+
}
21+
22+
public function getForceCardUpdate()
23+
{
24+
return $this->getParameter('forceCardUpdate');
25+
}
26+
27+
public function setDefaultBillTo($defaultBillTo)
28+
{
29+
return $this->setParameter('defaultBillTo', $defaultBillTo);
30+
}
31+
32+
public function getDefaultBillTo()
33+
{
34+
return $this->getParameter('defaultBillTo');
35+
}
36+
37+
/**
38+
* Create a new debit or credit card
39+
*
40+
* @param array $parameters
41+
*
42+
* @return CIMCreateCardRequest
43+
*/
44+
public function createCard(array $parameters = array())
45+
{
46+
return $this->createRequest('\Omnipay\AuthorizeNet\Message\CIMCreateCardRequest', $parameters);
47+
}
48+
49+
public function authorize(array $parameters = array())
50+
{
51+
return $this->createRequest('\Omnipay\AuthorizeNet\Message\CIMAuthorizeRequest', $parameters);
52+
}
53+
54+
public function capture(array $parameters = array())
55+
{
56+
return $this->createRequest('\Omnipay\AuthorizeNet\Message\CIMCaptureRequest', $parameters);
57+
}
58+
59+
public function purchase(array $parameters = array())
60+
{
61+
return $this->createRequest('\Omnipay\AuthorizeNet\Message\CIMPurchaseRequest', $parameters);
62+
}
63+
64+
public function refund(array $parameters = array())
65+
{
66+
return $this->createRequest('\Omnipay\AuthorizeNet\Message\CIMRefundRequest', $parameters);
67+
}
68+
69+
public function void(array $parameters = array())
70+
{
71+
return $this->createRequest('\Omnipay\AuthorizeNet\Message\CIMVoidRequest', $parameters);
72+
}
73+
}

0 commit comments

Comments
 (0)