static void getPreauthorization() { Paymill.ApiKey = Properties.Settings.Default.ApiKey; Paymill.ApiUrl = Properties.Settings.Default.ApiUrl; PreauthorizationService preauthorizationService = Paymill.GetService <PreauthorizationService>(); Console.WriteLine("Solicitando preauthorization..."); string preauthorizationID = "preauth_96fe414f466f91ddb266"; Preauthorization preauthorization = preauthorizationService.GetPreauthorization(preauthorizationID); Console.WriteLine("PreauthorizationID:" + preauthorization.Id); Console.WriteLine("Created at:" + preauthorization.Created_At.ToShortDateString()); Console.Read(); }
// preauthorizations static void getPreauthorizations() { Paymill.ApiKey = Properties.Settings.Default.ApiKey; Paymill.ApiUrl = Properties.Settings.Default.ApiUrl; PreauthorizationService preauthorizationService = Paymill.GetService <PreauthorizationService>(); Console.WriteLine("Waiting request list preauthorizations..."); List <Preauthorization> lstPreauthorizations = preauthorizationService.GetPreauthorizations(); foreach (Preauthorization preauthorization in lstPreauthorizations) { Console.WriteLine(String.Format("PreauthorizationID:{0}", preauthorization.Id)); } Console.Read(); }
static void addPreauthorization() { Paymill.ApiKey = Properties.Settings.Default.ApiKey; Paymill.ApiUrl = Properties.Settings.Default.ApiUrl; PreauthorizationService preauthorizationService = Paymill.GetService <PreauthorizationService>(); Preauthorization preauthorization = new Preauthorization(); preauthorization.Amount = 3500; preauthorization.Currency = "EUR"; //preauthorization.Token = "098f6bcd4621d373cade4e832627b4f6"; preauthorization.Payment = new Payment() { Id = "pay_4c159fe95d3be503778a" }; Preauthorization newPreauthorization = preauthorizationService.AddPreauthorization(preauthorization); Console.WriteLine("PreauthorizationID:" + newPreauthorization.Id); Console.Read(); }
static void getPreauthorizationsWithParameters() { Paymill.ApiKey = Properties.Settings.Default.ApiKey; Paymill.ApiUrl = Properties.Settings.Default.ApiUrl; PreauthorizationService preauthorizationService = Paymill.GetService <PreauthorizationService>(); Console.WriteLine("Waiting request list preauthorizations..."); Filter filter = new Filter(); filter.Add("count", 1); filter.Add("offset", 2); List <Preauthorization> lstPreauthorizations = preauthorizationService.GetPreauthorizations(filter); foreach (Preauthorization preauthorization in lstPreauthorizations) { Console.WriteLine(String.Format("PreauthorizationID:{0}", preauthorization.Id)); } Console.Read(); }