void SetCoordination(CoordinationPaymentMethod model)
        {
            CoordinationPaymentMethodViewModel coordinationPaymentMethodViewModel = new CoordinationPaymentMethodViewModel();

            ViewModelHelper.SetCoordinationPaymentMethodToCoordinationPaymentMethodViewModel(model, coordinationPaymentMethodViewModel);
            PaymentMethods.Add(coordinationPaymentMethodViewModel);
        }
Esempio n. 2
0
 public void AddPaymentMethod(PaymentMethodId paymentMethodId)
 {
     if (PaymentMethods.Contains(paymentMethodId))
     {
         return;
     }
     PaymentMethods.Add(paymentMethodId);
 }
        private void CardAdded(PaymentMethod paymentMethod)
        {
            var paymentMethodViewModel = new PaymentMethodViewModel(paymentMethod, PaymentMethodSelected);

            PaymentMethods.Add(paymentMethodViewModel);
            SelectPaymentMethod(paymentMethodViewModel);
            _methodSelectedCallback();
        }
 public GetPaymentMethodsResponse(PaymentMethodResult apiResult) : this()
 {
     foreach (var method in apiResult.PaymentMethods)
     {
         var paymentMethod = new PaymentMethod(method);
         PaymentMethods.Add(paymentMethod);
         if (paymentMethod.Cards.Any())
         {
             Cards = paymentMethod.Cards;
         }
     }
 }
Esempio n. 5
0
        public void Seed()
        {
            #region PaymentMethods

            var enumType = typeof(Core.Common.Data.Payment.PaymentMethod);
            foreach (var value in Enum.GetValues(enumType))
            {
                var id = (int)value;
                if (PaymentMethods.All(o => o.Id != id))
                {
                    PaymentMethods.Add(new PaymentMethod
                    {
                        Key  = Guid.NewGuid(),
                        Id   = id,
                        Code = Enum.GetName(enumType, value)
                    });
                }
            }
            SaveChanges();

            #endregion

            #region MatchingCriterias

            enumType = typeof(MatchingCriteriaEnum);
            foreach (var value in Enum.GetValues(enumType))
            {
                var id = (int)value;
                if (PaymentMethods.All(o => o.Id != id))
                {
                    MatchingCriterias.Add(new MatchingCriteria
                    {
                        Key  = Guid.NewGuid(),
                        Id   = (MatchingCriteriaEnum)id,
                        Code = Enum.GetName(enumType, value)
                    });
                }
            }

            SaveChanges();

            #endregion
        }
        public async Task Refresh()
        {
            var selectedPaymentMethodId = PaymentMethods.FirstOrDefault(p => p.Selected)?.PaymentMethod.Id;

            PaymentMethods.Clear();
            try {
                var stripeClient = await EphemeralService.Instance.GetClient();

                var customerId = await EphemeralService.Instance.GetCustomerId();

                var customerService = new CustomerService(stripeClient);
                _customer = await customerService.GetAsync(customerId);


                var paymentMethodService     = new PaymentMethodService(stripeClient);
                var paymentMethodListOptions = new PaymentMethodListOptions {
                    Customer = _customer.Id,
                    Type     = "card"
                };
                var methods = await paymentMethodService.ListAsync(paymentMethodListOptions);

                foreach (var paymentMethod in methods)
                {
                    PaymentMethods.Add(new PaymentMethodViewModel(paymentMethod, PaymentMethodSelected));
                }

                if (PaymentMethods.Any())
                {
                    var toSelect = PaymentMethods.FirstOrDefault(pm => pm.PaymentMethod.Id == selectedPaymentMethodId) ??
                                   PaymentMethods.First();
                    SelectPaymentMethod(toSelect);
                }
            }
            catch (Exception ex) {
                await Navigator.ShowMessage("Error", ex.Message);
            }
        }
Esempio n. 7
0
        public bool importFromXML()
        {
            //try
            //{
            XDocument doc                = XDocument.Load(Path);
            XElement  elemCompany        = doc.Element("Settings").Element("Company");
            XElement  elemContractors    = doc.Element("Settings").Element("Contractors");
            XElement  elemPaymentMethods = doc.Element("Settings").Element("PaymentMethods");
            XElement  elemUnitOfMeasures = doc.Element("Settings").Element("UnitOfMeasures");
            XElement  elemItems          = doc.Element("Settings").Element("Items");

            Company.Id          = Int32.Parse(elemCompany.Attribute("Id").Value);
            Company.FullName    = elemCompany.Attribute("FullName").Value;
            Company.Name        = elemCompany.Attribute("Name").Value;
            Company.NIP         = elemCompany.Attribute("NIP").Value;
            Company.REGON       = elemCompany.Attribute("REGON").Value;
            Company.Street      = elemCompany.Attribute("Street").Value;
            Company.BuldingNo   = elemCompany.Attribute("BuldingNo").Value;
            Company.PostalCode  = elemCompany.Attribute("PostalCode").Value;
            Company.City        = elemCompany.Attribute("City").Value;
            Company.Email       = elemCompany.Attribute("Email").Value;
            Company.Phone       = elemCompany.Attribute("Phone").Value;
            Company.Website     = elemCompany.Attribute("Website").Value;
            Company.BankName    = elemCompany.Attribute("BankName").Value;
            Company.BankAccount = elemCompany.Attribute("BankAccount").Value;
            Company.IssuerName  = elemCompany.Attribute("IssuerName").Value;


            foreach (XElement xContractor in elemContractors.Elements("Contractor"))
            {
                Contractor contractor = new Contractor();
                contractor.Id         = Int32.Parse(xContractor.Attribute("Id").Value);
                contractor.FullName   = xContractor.Attribute("FullName").Value;
                contractor.NIP        = xContractor.Attribute("NIP").Value;
                contractor.Street     = xContractor.Attribute("Street").Value;
                contractor.BuldingNo  = xContractor.Attribute("BuldingNo").Value;
                contractor.PostalCode = xContractor.Attribute("PostalCode").Value;
                contractor.City       = xContractor.Attribute("City").Value;
                Contractors.Add(contractor);
            }

            foreach (XElement xPaymentMethod in elemPaymentMethods.Elements("PaymentMethod"))
            {
                PaymentMethod paymentMethod = new PaymentMethod();
                paymentMethod.Id      = Int32.Parse(xPaymentMethod.Attribute("Id").Value);
                paymentMethod.Name    = xPaymentMethod.Attribute("Name").Value;
                paymentMethod.DueDate = Int32.Parse(xPaymentMethod.Attribute("DueDate").Value);
                PaymentMethods.Add(paymentMethod);
            }

            foreach (XElement xUnitOfMeasures in elemUnitOfMeasures.Elements("UnitOfMeasure"))
            {
                UnitOfMeasure unitOfMeasure = new UnitOfMeasure();
                unitOfMeasure.Id        = Int32.Parse(xUnitOfMeasures.Attribute("Id").Value);
                unitOfMeasure.Name      = xUnitOfMeasures.Attribute("Name").Value;
                unitOfMeasure.ShortName = xUnitOfMeasures.Attribute("ShortName").Value;
                UnitOfMeasures.Add(unitOfMeasure);
            }

            foreach (XElement xItems in elemItems.Elements("Item"))
            {
                Item item = new Item();
                item.Id   = Int32.Parse(xItems.Attribute("Id").Value);
                item.Name = xItems.Attribute("Name").Value;
                //item.UnitOfMeasure =;
                item.UnitPrice = Decimal.Parse(xItems.Attribute("UnitPrice").Value);
                item.VatRate   = Decimal.Parse(xItems.Attribute("VATRate").Value);
                Items.Add(item);
            }
            //}
            //catch (Exception)
            //{
            //    return false;
            //}

            return(true);
        }
Esempio n. 8
0
 public void SetPaymentMethod(bool set)
 {
     PaymentMethods.Add(new UserPaymentModel(set));
 }