コード例 #1
0
        public ContentResult validaCreedenciales(int iccs, string txtgpCardNumero, int txtgpExpirationMonth, int txtgpExpirationYear, string txtgpCardCVC)
        {
            FourGeeksPayments api = new FourGeeksPayments();
            DataTable         ds  = new DataTable();

            ds = conDB.SP_SELECTS(ds, "Call sp_CargarPrecioCharla(" + iccs + ") ");

            if (ds.Rows.Count > 0)
            {
                DataRow info_Precio  = ds.Rows[0];
                int     precioCharla = Convert.ToInt32(info_Precio["precioCharla"]);
                Me      me           = api.GetMyDevInfo();
                Me      newMe        = api.UpdateMyDevInfo(me);

                SimpleCharge sp = new SimpleCharge();

                sp.Amount            = precioCharla;
                sp.Description       = CompraDeCharla;
                sp.EntityDescription = UnCafeParaSeguir;
                sp.Currency          = colones;
                sp.CreditCardNumber  = txtgpCardNumero;
                sp.CVC             = txtgpCardCVC;
                sp.ExpirationMonth = txtgpExpirationMonth;
                sp.ExpirationYear  = txtgpExpirationYear;

                var resPago = api.CreateSimpleCharge(sp);

                return(Content("" + resPago));
            }
            else
            {
                return(Content("SinPrecio"));
            }
        }
コード例 #2
0
        public bool CreateSimpleCharge(SimpleCharge simpleCharge)
        {
            try
            {
                var client  = new RestClient(SimpleChargeUrl);
                var request = new RestRequest(Method.POST);
                request.AddHeader("authorization", $"bearer {this.Token.Access_Token}");

                request.AddParameter("application/json", JsonConvert.SerializeObject(simpleCharge), ParameterType.RequestBody);

                return(ProcessResponse.Process(client.Execute(request), HttpStatusCode.Created));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }