private function processRequest($hash_out, $hash_in, $type, $choice1 = null, $choice2 = null)
 {
     $hash_config = LitleOnlineRequest::overideconfig($hash_in);
     $hash = LitleOnlineRequest::getOptionalAttributes($hash_in, $hash_out);
     Checker::choice($choice1);
     Checker::choice($choice2);
     $request = Obj2xml::toXml($hash, $hash_config, $type);
     $litleOnlineResponse = $this->newXML->request($request, $hash_config, $this->useSimpleXml);
     return $litleOnlineResponse;
 }
Example #2
0
 private function addTransaction($hash_out, $hash_in, $type, $choice1 = null, $choice2 = null)
 {
     if ($this->closed) {
         throw new \RuntimeException("Could not add the transaction. This batchRequest is closed.");
     }
     if ($this->isFull()) {
         throw new \RuntimeException('The transaction could not be added to the batch. It is full.');
     }
     if ($type == 'accountUpdate' && $this->counts_and_amounts['accountUpdate']['count'] != $this->total_txns) {
         throw new \RuntimeException("The transaction could not be added to the batch. The transaction type {$type} cannot be mixed with non-Account Updates.");
     } elseif ($type != 'accountUpdate' && $this->counts_and_amounts['accountUpdate']['count'] == $this->total_txns && $this->total_txns > 0) {
         throw new \RuntimeException("The transaction could not be added to the batch. The transaction type {$type} cannot be mixed with AccountUpdates.");
     }
     if (isset($hash_in['reportGroup'])) {
         $report_group = $hash_in['reportGroup'];
     } else {
         $conf = Obj2xml::getConfig(array());
         $report_group = $conf['reportGroup'];
     }
     Checker::choice($choice1);
     Checker::choice($choice2);
     $request = Obj2xml::transactionToXml($hash_out, $type, $report_group);
     if (file_put_contents($this->transaction_file, $request, FILE_APPEND) === FALSE) {
         throw new \RuntimeException("A transaction could not be written to the batch file at {$this->transaction_file}. Please check your privilege.");
     }
     $this->total_txns += 1;
 }