/// <summary> /// Gets the URI of the recording for the specified ding. /// </summary> /// <param name="ding">The ding to get the recording URI for.</param> /// <returns>The URI for the recording of the provided ding.</returns> public async Task <Uri> GetRecordingUriAsync(Ding ding) { if (!ding.RecordingIsReady) { throw new ArgumentException("The provided ding does not have a recording available."); } var uri = DingRecordingUri.Replace("{id}", ding.Id.ToString()); var response = await SendRequestAsync(HttpMethod.Get, uri, AuthedSessionData, false); if (!response.IsSuccessStatusCode && response.StatusCode != HttpStatusCode.Found) { if (response.StatusCode == HttpStatusCode.Unauthorized) { throw new SecurityException("The Ring API returned the following error: " + response.ReasonPhrase); } else { throw new Exception("The Ring API returned the following error: " + response.ReasonPhrase); } } return(response.Headers.Location); }
public async Task <Ding.SendTransferResponse> DingSimular(object cuenta) { var phone1 = ""; if (cuenta is customer_info) { var customer = cuenta as customer_info; phone1 = customer.phone1; } else if (cuenta is account_info) { var account = cuenta as account_info; phone1 = account.phone1; } var reguest = new Ding.SendTransferRequest { AccountNumber = this.CodigoPais + this.Numero, SkuCode = "CU_NU_TopUp", SendValue = this.Monto, ValidateOnly = true, DistributorRef = phone1 }; return(await Ding.SendTransfer(reguest)); }
public async Task <bool> Simular() { var result = await Ding.SimulateTransfer(new Ding.SendTransferRequest { SkuCode = this.Code, AccountNumber = this.numero, SendValue = (float)this.monto, DistributorRef = _Global.CurrentAccount.phone1, ValidateOnly = true }); if (result is null) { this.topupResponse = new topupResponse { error_code = "-1" }; return(true); } if (result.TransferRecord.ProcessingState == "Complete") { this.topupResponse = new topupResponse { error_code = "0" }; } else { this.topupResponse = new topupResponse { error_code = "-1" }; } return(true); }
public async Task <IHttpActionResult> Get(string id) { var validateProducto = new ValidateProducto { IdCuenta = "5355043317", Producto = "5355043317", Monto = (float)20, TipoProducto = "movil" }; if (!string.IsNullOrEmpty(id)) { validateProducto = new ValidateProducto { IdCuenta = "5355043317", Producto = "5355043317", Monto = (float)20, TipoProducto = id }; } var Product = await Ding.GetProductsByaccountNumber(validateProducto.Producto); var Provider = await Ding.GetProvidersByaccountNumber(validateProducto.Producto); if (Product is null || Provider is null) { return(CreatedAtRoute("DefaultApi", null, new { })); }
public Trolli.Models.Paged <Ding> Get(string date, double lat, double lon, int pageIndex, int pageSize) { int totalCount = 0; Trolli.Models.Paged <Ding> responseBody = null; List <Ding> list = null; string procName = "[dbo].[Dings_SelectAllV2]"; _dataProvider.ExecuteCmd(procName , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Date", date); paramCollection.AddWithValue("@Lat", lat); paramCollection.AddWithValue("@Long", lon); paramCollection.AddWithValue("@pageIndex", pageIndex); paramCollection.AddWithValue("@pageSize", pageSize); } , singleRecordMapper : delegate(IDataReader reader, short set) { Trolli.Models.Domain.Ding dings = new Ding(); int startingIndex = 0; dings.DingId = reader.GetSafeInt32(startingIndex++); dings.DingCategory = reader.GetSafeString(startingIndex++); dings.Value = reader.GetSafeString(startingIndex++); dings.DateAdded = reader.GetSafeDateTime(startingIndex++); dings.CreatedBy = reader.GetSafeInt32(startingIndex++); dings.RouteId = reader.GetSafeInt32(startingIndex++); dings.StopId = reader.GetSafeInt32(startingIndex++); dings.StopDisplayName = reader.GetSafeString(startingIndex++); dings.Agency = reader.GetSafeString(startingIndex++); dings.Lat = reader.GetSafeDouble(startingIndex++); dings.Long = reader.GetSafeDouble(startingIndex++); startingIndex++; if (totalCount == 0) { totalCount = reader.GetSafeInt32(startingIndex++); } if (list == null) { list = new List <Ding>(); } list.Add(dings); } ); if (list != null) { responseBody = new Trolli.Models.Paged <Ding>(list, pageIndex, pageSize, totalCount); } return(responseBody); }
public async Task <IHttpActionResult> Get() { var validateProducto = new ValidateProducto { IdCuenta = "5355043317", Producto = "*****@*****.**", Monto = 5, TipoProducto = "nauta" }; var Product = await Ding.GetProductsByaccountNumber(validateProducto.Producto); var Provider = await Ding.GetProvidersByaccountNumber(validateProducto.Producto); if (Product is null || Provider is null) { ; } if (!Product.Items.Any() || !Provider.Items.Any()) { ; } var promociones = db.DingPromo.Where(x => x.Estado == true && validateProducto.Monto >= x.Min && validateProducto.Monto <= x.Max).ToList(); var result = new Producto(); try { result.Code = Product.Items.First().SkuCode; result.Image = "producto.png"; result.Name = Provider.Items.First().Name; result.ProviderCode = Provider.Items.First().ProviderCode; result.CountryIso = Provider.Items.First().CountryIso; result.MinValue = Product.Items.First().Minimum.SendValue; result.MaxValue = Product.Items.First().Maximum.SendValue; result.CommissionRate = (float)Product.Items.First().CommissionRate; result.ValidationRegex = Provider.Items.First().ValidationRegex; result.DisplayText = Product.Items.First().DefaultDisplayText; if (promociones.Any()) { result.Bono = promociones.First().MontoText; } } catch (Exception) { return(CreatedAtRoute("DefaultApi", null, new { })); } return(CreatedAtRoute("DefaultApi", null, result)); }
//public async Task<bool> Simular(string pnone1) //{ // using (var client = new HttpClient()) // { // client.BaseAddress = new Uri("http://smsteleyuma.azurewebsites.net/Service1.svc/TransferTo/"); // client.DefaultRequestHeaders.Accept.Clear(); // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // var param = new topupInfo() // { // msisdn = pnone1, // destination_msisdn = this.CodigoPais + this.Numero, // product = this.Monto.ToString(), // sender_sms = "yes", // action = "simulation" // }; // var response = await client.PostAsync("topup", param.AsJsonStringContent()); // var Result = await response.Content.ReadAsStringAsync(); // try // { // topupMovil.topupResponse = JsonConvert.DeserializeObject<topupResponse>(Result); // return true; // } // catch // { // return false; // } // } //} //public async Task<bool> recargar(string pnone1) //{ // using (var client = new HttpClient()) // { // client.BaseAddress = new Uri("http://smsteleyuma.azurewebsites.net/Service1.svc/TransferTo/"); // client.DefaultRequestHeaders.Accept.Clear(); // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // var param = new topupInfo() // { // msisdn = pnone1, // destination_msisdn = this.CodigoPais + this.Numero, // product = this.Monto.ToString(), // sender_sms = "yes", // action = "topup" // }; // var response = await client.PostAsync("topup", param.AsJsonStringContent()); // var Result = await response.Content.ReadAsStringAsync(); // try // { // topupMovil.topupResponse = JsonConvert.DeserializeObject<topupResponse>(Result); // return true; // } // catch // { // return false; // } // } //} public async Task <Ding.SendTransferResponse> DingSimular(string phone1) { var reguest = new Ding.SendTransferRequest { AccountNumber = this.CodigoPais + this.Numero, SkuCode = "CU_CU_TopUp", SendValue = this.Monto, ValidateOnly = true, DistributorRef = phone1 }; return(await Ding.SendTransfer(reguest)); }
public async Task <IHttpActionResult> Post([FromBody] ValidateProducto validateProducto) { if (Autorize.TeleyumaLogin(this.Request.Headers).ErrorCode > 0) { return(CreatedAtRoute("DefaultApi", null, Autorize.TeleyumaLogin(this.Request.Headers))); } var Product = await Ding.GetProductsByaccountNumber(validateProducto.Producto); var Provider = await Ding.GetProvidersByaccountNumber(validateProducto.Producto); if (Product is null || Provider is null) { return(CreatedAtRoute("DefaultApi", null, new { })); } if (!Product.Items.Any() || !Provider.Items.Any()) { return(CreatedAtRoute("DefaultApi", null, new { })); } var promociones = db.DingPromo.Where(x => x.Estado == true && validateProducto.Monto >= x.Min && validateProducto.Monto <= x.Max).ToList(); var result = new Producto(); try { result.Code = Product.Items.First().SkuCode; result.Image = "producto.png"; result.Name = Provider.Items.First().Name; result.ProviderCode = Provider.Items.First().ProviderCode; result.CountryIso = Provider.Items.First().CountryIso; result.MinValue = Product.Items.First().Minimum.SendValue; result.MaxValue = Product.Items.First().Maximum.SendValue; result.CommissionRate = (float)Product.Items.First().CommissionRate; result.ValidationRegex = Provider.Items.First().ValidationRegex; result.DisplayText = Product.Items.First().DefaultDisplayText; if (promociones.Any()) { result.Bono = promociones.First().MontoText; } } catch (Exception) { return(CreatedAtRoute("DefaultApi", null, new { })); } return(CreatedAtRoute("DefaultApi", null, result)); }
public async void CargarPromo() { try { var promo = await Ding.GetPromoActiva(); PromoActiva = promo.Promo; ShowPromoActiva = true; } catch (Exception ex) { ShowPromoActiva = false; } Task.Delay(5000); CargarPromo(); }
private void cmdPlay_Click(object sender, RoutedEventArgs e) { if (winter) { img.Source = new BitmapImage(new Uri("images/Blue hills.jpg", UriKind.Relative)); Ding.Stop(); Ding.Play(); } else { Sound.Stop(); Sound.Play(); img.Source = new BitmapImage(new Uri("pack://application:,,,/images/winter.jpg")); } winter = !winter; }
// POST: api/TopUp public async Task <IHttpActionResult> Post([FromBody] Teleyuma.Teleyuma.TopUpRequest topUpRequest) { if (Autorize.TeleyumaLogin(this.Request.Headers).ErrorCode > 0) { return(CreatedAtRoute("DefaultApi", null, Autorize.TeleyumaLogin(this.Request.Headers))); } //Transformar datos var DingRequest = new Ding.SendTransferRequest(); DingRequest.SkuCode = topUpRequest.SkuCode; DingRequest.AccountNumber = topUpRequest.AccountNumber; DingRequest.SendValue = topUpRequest.SendValue; DingRequest.DistributorRef = topUpRequest.DistributorRef; DingRequest.ValidateOnly = topUpRequest.ValidateOnly; var result = await Ding.SendTransfer(DingRequest); return(CreatedAtRoute("DefaultApi", null, result)); }
public List <Ding> Post(DingSelectRoute model) { string storedProc = "[dbo].[Dings_SelectList]"; List <Ding> dingList = new List <Ding>(); _dataProvider.ExecuteCmd(storedProc , inputParamMapper : delegate(SqlParameterCollection sqlParams) { DingSelectRoute dingSelect = new DingSelectRoute(); SqlParameter p = new SqlParameter("@RouteId", System.Data.SqlDbType.Structured); if (model.RouteId != null && model.RouteId.Any()) { p.Value = new Trolli.Data.IntIdTable(model.RouteId); } sqlParams.Add(p); sqlParams.AddWithValue("@DateAdded", model.Date); } , singleRecordMapper : delegate(IDataReader reader, short set) { Ding ding = new Ding(); int startingIndex = 0; ding.DingId = reader.GetSafeInt32(startingIndex++); ding.DingCategory = reader.GetSafeString(startingIndex++); ding.Value = reader.GetSafeString(startingIndex++); ding.DateAdded = reader.GetSafeDateTime(startingIndex++); ding.CreatedBy = reader.GetSafeInt32(startingIndex++); ding.RouteId = reader.GetSafeInt32(startingIndex++); ding.StopId = reader.GetSafeInt32(startingIndex++); ding.StopDisplayName = reader.GetSafeString(startingIndex++); ding.Agency = reader.GetSafeString(startingIndex++); ding.Lat = reader.GetSafeDouble(startingIndex++); ding.Long = reader.GetSafeDouble(startingIndex++); dingList.Add(ding); }); return(dingList); }
public List <Ding> Get(LatLongRequest model) { string storedProc = "[dbo].[Dings_SelectAll]"; List <Ding> dingData = null; _dataProvider.ExecuteCmd(storedProc , inputParamMapper : delegate(SqlParameterCollection sqlParams) { sqlParams.AddWithValue("@Date", model.Date); sqlParams.AddWithValue("@Lat", model.Lat); sqlParams.AddWithValue("@Long", model.Long); } , singleRecordMapper : delegate(IDataReader reader, short set) { Ding ding = new Ding(); int startingIndex = 0; ding.DingId = reader.GetSafeInt32(startingIndex++); ding.DingCategory = reader.GetSafeString(startingIndex++); ding.Value = reader.GetSafeString(startingIndex++); ding.DateAdded = reader.GetSafeDateTime(startingIndex++); ding.CreatedBy = reader.GetSafeInt32(startingIndex++); ding.RouteId = reader.GetSafeInt32(startingIndex++); ding.StopId = reader.GetSafeInt32(startingIndex++); ding.StopDisplayName = reader.GetSafeString(startingIndex++); ding.Agency = reader.GetSafeString(startingIndex++); ding.Lat = reader.GetSafeDouble(startingIndex++); ding.Long = reader.GetSafeDouble(startingIndex++); ding.Miles = reader.GetSafeDouble(startingIndex++); if (dingData == null) { dingData = new List <Ding>(); } dingData.Add(ding); }); return(dingData); }
public async Task <IHttpActionResult> Get(string id) { var result = await Ding.GetProductsByaccountNumber(id); return(CreatedAtRoute("DefaultApi", null, result)); }
// Start is called before the first frame update void Start() { D = FindObjectOfType <Ding>(); t.text = "hp:2"; }
// Start is called before the first frame update void Start() { D = FindObjectOfType <Ding>(); }
void Slider(bool stop) { float leftZone = 2.274f; float rightZone = 2.5f; bar.SetActive(true); slider.SetActive(true); RectTransform rectT = bar.GetComponent <RectTransform> (); float leftBound = bar.transform.position.x - rectT.rect.width / 2; float rightBound = bar.transform.position.x + rectT.rect.width / 2; Vector3 start = bar.transform.position; Vector3 curPos = slider.transform.position; goalCounter(goal.goalCount); missCounter(missedCount); if (goal.goalCount < 5) { if (!stop) { if (slider.transform.position.x > leftBound && direction == Vector3.left) { curPos.x -= sliderSpeed * Time.deltaTime; slider.transform.position = curPos; } else if (slider.transform.position.x < leftBound) { direction = Vector3.right; slider.transform.position = new Vector3((leftBound + .003f), 0.3f, 0); } if (slider.transform.position.x < rightBound && direction == Vector3.right) { curPos.x += sliderSpeed * Time.deltaTime; slider.transform.position = curPos; } else if (slider.transform.position.x > rightBound) { direction = Vector3.left; slider.transform.position = new Vector3((rightBound - .003f), (.3f - .223103f), 0); } } else if (slider.GetComponent <RectTransform> ().position.x >= leftZone && slider.GetComponent <RectTransform> ().position.x <= rightZone) { if (Input.GetKeyDown(KeyCode.Space)) { successCount++; goal.goalCount++; Ding.Play(); /*if (successCount == 5) { * img4.SetActive (false); * img5.SetActive (true); * img6.SetActive (true); * }*/ //Time.timeScale = 0; sliderSpeed += .1f; gameMessage.text = "Steal the test answers: " + goal.goalCount.ToString() + "/" + successLimit.ToString(); } } else if (!(slider.GetComponent <RectTransform> ().position.x >= leftZone && slider.GetComponent <RectTransform> ().position.x <= rightZone)) { if (Input.GetKeyDown(KeyCode.Space)) { missedCount++; progressTimer.text = missedCount.ToString(); Error.Play(); } if (missedCount >= missedLimit) { ComputerController c = GameObject.Find("Prefect_0").GetComponent <ComputerController> (); c.isAlerted = true; goal.isAlerted = true; Detected.Play(); //activate GameObject for exclamation point over Smart Kid for (int i = 0; i < alerts.Length; i++) { SpriteRenderer sp = alerts [i].GetComponent <SpriteRenderer> (); sp.enabled = true; } } } } else { //goalCount = 0; miniEnable = false; bar.SetActive(false); slider.SetActive(false); Miss1.SetActive(false); Miss2.SetActive(false); Miss3.SetActive(false); } }
public async Task <bool> Recargar() { var result = await Ding.SimulateTransfer(new Ding.SendTransferRequest { SkuCode = this.Code, AccountNumber = this.numero, SendValue = (float)this.monto, DistributorRef = _Global.CurrentAccount.phone1, ValidateOnly = false }); if (result is null) { this.topupResponse = new topupResponse { error_code = "-1" }; return(true); } if (result.TransferRecord.ProcessingState == "Complete") { this.topupResponse = new topupResponse { error_code = "0" }; } else { this.topupResponse = new topupResponse { error_code = "-1" }; } return(true); //using (var client = new HttpClient()) //{ // client.BaseAddress = new Uri("http://smsteleyuma.azurewebsites.net/Service1.svc/TransferTo/"); // client.DefaultRequestHeaders.Accept.Clear(); // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // var param = new topupInfo() // { // msisdn = "69999999999", // destination_msisdn = this.numero, // product = this.monto.ToString(), // sender_sms = "yes", // action = "topup" // }; // var response = await client.PostAsync("topup", param.AsJsonStringContent()); // var Result = await response.Content.ReadAsStringAsync(); // try // { // this.topupResponse = JsonConvert.DeserializeObject<topupResponse>(Result); // return true; // } // catch // { // return false; // } //} }
// GET: Recargas/Edit/5 public async Task <IActionResult> RecargarLista() { IsLogged(); var cuentaActiva = await ValidarCuentaActiva(); if (!cuentaActiva) { return(RedirectToAction("Salir", "Login")); } //Validar fondos var listaRecargas = await _context.RT_Recargas.Where(x => (x.status == RecargaStatus.en_lista || x.status == RecargaStatus.error) && x.activo && x.idCuenta == Logged.IdCuenta).ToListAsync(); var totalLisat = listaRecargas.Sum(x => x.monto); var fondos = await GetFondos(); if (fondos < totalLisat) { PrompErro("No tiene saldo suiciente, su crédito puede haber sido actualizado"); return(RedirectToAction(nameof(Index))); } else { string ding_token = ""; try { var credenciales = await _context.RT_Credenciales.ToListAsync(); var dingPeovvedor = credenciales.First(x => x.codigo == "ding"); ding_token = dingPeovvedor.token == null ? string.Empty : dingPeovvedor.token; } catch (Exception ex) { PrompErro("Error de credenciales del proveedor, contacte con soporte técnico"); return(RedirectToAction(nameof(Index))); } foreach (var item in listaRecargas) { var result = await Ding.SendTransfer(item, ding_token); item.TransactionDate = DateTime.Now.ToEasternStandardTime(); item.TransactionResultCode = result.ResultCode; item.TransactionMsg = result.ErrorCodes != null && result.ErrorCodes.Length > 0 ? result.ErrorCodes.FirstOrDefault().Code : null; if (Ding.simulate) { result.ResultCode = "1"; } if (Convert.ToInt32(result.ResultCode) > 2) { item.status = RecargaStatus.error; } else { item.status = RecargaStatus.success; } _context.RT_Recargas.Update(item); await _context.SaveChangesAsync(); } var Sumarbalance = listaRecargas.Where(x => x.status == RecargaStatus.success).Sum(x => x.monto); var cuenta = await _context.RT_Cuentas.FindAsync(Logged.IdCuenta); cuenta.Balance = cuenta.Balance + Sumarbalance; _context.RT_Cuentas.Update(cuenta); await _context.SaveChangesAsync(); await GetFondos(); } if (!listaRecargas.Where(x => x.status == RecargaStatus.error).Any()) { return(RedirectToAction(nameof(Index), new { success = true })); } else { return(RedirectToAction(nameof(Index), new { success = true })); } }