Ejemplo n.º 1
0
        private static void E2E()
        {
            string    sellerPhoneNumber  = "07434";
            string    buyerPhoneNumber   = "34075";
            string    donatorPhoneNumber = "1234";
            ApiServer apiServer          = new ApiServer("http://africatransferapi.azurewebsites.net/api/");

            apiServer.AddPhoneNUmber(sellerPhoneNumber);
            apiServer.AddPhoneNUmber(buyerPhoneNumber);
            apiServer.AddPhoneNUmber(donatorPhoneNumber);
            var x = apiServer.GetAuthModels();

            TransactionProcessor processor = new TransactionProcessor(apiServer);

            processor.AddBankTransfer(44, donatorPhoneNumber);

            processor.AddMobileTransfer(23, donatorPhoneNumber, buyerPhoneNumber);

            var product = processor.AddProduct(new Product {
                Name = "Capriciosa", Price = 22
            });

            var orderId = processor.AddOrder(new List <OrderLine>()
            {
                new OrderLine {
                    ProductID = product.ID,
                    Quantity  = 2
                }
            }, sellerPhoneNumber);

            var order      = processor.GetOrder(orderId);
            var orderTotal = order.OrderLines.Sum(o => o.ProductPrice);

            processor.ConfirmOrder(order, buyerPhoneNumber);
        }
Ejemplo n.º 2
0
        public async void AddPhone(object sender, EventArgs e)
        {
            AuthModel.MobilePhoneNumber = Phone;
            ApiServer server = new ApiServer();

            server.AddPhoneNUmber(Phone);

            await Navigation.PushModalAsync(new NavigationPage(new MainPage()));
        }
 public void RegisterNewUser(string phoneNumber)
 {
     apiServer.AddPhoneNUmber(phoneNumber);
 }