/** * Test updateCreditCardCustomerCode by updating the recurring schedule card details. * * @depends testCustomerLinkupdateCreditCardCustomerCodeNewRecurringScheduleDate */ public function testCustomerLinkupdateCreditCardCustomerCodeNewRecurringScheduleCard() { $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' => '', 'customerCode' => self::$creditCardCustomerCode, 'firstName' => 'Test', 'lastName' => 'Account', 'companyName' => 'Test Co.', 'address' => '1234 Any Street', 'city' => 'Schenectady', 'state' => 'NY', 'zipCode' => '12345', 'phone' => '555-555-1234', 'fax' => '555-555-4321', 'alternatePhone' => '555-555-5555', 'email' => '*****@*****.**', 'comment' => 'Customer code update test.', 'recurring' => TRUE, 'amount' => '5', 'beginDate' => $iats->getFormattedDate($beginTime), 'endDate' => $iats->getFormattedDate($endTime), 'scheduleType' => 'Weekly', 'scheduleDate' => '7', 'creditCardCustomerName' => 'Test Account', 'creditCardNum' => '4444444444444448', 'creditCardExpiry' => '12/20', 'mop' => 'VISA', 'updateCreditCardNum' => TRUE); $response = $iats->updateCreditCardCustomerCode($request); $this->assertEquals('OK', $response['AUTHORIZATIONRESULT']); // Get customer details to confirm update. $request = array('customerIPAddress' => '', 'customerCode' => self::$creditCardCustomerCode); $response = $iats->getCustomerCodeDetail($request); $this->assertArrayHasKey('CST', $response); $this->assertStringEndsWith('4448', $response['CST']['AC1']['CC']['CCN']); $this->assertEquals('12/20', $response['CST']['AC1']['CC']['EXP']); }
/** * Test updateInvalidCreditCardCustomerCode. * * @depends testCustomerLinkcreateCreditCardCustomerCode */ public function testCustomerLinkupdateInvalidCreditCardCustomerCode() { $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' => '', 'customerCode' => '000000', 'firstName' => 'Test', 'lastName' => 'Account', 'companyName' => 'Test Co.', 'address' => '1234 Any Street', 'city' => 'Schenectady', 'state' => 'NY', 'zipCode' => '12345', 'phone' => '555-555-1234', 'fax' => '555-555-4321', 'alternatePhone' => '555-555-5555', 'email' => '*****@*****.**', 'comment' => 'Customer code update test.', 'recurring' => FALSE, 'amount' => '5', 'beginDate' => $iats->getFormattedDate($beginTime), 'endDate' => $iats->getFormattedDate($endTime), 'scheduleType' => 'Annually', 'scheduleDate' => '', 'creditCardCustomerName' => 'Test Account', 'creditCardNum' => '4222222222222220', 'creditCardExpiry' => '12/17', 'mop' => 'VISA', 'updateCreditCardNum' => FALSE); $response = $iats->updateCreditCardCustomerCode($request); $this->assertEquals('0Can not find the Customer Code', $response['AUTHORIZATIONRESULT']); }