public function test_simple_capture_with_partial()
 {
     $hash_in = array('litleTxnId' => '1234567891234567891', 'patial' => 'true', 'amount' => '123');
     $initilaize = new LitleOnlineRequest();
     $captureResponse = $initilaize->captureRequest($hash_in);
     $message = XmlParser::getAttribute($captureResponse, 'litleOnlineResponse', 'response');
     $this->assertEquals('0', $message);
 }
 public function test_simple()
 {
     $hash_in = array('planCode' => '1', 'active' => 'false');
     $initialize = new LitleOnlineRequest();
     $updatePlanResponse = $initialize->updatePlan($hash_in);
     $message = XmlParser::getAttribute($updatePlanResponse, 'litleOnlineResponse', 'message');
     $this->assertEquals('Valid Format', $message);
 }
 public function test_simple()
 {
     $hash_in = array('subscriptionId' => '1', 'planCode' => '2', 'billToAddress' => array('addressLine1' => '3'), 'card' => array('type' => 'VI', 'number' => '4100000000000000', 'expDate' => '1213', 'cardValidationNum' => '1213'), 'billingDate' => '2013-12-17');
     $initialize = new LitleOnlineRequest();
     $updateSubscriptionResponse = $initialize->updateSubscription($hash_in);
     $message = XmlParser::getAttribute($updateSubscriptionResponse, 'litleOnlineResponse', 'message');
     $this->assertEquals('Valid Format', $message);
 }
 public function test_simple_credit_with_litleTxnId_AndSecondaryAmount()
 {
     $hash_in = array('id' => 'id', 'reportGroup' => 'planets', 'litleTxnId' => '1234567891234567891', 'secondaryAmount' => '100');
     $initilaize = new LitleOnlineRequest();
     $creditResponse = $initilaize->creditRequest($hash_in);
     $message = XmlParser::getAttribute($creditResponse, 'litleOnlineResponse', 'response');
     $this->assertEquals("0", $message);
 }
 public function test_simple()
 {
     $hash_in = array('planCode' => '1', 'name' => '2', 'intervalType' => 'MONTHLY', 'amount' => '1000');
     $initialize = new LitleOnlineRequest();
     $createPlanResponse = $initialize->createPlan($hash_in);
     $message = XmlParser::getAttribute($createPlanResponse, 'litleOnlineResponse', 'message');
     $this->assertEquals('Valid Format', $message);
 }
 public function test_simple_token_with_echeck()
 {
     $hash_in = array('reportGroup' => 'Planets', 'merchantId' => '101', 'version' => '8.8', 'orderId' => '12344', 'echeckForToken' => array('accNum' => '12344565', 'routingNum' => '123476545'));
     $initilaize = new LitleOnlineRequest();
     $registerTokenResponse = $initilaize->registerTokenRequest($hash_in);
     $message = XmlParser::getAttribute($registerTokenResponse, 'litleOnlineResponse', 'message');
     $this->assertEquals('Valid Format', $message);
 }
 public function test_echeckCredit_missing_billing()
 {
     $hash_in = array('amount' => '123456', 'verify' => 'true', 'orderId' => '12345', 'orderSource' => 'ecommerce', 'echeckToken' => array('accType' => 'Checking', 'litleToken' => '1234565789012', 'routingNum' => '123456789', 'checkNum' => '123455'));
     $initilaize = new LitleOnlineRequest();
     $echeckCreditResponse = $initilaize->echeckCreditRequest($hash_in);
     $message = XmlParser::getAttribute($echeckCreditResponse, 'litleOnlineResponse', 'message');
     $this->assertRegExp('/Error validating xml data against the schema/', $message);
 }
 public function test_simple_echeckSale_secondaryAmount_With_CCD_longerthan80()
 {
     $hash_in = array('amount' => '123456', 'secondaryAmount' => '2000', 'verify' => 'true', 'orderId' => '12345', 'orderSource' => 'ecommerce', 'echeck' => array('accType' => 'Checking', 'accNum' => '12345657890', 'routingNum' => '123456789', 'checkNum' => '123455', 'ccdPaymentInformation' => '000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 'billToAddress' => array('name' => 'Bob', 'city' => 'lowell', 'state' => 'MA', 'email' => 'litle.com'));
     $initilaize = new LitleOnlineRequest();
     $echeckSaleResponse = $initilaize->echeckSaleRequest($hash_in);
     $message = XmlParser::getAttribute($echeckSaleResponse, 'litleOnlineResponse', 'message');
     $this->assertRegExp('/Error validating xml data against the schema/', $message);
 }
 public function test_illegal_card_type()
 {
     $hash_in = array('card' => array('type' => 'DK', 'number' => '4100000000000000', 'expDate' => '1213', 'cardValidationNum' => '1213'), 'id' => '1211', 'orderId' => '2111', 'reportGroup' => 'Planets', 'orderSource' => 'ecommerce', 'amount' => '123');
     $initilaize = new LitleOnlineRequest();
     $saleResponse = $initilaize->saleRequest($hash_in);
     $message = XmlParser::getAttribute($saleResponse, 'litleOnlineResponse', 'message');
     $this->assertRegExp('/Error validating xml data against the schema/', $message);
 }
 public function test_simple()
 {
     $hash_in = array('id' => '1211', 'merchantId' => '101', 'version' => '8.14', 'reportGroup' => 'Planets', 'orderId' => '12344', 'litleToken' => '123456789101112', 'cardValidationNum' => '123');
     $initilaize = new LitleOnlineRequest();
     $updateCardValidationNumOnTokenResponse = $initilaize->updateCardValidationNumOnToken($hash_in);
     $message = XmlParser::getAttribute($updateCardValidationNumOnTokenResponse, 'litleOnlineResponse', 'message');
     $this->assertEquals('Valid Format', $message);
 }
 public function test_simple_token_applepay()
 {
     $hash_in = array('merchantId' => '101', 'version' => '8.8', 'reportGroup' => 'Planets', 'orderId' => '12344', 'applepay' => array('data' => 'string data here', 'header' => array('applicationData' => '454657413164', 'ephemeralPublicKey' => '1', 'publicKeyHash' => '1234', 'transactionId' => '12345'), 'signature' => 'signature', 'version' => 'version 1'));
     $initilaize = new LitleOnlineRequest();
     $registerTokenResponse = $initilaize->registerTokenRequest($hash_in);
     $message = XmlParser::getAttribute($registerTokenResponse, 'litleOnlineResponse', 'message');
     $this->assertEquals('Valid Format', $message);
 }
 public function test_simple()
 {
     $hash_in = array('litleTxnId' => '123456789012345678');
     $initilaize = new LitleOnlineRequest();
     $refundReversalResponse = $initilaize->echeckVoidRequest($hash_in);
     $response = XmlParser::getAttribute($refundReversalResponse, 'litleOnlineResponse', 'response');
     $this->assertEquals('0', $response);
 }
 public function test_simple()
 {
     $hash_in = array('orderId' => '1', 'amount' => '2', 'orderSource' => 'ecommerce', 'card' => array('type' => 'VI', 'number' => '4100000000000000', 'expDate' => '1213', 'cardValidationNum' => '1213'));
     $initialize = new LitleOnlineRequest();
     $response = $initialize->unload($hash_in);
     $message = XmlParser::getAttribute($response, 'litleOnlineResponse', 'message');
     $this->assertEquals('Valid Format', $message);
 }
 public function test_illegal_orderSource()
 {
     $hash_in = array('paypal' => array("payerId" => '123', "token" => '12321312', "transactionId" => '123123'), 'id' => '1211', 'orderId' => '2111', 'reportGroup' => 'Planets', 'orderSource' => 'notecommerce', 'amount' => '123');
     $initilaize = new LitleOnlineRequest();
     $authorizationResponse = $initilaize->authorizationRequest($hash_in);
     $message = XmlParser::getAttribute($authorizationResponse, 'litleOnlineResponse', 'message');
     $this->assertRegExp('/Error validating xml data against the schema/', $message);
 }
 public function test_simple_forceCapture_with_token()
 {
     $hash_in = array('merchantId' => '101', 'version' => '8.8', 'reportGroup' => 'Planets', 'litleTxnId' => '123456', 'orderId' => '12344', 'amount' => '106', 'orderSource' => 'ecommerce', 'token' => array('litleToken' => '123456789101112', 'expDate' => '1210', 'cardValidationNum' => '555', 'type' => 'VI'));
     $initilaize = new LitleOnlineRequest();
     $forceCaptureResponse = $initilaize->forceCaptureRequest($hash_in);
     $message = XmlParser::getAttribute($forceCaptureResponse, 'litleOnlineResponse', 'message');
     $this->assertEquals('Valid Format', $message);
 }
 public function test_echeckSale_missing_amount()
 {
     $hash_in = array('verify' => 'true', 'orderId' => '12345', 'orderSource' => 'ecommerce', 'echeckToken' => array('accType' => 'Checking', 'litleToken' => '1234565789012', 'routingNum' => '123456789', 'checkNum' => '123455'), 'billToAddress' => array('name' => 'Bob', 'city' => 'lowell', 'state' => 'MA', 'email' => 'litle.com'));
     $initilaize = new LitleOnlineRequest();
     $echeckSaleResponse = $initilaize->echeckSaleRequest($hash_in);
     $message = XmlParser::getAttribute($echeckSaleResponse, 'litleOnlineResponse', 'message');
     $this->assertRegExp('/Error validating xml data against the schema/', $message);
 }
 public function test_simple()
 {
     $hash_in = array('subscriptionId' => '2');
     $initialize = new LitleOnlineRequest();
     $cancelSubscriptionResponse = $initialize->cancelSubscription($hash_in);
     $message = XmlParser::getAttribute($cancelSubscriptionResponse, 'litleOnlineResponse', 'message');
     $this->assertEquals('Valid Format', $message);
 }
 public function test_simple_forceCapture_with_secondary_amount()
 {
     $hash_in = array('merchantId' => '101', 'version' => '8.8', 'reportGroup' => 'Planets', 'litleTxnId' => '123456', 'orderId' => '12344', 'amount' => '106', 'secondaryAmount' => '2000', 'orderSource' => 'ecommerce', 'card' => array('type' => 'VI', 'number' => '4100000000000000', 'expDate' => '1210'));
     $initilaize = new LitleOnlineRequest();
     $forceCaptureResponse = $initilaize->forceCaptureRequest($hash_in);
     $response = XmlParser::getAttribute($forceCaptureResponse, 'litleOnlineResponse', 'response');
     $this->assertEquals('000', $response);
 }
 public function test_paypage_missing_expDate_and_validationNum()
 {
     $hash_in = array('merchantId' => '101', 'version' => '8.8', 'reportGroup' => 'Planets', 'orderId' => '12344', 'amount' => '106', 'orderSource' => 'ecommerce', 'paypage' => array('paypageRegistrationId' => '123456789101112', 'type' => 'VI'));
     $initilaize = new LitleOnlineRequest();
     $creditResponse = $initilaize->creditRequest($hash_in);
     $message = XmlParser::getAttribute($creditResponse, 'litleOnlineResponse', 'message');
     $this->assertEquals("Valid Format", $message);
 }
 /**
  * Gets an attribute from the first matched element in a DomDocument.
  *
  * This method wraps the XmlParser static call in the SDK.
  *
  * @param DomDocument $dom
  *   The response.
  * @param string $elementName
  *   The element/tag to match.
  * @param string $attributeName
  *   The name of the attribute to get.
  *
  * @return string
  *   The value of the attribute.
  */
 public function getAttribute($dom, $elementName, $attributeName)
 {
     return \litle\sdk\XmlParser::getAttribute($dom, $elementName, $attributeName);
 }