private function generateTransferXML(TransferRequest $request)
 {
     $xml = null;
     if ($request->getFundingMapped() == null) {
         $xml = "<TransferRequest>";
         $xml .= "<LocalDate>" . $request->getLocalDate() . "</LocalDate>";
         $xml .= "<LocalTime>" . $request->getLocalTime() . "</LocalTime>";
         $xml .= "<TransactionReference>" . $request->getTransactionReference() . "</TransactionReference>";
         $xml .= "<SenderName>" . $request->getSenderName() . "</SenderName>";
         $xml .= "<SenderAddress>";
         $xml .= "<Line1>" . $request->getSenderAddress()->getLine1() . "</Line1>";
         $xml .= "<Line2>" . $request->getSenderAddress()->getLine2() . "</Line2>";
         $xml .= "<City>" . $request->getSenderAddress()->getCity() . "</City>";
         $xml .= "<CountrySubdivision>" . $request->getSenderAddress()->getCountrySubdivision() . "</CountrySubdivision>";
         $xml .= "<PostalCode>" . $request->getSenderAddress()->getPostalCode() . "</PostalCode>";
         $xml .= "<Country>" . $request->getSenderAddress()->getCountry() . "</Country>";
         $xml .= "</SenderAddress>";
         $xml .= "<FundingCard>";
         $xml .= "<AccountNumber>" . $request->getFundingCard()->getAccountNumber() . "</AccountNumber>";
         $xml .= "<ExpiryMonth>" . $request->getFundingCard()->getExpiryMonth() . "</ExpiryMonth>";
         $xml .= "<ExpiryYear>" . $request->getFundingCard()->getExpiryYear() . "</ExpiryYear>";
         $xml .= "</FundingCard>";
         $xml .= "<FundingUCAF>" . $request->getFundingUCAF() . "</FundingUCAF>";
         $xml .= "<FundingMasterCardAssignedId>" . $request->getFundingMasterCardAssignedId() . "</FundingMasterCardAssignedId>";
         $xml .= "<FundingAmount>";
         $xml .= "<Value>" . $request->getFundingAmount()->getValue() . "</Value>";
         $xml .= "<Currency>" . $request->getFundingAmount()->getCurrency() . "</Currency>";
         $xml .= "</FundingAmount>";
         $xml .= "<ReceiverName>" . $request->getReceiverName() . "</ReceiverName>";
         $xml .= "<ReceiverAddress>";
         $xml .= "<Line1>" . $request->getReceiverAddress()->getLine1() . "</Line1>";
         $xml .= "<Line2>" . $request->getReceiverAddress()->getLine2() . "</Line2>";
         $xml .= "<City>" . $request->getReceiverAddress()->getCity() . "</City>";
         $xml .= "<PostalCode>" . $request->getReceiverAddress()->getPostalCode() . "</PostalCode>";
         $xml .= "<Country>" . $request->getReceiverAddress()->getCountry() . "</Country>";
         $xml .= "</ReceiverAddress>";
         $xml .= "<ReceiverPhone>" . $request->getReceiverPhone() . "</ReceiverPhone>";
         $xml .= "<ReceivingCard>";
         $xml .= "<AccountNumber>" . $request->getReceivingCard()->getAccountNumber() . "</AccountNumber>";
         $xml .= "</ReceivingCard>";
         $xml .= "<ReceivingAmount>";
         $xml .= "<Value>" . $request->getReceivingAmount()->getValue() . "</Value>";
         $xml .= "<Currency>" . $request->getReceivingAmount()->getCurrency() . "</Currency>";
         $xml .= "</ReceivingAmount>";
         $xml .= "<Channel>" . $request->getChannel() . "</Channel>";
         $xml .= "<UCAFSupport>" . $request->getUCAFSupport() . "</UCAFSupport>";
         $xml .= "<ICA>" . $request->getICA() . "</ICA>";
         $xml .= "<ProcessorId>" . $request->getProcessorId() . "</ProcessorId>";
         $xml .= "<RoutingAndTransitNumber>" . $request->getRoutingAndTransitNumber() . "</RoutingAndTransitNumber>";
         $xml .= "<CardAcceptor>";
         $xml .= "<Name>" . $request->getCardAcceptor()->getName() . "</Name>";
         $xml .= "<City>" . $request->getCardAcceptor()->getCity() . "</City>";
         $xml .= "<State>" . $request->getCardAcceptor()->getState() . "</State>";
         $xml .= "<PostalCode>" . $request->getCardAcceptor()->getPostalCode() . "</PostalCode>";
         $xml .= "<Country>" . $request->getCardAcceptor()->getCountry() . "</Country>";
         $xml .= "</CardAcceptor>";
         $xml .= "<TransactionDesc>" . $request->getTransactionDesc() . "</TransactionDesc>";
         $xml .= "<MerchantId>" . $request->getMerchantId() . "</MerchantId>";
         $xml .= "</TransferRequest>";
     } else {
         $xml = "<TransferRequest>";
         $xml .= "<LocalDate>" . $request->getLocalDate() . "</LocalDate>";
         $xml .= "<LocalTime>" . $request->getLocalTime() . "</LocalTime>";
         $xml .= "<TransactionReference>" . $request->getTransactionReference() . "</TransactionReference>";
         $xml .= "<FundingMapped>";
         $xml .= "<SubscriberId>" . $request->getFundingMapped()->getSubscriberId() . "</SubscriberId>";
         $xml .= "<SubscriberType>" . $request->getFundingMapped()->getSubscriberType() . "</SubscriberType>";
         $xml .= "<SubscriberAlias>" . $request->getFundingMapped()->getSubscriberAlias() . "</SubscriberAlias>";
         $xml .= "</FundingMapped>";
         $xml .= "<FundingUCAF>" . $request->getFundingUCAF() . "</FundingUCAF>";
         $xml .= "<FundingMasterCardAssignedId>" . $request->getFundingMasterCardAssignedId() . "</FundingMasterCardAssignedId>";
         $xml .= "<FundingAmount>";
         $xml .= "<Value>" . $request->getFundingAmount()->getValue() . "</Value>";
         $xml .= "<Currency>" . $request->getFundingAmount()->getCurrency() . "</Currency>";
         $xml .= "</FundingAmount>";
         $xml .= "<ReceiverName>" . $request->getReceiverName() . "</ReceiverName>";
         $xml .= "<ReceiverAddress>";
         $xml .= "<Line1>" . $request->getReceiverAddress()->getLine1() . "</Line1>";
         $xml .= "<Line2>" . $request->getReceiverAddress()->getLine2() . "</Line2>";
         $xml .= "<City>" . $request->getReceiverAddress()->getCity() . "</City>";
         $xml .= "<PostalCode>" . $request->getReceiverAddress()->getPostalCode() . "</PostalCode>";
         $xml .= "<Country>" . $request->getReceiverAddress()->getCountry() . "</Country>";
         $xml .= "</ReceiverAddress>";
         $xml .= "<ReceiverPhone>" . $request->getReceiverPhone() . "</ReceiverPhone>";
         $xml .= "<ReceivingCard>";
         $xml .= "<AccountNumber>" . $request->getReceivingCard()->getAccountNumber() . "</AccountNumber>";
         $xml .= "</ReceivingCard>";
         $xml .= "<ReceivingAmount>";
         $xml .= "<Value>" . $request->getReceivingAmount()->getValue() . "</Value>";
         $xml .= "<Currency>" . $request->getReceivingAmount()->getCurrency() . "</Currency>";
         $xml .= "</ReceivingAmount>";
         $xml .= "<Channel>" . $request->getChannel() . "</Channel>";
         $xml .= "<UCAFSupport>" . $request->getUCAFSupport() . "</UCAFSupport>";
         $xml .= "<ICA>" . $request->getICA() . "</ICA>";
         $xml .= "<ProcessorId>" . $request->getProcessorId() . "</ProcessorId>";
         $xml .= "<RoutingAndTransitNumber>" . $request->getRoutingAndTransitNumber() . "</RoutingAndTransitNumber>";
         $xml .= "<CardAcceptor>";
         $xml .= "<Name>" . $request->getCardAcceptor()->getName() . "</Name>";
         $xml .= "<City>" . $request->getCardAcceptor()->getCity() . "</City>";
         $xml .= "<State>" . $request->getCardAcceptor()->getState() . "</State>";
         $xml .= "<PostalCode>" . $request->getCardAcceptor()->getPostalCode() . "</PostalCode>";
         $xml .= "<Country>" . $request->getCardAcceptor()->getCountry() . "</Country>";
         $xml .= "</CardAcceptor>";
         $xml .= "<TransactionDesc>" . $request->getTransactionDesc() . "</TransactionDesc>";
         $xml .= "<MerchantId>" . $request->getMerchantId() . "</MerchantId>";
         $xml .= "</TransferRequest>";
     }
     return $xml;
 }
 /**
  * Handle a login request to the application.
  *
  * @param \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function transaction()
 {
     $testUtils = new ENV(Environment::SANDBOX);
     $cardMappingService = new TransferService(ENV::SANDBOX_CONSUMER_KEY, $testUtils->getPrivateKey(), Environment::SANDBOX);
     $transferRequestCard = new TransferRequest();
     $transferRequestCard->setLocalDate("1212");
     $transferRequestCard->setLocalTime("161222");
     $transferRequestCard->setTransactionReference("40000000010101020" . rand(10, 90));
     $transferRequestCard->setSenderName("John Doe");
     $address = new SenderAddress();
     $address->setLine1("123 Main Street");
     $address->setLine2("#5A");
     $address->setCity("Arlington");
     $address->setCountrySubdivision("VA");
     $address->setPostalCode(22207);
     $address->setCountry("USA");
     $transferRequestCard->setSenderAddress($address);
     $fundingCard = new FundingCard();
     $fundingCard->setAccountNumber("5184680430000006");
     $fundingCard->setExpiryMonth(11);
     $fundingCard->setExpiryYear(2015);
     $transferRequestCard->setFundingCard($fundingCard);
     $transferRequestCard->setFundingUCAF("MjBjaGFyYWN0ZXJqdW5rVUNBRjU=1111");
     $transferRequestCard->setFundingMasterCardAssignedId(123456);
     $fundingAmount = new FundingAmount();
     $fundingAmount->setValue(15000);
     $fundingAmount->setCurrency(840);
     $transferRequestCard->setFundingAmount($fundingAmount);
     $transferRequestCard->setReceiverName("Jose Lopez");
     $receiverAddress = new ReceiverAddress();
     $receiverAddress->setLine1("Pueblo Street");
     $receiverAddress->setLine2("PO BOX 12");
     $receiverAddress->setCity("El PASO");
     $receiverAddress->setCountrySubdivision("TX");
     $receiverAddress->setPostalCode(79906);
     $receiverAddress->setCountry("USA");
     $transferRequestCard->setReceiverAddress($receiverAddress);
     $transferRequestCard->setReceiverPhone("1800639426");
     $receivingCard = new ReceivingCard();
     $receivingCard->setAccountNumber("5184680430000006");
     $transferRequestCard->setReceivingCard($receivingCard);
     $receivingAmount = new ReceivingAmount();
     $receivingAmount->setValue(182206);
     $receivingAmount->setCurrency(484);
     $transferRequestCard->setReceivingAmount($receivingAmount);
     $transferRequestCard->setChannel("W");
     $transferRequestCard->setUCAFSupport("false");
     $transferRequestCard->setICA("009674");
     $transferRequestCard->setProcessorId("9000000442");
     $transferRequestCard->setRoutingAndTransitNumber(990442082);
     $cardAcceptor = new CardAcceptor();
     $cardAcceptor->setName("My Local Bank");
     $cardAcceptor->setCity("Saint Louis");
     $cardAcceptor->setState("MO");
     $cardAcceptor->setPostalCode(63101);
     $cardAcceptor->setCountry("USA");
     $transferRequestCard->setCardAcceptor($cardAcceptor);
     $transferRequestCard->setTransactionDesc("A2A");
     $transferRequestCard->setMerchantId(123456);
     $transfer = $cardMappingService->getTransfer($transferRequestCard);
     //var_dump(get_class_methods($transfer));die;
     if (null != $transfer) {
         var_dump($transfer->getTransactionHistory());
         die;
     }
     var_dump($transfer);
     die;
 }