public function test_enhanced_data_more_than_10_line_items()
 {
     $hash = array("merchantSdk" => '', "enhancedData" => array("lineItemData1" => array("itemSequenceNumber" => "1", "itemDescription" => "First"), "lineItemData2" => array("itemSequenceNumber" => "2", "itemDescription" => "Second"), "lineItemData3" => array("itemSequenceNumber" => "3", "itemDescription" => "Third"), "lineItemData4" => array("itemSequenceNumber" => "4", "itemDescription" => "Fourth"), "lineItemData5" => array("itemSequenceNumber" => "5", "itemDescription" => "Fifth"), "lineItemData6" => array("itemSequenceNumber" => "6", "itemDescription" => "Sixth"), "lineItemData7" => array("itemSequenceNumber" => "7", "itemDescription" => "Seventh"), "lineItemData8" => array("itemSequenceNumber" => "8", "itemDescription" => "Eighth"), "lineItemData9" => array("itemSequenceNumber" => "9", "itemDescription" => "Ninth"), "lineItemData10" => array("itemSequenceNumber" => "10", "itemDescription" => "Tenth"), "lineItemData11" => array("itemSequenceNumber" => "11", "itemDescription" => "Eleventh")));
     $outputxml = Obj2xml::toXml($hash, array(), 'authorization');
     //Finding this means the schema will fail validation
     $this->assertTrue(FALSE === strpos($outputxml, 'lineItemData11'));
 }
 public function setUp()
 {
     $this->direct = sys_get_temp_dir() . '/test';
     if (!file_exists($this->direct)) {
         mkdir($this->direct);
     }
     $this->config = Obj2xml::getConfig(array('batch_requests_path' => $this->direct, 'litle_requests_path' => $this->direct));
     $this->sale = array('card' => array('type' => 'VI', 'number' => '4100000000000000', 'expDate' => '1213', 'cardValidationNum' => '1213'), 'id' => '1211', 'orderId' => '2111', 'reportGroup' => 'Planets', 'orderSource' => 'ecommerce', 'amount' => '123');
 }
 public function setUp()
 {
     $this->direct = sys_get_temp_dir() . '/test';
     if (!file_exists($this->direct)) {
         mkdir($this->direct);
     }
     $this->config = Obj2xml::getConfig(array('batch_requests_path' => $this->direct, 'litle_requests_path' => $this->direct));
     $this->sale = array('id' => 'id', 'orderId' => '1864', 'amount' => '10010', 'orderSource' => 'ecommerce', 'billToAddress' => array('name' => 'John Smith', 'addressLine1' => '1 Main St.', 'city' => 'Burlington', 'state' => 'MA', 'zip' => '01803-3747', 'country' => 'US'), 'card' => array('number' => '4457010000000009', 'expDate' => '0112', 'cardValidationNum' => '349', 'type' => 'VI'), 'reportGroup' => 'Planets');
 }
 public function closeRequest()
 {
     $handle = @fopen($this->batches_file, "r");
     if ($handle) {
         file_put_contents($this->request_file, Obj2xml::generateRequestHeader($this->config, $this->num_batch_requests), FILE_APPEND);
         while (($buffer = fgets($handle, 4096)) !== false) {
             file_put_contents($this->request_file, $buffer, FILE_APPEND);
         }
         if (!feof($handle)) {
             throw new \RuntimeException("Error when reading batches file at {$this->batches_file}. Please check your privilege.");
         }
         fclose($handle);
         file_put_contents($this->request_file, "</litleRequest>", FILE_APPEND);
         unlink($this->batches_file);
         unset($this->batches_file);
         $this->closed = true;
     } else {
         throw new \RuntimeException("Could not open batches file at {$this->batches_file}. Please check your privilege.");
     }
 }