// ApiCalling api = new ApiCalling(); public EnterGroceryAmount(TrollyCreation ob, int count) { InitializeComponent(); obj = ob; itemCount = count; LoadData(); }
public PaymentCardInfo(TrollyCreation ob) { InitializeComponent(); trollyCreation = ob; checkCardInfo(); }
public void SaveTrolly(Object sender, EventArgs e) { ApiCalling apiCall = new ApiCalling(); Dictionary <string, object> userData = ShareUserData.getUserData; string deliveryDateTime = ""; if (datePicker.IsVisible == true && timePicker.IsVisible == true) { DateTime dateOnly = datePicker.Date; //DateTime dateOnly = timePicker.Time; deliveryDateTime = dateOnly.ToString("dd/MM/yyyy") + " " + timePicker.Time.ToString(); } else { deliveryDateTime = currentDate.Text + " " + currentTime.Text; } TrollyCreation trolly = new TrollyCreation { createdDate = DateTime.Now.ToString("dd/MM/yyyy"), lastModifiedDate = DateTime.Now.ToString("dd/MM/yyyy"), trollyTitle = "My Trolly", trollyDetail = getItemsInJson(), assigneeId = "1234", clientId = Convert.ToString(userData["simNumber"]), status = "pending", isScheduledDelivery = "true", deliveryDateTime = deliveryDateTime }; apiCall.trollyCreation(trolly); Navigation.PushAsync(new PaymentCardInfo()); }
public FeesCalculation(TrollyCreation trolly) { InitializeComponent(); // Calculations(); ob = trolly; additionalAmount.Text = "Your Grocery Amount is $100\n\nBase Fees is $15\n\nTotal Amount you pay $115"; }
public MyJobDetail(TrollyCreation ob) { InitializeComponent(); items = ob; title.Text = ob.trollyTitle; StatusUpdate(ob.status); GetConnection(); }
public MyTrollyItems(TrollyCreation ob, string storeName) { InitializeComponent(); items = ob; store = storeName; trolliName.Text = storeName; LoadData(); }
public MyTrolliDetail(TrollyCreation trollyCreation) { InitializeComponent(); LoadData(trollyCreation); items = trollyCreation; trolliName.Text = trollyCreation.trollyTitle; StatusUpdate(trollyCreation.status); }
public MyJobItems(TrollyCreation ob, string storeName, int itemCount) { InitializeComponent(); items = ob; store = storeName; trolliName.Text = storeName; itemsCount = itemCount; StatusUpdate(ob.status); LoadData(); }
public async void TrollyCreation(TrollyCreation ob) { try { await _client.PostAsync(ApiEndPoints.trolliCreation + "&trolliId=" + ob.trolliId + "&clientId=" + ob.clientId + "&trollyTitle=" + ob.trollyTitle + "&trollyDetail=" + ob.trollyDetail + "&createdDate=" + ob.createdDate + "&lastModifiedDate=" + ob.lastModifiedDate + "&deliveryDateTime=" + ob.deliveryDateTime + "&status=" + ob.status + "&assigneeId=" + ob.assigneeId + "&SBNotificationId= " + ob.SBNotificationId + "&clientNotificationId=" + ob.clientNotificationId + "&stripeChargeId=" + ob.stripeChargeId, null); } catch (Exception ex) { Log.Warning("Error", ex.ToString()); } }
public async void trollyCreation(TrollyCreation ob) { try { await _client.PostAsync("https://trolli-194513.appspot.com/TrollyCreation?assigneeId=" + ob.assigneeId + "&clientId=" + ob.clientId + "&trollyTitle=" + ob.trollyTitle + "&trollyDetail=" + ob.trollyDetail + "&createdDate=" + ob.createdDate + "&lastModifiedDate=" + ob.lastModifiedDate + "&deliveryDateTime=" + ob.deliveryDateTime + "&isScheduledDelivery=" + ob.isScheduledDelivery + "&status=" + ob.status, null); } catch (Exception ex) { Log.Warning("Error", ex.ToString()); } }
public async void GetRecord() { try { activIndicator.IsRunning = true; listView.ItemsSource = null; list = new List <TrollyCreation>(); Dictionary <string, object> userData = SharedUserData.getUserData; string globalClientId = Convert.ToString(userData["UniqueID"]);//"c9bdb5ec-7ef1-462c-adbb-076e8a4cddf4";// //Application.Current.Properties["phoneNumber"]; string url = ApiEndPoints.myJobsFind + globalClientId; string content = await _client.GetStringAsync(url); List <Dictionary <string, object> > posts = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(content); foreach (Dictionary <string, object> i in posts) { Dictionary <string, object> post = JsonConvert.DeserializeObject <Dictionary <string, object> >(Convert.ToString(i["properties"])); Dictionary <string, object> trollyData = JsonConvert.DeserializeObject <Dictionary <string, object> >(Convert.ToString(post["trollyDetail"])); string clientId = Convert.ToString(post["assigneeId"]); if (globalClientId == clientId) { TrollyCreation ob = new TrollyCreation() { clientId = Convert.ToString(post["clientId"]), trolliId = Convert.ToString(post["trolliId"]), createdDate = Convert.ToString(post["createdDate"]), deliveryDateTime = Convert.ToString(post["deliveryDateTime"]), lastModifiedDate = Convert.ToString(post["lastModifiedDate"]), status = Convert.ToString(post["status"]), trollyDetail = Convert.ToString(trollyData["value"]), trollyTitle = Convert.ToString(post["trollyTitle"]), assigneeId = Convert.ToString(post["assigneeId"]), clientNotificationId = Convert.ToString(post["clientNotificationId"]), SBNotificationId = Convert.ToString(post["SBNotificationId"]) }; list.Add(ob); } } listView.ItemsSource = list; activIndicator.IsRunning = false; } catch (Exception ex) { activIndicator.IsRunning = false; await DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); } }
public string TrollyTestTransaction(TrollyCreation ob) { try { var response = _client.PutAsync(ApiEndPoints.assigneeJobTransationAPI + "?assigneeId=" + ob.assigneeId + "&trolliId=" + ob.trolliId + "&SBNotificationId=" + ob.SBNotificationId, null).Result; string jsonResponse = response.Content.ReadAsStringAsync().Result; return(jsonResponse); } catch (Exception ex) { Log.Warning("Error", ex.ToString()); return(""); } }
public void ItemSelected(object sender, SelectedItemChangedEventArgs e) { try { if (e.SelectedItem == null) { return; } TrollyCreation trollyDetail = e.SelectedItem as TrollyCreation; Navigation.PushAsync(new MyTrolliDetail(trollyDetail)); ((ListView)sender).SelectedItem = null; } catch (Exception ex) { DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); //Exception Class } }
public void LoadData(TrollyCreation trollyCreation) { try { // if (e.SelectedItem == null) return; // TrollyCreation trollyDetail = (sender as Button).CommandParameter as TrollyCreation; ObservableCollection <ListProduct> dataItems = new ObservableCollection <ListProduct>(); ObservableCollection <ListStores> listStores = new ObservableCollection <ListStores>(); SharedUserData.addProduct = null; string trollyData = "[" + trollyCreation.trollyDetail + "]"; List <Dictionary <string, object> > posts = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(trollyData); // listView.ItemsSource = posts; bool check = true; foreach (Dictionary <string, object> i in posts) { ListProduct ob = new ListProduct() { detailItem = Convert.ToString(i["detailItem"]), description = Convert.ToString(i["description"]), items = Convert.ToString(i["items"]), quantity = Convert.ToInt32(i["quantity"]), size = Convert.ToString(i["size"]), store = Convert.ToString(i["store"]), storeSuburb = Convert.ToString(i["storeSuburb"]), unit = Convert.ToString(i["unit"]) }; if (check) { listData.Add(ob.store); ListStores listStore = new ListStores() { store = Convert.ToString(i["store"]), storeSuburb = Convert.ToString(i["storeSuburb"]) }; listStores.Add(listStore); check = false; } else { if (listData.Contains(ob.store)) { } else { listData.Add(ob.store); ListStores listStore = new ListStores() { store = Convert.ToString(i["store"]), storeSuburb = Convert.ToString(i["storeSuburb"]) }; listStores.Add(listStore); } } dataItems.Add(ob); } List <ListStores> listViewStore = new List <ListStores>(); if (listStores != null) { foreach (ListStores listStore in listStores) { int counter = 0; foreach (ListProduct listData in dataItems) { if (listData.store == listStore.store) { counter++; } } ListStores listStorez = new ListStores() { store = listStore.store, storeSuburb = listStore.storeSuburb, storeDetail = listStore.store + " (" + counter + " Items)" }; listViewStore.Add(listStorez); } // SharedUserData.listStore = listStores; } listView.ItemsSource = listViewStore; } catch (Exception ex) { DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); } }
public async void AssignHandler(Object sender, EventArgs e) { try { if (statusText.Text != "Assign") { activIndicator.IsRunning = true; string SBNotificationid = ""; OneSignal.Current.IdsAvailable((playerID, pushToken) => { SBNotificationid = playerID; // App.Current.MainPage.DisplayAlert("playerId", id.ToString(), "OK"); }); ApiCalling apiCall = new ApiCalling(); var deviceId = CrossDeviceInfo.Current.Id; if (SharedUserData.getUserData == null) { string userId = Convert.ToString(Application.Current.Properties["phoneNumber"]); string userUrl = ApiEndPoints.userDetail + userId; string content = await _client.GetStringAsync(userUrl); List <Dictionary <string, object> > posts = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(content); foreach (Dictionary <string, object> i in posts) { Dictionary <string, object> post = JsonConvert.DeserializeObject <Dictionary <string, object> >(Convert.ToString(i["properties"])); string deviceIdJson = Convert.ToString(post["deviceId"]); if (deviceIdJson == deviceId) { Dictionary <string, object> userDataRecord = JsonConvert.DeserializeObject <Dictionary <string, object> >(Convert.ToString(i["properties"])); SharedUserData.getUserData = userDataRecord; } } } Dictionary <string, object> userData = SharedUserData.getUserData; TrollyCreation ob = new TrollyCreation() { assigneeId = Convert.ToString(userData["UniqueID"]), //Smart Buyer Assigne ID trolliId = notificationAssignIds, // Trolli ID SBNotificationId = SBNotificationid // Smart Buyer OneSignal Notification UDID. }; string data = apiCall.TrollyTestTransaction(ob); // data = "[" + data + "]"; var values = JsonConvert.DeserializeObject <Dictionary <string, string> >(data); string ErrorMessage = ""; if (values != null) { ErrorMessage = values["Error Message"]; } if (ErrorMessage == "Invalid Record") { await DisplayAlert("", "This Trolli has been already assign", "Ok"); } else { await DisplayAlert("", "The Trolli has been assigned to you", "Ok"); apiCall.SendSBNotification(ob.assigneeId, clientNotificationId); statusText.Text = "Assign"; } } else { await DisplayAlert("", "This Trolli has been already assign", "Ok"); } activIndicator.IsRunning = false; } catch (Exception ex) { await DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); //Exception Class } }
public async void JobStatusHandler(object sender, EventArgs e) { try { bool connect = CrossConnectivity.Current.IsConnected; if (connect) { if (items.status == "Open") { bool check = await DisplayAlert("", "Are you sure to Cancel the Job", "Yes", "No"); if (check) { ApiCalling apiCall = new ApiCalling(); TrollyCreation trolly = new TrollyCreation { createdDate = items.createdDate, lastModifiedDate = DateTime.Now.ToString("dd/MM/yyyy"), trollyTitle = items.trollyTitle, trollyDetail = items.trollyDetail, trolliId = items.trolliId, clientId = items.clientId,//Convert.ToString(userData["simNumber"]), status = "Cancelled by Client", deliveryDateTime = items.deliveryDateTime, assigneeId = " ", SBNotificationId = " ", clientNotificationId = items.clientNotificationId }; // status.Text = ""; StatusUpdate("Cancelled by Client"); statusButton.Text = "Re-Open Job"; items.status = "Cancelled by Client"; apiCall.TrollyCreation(trolly); OnAppearing(); } } else if (items.status == "Cancelled by Client" || items.status == "Cancelled by Smart Buyer") { bool check = await DisplayAlert("", "Are you sure to re-open the Job", "Yes", "Cancel"); if (check) { ApiCalling apiCall = new ApiCalling(); TrollyCreation trolly = new TrollyCreation { createdDate = items.createdDate, lastModifiedDate = DateTime.Now.ToString("dd/MM/yyyy"), trollyTitle = items.trollyTitle, trollyDetail = items.trollyDetail, trolliId = items.trolliId, clientId = items.clientId,//Convert.ToString(userData["simNumber"]), status = "Open", deliveryDateTime = items.deliveryDateTime, assigneeId = " ", SBNotificationId = " ", clientNotificationId = items.clientNotificationId }; // status.Text = "Open"; StatusUpdate("Open"); statusButton.Text = "Cancel Job"; items.status = "Open"; apiCall.TrollyCreation(trolly); OnAppearing(); } } else if (items.status == "Assign") { bool check = await DisplayAlert("", "You are about to cancel this Trolli, while it is already assigned to someone. The $5 base fee and $5 as a penalty will still be charged. Are you sure you want to cancel?", "Yes", "No"); if (check) { chargePenalty(items.stripeChargeId); ApiCalling apiCall = new ApiCalling(); TrollyCreation trolly = new TrollyCreation { createdDate = items.createdDate, lastModifiedDate = DateTime.Now.ToString("dd/MM/yyyy"), trollyTitle = items.trollyTitle, trollyDetail = items.trollyDetail, trolliId = items.trolliId, clientId = items.clientId,//Convert.ToString(userData["simNumber"]), status = "Cancelled by Client", deliveryDateTime = items.deliveryDateTime, assigneeId = " ", SBNotificationId = " ", clientNotificationId = items.clientNotificationId, stripeChargeId = " " }; // status.Text = "Cancelled by Client"; StatusUpdate("Cancelled by Client"); statusButton.Text = "Re-Open Job"; items.status = "Cancelled by Client"; apiCall.TrollyCreation(trolly); apiCall.SendNotificationToSB(items.SBNotificationId); await DisplayAlert("", "Your Trolli has been cancelled", "Ok"); } } } else { await DisplayAlert("Uh Oh!", "It seems like you are not connected to internet. Retry once your connections is back", "Exit"); // internetCheck.IsVisible = true; // RetryVariable.IsVisible = true; } } catch (Exception ex) { DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); //Exception Class } }
public void SaveInDraft(Object sender, EventArgs e) { try { string UUIDs = ""; bool connect = CrossConnectivity.Current.IsConnected; if (connect) { if (CheckField()) { ApiCalling apiCall = new ApiCalling(); string clientNotificationId = ""; OneSignal.Current.IdsAvailable((playerID, pushToken) => { clientNotificationId = playerID; // App.Current.MainPage.DisplayAlert("playerId", id.ToString(), "OK"); }); Dictionary <string, object> userData = SharedUserData.getUserData; string deliveryDateTime = ""; UUIDs = Guid.NewGuid().ToString(); deliveryDateTime = "Not set";//currentDate.Text + " " + currentTime.Text; TrollyCreation trolly = new TrollyCreation { createdDate = DateTime.Now.ToString("dd/MM/yyyy"), lastModifiedDate = DateTime.Now.ToString("dd/MM/yyyy"), trollyTitle = trolliTitle.Text, trollyDetail = GetItemsInJson(), trolliId = UUIDs, clientId = Convert.ToString(userData["UniqueID"]), status = "Draft", deliveryDateTime = deliveryDateTime, assigneeId = " ", clientNotificationId = clientNotificationId, SBNotificationId = " " }; apiCall.TrollyCreation(trolly); SharedUserData.draftRecord = trolly; // SharedUserData.listStore = new ObservableCollection<ListStores>(); // SharedUserData.addProduct = new ObservableCollection<ListProduct>(); DisplayAlert("", "Trolli saved", "Ok"); // Navigation.PushAsync(new FeesCalculation()); } else { DisplayAlert("", "Enter the name Trolly Title", "Ok"); } } else { DisplayAlert("Uh Oh!", "It seems like you are not connected to internet. Retry once your connections is back", "Exit"); // internetCheck.IsVisible = true; // RetryVariable.IsVisible = true; } }catch (Exception ex) { DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); } }
public void CloneHandle(Object sender, EventArgs e) { try { // if (e.SelectedItem == null) return; TrollyCreation trollyDetail = (sender as Button).CommandParameter as TrollyCreation; ObservableCollection <ListProduct> dataItems = new ObservableCollection <ListProduct>(); ObservableCollection <ListStores> listStores = new ObservableCollection <ListStores>(); SharedUserData.addProduct = null; string trollyData = "[" + trollyDetail.trollyDetail + "]"; List <Dictionary <string, object> > posts = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(trollyData); // listView.ItemsSource = posts; bool check = true; foreach (Dictionary <string, object> i in posts) { ListProduct ob = new ListProduct() { detailItem = Convert.ToString(i["detailItem"]), description = Convert.ToString(i["description"]), items = Convert.ToString(i["items"]), quantity = Convert.ToInt32(i["quantity"]), size = Convert.ToString(i["size"]), store = Convert.ToString(i["store"]), storeSuburb = Convert.ToString(i["storeSuburb"]), unit = Convert.ToString(i["unit"]) }; if (check) { listData.Add(ob.store); ListStores listStore = new ListStores() { store = Convert.ToString(i["store"]), storeSuburb = Convert.ToString(i["storeSuburb"]) }; listStores.Add(listStore); check = false; } else { if (listData.Contains(ob.store)) { } else { listData.Add(ob.store); ListStores listStore = new ListStores() { store = Convert.ToString(i["store"]), storeSuburb = Convert.ToString(i["storeSuburb"]) }; listStores.Add(listStore); } } dataItems.Add(ob); } // SharedUserData.listStore = listStores; SharedUserData.addProduct = dataItems; UpdateStoreList(); if (trollyDetail.status == "Draft") { TrollyCreation trolly = new TrollyCreation { createdDate = trollyDetail.createdDate, lastModifiedDate = DateTime.Now.ToString("dd/MM/yyyy"), trollyTitle = trollyDetail.trollyTitle, trollyDetail = trollyDetail.trollyDetail, trolliId = trollyDetail.trolliId, clientId = trollyDetail.clientId,//Convert.ToString(userData["UniqueID"]), status = "Draft", deliveryDateTime = trollyDetail.deliveryDateTime, assigneeId = " ", clientNotificationId = trollyDetail.clientNotificationId, SBNotificationId = " " }; SharedUserData.draftRecord = trolly; } Navigation.PushAsync(new CreateTrolli()); } catch (Exception ex) { DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); } }
public async void CancelJobHandler(object sender, EventArgs e) { try { bool connect = CrossConnectivity.Current.IsConnected; var locator = CrossGeolocator.Current; if (connect) { if (!locator.IsGeolocationAvailable || !locator.IsGeolocationEnabled) { await DisplayAlert("", "Trolli app requires access to location services, in order to function properly. If you do not allow location access, some features may not work as expected.", "Ok"); } else { if (items.status == "Assign") { bool check = await DisplayAlert("", "Are you sure to Cancel the Job?", "Yes", "No"); if (check) { ApiCalling apiCall = new ApiCalling(); TrollyCreation trolly = new TrollyCreation { createdDate = items.createdDate, lastModifiedDate = DateTime.Now.ToString("dd/MM/yyyy"), trollyTitle = items.trollyTitle, trollyDetail = items.trollyDetail, trolliId = items.trolliId, clientId = items.clientId,//Convert.ToString(userData["simNumber"]), status = "Open", deliveryDateTime = items.deliveryDateTime, assigneeId = " ", SBNotificationId = " ", clientNotificationId = items.clientNotificationId, stripeChargeId = items.stripeChargeId }; StatusUpdate("Cancelled by Shopper"); // statusButton.Text = "Re-Open Job"; items.status = "Cancelled by Shopper"; apiCall.TrollyCreation(trolly); apiCall.SendNotificationToClient(items.clientNotificationId); apiCall.SendNotificationWhenSBCancelled(items.trolliId, items.clientNotificationId, items.SBNotificationId); OnAppearing(); } } } } else { await DisplayAlert("Uh Oh!", "It seems like you are not connected to internet. Retry once your connections is back", "Exit"); // internetCheck.IsVisible = true; // RetryVariable.IsVisible = true; } } catch (Exception ex) { await DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); //Exception Class } }
public async void FindSmartBuyer(Object sender, EventArgs e) { try { // searchText.IsVisible = true; StripeConfiguration.SetApiKey("sk_test_Q5wSnyXL03yN0KpPaAMYttOb"); if (IsCardAvailable) { /* ChargeDestinationCreateOptions chargeDestination = new ChargeDestinationCreateOptions { * Account = "acct_1DWkSgB4PaSzuOZk", * Amount = 1000 * }; */ var charge = new ChargeCreateOptions { Amount = Convert.ToInt32(50 * 100), // In cents, not dollars, times by 100 to convert Currency = "aud", // or the currency you are dealing with CustomerId = Convert.ToString(userData["stripeCustomerId"]), Capture = false }; var services = new ChargeService(); var response = services.Create(charge); TrollyCreation trolly = new TrollyCreation() { createdDate = trollyCreation.createdDate, lastModifiedDate = DateTime.Now.ToString("dd/MM/yyyy"), trollyTitle = trollyCreation.trollyTitle, trollyDetail = trollyCreation.trollyDetail, trolliId = trollyCreation.trolliId, clientId = trollyCreation.clientId, status = "Open", deliveryDateTime = trollyCreation.deliveryDateTime, assigneeId = " ", clientNotificationId = trollyCreation.clientNotificationId, SBNotificationId = " ", stripeChargeId = response.Id }; api.TrollyCreation(trolly); searchText.IsVisible = true; await Navigation.PushAsync(new FindSmartBuyer()); await DisplayAlert("", "Transaction Id: " + response.Id, "Ok"); } else { /* var options = new TransferCreateOptions * { * Amount = 400, * Currency = "aud", * Destination = "acct_1DWlL0LUUlibc6UD" * }; * * var service = new TransferService(); * Transfer Transfer = service.Create(options); * * //-------Get IP Address---------// * var MyIp = ""; * string uploadId = ""; * foreach (IPAddress adress in Dns.GetHostAddresses(Dns.GetHostName())) * { * MyIp = adress.ToString(); * break; * } * * //------Camera will Open User take the Picture Of Idenity Card-----------// * var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions * { * Directory = "Sample", * Name = "test.jpg", * PhotoSize = Plugin.Media.Abstractions.PhotoSize.Small * * }); * * //-------Upload File in stripe and return the file Id -------------// * using (FileStream stream = System.IO.File.Open(file.Path, FileMode.Open)) * { * var fileService = new FileService(); * var fileCreateOptions = new FileCreateOptions * { * File = stream, * Purpose = "identity_document", * }; * Stripe.File upload = fileService.Create(fileCreateOptions); * uploadId = upload.Id; * } * * //------Set File.id-----/// * AccountVerificationOptions verifiy = new AccountVerificationOptions { DocumentId = uploadId, }; * * * * //--------Create User Account Legal Entity-----------// * AccountLegalEntityOptions legalEntity = new AccountLegalEntityOptions * { * FirstName = "Saeed", * LastName = "Ali", * Address = new AddressOptions { City = "Sydney", Country = "AU", PostalCode = "5106", Line1 = "Home", State = "Victoria" }, * Dob = new AccountDobOptions { Day = 12, Month = 09, Year = 1990 }, * Type = "individual", * Verification = verifiy, * PhoneNumber = "+6112345678" * }; * * //--------Create Payout Account-----------// * var options = new AccountCreateOptions * { * Email = "*****@*****.**", * Type = AccountType.Custom, * Country = "AU", * LegalEntity = legalEntity * }; * var services = new AccountService(); * Account account = services.Create(options); * * * //---------Create External Bank Account and return Token---------/// * TokenCreateOptions optionss = new TokenCreateOptions * { * BankAccount = new BankAccountOptions * { * Country = "AU", * AccountNumber = "000123456", * RoutingNumber = "110000", * Currency = "aud" * * } * }; * TokenService service = new TokenService(); * Token stripeToken = service.Create(optionss); * * * var externalOption = new ExternalAccountCreateOptions * { * ExternalAccountTokenId = stripeToken.Id, //pass the bank account creation token * }; * var externalAccount = new ExternalAccountService(); * var bankAccount = externalAccount.Create(account.Id, externalOption); //Bank Account Created * * // await DisplayAlert("", "" + account.Id, "Ok"); * //api.AcceptedStripeAgreement(account.Id,CurrentTimeMillis(), MyIp); //Accepted Stripe TOS * * * * * * */ /* * AccountTosAcceptanceOptions tos = new AccountTosAcceptanceOptions() * { * Ip = MyIp, * Date = DateTime.Now.AddMilliseconds(1234) * }; * DisplayAlert("", "" + DATE, "Ok"); * TokenCreateOptions optionss = new TokenCreateOptions * { * BankAccount = new BankAccountOptions * { * Country = "AU", * AccountNumber = "000123456", * RoutingNumber = "110000", * Currency = "aud" * * } * }; * TokenService service = new TokenService(); * Token stripeToken = service.Create(optionss); * * var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions * { * Directory = "Sample", * Name = "test.jpg", * PhotoSize = Plugin.Media.Abstractions.PhotoSize.Small * * }); * * AccountVerificationOptions verifiy = new AccountVerificationOptions { DocumentId = file.Path, }; * * AccountLegalEntityOptions legalEntity = new AccountLegalEntityOptions * { * FirstName = "Usman", * LastName = "Kamran", * Address = new AddressOptions { City = "Sydney", Country = "AU", PostalCode = "5106", Line1 = "Home", State = "Victoria"}, * Dob = new AccountDobOptions { Day = 12, Month = 09, Year = 1990}, * Verification = verifiy, * Type = "individual", * * }; * var options = new AccountCreateOptions * { * Email = "*****@*****.**", * Type = AccountType.Custom, * Country = "AU", * LegalEntity =legalEntity * }; * * var services = new AccountService(); * Account account = services.Create(options); * DisplayAlert("", "" + account.TosAcceptance.Ip, "Ok"); * */ // DisplayAlert("", "" + tos.Date, "Ok"); string cardHolderNameVar = cardHolderName.Text; string cardNumberVar = cardNumber.Text; string experiationDateVar = experiationDate.Text; string cvvVar = cvcNumber.Text; TokenCreateOptions options = new TokenCreateOptions { Card = new CreditCardOptions { Number = cardNumberVar, ExpYear = 2019, ExpMonth = 11, Cvc = cvvVar, Name = cardHolderNameVar } }; TokenService service = new TokenService(); Token stripeToken = service.Create(options); var customerOptions = new CustomerCreateOptions { Email = Convert.ToString(userData["email"]), SourceToken = stripeToken.Id, }; var customerService = new CustomerService(); Customer customer = customerService.Create(customerOptions); var charge = new ChargeCreateOptions { Amount = Convert.ToInt32(50 * 100), // In cents, not dollars, times by 100 to convert Currency = "aud", // or the currency you are dealing with CustomerId = customer.Id, Capture = false }; var services = new ChargeService(); var response = services.Create(charge); await DisplayAlert("", "Transaction Id: " + response.Id, "Ok"); ApiCalling api = new ApiCalling(); api.CreateStripeCustomerId(Convert.ToString(userData["simNumber"]), customer.Id); // TrollyCreation trolly = new TrollyCreation() { createdDate = trollyCreation.createdDate, lastModifiedDate = DateTime.Now.ToString("dd/MM/yyyy"), trollyTitle = trollyCreation.trollyTitle, trollyDetail = trollyCreation.trollyDetail, trolliId = trollyCreation.trolliId, clientId = trollyCreation.clientId, status = "Open", deliveryDateTime = trollyCreation.deliveryDateTime, assigneeId = " ", clientNotificationId = trollyCreation.clientNotificationId, SBNotificationId = " ", stripeChargeId = response.Id }; api.TrollyCreation(trolly); // DisplayAlert("", output, "OK"); // Application.Current.Properties["paymentCardInfo"] = output; searchText.IsVisible = true; await Navigation.PushAsync(new FindSmartBuyer()); } } catch (Exception ex) { await DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); } // Navigation.PushAsync(new FindSmartBuyer()); // DisplayAlert("", "" + name, "Ok"); // Charge the Customer instead of the card: /* var chargeOptions = new ChargeCaptureOptions * { * Amount = 50, * }; * var chargeService = new ChargeService(); * Charge charge = chargeService.Capture("ch_1DUTlGBXLNpDm6rJjHQFSzhL", chargeOptions, null); */ // var service = new ChargeService(); // Charge charge = service.Capture("ch_1DUCTtBXLNpDm6rJzTe5o7Nl", null,null); // YOUR CODE: Save the customer ID and other info in a database for later. // When it's time to charge the customer again, retrieve the customer ID. /* TokenCreateOptions options = new TokenCreateOptions * { * Card = new CreditCardOptions * { * Number = info.cardNumber, * ExpYear = Convert.ToInt32(info.experationDate), * ExpMonth = 11, * Cvc = info.cvvNumber, * * } * }; * * TokenService service = new TokenService(); * Token stripeToken = service.Create(options); */ /*var charge = new ChargeCreateOptions * { * Amount = Convert.ToInt32(43.65 * 100), // In cents, not dollars, times by 100 to convert * Currency = "aud", // or the currency you are dealing with * Description = "2018110901", * CustomerId = "cus_DvIGCEtsC9BZxL", * Capture = false * }; * var services = new ChargeService(); * var response = services.Create(charge);*/ // Record or do something with the charge information // Navigation.PushAsync(new FindSmartBuyer(), true); }
public void CloneHandle(Object sender, EventArgs e) { try { // if (e.SelectedItem == null) return; TrollyCreation trollyDetail = (sender as Button).CommandParameter as TrollyCreation; ObservableCollection <ListProduct> dataItems = new ObservableCollection <ListProduct>(); ObservableCollection <ListStores> listStores = new ObservableCollection <ListStores>(); SharedUserData.addProduct = null; string trollyData = "[" + trollyDetail.trollyDetail + "]"; List <Dictionary <string, object> > posts = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(trollyData); // listView.ItemsSource = posts; bool check = true; foreach (Dictionary <string, object> i in posts) { ListProduct ob = new ListProduct() { detailItem = Convert.ToString(i["detailItem"]), description = Convert.ToString(i["description"]), items = Convert.ToString(i["items"]), quantity = Convert.ToInt32(i["quantity"]), size = Convert.ToString(i["size"]), store = Convert.ToString(i["store"]), storeSuburb = Convert.ToString(i["storeSuburb"]), unit = Convert.ToString(i["unit"]) }; if (check) { listData.Add(ob.store); ListStores listStore = new ListStores() { store = Convert.ToString(i["store"]), storeSuburb = Convert.ToString(i["storeSuburb"]) }; listStores.Add(listStore); check = false; } else { if (listData.Contains(ob.store)) { } else { listData.Add(ob.store); ListStores listStore = new ListStores() { store = Convert.ToString(i["store"]), storeSuburb = Convert.ToString(i["storeSuburb"]) }; listStores.Add(listStore); } } dataItems.Add(ob); } // SharedUserData.listStore = listStores; SharedUserData.addProduct = dataItems; UpdateStoreList(); Navigation.PushAsync(new CreateTrolli()); } catch (Exception ex) { DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); } }