Exemple #1
0
        public TicketGames.PagSeguro.Model.Billet MappingBillet(Domain.Model.Participant participant, Domain.Model.OrderDeliveryAddress orderDeliveryAddress, TicketGames.Domain.Model.Billet billet)
        {
            TicketGames.PagSeguro.Model.Billet billetPagSeguro = new PagSeguro.Model.Billet();

            billetPagSeguro.Price = billet.Value;

            billetPagSeguro.ShippingAddress = new TicketGames.PagSeguro.Model.ShippingAddress();

            billetPagSeguro.ShippingAddress.Street     = orderDeliveryAddress.Street;
            billetPagSeguro.ShippingAddress.Number     = orderDeliveryAddress.Number;
            billetPagSeguro.ShippingAddress.Complement = orderDeliveryAddress.Complement;
            billetPagSeguro.ShippingAddress.District   = orderDeliveryAddress.District;
            billetPagSeguro.ShippingAddress.ZipCode    = orderDeliveryAddress.ZipCode;
            billetPagSeguro.ShippingAddress.City       = orderDeliveryAddress.City;
            billetPagSeguro.ShippingAddress.State      = orderDeliveryAddress.State;

            billetPagSeguro.Buyer = new TicketGames.PagSeguro.Model.Buyer();

            billetPagSeguro.Session     = billet.Session;
            billetPagSeguro.SenderHash  = billet.SenderHash;
            billetPagSeguro.Buyer.Name  = participant.Name;
            billetPagSeguro.Buyer.CPF   = participant.CPF;
            billetPagSeguro.Buyer.DDD   = "11";
            billetPagSeguro.Buyer.Phone = "980203026";
            billetPagSeguro.Buyer.Mail  = participant.Email;

            return(billetPagSeguro);
        }
 public Participant(Domain.Model.Participant participant)
 {
     this.Id         = participant.Id;
     this.Name       = participant.Name;
     this.Gender     = participant.Gender;
     this.BirthDate  = participant.BirthDate;
     this.CPF        = participant.CPF;
     this.RG         = participant.RG;
     this.Email      = participant.Email;
     this.HomePhone  = participant.HomePhone;
     this.CellPhone  = participant.CellPhone;
     this.Street     = participant.Street;
     this.Number     = participant.Number;
     this.Complement = participant.Complement;
     this.District   = participant.District;
     this.City       = participant.City;
     this.State      = participant.State;
     this.ZipCode    = participant.ZipCode;
 }
        public Domain.Model.Participant MappingDomain()
        {
            Hash baseCrypt = new Hash();
            var  salt      = string.Empty;
            var  password  = string.Empty;

            if (!string.IsNullOrEmpty(this.Password))
            {
                salt     = Guid.NewGuid().ToString();
                password = baseCrypt.GetHash(this.Password, salt, CypherType.SHA512);
            }

            Domain.Model.Participant participant = new Domain.Model.Participant()
            {
                Id = this.Id,
                ParticipantStatusId = (this.Id > 0) ? (int)ParticipantStatus.Active : (int)ParticipantStatus.Pending,
                Login      = (this.Id > 0) ? this.Login : this.CPF,
                Password   = !string.IsNullOrEmpty(password) ? password : string.Empty,
                Salt       = !string.IsNullOrEmpty(salt) ? salt : string.Empty,
                Name       = this.Name,
                Gender     = this.Gender,
                BirthDate  = this.BirthDate,
                CPF        = this.CPF,
                RG         = this.RG,
                Email      = this.Email,
                HomePhone  = this.HomePhone,
                CellPhone  = this.CellPhone,
                Street     = this.Street,
                Number     = this.Number,
                Complement = this.Complement,
                District   = this.District,
                City       = this.City,
                State      = this.State,
                ZipCode    = this.ZipCode
            };

            return(participant);
        }
Exemple #4
0
        public TicketGames.PagSeguro.Model.Credit MappingCredit(Domain.Model.Participant participant, Domain.Model.Cart cart, Domain.Model.OrderDeliveryAddress orderDeliveryAddress, TicketGames.Domain.Model.Credit credit)
        {
            TicketGames.PagSeguro.Model.Credit creditPagSeguro = new TicketGames.PagSeguro.Model.Credit();

            // Add items
            foreach (var item in cart.CartItems)
            {
                creditPagSeguro.Items.Add(new TicketGames.PagSeguro.Model.Item()
                {
                    ProductId = item.ProductId.ToString(),
                    Product   = item.Product.Name,
                    Quantity  = item.Quantity,
                    Value     = (45 / cart.CartItems.Count)
                });
            }

            creditPagSeguro.OrderId = 33873647;


            creditPagSeguro.ShippingAddress = new TicketGames.PagSeguro.Model.ShippingAddress();

            creditPagSeguro.ShippingAddress.Street     = orderDeliveryAddress.Street;
            creditPagSeguro.ShippingAddress.Number     = orderDeliveryAddress.Number;
            creditPagSeguro.ShippingAddress.Complement = orderDeliveryAddress.Complement;
            creditPagSeguro.ShippingAddress.District   = orderDeliveryAddress.District;
            creditPagSeguro.ShippingAddress.ZipCode    = orderDeliveryAddress.ZipCode;
            creditPagSeguro.ShippingAddress.City       = orderDeliveryAddress.City;
            creditPagSeguro.ShippingAddress.State      = orderDeliveryAddress.State;

            if (credit.Owner)
            {
                creditPagSeguro.BillingAddress = new TicketGames.PagSeguro.Model.BillingAddress();

                creditPagSeguro.BillingAddress.Street     = participant.Street;
                creditPagSeguro.BillingAddress.Number     = participant.Number;
                creditPagSeguro.BillingAddress.Complement = participant.Complement;
                creditPagSeguro.BillingAddress.ZipCode    = participant.ZipCode;
                creditPagSeguro.BillingAddress.District   = participant.District;
                creditPagSeguro.BillingAddress.City       = participant.City;
                creditPagSeguro.BillingAddress.State      = participant.State;
            }


            creditPagSeguro.CreditCardHolder = new TicketGames.PagSeguro.Model.CreditCardHolder();

            creditPagSeguro.CreditCardHolder.Name      = participant.Name;
            creditPagSeguro.CreditCardHolder.CPF       = participant.CPF;
            creditPagSeguro.CreditCardHolder.BirthDate = Convert.ToDateTime("21/05/1989");
            creditPagSeguro.CreditCardHolder.DDD       = "11";
            creditPagSeguro.CreditCardHolder.Phone     = "980203026";

            creditPagSeguro.Buyer = new TicketGames.PagSeguro.Model.Buyer();

            creditPagSeguro.SenderHash  = credit.SenderHash;
            creditPagSeguro.Buyer.Name  = participant.Name;
            creditPagSeguro.Buyer.CPF   = participant.CPF;
            creditPagSeguro.Buyer.DDD   = "11";
            creditPagSeguro.Buyer.Phone = "980203026";
            creditPagSeguro.Buyer.Mail  = participant.Email;

            creditPagSeguro.CreditCardToken = credit.CreditCardToken;

            creditPagSeguro.Parcel = new TicketGames.PagSeguro.Model.Parcel();

            creditPagSeguro.Parcel.Quantity = credit.Parcel;
            creditPagSeguro.Parcel.Value    = credit.Value;
            creditPagSeguro.Brand           = credit.Brand;
            creditPagSeguro.Owner           = credit.Owner;
            creditPagSeguro.Session         = credit.Session;

            return(creditPagSeguro);
        }