コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);

        }
コード例 #4
0
ファイル: TransactionRequest.cs プロジェクト: andrelmp/Cielo
        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);
        }
コード例 #5
0
ファイル: Xml.cs プロジェクト: yadazula/DynamicBuilder
        /// <summary>
        /// Alternate syntax for generating an XML object via this static factory
        /// method instead of expliclty creating a "dynamic" in client code.
        /// </summary>
        /// <param name="builder"></param>
        /// <returns></returns>
        public static Xml Build(Action<dynamic> builder)
        {
            if (builder == null) { throw new ArgumentNullException("builder"); }

            var xbuilder = new Xml();
            builder(xbuilder);
            return xbuilder;
        }