Skip to content

Commit

Permalink
Updated date string to SOAP specifications, cleaned up documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruscoe committed Jul 23, 2014
1 parent 585dbc7 commit c72b5e7
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 168 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ credit / debit card transactions, rejected transactions and returns.
### Use Case 1 - CustomerLink - Creating a new Customer Code for credit card transactions

```php
$beginDate = strtotime('01/01/2014');
$endDate = strtotime('01/31/2014');

// Create and populate the request object.
$request = array(
'customerIPAddress' => '',
Expand All @@ -102,8 +99,8 @@ $request = array(
'comment' => 'Customer code creation test.',
'recurring' => FALSE,
'amount' => '5',
'beginDate' => $beginDate,
'endDate' => $endDate,
'beginDate' => '2014-07-01T00:00:00+00:00',
'endDate' => '2014-08-01T00:00:00+00:00',
'scheduleType' => 'Annually',
'scheduleDate' => '',
'creditCardCustomerName' => 'Test Account',
Expand Down Expand Up @@ -156,13 +153,10 @@ if (trim($response['AUTHORIZATIONRESULT']) == 'OK')
### Use Case 3 - ReportLink - Get credit card transation history report as CSV

```php
$beginDate = strtotime('01/01/2014');
$endDate = strtotime('01/31/2014');

// Create and populate the request object.
$request = array(
'fromDate' => $fromDate,
'toDate' => $toDate,
'fromDate' => '2014-07-01T00:00:00+00:00',
'toDate' => '2014-08-01T00:00:00+00:00',
'customerIPAddress' => '',
);

Expand Down
130 changes: 74 additions & 56 deletions Tests/CustomerLinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ public function setUp()
* Test createCreditCardCustomerCode.
*/
public function testCustomerLinkcreateCreditCardCustomerCode() {
$beginDate = strtotime('10/23/2011');
$endDate = strtotime('10/23/2014');
$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');

$beginTime = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
$endTime = mktime(0, 0, 0, date('n'), date('j'), date('Y') + 10);

// Create and populate the request object.
$request = array(
'customerIPAddress' => '',
Expand All @@ -63,8 +66,8 @@ public function testCustomerLinkcreateCreditCardCustomerCode() {
'comment' => 'Customer code creation test.',
'recurring' => FALSE,
'amount' => '5',
'beginDate' => $beginDate,
'endDate' => $endDate,
'beginDate' => $iats->getFormattedDate($beginTime),
'endDate' => $iats->getFormattedDate($endTime),
'scheduleType' => 'Annually',
'scheduleDate' => '',
'creditCardCustomerName' => 'Test Account',
Expand All @@ -75,7 +78,6 @@ public function testCustomerLinkcreateCreditCardCustomerCode() {
'currency' => 'USD',
);

$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');
$response = $iats->createCreditCardCustomerCode($request);

$this->assertEquals('OK', $response['AUTHORIZATIONRESULT']);
Expand All @@ -89,8 +91,11 @@ public function testCustomerLinkcreateCreditCardCustomerCode() {
* @depends testCustomerLinkcreateCreditCardCustomerCode
*/
public function testCustomerLinkupdateCreditCardCustomerCode() {
$beginDate = strtotime('10/23/2011');
$endDate = strtotime('10/23/2014');
$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');

$beginTime = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
$endTime = mktime(0, 0, 0, date('n'), date('j'), date('Y') + 10);

// Create and populate the request object.
$request = array(
'customerIPAddress' => '',
Expand All @@ -109,8 +114,8 @@ public function testCustomerLinkupdateCreditCardCustomerCode() {
'comment' => 'Customer code update test.',
'recurring' => FALSE,
'amount' => '5',
'beginDate' => $beginDate,
'endDate' => $endDate,
'beginDate' => $iats->getFormattedDate($beginTime),
'endDate' => $iats->getFormattedDate($endTime),
'scheduleType' => 'Annually',
'scheduleDate' => '',
'creditCardCustomerName' => 'Test Account',
Expand All @@ -120,7 +125,6 @@ public function testCustomerLinkupdateCreditCardCustomerCode() {
'updateCreditCardNum' => FALSE,
);

$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');
$response = $iats->updateCreditCardCustomerCode($request);

$this->assertEquals('OK', $response['AUTHORIZATIONRESULT']);
Expand All @@ -132,8 +136,11 @@ public function testCustomerLinkupdateCreditCardCustomerCode() {
* @depends testCustomerLinkcreateCreditCardCustomerCode
*/
public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringSchedule() {
$beginDate = strtotime('10/23/2011');
$endDate = strtotime('10/23/2014');
$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');

$beginTime = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
$endTime = mktime(0, 0, 0, date('n'), date('j'), date('Y') + 10);

// Create and populate the request object.
$request = array(
'customerIPAddress' => '',
Expand All @@ -152,8 +159,8 @@ public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringSchedule
'comment' => 'Customer code update test.',
'recurring' => TRUE,
'amount' => '5',
'beginDate' => $beginDate,
'endDate' => $endDate,
'beginDate' => $iats->getFormattedDate($beginTime),
'endDate' => $iats->getFormattedDate($endTime),
'scheduleType' => 'Monthly',
'scheduleDate' => '1', // 1st of every month.
'creditCardCustomerName' => 'Test Account',
Expand All @@ -163,7 +170,6 @@ public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringSchedule
'updateCreditCardNum' => FALSE,
);

$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');
$response = $iats->updateCreditCardCustomerCode($request);

$this->assertEquals('OK', $response['AUTHORIZATIONRESULT']);
Expand All @@ -189,8 +195,11 @@ public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringSchedule
* @depends testCustomerLinkupdateCreditCardCustomerCodeNewRecurringSchedule
*/
public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringScheduleDate() {
$beginDate = strtotime('10/23/2011');
$endDate = strtotime('10/23/2014');
$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');

$beginTime = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
$endTime = mktime(0, 0, 0, date('n'), date('j'), date('Y') + 10);

// Create and populate the request object.
$request = array(
'customerIPAddress' => '',
Expand All @@ -209,8 +218,8 @@ public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringSchedule
'comment' => 'Customer code update test.',
'recurring' => TRUE,
'amount' => '5',
'beginDate' => $beginDate,
'endDate' => $endDate,
'beginDate' => $iats->getFormattedDate($beginTime),
'endDate' => $iats->getFormattedDate($endTime),
'scheduleType' => 'Weekly',
'scheduleDate' => '7', // 7th day of the week.
'creditCardCustomerName' => 'Test Account',
Expand All @@ -220,7 +229,6 @@ public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringSchedule
'updateCreditCardNum' => FALSE,
);

$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');
$response = $iats->updateCreditCardCustomerCode($request);

$this->assertEquals('OK', $response['AUTHORIZATIONRESULT']);
Expand All @@ -246,8 +254,11 @@ public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringSchedule
* @depends testCustomerLinkupdateCreditCardCustomerCodeNewRecurringScheduleDate
*/
public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringScheduleCard() {
$beginDate = strtotime('10/23/2011');
$endDate = strtotime('10/23/2014');
$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');

$beginTime = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
$endTime = mktime(0, 0, 0, date('n'), date('j'), date('Y') + 10);

// Create and populate the request object.
$request = array(
'customerIPAddress' => '',
Expand All @@ -266,8 +277,8 @@ public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringSchedule
'comment' => 'Customer code update test.',
'recurring' => TRUE,
'amount' => '5',
'beginDate' => $beginDate,
'endDate' => $endDate,
'beginDate' => $iats->getFormattedDate($beginTime),
'endDate' => $iats->getFormattedDate($endTime),
'scheduleType' => 'Weekly',
'scheduleDate' => '7', // 7th day of the week.
'creditCardCustomerName' => 'Test Account',
Expand All @@ -277,7 +288,6 @@ public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringSchedule
'updateCreditCardNum' => TRUE,
);

$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');
$response = $iats->updateCreditCardCustomerCode($request);

$this->assertEquals('OK', $response['AUTHORIZATIONRESULT']);
Expand Down Expand Up @@ -320,8 +330,11 @@ public function testgetCustomerCodeDetail() {
* Test createACHEFTCustomerCode.
*/
public function testCustomerLinkcreateACHEFTCustomerCode() {
$beginDate = strtotime('10/23/2011');
$endDate = strtotime('10/23/2014');
$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');

$beginTime = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
$endTime = mktime(0, 0, 0, date('n'), date('j'), date('Y') + 10);

// Create and populate the request object.
$request = array(
'customerIPAddress' => '',
Expand All @@ -340,16 +353,15 @@ public function testCustomerLinkcreateACHEFTCustomerCode() {
'comment' => 'Customer code update test.',
'recurring' => FALSE,
'amount' => '5',
'beginDate' => $beginDate,
'endDate' => $endDate,
'beginDate' => $iats->getFormattedDate($beginTime),
'endDate' => $iats->getFormattedDate($endTime),
'scheduleType' => 'Annually',
'scheduleDate' => '',
'accountCustomerName' => 'Test Account',
'accountNum' => '999999999',
'accountType' => 'Checking',
);

$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');
$response = $iats->createACHEFTCustomerCode($request);

$this->assertEquals('OK', $response['AUTHORIZATIONRESULT']);
Expand All @@ -363,8 +375,11 @@ public function testCustomerLinkcreateACHEFTCustomerCode() {
* @depends testCustomerLinkcreateACHEFTCustomerCode
*/
public function testCustomerLinkupdateACHEFTCustomerCode() {
$beginDate = strtotime('10/23/2011');
$endDate = strtotime('10/23/2014');
$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');

$beginTime = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
$endTime = mktime(0, 0, 0, date('n'), date('j'), date('Y') + 10);

// Create and populate the request object.
$request = array(
'customerIPAddress' => '',
Expand All @@ -383,8 +398,8 @@ public function testCustomerLinkupdateACHEFTCustomerCode() {
'comment' => 'Customer code update test.',
'recurring' => FALSE,
'amount' => '5',
'beginDate' => $beginDate,
'endDate' => $endDate,
'beginDate' => $iats->getFormattedDate($beginTime),
'endDate' => $iats->getFormattedDate($endTime),
'scheduleType' => 'Annually',
'scheduleDate' => '',
'accountCustomerName' => 'Test Account',
Expand All @@ -393,7 +408,6 @@ public function testCustomerLinkupdateACHEFTCustomerCode() {
'updateAccountNum' => FALSE,
);

$iats = new CustomerLink(self::$agentCode, self::$password, 'NA');
$response = $iats->updateACHEFTCustomerCode($request);

$this->assertEquals('OK', $response['AUTHORIZATIONRESULT']);
Expand Down Expand Up @@ -457,14 +471,18 @@ public function testgetCustomerCodeDetailInvalidCode() {
* Test directDebitACHEFTPayerValidate.
*/
public function testCustomerLinkdirectDebitACHEFTPayerValidate() {
$beginDate = strtotime('10/23/2011');
$endDate = strtotime('10/23/2014');
// Test only valid for UK clients.
$iats = new CustomerLink(self::$agentCode, self::$password, 'UK');

$beginTime = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
$endTime = mktime(0, 0, 0, date('n'), date('j'), date('Y') + 10);

// Create and populate the request object.
$request = array(
'customerIPAddress' => '',
'ACHEFTReferenceNum' => '',
'beginDate' => $beginDate,
'endDate' => $endDate,
'beginDate' => $iats->getFormattedDate($beginTime),
'endDate' => $iats->getFormattedDate($endTime),
'accountCustomerName' => 'Test Account',
'accountNum' => '999999999',
'companyName' => 'Test Company',
Expand All @@ -478,8 +496,6 @@ public function testCustomerLinkdirectDebitACHEFTPayerValidate() {
'zipCode' => '12345',
);

// Test only valid for UK clients.
$iats = new CustomerLink(self::$agentCode, self::$password, 'UK');
$response = $iats->directDebitACHEFTPayerValidate($request);

// API responded correctly.
Expand All @@ -492,15 +508,18 @@ public function testCustomerLinkdirectDebitACHEFTPayerValidate() {
* Test directDebitCreateACHEFTCustomerCode.
*/
public function testCustomerLinkdirectDebitCreateACHEFTCustomerCode() {
// Start date must be at least 12 days from current date.
$beginDate = strtotime(date('m/d/Y', time()) . ' + 12 days');
$endDate = strtotime(date('m/d/Y', time()) . ' + 4 years');
// Test only valid for UK clients.
$iats = new CustomerLink(self::$agentCode, self::$password, 'UK');

// Begin date must be at least 12 days from current date.
$beginTime = mktime(0, 0, 0, date('n'), date('j') + 12, date('Y'));
$endTime = mktime(0, 0, 0, date('n'), date('j'), date('Y') + 10);

// Create and populate the request object.
$request = array(
'customerIPAddress' => '',
'customerCode' => '',
'ACHEFTReferenceNum' => '',
'ACHEFTReferenceNum' => 'UDDDA14D86',
'firstName' => 'Test',
'lastName' => 'Account',
'companyName' => 'Test Co.',
Expand All @@ -512,20 +531,18 @@ public function testCustomerLinkdirectDebitCreateACHEFTCustomerCode() {
'fax' => '555-555-4321',
'alternatePhone' => '555-555-5555',
'email' => 'email@test.co',
'comment' => 'Customer code update test.',
'comment' => 'Direct debit customer code creation test.',
'recurring' => FALSE,
'amount' => '5',
'beginDate' => $beginDate,
'endDate' => $endDate,
'beginDate' => $iats->getFormattedDate($beginTime),
'endDate' => $iats->getFormattedDate($endTime),
'scheduleType' => 'Annually',
'scheduleDate' => '',
'accountCustomerName' => 'Test Account',
'accountNum' => '999999999',
'accountType' => 'CHECKING',
);

// Test only valid for UK clients.
$iats = new CustomerLink(self::$agentCode, self::$password, 'UK');
$response = $iats->directDebitCreateACHEFTCustomerCode($request);

// API responded correctly.
Expand All @@ -539,8 +556,11 @@ public function testCustomerLinkdirectDebitCreateACHEFTCustomerCode() {
* Test directDebitUpdateACHEFTCustomerCode.
*/
public function testCustomerLinkdirectDebitUpdateACHEFTCustomerCode() {
$beginDate = strtotime('10/23/2011');
$endDate = strtotime('10/23/2014');
// Test only valid for UK clients.
$iats = new CustomerLink(self::$agentCode, self::$password, 'UK');

$beginTime = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
$endTime = mktime(0, 0, 0, date('n'), date('j'), date('Y') + 10);

// Create and populate the request object.
$request = array(
Expand All @@ -561,8 +581,8 @@ public function testCustomerLinkdirectDebitUpdateACHEFTCustomerCode() {
'comment' => 'Customer code update test.',
'recurring' => FALSE,
'amount' => '5',
'beginDate' => $beginDate,
'endDate' => $endDate,
'beginDate' => $iats->getFormattedDate($beginTime),
'endDate' => $iats->getFormattedDate($endTime),
'scheduleType' => 'Annually',
'scheduleDate' => '',
'accountCustomerName' => 'Test Account',
Expand All @@ -571,8 +591,6 @@ public function testCustomerLinkdirectDebitUpdateACHEFTCustomerCode() {
'updateAccountNum' => FALSE,
);

// Test only valid for UK clients.
$iats = new CustomerLink(self::$agentCode, self::$password, 'UK');
$response = $iats->directDebitUpdateACHEFTCustomerCode($request);

// API responded correctly.
Expand Down
Loading

0 comments on commit c72b5e7

Please sign in to comment.