public static async Task UpdateUser(double lat, double lon) { //cache so we dont send teh same one again and again. just keep last one. if (lat == LastLat && lon == LastLon) { return; } LastLat = lat; LastLon = lon; Dictionary <string, object> requestDictionary = new Dictionary <string, object>(); requestDictionary.Add("lat", lat); requestDictionary.Add("lng", lon); NVCEndpoint endpoint = new NVCEndpoint(); endpoint.Method = NVCEndpoint.EndpointType.Put; endpoint.Controller = Mapping; await NVCRestHelper.Async(endpoint, requestDictionary, null); System.Diagnostics.Debug.WriteLine("User location updated on server: lat: " + lat + " lon: " + lon); }
public static async Task GetTranactions(List <Card> itemsToIgnore) { NVCEndpoint endpoint = new NVCEndpoint(); endpoint.Method = NVCEndpoint.EndpointType.Get; endpoint.Controller = Mapping; var data = await NVCRestHelper.Async(endpoint, new Dictionary <string, object>(), null); if (!data.Sucessful) { return; } var token = data.ReturnedData; if (token == null) { return; } var transactions = token["transactions"] as JArray; if (transactions == null) { return; } foreach (var transactionToken in transactions) { ParseTransaction(transactionToken, itemsToIgnore); } }
public static async Task <NVCRestResult> CreateUser() { NVCEndpoint endpoint = new NVCEndpoint(); endpoint.Method = NVCEndpoint.EndpointType.PostRaw; endpoint.Controller = Mapping; return(await NVCRestHelper.Async(endpoint, new Dictionary <string, object>(), null)); }
public static async Task UpdateUser(string oneSignalId) { Dictionary <string, object> requestDictionary = new Dictionary <string, object>(); requestDictionary.Add("oneSignalId", oneSignalId); NVCEndpoint endpoint = new NVCEndpoint(); endpoint.Method = NVCEndpoint.EndpointType.Put; endpoint.Controller = Mapping; await NVCRestHelper.Async(endpoint, requestDictionary, null); }
public static async Task <NVCRestResult> SendValidationCode(string email) { NVCEndpoint endpoint = new NVCEndpoint(); endpoint.Method = NVCEndpoint.EndpointType.PostRaw; endpoint.Controller = Mapping; Dictionary <string, object> requestDictionary = new Dictionary <string, object>(); requestDictionary.Add("email", email); return(await NVCRestHelper.Async(endpoint, requestDictionary, null)); }
public static async Task TerminateTransaction(string transactionId) { List <string> appendString = new List <string>() { transactionId, "terminate" }; NVCEndpoint endpoint = new NVCEndpoint(); endpoint.Method = NVCEndpoint.EndpointType.PostRaw; endpoint.Controller = Mapping; await NVCRestHelper.Async(endpoint, null, appendString); }
public static async Task <string> CreateTransaction(double lat, double lng, Card card, string userName) { //replace the card name w/ the users name var obj = card.ToJObject(); obj["name"] = userName; obj["uuid"] = Guid.NewGuid().ToString(); Dictionary <string, object> requestDictionary = new Dictionary <string, object>(); requestDictionary.Add("lat", lat); requestDictionary.Add("lng", lng); requestDictionary.Add("distance", 1); requestDictionary.Add("card", obj); NVCEndpoint endpoint = new NVCEndpoint(); endpoint.Method = NVCEndpoint.EndpointType.PostRaw; endpoint.Controller = Mapping; var data = await NVCRestHelper.Async(endpoint, requestDictionary, null); if (!data.Sucessful) { return(null); } var token = data.ReturnedData; if (token["id"] == null) { return(null); } var transactionId = (string)token["id"]; return(transactionId); }