public async Task ExecuteJoinPartyCommand() { if (IsBusy) { return; } IsBusy = true; joinButtonLabel = null; try { var loginProvider = DependencyService.Get <ILoginProvider>(); //TODO Optimize string customerid; //loginProvider.RetreiveAccountFromSecureStore().Properties.TryGetValue(Constants.stripeAccountIdPropertyName,out customerid); string userTableid = loginProvider.RetrieveTableIdFromSecureStore(); var cloudService = ServiceLocator.Instance.Resolve <ICloudService>(); ICloudTable <AttendeeDetails> Table = cloudService.GetTable <AttendeeDetails>(); AttendeeDetails attendeeDetails = new AttendeeDetails { userId = userTableid, partyId = Id, //Actually tableid paid = false, accepted = false, chargeId = " ", }; await Table.CreateItemAsync(attendeeDetails); //TODO register for notifications } catch (Exception ex) { Console.WriteLine($"[Login] Error = {ex.Message}"); } finally { joinButtonLabel = Constants.joinButtonTitles[(int)Constants.JoinedPartyStates.RequestSent]; Console.WriteLine("Join Party Command Executed"); IsBusy = false; } }
public async Task ExecuteDeclineAttendeeCommand() { if (Declined == false) { return; } var Table = cloudService.GetTable <AttendeeDetails>(); AttendeeDetails attendee = new AttendeeDetails() { Id = attendeeID, userId = this.userId, partyId = this.partyid, UpdatedAt = DateTime.Now, accepted = false, declined = true }; await Table.UpdateItemAsync(attendee); Declined = true; }
public async Task ExecuteAcceptAttendeeCommand() { //Charge Customer //var stripeService = ServiceLocator.Instance.Resolve<IStripeProvider>(); //string id; //var loginProvider = DependencyService.Get<ILoginProvider>(); //Account acc = loginProvider.RetreiveAccountFromSecureStore(); //acc.Properties.TryGetValue(Constants.stripeAccountIdPropertyName, out id); // //string JParty = JsonConvert.SerializeObject(partyDetails); // //StripeCharge stripeCharge = new StripeCharge() //{ // amount = price, // customerId = customerid, // currency = "dkk", // receiverId = id, //This users id // partyId = partyid, // ObjectJson = JParty //}; //StripeResponse response = await stripeService.ChargeCustomer(stripeCharge); //Update Table cloudService = ServiceLocator.Instance.Resolve <ICloudService>(); var Table = cloudService.GetTable <AttendeeDetails>(); AttendeeDetails attendee = new AttendeeDetails() { Id = attendeeID, userId = this.userId, partyId = this.partyID, UpdatedAt = DateTime.Now, accepted = true, declined = false }; await Table.UpdateItemAsync(attendee); Accepted = true; }