app/src/main/java/com/treslines/pagsegurodemo/PagSeguroCheckout.java
public String buildCheckoutXml(){
        String xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\"?>\n" +
                "<checkout>\n" +
                "    <currency>%s</currency>\n" +
                (redirectUrl!=null?"<redirectURL>%s</redirectURL>\n":"") +
                "    <items>\n" +
                buildPagSeguroItemsXml() +
                "    </items>\n" +
                "    <reference>%s</reference>\n" +
                "    <sender>\n" +
                pagSeguroBuyer.buildPagSeguroBuyerXml()+
                "    </sender>\n" +
                "    <shipping>\n" +
                pagSeguroShipping.buildPagSeguroShippingXml()+
                "    </shipping>\n" +
                "</checkout>";
        String formattedXml = "";
        if(redirectUrl!=null){
            formattedXml =String.format(xml, landCurrency.getCurrencyCode(),redirectUrl, saleReference);
        }else{
            formattedXml = String.format(xml, landCurrency.getCurrencyCode(), saleReference);
        }
        return formattedXml;
    }
/** returns the pagseguro xml to execute a checkout request over the pagseguro webservice*/
returns the pagseguro xml to execute a checkout request over the pagseguro webservice
returns the pagseguro xml to execute a checkout request over the pagseguro webservice
public String buildCheckoutXml(){
        String xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\"?>\n" +
                "<checkout>\n" +
                "    <currency>%s</currency>\n" +
                (redirectUrl!=null?"<redirectURL>%s</redirectURL>\n":"") +
                "    <items>\n" +
                buildPagSeguroItemsXml() +
                "    </items>\n" +
                "    <reference>%s</reference>\n" +
                "    <sender>\n" +
                pagSeguroBuyer.buildPagSeguroBuyerXml()+
                "    </sender>\n" +
                "    <shipping>\n" +
                pagSeguroShipping.buildPagSeguroShippingXml()+
                "    </shipping>\n" +
                "</checkout>";
        String formattedXml = "";
        if(redirectUrl!=null){
            formattedXml =String.format(xml, landCurrency.getCurrencyCode(),redirectUrl, saleReference);
        }else{
            formattedXml = String.format(xml, landCurrency.getCurrencyCode(), saleReference);
        }
        return formattedXml;
    }
public String buildCheckoutXml ( ) { String xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\"?>\n" + "<checkout>\n" + "    <currency>%s</currency>\n" + ( redirectUrl != null ? "<redirectURL>%s</redirectURL>\n" : "" ) + "    <items>\n" + buildPagSeguroItemsXml ( ) + "    </items>\n" + "    <reference>%s</reference>\n" + "    <sender>\n" + pagSeguroBuyer . buildPagSeguroBuyerXml ( ) + "    </sender>\n" + "    <shipping>\n" + pagSeguroShipping . buildPagSeguroShippingXml ( ) + "    </shipping>\n" + "</checkout>" ; String formattedXml = "" ; if ( redirectUrl != null ) { formattedXml = String . format ( xml , landCurrency . getCurrencyCode ( ) , redirectUrl , saleReference ) ; } else { formattedXml = String . format ( xml , landCurrency . getCurrencyCode ( ) , saleReference ) ; } return formattedXml ; }
returns the pagseguro xml to execute a checkout request over the pagseguro webservice
returns the pagseguro xml to execute a checkout request over the pagseguro webservice