Пример #1
0
        public JsonResult BuscarClienteSigo(int tipoDocumento, string documento)
        {
            //load settings for a chosen store scope
            // return RedirectToRoute("CustomerSigoCreditos");
            SigoCreditosInfoModel result = CRMContext.CRMContext.ObtenerCliente(tipoDocumento, documento);

            //SigoCreditosInfoModel result = new SigoCreditosInfoModel
            //{
            //    CostumerLastName = "Linares",
            //    SigoClubId = Convert.ToInt64(new Random().Next(1000, 2000)),
            //    EntityId = Convert.ToInt64(new Random().Next(1000, 2000)),
            //    CostumerName = "Carol",
            //    CostumerPhone = "0295-65874023",
            //    CustomerDocumentType = tipoDocumento,
            //    CustomerDocumentValue = documento
            //};
            if (result.EntityId == 0)
            {
                result = null;
            }


            return(Json(result));


            //now clear settings cache
        }
Пример #2
0
        public IActionResult Abonar(SigoCreditosInfoModel model)
        {
            long Cod_Abono = 0;

            try
            {
                if (!ModelState.IsValid)
                {
                    return(Configure());
                }
                var result = CRMContext.CRMContext.AbonarPuntos(model);
                if (result != null)
                {
                    var SCPaypalmodel = new SigoCreditosPaypal
                    {
                        TransaccionPaypalID = model.IdTransaccion,
                        TransaccionCreditID = result.Cod_Abono,
                        CedulaReceptor      = model.AddBalanceModel.OwnerBalance == 1 ? model.CustomerDocumentValue : model.AddBalanceModel.ReceiverDocumentValue,
                        Estatus_Operacion   = result.Cod_Abono != 0 ? true : false,
                        Monto          = Convert.ToDecimal(model.AddBalanceModel.TransactionAmount),
                        FechaCreacion  = DateTime.Now,
                        NombreReceptor = model.CostumerName,
                        CustomerID     = model.CustomerID,
                    };
                    model.Cod_Abono = result.Cod_Abono;
                    _SigoCreditosPayPalService.InsertSigoCreditosPaypal(SCPaypalmodel);
                    return(Json(model));
                    //return RedirectToRoute("CustomerSigoCreditos");
                }
                else
                {
                    return(Configure());
                }
            }
            catch (Exception ex)
            {
                var SCPaypalmodel = new SigoCreditosPaypal
                {
                    TransaccionPaypalID = model.IdTransaccion,
                    TransaccionCreditID = model.Cod_Abono,
                    CedulaReceptor      = model.AddBalanceModel.OwnerBalance == 1 ? model.CustomerDocumentValue : model.AddBalanceModel.ReceiverDocumentValue,
                    Estatus_Operacion   = false,
                    Monto          = Convert.ToDecimal(model.AddBalanceModel.TransactionAmount.Replace(".", string.Empty).Replace(",", ".").Trim()),
                    FechaCreacion  = DateTime.Now,
                    NombreReceptor = model.CostumerName,
                    CustomerID     = model.CustomerID,
                };
                _SigoCreditosPayPalService.InsertSigoCreditosPaypal(SCPaypalmodel);
                return(Json(model));
                //throw ex;
            }


            //now clear settings cache
        }
Пример #3
0
 public static bool ConsumirPuntos(SigoCreditosInfoModel model)
 {
     try
     {
         //ApiCloudService.MDBResponseOflong response = ApiClient.ConsumePointsAsync(model.SigoClubId, "34", model.NumberAccount, model.CustomerDocumentValue, model.OldAmount, model.Amount, 0, ApiCloudService.mConsume.eTipoOperacionesMovimiento.ConsumoSaldo_Ecommerce).Result;
         return(false);//response.body != 0 ? true : false;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #4
0
        public IActionResult Abonar(SigoCreditosInfoModel model)
        {
            bool esGiftCard = string.IsNullOrWhiteSpace(model.Abono.IndGiftCard) ? false : Convert.ToBoolean(model.Abono.IndGiftCard);

            if (esGiftCard)
            {
                model.Abono.MontoTransaccion = model.Abono.MontoTransaccionGiftCard;
            }

            TransaccionModel transaccion = new TransaccionModel(model);

            try
            {
                if (!ModelState.IsValid)
                {
                    return(Configure());
                }

                var result = esGiftCard  ? CRMContext.CRMContext.EnviarGiftCard(model) : CRMContext.CRMContext.AbonarPuntos(model);
                if (result != null)
                {
                    model.Abono.Cod_Abono           = result.Cod_Abono;
                    transaccion.Cod_Abono           = result.Cod_Abono;
                    model.Abono.TransaccionPayPalId = transaccion.TransaccionPaypalID;
                    transaccion.Estatus_Operacion   = result.Cod_Abono != 0 ? true : false;
                    InsertarPaypal(transaccion);
                    return(Json(model));
                }
                else
                {
                    transaccion.Estatus_Operacion   = false;
                    model.Abono.TransaccionPayPalId = transaccion.TransaccionPaypalID;
                    InsertarPaypal(transaccion);
                    return(Json(model));
                }
            }
            catch (Exception)
            {
                model.Abono.TransaccionPayPalId = transaccion.TransaccionPaypalID;
                transaccion.Estatus_Operacion   = false;
                InsertarPaypal(transaccion);
                return(Json(model));
                //throw ex;
            }
        }
Пример #5
0
        public IViewComponentResult Invoke()
        {
            var model = new SigoCreditosInfoModel()
            {
                //CreditCardTypes = new List<SelectListItem>
                //{
                //    new SelectListItem { Text = "Visa", Value = "visa" },
                //    new SelectListItem { Text = "Master card", Value = "MasterCard" },
                //    new SelectListItem { Text = "Discover", Value = "Discover" },
                //    new SelectListItem { Text = "Amex", Value = "Amex" },
                //}
            };

            //years
            //for (var i = 0; i < 15; i++) {
            //    var year = (DateTime.Now.Year + i).ToString();
            //    model.ExpireYears.Add(new SelectListItem { Text = year, Value = year, });
            //}

            ////months
            //for (var i = 1; i <= 12; i++) {
            //    model.ExpireMonths.Add(new SelectListItem { Text = i.ToString("D2"), Value = i.ToString(), });
            //}

            ////set postback values (we cannot access "Form" with "GET" requests)
            //if (this.Request.Method != WebRequestMethods.Http.Get) {
            //    var form = this.Request.Form;
            //    model.CardholderName = form["CardholderName"];
            //    model.CardNumber = form["CardNumber"];
            //    model.CardCode = form["CardCode"];
            //    var selectedCcType = model.CreditCardTypes.FirstOrDefault(x => x.Value.Equals(form["CreditCardType"], StringComparison.InvariantCultureIgnoreCase));
            //    if (selectedCcType != null)
            //        selectedCcType.Selected = true;
            //    var selectedMonth = model.ExpireMonths.FirstOrDefault(x => x.Value.Equals(form["ExpireMonth"], StringComparison.InvariantCultureIgnoreCase));
            //    if (selectedMonth != null)
            //        selectedMonth.Selected = true;
            //    var selectedYear = model.ExpireYears.FirstOrDefault(x => x.Value.Equals(form["ExpireYear"], StringComparison.InvariantCultureIgnoreCase));
            //    if (selectedYear != null)
            //        selectedYear.Selected = true;
            //}

            return(View("~/Plugins/Payments.SigoCreditos/Views/SigoCreditosInfo.cshtml", model));
        }
Пример #6
0
        /// <summary>
        /// Asigna codigos giftcard a un cliente.
        /// </summary>
        /// <param name="pGifcardModel"></param>
        /// <returns></returns>
        public static wsCRM.mAbonosCredito EnviarGiftCard(SigoCreditosInfoModel pGifcardModel)
        {
            try
            {
                wsCRM.mCliente client = cRMClient.ObtenerPuntosxClienteAsync(pGifcardModel.Abono.Receptor.TipoDocumento, pGifcardModel.Abono.Receptor.Documento).Result;

                // var result=  cRMClient.CrearVenderGiftCardAsync(0, pGifcardModel.Abono.Receptor.EntityId, client, 1, 2, Convert.ToDecimal(pGifcardModel.Abono.MontoTransaccionGiftCard), "Dolares", true).Result;
                var vResult = new wsCRM.mAbonosCredito
                {
                    Cod_Abono = 0//result
                };

                return(vResult);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #7
0
        /// <summary>
        /// Validate payment form
        /// </summary>
        /// <param name="form">The parsed form values</param>
        /// <returns>List of validating errors</returns>
        public IList <string> ValidatePaymentForm(IFormCollection form)
        {
            var warnings = new List <string>();

            //validate
            var validator = new SigoCreditosInfoValidator(_localizationService);
            var model     = new SigoCreditosInfoModel
            {
                //CardholderName = form["CardholderName"],
                //CardNumber = form["CardNumber"],
                //CardCode = form["CardCode"],
                //ExpireMonth = form["ExpireMonth"],
                //ExpireYear = form["ExpireYear"]
            };
            var validationResult = validator.Validate(model);

            if (!validationResult.IsValid)
            {
                warnings.AddRange(validationResult.Errors.Select(error => error.ErrorMessage));
            }

            return(warnings);
        }
Пример #8
0
        public static wsCRM.mAbonosCredito AbonarPuntos(SigoCreditosInfoModel pModel)
        {
            try
            {
                wsCRM.IwsCRMClient cRMClient = new wsCRM.IwsCRMClient(wsCRM.IwsCRMClient.EndpointConfiguration.BasicHttpBinding_IwsCRM);
                wsCRM.mCliente     clienteA  = new wsCRM.mCliente();
                wsCRM.mCliente     client    = pModel.AddBalanceModel.OwnerBalance == 1
                ? new wsCRM.mCliente()
                {
                    Cod_SigoClub = pModel.AddBalanceModel.CustomerSigoClubId, Cedula = pModel.CustomerDocumentValue
                }
                : cRMClient.ObtenerPuntosxClienteAsync(pModel.AddBalanceModel.ReceiverDocumentType, pModel.AddBalanceModel.ReceiverDocumentValue).Result;

                // wsCRM.mAbonosCredito result = cRMClient.GenerarAbonoPuntosAsync(client.Cod_SigoClub, "00", 2, new wsCRM.mCliente(), "", pModel.AddBalanceModel.TransactionAmount, 13440, 44, "", false, "Dolar", (wsCRM.CodigosTipoOperacionMov)TipoOperacionMov.EcormmerceAbonoSaldo, -1).Result;
                // wsCRM.mAbonosCredito result = cRMClient.GenerarAbonoPuntosAsync(client.Cod_SigoClub, "00", 2, new wsCRM.mCliente(), "", pModel.AddBalanceModel.TransactionAmount, 13440, 44, "", false, "Dolar", (wsCRM.CodigosTipoOperacionMov)TipoOperacionMov.CRMAbobodirectodesaldo, -1).Result;
                return(cRMClient.GenerarAbonoPuntosAsync(client.Cod_SigoClub, "00", 2, clienteA, "", Convert.ToDecimal(pModel.AddBalanceModel.TransactionAmount.Replace(".", string.Empty).Replace(",", ".").Trim()), 0, 44, "", false, "Dolar", (wsCRM.CodigosTipoOperacionMov)TipoOperacionMov.EcormmerceAbonoSaldo, -1).Result);
                //return CRMAbobodirectodesaldo
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #9
0
        public static SigoCreditosInfoModel ObtenerCliente(int pCodTipo, string pDocumento)
        {
            try
            {
                ApiCloudService.MDBResponseOfmClient3GCkhWO1 response = ApiClient.GetClientBalanceAsync(pCodTipo, pDocumento).Result;
                SigoCreditosInfoModel model = new SigoCreditosInfoModel();
                if (response.body != null)
                {
                    model.EntityId              = response.body.Code;
                    model.SigoClubId            = response.body.Cod_SigoClub;
                    model.NumberAccount         = response.body.Account.Count > 0 ? response.body.Account.Where(x => x.AccountType.Code == 7).FirstOrDefault().Number : 0;
                    model.CustomerDocumentValue = response.body.DNI;
                    model.OldAmount             = response.body.Account.Count > 0 ? (decimal)response.body.Account.Where(x => x.AccountType.Code == 7).FirstOrDefault().Balance : 0;
                    model.Amount = 0;
                }

                return(model);
            }
            catch (Exception)
            {
                SigoCreditosInfoModel model = new SigoCreditosInfoModel();
                return(model);
            }
        }