Ejemplo n.º 1
0
        public string Create(string planId, string name, int price, int intervalCount, int?trialPeriodDays = null, int?defaultCycleCount = null)
        {
            var currency = "CLP";
            var interval = "month";

            intervalCount = intervalCount < 1 ? 1 : intervalCount;
            string json = string.Empty;

            if (trialPeriodDays != null || defaultCycleCount != null)
            {
                json = JsonConvert.SerializeObject(new { id = planId, name, price, currency, interval, interval_count = intervalCount, trial_period_days = trialPeriodDays, default_cycle_count = defaultCycleCount });
            }
            else if (trialPeriodDays != null)
            {
                json = JsonConvert.SerializeObject(new { id = planId, name, price, currency, interval, interval_count = intervalCount, trial_period_days = trialPeriodDays });
            }
            else if (defaultCycleCount != null)
            {
                json = JsonConvert.SerializeObject(new { id = planId, name, price, currency, interval, interval_count = intervalCount, default_cycle_count = defaultCycleCount });
            }
            else
            {
                json = JsonConvert.SerializeObject(new { id = planId, name, price, currency, interval, interval_count = intervalCount });
            }


            SetUrl(Methods.Create);
            return(Service.PostPut(json));
        }
Ejemplo n.º 2
0
        public string CreateInscription(string customerId)
        {
            SetUrl(Methods.Create, customerId);
            string json = JsonConvert.SerializeObject(new { return_url = Service.ReturnFromQvo });

            return(Service.PostPut(json));
        }
Ejemplo n.º 3
0
        public string Create(string customerId, string planId, DateTime?start = null, bool prorate = true, int?cycleCount = null)
        {
            var     taxName    = "IVA";
            decimal taxPercent = 19m;

            start = start ?? DateTime.Now.AddHours(1);

            string json = string.Empty;

            if (!prorate && cycleCount != null)
            {
                json = JsonConvert.SerializeObject(new { customer_id = customerId, plan_id = planId, start, prorate, cycle_count = cycleCount, tax_name = taxName, tax_percent = taxPercent });
            }
            else if (cycleCount != null)
            {
                json = JsonConvert.SerializeObject(new { customer_id = customerId, plan_id = planId, start, cycle_count = cycleCount, tax_name = taxName, tax_percent = taxPercent });
            }
            else //(cycleCount == null)
            {
                json = JsonConvert.SerializeObject(new { customer_id = customerId, plan_id = planId, start, tax_name = taxName, tax_percent = taxPercent });
            }

            SetUrl(Methods.Create);
            return(Service.PostPut(json));
        }
Ejemplo n.º 4
0
        public string Create(string email, string name, string phone)
        {
            SetUrl(Methods.Create);
            string json = JsonConvert.SerializeObject(new { email, name, phone });

            return(Service.PostPut(json));
        }
Ejemplo n.º 5
0
        public void Create(int amount)
        {
            SetUrl(Methods.Create);
            string json = JsonConvert.SerializeObject(new { amount });

            Service.PostPut(json);
        }
Ejemplo n.º 6
0
        public void Refund(string transactionId, int amount)
        {
            SetUrl(Methods.Create, transactionId);
            //Confirmar con QVO si el parametro es obligatorio - documentacion no clara
            string json = JsonConvert.SerializeObject(new { amount });

            Service.PostPut(json);
        }