public override string ToXml(bool indent)
        {
            dynamic xml = new Xml {UseDashInsteadUnderscore = true};
            xml.Declaration(encoding: "ISO-8859-1");
            xml.requisicao_transacao(new {id = UniqueKey, versao = CieloVersion.Version}, Xml.Fragment(req =>
            {
                Affiliate.ToXml(req, Configuration);

                if (_creditCardData != null)
                {
                    _creditCardData.ToXml(req);
                }

                _order.ToXml(req, Configuration);

                _paymentMethod.ToXml(req);

                req.url_retorno(Configuration.ReturnUrl);
                req.autorizar((int) _options.AuthorizationType);
                req.capturar(_options.Capture.ToString(CultureInfo.InvariantCulture).ToLower());
                req.gerar_token(_options.GenerateToken.ToString(CultureInfo.InvariantCulture).ToLower());
            }));

            return xml.ToString(indent);
        }
        public override string ToXml(bool indent)
        {
            dynamic xml = new Xml {UseDashInsteadUnderscore = true};
            xml.Declaration(encoding: "ISO-8859-1");

            xml.requisicao_consulta(new {id = UniqueKey, versao = CieloVersion.Version}, Xml.Fragment(req =>
            {
                req.tid(_tid);
                Affiliate.ToXml(req, Configuration);
            }));

            return xml.ToString(indent);
        }
        public override string ToXml(bool indent)
        {
            dynamic xml = new Xml { UseDashInsteadUnderscore = true };
            xml.Declaration(encoding: "ISO-8859-1");

            xml.requisicao_captura(new { id = UniqueKey, versao = CieloVersion.Version }, Xml.Fragment(req =>
            {
                req.tid(Tid);
                Affiliate.ToXml(req, Configuration);
                if (Valor.HasValue && Valor.Value > 0)
                {
                    req.valor(Valor.Value.ToCieloFormatValue());
                }
            }));

            return xml.ToString(indent);

        }
Beispiel #4
0
        public string ToXml(bool indent = false)
        {
            dynamic xml = new Xml { UseDashInsteadUnderscore = true };
            xml.Declaration(encoding: "ISO-8859-1");
            xml.requisicao_transacao(new { id = UniqueKey, versao = "1.3.0" }, Xml.Fragment(req =>
            {
                req.dados_ec(Xml.Fragment(c =>
                {
                    c.numero(_configuration.CustomerId);
                    c.chave(_configuration.CustomerKey);
                }));

                req.dados_pedido(Xml.Fragment(c =>
                {
                    c.numero(_order.Id);
                    c.valor(_order.Total.ToCieloFormatValue());
                    c.moeda(_configuration.CurrencyId);
                    c.data_hora(_order.Date.ToCieloFormatDate());
                    c.descricao(_order.Description);
                    c.idioma(_configuration.Language.GetDescription());
                    c.soft_descriptor("");
                }));

                req.forma_pagamento(Xml.Fragment(c =>
                {
                    c.bandeira(_paymentMethod.CreditCard.GetDescription());
                    c.produto(_paymentMethod.PurchaseType.GetDescription());
                    c.parcelas(_paymentMethod.Installments);
                }));

                req.url_retorno(_configuration.ReturnUrl);
                req.autorizar((int)_options.AuthorizationType);
                req.capturar(_options.Capture.ToString(CultureInfo.InvariantCulture).ToLower());
                req.gerar_token(_options.GenerateToken.ToString(CultureInfo.InvariantCulture).ToLower());
            }));

            return xml.ToString(indent);
        }