Exemplo n.º 1
0
 private function generatePaymentXML(PaymentRequest $request)
 {
     $xml = null;
     if ($request->getReceivingMapped() == null) {
         $xml = "<PaymentRequest>";
         $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 .= "<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 .= "<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 .= "</PaymentRequest>";
     } else {
         $xml = "<PaymentRequest>";
         $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 .= "<ReceivingMapped>";
         $xml .= "<SubscriberId>" . $request->getReceivingMapped()->getSubscriberId() . "</SubscriberId>";
         $xml .= "<SubscriberType>" . $request->getReceivingMapped()->getSubscriberType() . "</SubscriberType>";
         $xml .= "<SubscriberAlias>" . $request->getReceivingMapped()->getSubscriberAlias() . "</SubscriberAlias>";
         $xml .= "</ReceivingMapped>";
         $xml .= "<ReceivingAmount>";
         $xml .= "<Value>" . $request->getReceivingAmount()->getValue() . "</Value>";
         $xml .= "<Currency>" . $request->getReceivingAmount()->getCurrency() . "</Currency>";
         $xml .= "</ReceivingAmount>";
         $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 .= "</PaymentRequest>";
     }
     return $xml;
 }