/**
  * @param $creditCardLine
  * @return TransactionReportCreditCardTransaction
  */
 public static function CreditCardTransactionParser($creditCardLine)
 {
     $creditCardTransaction = new TransactionReportCreditCardTransaction();
     $transactionReportOrder = new TransactionReportOrder();
     $transactionReportOrder->setOrderKey($creditCardLine[1])->setOrderReference($creditCardLine[2])->setMerchantKey($creditCardLine[3])->setMerchantName($creditCardLine[4]);
     $creditCardTransaction->setOrder($transactionReportOrder);
     $creditCardTransaction->setTransactionKey($creditCardLine[5])->setTransactionKeyToAcquirer($creditCardLine[6])->setCreditCardTransactionReference($creditCardLine[7])->setCreditCardBrand($creditCardLine[8])->setCreditCardNumber($creditCardLine[9]);
     $creditCardLine[10] == false ? $creditCardTransaction->setInstallmentCount($creditCardLine[10]) : 0;
     $creditCardTransaction->setAcquirerName($creditCardLine[11])->setStatus($creditCardLine[12]);
     $creditCardLine[13] == false ? $creditCardTransaction->setAmountInCents($creditCardLine[13]) : 0;
     $creditCardLine[14] == false ? $creditCardTransaction->setIataAmountInCents($creditCardLine[14]) : 0;
     $creditCardTransaction->setAuthorizationCode($creditCardLine[15])->setTransactionIdentifier($creditCardLine[16])->setUniqueSequentialNumber($creditCardLine[17]);
     $creditCardLine[18] == false ? $creditCardTransaction->setAuthorizedAmountInCents($creditCardLine[18]) : 0;
     $creditCardLine[19] == false ? $creditCardTransaction->setCapturedAmountInCents($creditCardLine[19]) : 0;
     $creditCardLine[20] == false ? $creditCardTransaction->setVoidedAmountInCents($creditCardLine[20]) : 0;
     $creditCardLine[21] == false ? $creditCardTransaction->setRefundedAmountInCents($creditCardLine[21]) : 0;
     $creditCardTransaction->setAcquirerAuthorizationReturnCode($creditCardLine[22]);
     $creditCardLine[23] == false ? $creditCardTransaction->setAuthorizedDate($creditCardLine[23]) : null;
     $creditCardLine[24] == false ? $creditCardTransaction->setCapturedDate($creditCardLine[24]) : null;
     $creditCardLine[25] == false ? $creditCardTransaction->setVoidedDate($creditCardLine[25]) : null;
     $creditCardLine[26] == false ? $creditCardTransaction->setLastProbeDate($creditCardLine[26]) : null;
     return $creditCardTransaction;
 }
 /**
  * @param $reportDate
  */
 public function ParseTransactionReportFile($reportFileData)
 {
     $response = new \Gateway\One\DataContract\TransactionReport\TransactionReport();
     foreach (preg_split("/((\r?\n)|(\r\n?))/", $reportFileData) as $line) {
         $lineProperties = explode(',', $line);
         switch ($lineProperties[0]) {
             case "01":
                 $header = TransactionReportHelper::HeaderTransactionParser($lineProperties);
                 $response->setHeader($header);
                 break;
             case "20":
                 $creditCardTransaction = TransactionReportHelper::CreditCardTransactionParser($lineProperties);
                 $response->addCreditCardTransaction($creditCardTransaction);
                 break;
             case "30":
                 $boletoTransaction = new One\DataContract\TransactionReport\TransactionReportData\TransactionReportBoletoTransaction();
                 $transactionReportOrder = new One\DataContract\TransactionReport\TransactionReportData\TransactionReportOrder();
                 $transactionReportOrder->setOrderKey($lineProperties[1])->setOrderReference($lineProperties[2])->setMerchantKey($lineProperties[3])->setMerchantName($lineProperties[4]);
                 $boletoTransaction->setOrder($transactionReportOrder);
                 $boletoTransaction->setTransactionKey($lineProperties[5])->setTransactionReference($lineProperties[6])->setStatus($lineProperties[7])->setNossoNumero($lineProperties[8])->setBankNumber($lineProperties[9])->setAgency($lineProperties[10])->setAccount($lineProperties[11])->setBarCode($lineProperties[12])->setExpirationDate($lineProperties[13])->setAmountInCents($lineProperties[14]);
                 $lineProperties[15] == false ? $boletoTransaction->setAmountPaidInCents($lineProperties[15]) : 0;
                 $lineProperties[16] == false ? $boletoTransaction->setPaymentDate($lineProperties[16]) : null;
                 $lineProperties[17] == false ? $boletoTransaction->setCreditDate($lineProperties[17]) : null;
                 $response->addBoletoTransaction($boletoTransaction);
                 break;
             case "40":
                 $onlineDebitTransaction = new One\DataContract\TransactionReport\TransactionReportData\OnlineDebitTransaction();
                 $transactionReportOrder = new One\DataContract\TransactionReport\TransactionReportData\TransactionReportOrder();
                 $transactionReportOrder->setOrderKey($lineProperties[1])->setOrderReference($lineProperties[2])->setMerchantKey($lineProperties[3])->setMerchantName($lineProperties[4]);
                 $onlineDebitTransaction->setOrder($transactionReportOrder)->setTransactionKey($lineProperties[5])->setTransactionReference($lineProperties[6])->setBank($lineProperties[7])->setStatus($lineProperties[8])->setAmountInCents($lineProperties[9]);
                 $lineProperties[10] == false ? $onlineDebitTransaction->setAmountPaidInCents($lineProperties[10]) : 0;
                 $lineProperties[11] == false ? $onlineDebitTransaction->setPaymentDate($lineProperties[11]) : null;
                 $onlineDebitTransaction->setBankReturnCode($lineProperties[12])->setBankPaymentDate($lineProperties[13])->setSignature($lineProperties[14])->setTransactionKeyToBank($lineProperties[15]);
                 $response->addOnlineDebitTransaction($onlineDebitTransaction);
                 break;
             case "99":
                 $trailer = new One\DataContract\TransactionReport\TransactionReportData\Trailer();
                 $trailer->setOrderDataCount($lineProperties[1])->setCreditCardTransactionDataCount($lineProperties[2])->setBoletoTransactionDataCount($lineProperties[3])->setOnlineDebitTransactionDataCount($lineProperties[4]);
                 $response->setTrailer($trailer);
                 break;
         }
     }
     return $response;
 }