Пример #1
0
        static void addTransactionWithClient()
        {
            // Hay que depurar esta función, no funciona bien cuando se pasa el identificador del cliente,
            // está creando un nuevo cliente aunque le pasemos el identificador de uno ya existente

            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            TransactionService transactionService = Paymill.GetService <TransactionService>();

            Transaction transaction = new Transaction();

            transaction.Amount      = 8000;
            transaction.Currency    = "EUR";
            transaction.Description = "Transacción con cliente";
            transaction.Payment     = new Payment()
            {
                Id = "pay_c08f1f94754b93f46ac3"
            };
            transaction.Client = new Client()
            {
                Id = "client_ad591663d69051d306a8"
            };

            Transaction newTransaction = transactionService.AddTransaction(transaction);

            Console.WriteLine("TransactionID:" + newTransaction.Id);
            Console.Read();
        }
Пример #2
0
        static void getOffersWithParameters()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            OfferService offerService = Paymill.GetService <OfferService>();

            Console.WriteLine("Waiting request list offers with parameters...");

            DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime();
            TimeSpan span  = (new DateTime(2012, 11, 28, 18, 38, 33) - epoch);

            Filter filter = new Filter();

            filter.Add("count", 1);  //OK
            filter.Add("offset", 2); //OK
            //filter.Add("interval","month"); //OK
            //filter.Add("amount", 495); //OK
            //filter.Add("created_at", span.TotalSeconds.ToString()); //KO
            //filter.Add("trial_period_days", 5); //OK

            List <Offer> lstOffers = offerService.GetOffers(filter);

            foreach (Offer o in lstOffers)
            {
                Console.WriteLine(String.Format("OfferID:{0}", o.Id));
            }

            Console.Read();
        }
Пример #3
0
        static void getSubscriptionsWithParameters()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            SubscriptionService susbscriptionService = Paymill.GetService <SubscriptionService>();

            Console.WriteLine("Waiting request list subscriptions with parameters...");

            Filter filter = new Filter();

            filter.Add("count", 1);  //OK
            filter.Add("offset", 2); //OK
            //filter.Add("offer", "offer_32008ddd39954e71ed48"); //KO
            //filter.Add("canceled_at", 495); //KO
            //filter.Add("created_at", 1353194860); //KO

            List <Subscription> lstSubscriptions = susbscriptionService.GetSubscriptions(filter);

            foreach (Subscription s in lstSubscriptions)
            {
                Console.WriteLine(String.Format("SubscriptionID:{0}", s.Id));
            }

            Console.Read();
        }
Пример #4
0
        static void addSubscription()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            SubscriptionService susbscriptionService = Paymill.GetService <SubscriptionService>();

            Subscription subscription = new Subscription();

            subscription.Client = new Client()
            {
                Id = "client_bbe895116de80b6141fd"
            };
            subscription.Offer = new Offer()
            {
                Id = "offer_32008ddd39954e71ed48"
            };
            subscription.Payment = new Payment()
            {
                Id = "pay_81ec02206e9b9c587513"
            };

            Subscription newSubscription = susbscriptionService.AddSubscription(subscription);

            Console.WriteLine("SubscriptionID:" + newSubscription.Id);
            Console.Read();
        }
Пример #5
0
        static void getRefundsWithParameters()
        {
            // probar los parametros, no funciona bien
            // transaction es ok
            // client no funciona
            // amount es ok
            // created_at no funciona
            // count es ok

            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            RefundService refundService = Paymill.GetService <RefundService>();

            Console.WriteLine("Waiting request list refunds with parameters...");

            Filter filter = new Filter();

            filter.Add("count", 5);

            List <Refund> lstRefunds = refundService.GetRefunds(filter);

            foreach (Refund refund in lstRefunds)
            {
                Console.WriteLine(String.Format("RefundID:{0}", refund.Id));
            }

            Console.Read();
        }
Пример #6
0
 public void Connect(string apiUrl, string apiKey)
 {
     PaymillWrapper.Paymill.ApiKey = apiKey;
     PaymillWrapper.Paymill.ApiUrl = apiUrl;
     clientService      = Paymill.GetService <ClientService>();
     paymentService     = Paymill.GetService <PaymentService>();
     transactionService = Paymill.GetService <TransactionService>();
     refundService      = Paymill.GetService <RefundService>();
 }
Пример #7
0
        static void removePayment()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            PaymentService paymentService = Paymill.GetService <PaymentService>();

            string paymentID = "pay_640be2127169cea1d375";
            bool   reply     = paymentService.RemovePayment(paymentID);

            Console.WriteLine("Result remove:" + reply);
            Console.Read();
        }
Пример #8
0
        static void getPayment()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            PaymentService paymentService = Paymill.GetService <PaymentService>();

            string  paymentID = "pay_4c159fe95d3be503778a";
            Payment payment   = paymentService.GetPayment(paymentID);

            Console.WriteLine("PaymentID:" + payment.Id);
            Console.WriteLine("PaymentID:" + payment.Created_At.ToShortDateString());
            Console.Read();
        }
Пример #9
0
        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();
        }
Пример #10
0
        static void getTransaction()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            TransactionService transactionService = Paymill.GetService <TransactionService>();

            Console.WriteLine("Solicitando transaction...");
            string      transactionID = "tran_9255ee9ad5a7f2999625";
            Transaction transaction   = transactionService.GetTransaction(transactionID);

            Console.WriteLine("TransactionID:" + transaction.Id);
            Console.WriteLine("Created at:" + transaction.Created_At.ToShortDateString());
            Console.Read();
        }
Пример #11
0
        static void getClient()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            ClientService clientService = Paymill.GetService <ClientService>();

            Console.WriteLine("Request client...");
            string clientID = "client_ad591663d69051d306a8";
            Client c        = clientService.GetClient(clientID);

            Console.WriteLine("ClientID:" + c.Id);
            Console.WriteLine("Created at:" + c.Created_At.ToShortDateString());
            Console.Read();
        }
Пример #12
0
        static void getRefund()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            RefundService refundService = Paymill.GetService <RefundService>();

            Console.WriteLine("Request refund...");
            string refundID = "refund_53860aa0e514d4913aad";
            Refund refund   = refundService.GetRefund(refundID);

            Console.WriteLine("RefundID:" + refund.Id);
            Console.WriteLine("Created at:" + refund.Created_At.ToShortDateString());
            Console.Read();
        }
Пример #13
0
        static void getSubscription()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            SubscriptionService susbscriptionService = Paymill.GetService <SubscriptionService>();

            Console.WriteLine("Request subscription...");
            string       subscriptionID = "sub_e77d3332e456674101ad";
            Subscription subscription   = susbscriptionService.GetSubscription(subscriptionID);

            Console.WriteLine("SubscriptionID:" + subscription.Id);
            Console.WriteLine("Created at:" + subscription.Created_At.ToShortDateString());
            Console.Read();
        }
Пример #14
0
        static void removeOffer()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            OfferService offerService = Paymill.GetService <OfferService>();

            Console.WriteLine("Removing offer...");

            string offerID = "offer_6eea405f83d4d3098604";
            bool   reply   = offerService.RemoveOffer(offerID);

            Console.WriteLine("Result remove:" + reply);
            Console.Read();
        }
Пример #15
0
        static void getOffer()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            OfferService offerService = Paymill.GetService <OfferService>();

            Console.WriteLine("Request offer...");
            string offerID = "offer_6eea405f83d4d3098604";
            Offer  offer   = offerService.GetOffer(offerID);

            Console.WriteLine("OfferID:" + offer.Id);
            Console.WriteLine("Created at:" + offer.Created_At.ToShortDateString());
            Console.Read();
        }
Пример #16
0
        static void addCreditCardPayment()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            PaymentService paymentService = Paymill.GetService <PaymentService>();

            Payment payment = new Payment();

            payment.Token = "098f6bcd4621d373cade4e832627b4f6";

            Payment newPayment = paymentService.AddPayment(payment);

            Console.WriteLine("PaymentID:" + newPayment.Id);
            Console.Read();
        }
Пример #17
0
        // offers
        static void getOffers()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            OfferService offerService = Paymill.GetService <OfferService>();

            Console.WriteLine("Waiting request list offers...");
            List <Offer> lstOffers = offerService.GetOffers();

            foreach (Offer o in lstOffers)
            {
                Console.WriteLine(String.Format("OfferID:{0}", o.Id));
            }

            Console.Read();
        }
Пример #18
0
        // 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();
        }
Пример #19
0
        static void addClient()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            ClientService clientService = Paymill.GetService <ClientService>();

            Client c = new Client();

            c.Description = "Prueba API";
            c.Email       = "*****@*****.**";

            Client newClient = clientService.AddClient(c);

            Console.WriteLine("ClientID:" + newClient.Id);
            Console.Read();
        }
Пример #20
0
        // clients
        static void getClients()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            ClientService clientService = Paymill.GetService <ClientService>();

            Console.WriteLine("Waiting request list clients...");
            List <Client> lstClients = clientService.GetClients();

            foreach (Client c in lstClients)
            {
                Console.WriteLine(String.Format("ClientID:{0}", c.Id));
            }

            Console.Read();
        }
Пример #21
0
        static void updateOffer()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            OfferService offerService = Paymill.GetService <OfferService>();

            Offer offer = new Offer();

            offer.Name = "Oferta 48";
            offer.Id   = "offer_6eea405f83d4d3098604";

            Offer updatedOffer = offerService.UpdateOffer(offer);

            Console.WriteLine("OfferID:" + updatedOffer.Id);
            Console.Read();
        }
Пример #22
0
        static void removeSubscription()
        {
            // se elimina correctamente pero el json de respuesta no devuelve vacio

            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            SubscriptionService susbscriptionService = Paymill.GetService <SubscriptionService>();

            Console.WriteLine("Removing subscription...");

            string subscriptionID = "sub_569df922b4506cd73030";
            bool   reply          = susbscriptionService.RemoveSubscription(subscriptionID);

            Console.WriteLine("Result remove:" + reply);
            Console.Read();
        }
Пример #23
0
        // refunds
        static void getRefunds()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            RefundService refundService = Paymill.GetService <RefundService>();

            Console.WriteLine("Waiting request list refunds...");
            List <Refund> lstRefunds = refundService.GetRefunds();

            foreach (Refund refund in lstRefunds)
            {
                Console.WriteLine(String.Format("RefundID:{0}", refund.Id));
            }

            Console.Read();
        }
Пример #24
0
        // transactions
        static void getTransactions()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            TransactionService transactionService = Paymill.GetService <TransactionService>();

            Console.WriteLine("Waiting request list transactions...");
            List <Transaction> lstTransactions = transactionService.GetTransactions();

            foreach (Transaction transaction in lstTransactions)
            {
                Console.WriteLine(String.Format("TransactionID:{0}", transaction.Id));
            }

            Console.Read();
        }
Пример #25
0
        static void updateSubscription()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            SubscriptionService susbscriptionService = Paymill.GetService <SubscriptionService>();

            Subscription subscription = new Subscription();

            subscription.Cancel_At_Period_End = true;
            subscription.Id = "sub_569df922b4506cd73030";

            Subscription updatedSubscription = susbscriptionService.UpdateSubscription(subscription);

            Console.WriteLine("SubscriptionID:" + updatedSubscription.Id);
            Console.Read();
        }
Пример #26
0
        // subscriptions
        static void getSubscriptions()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            SubscriptionService susbscriptionService = Paymill.GetService <SubscriptionService>();

            Console.WriteLine("Waiting request list subscriptions...");
            List <Subscription> lstSubscriptions = susbscriptionService.GetSubscriptions();

            foreach (Subscription s in lstSubscriptions)
            {
                Console.WriteLine(String.Format("SubscriptionID:{0}", s.Id));
            }

            Console.Read();
        }
Пример #27
0
        static void updateClient()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            ClientService clientService = Paymill.GetService <ClientService>();

            Client c = new Client();

            c.Description = "Javier";
            c.Email       = "*****@*****.**";
            c.Id          = "client_bbe895116de80b6141fd";

            Client updatedClient = clientService.UpdateClient(c);

            Console.WriteLine("ClientID:" + updatedClient.Id);
            Console.Read();
        }
Пример #28
0
        static void removeClient()
        {
            // lo borra pero no devuelve blanco
            // devuelve el objeto cliente con el identificador pasado por parametro

            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            ClientService clientService = Paymill.GetService <ClientService>();

            Console.WriteLine("Removing client...");

            string clientID = "client_180ad3d1042a1da4a0a0";
            bool   reply    = clientService.RemoveClient(clientID);

            Console.WriteLine("Result remove:" + reply);
            Console.Read();
        }
Пример #29
0
        static void addTransaction()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            TransactionService transactionService = Paymill.GetService <TransactionService>();

            Transaction transaction = new Transaction();

            transaction.Token       = "098f6bcd4621d373cade4e832627b4f6";
            transaction.Amount      = 3500;
            transaction.Currency    = "EUR";
            transaction.Description = "Prueba desde API c#";

            Transaction newTransaction = transactionService.AddTransaction(transaction);

            Console.WriteLine("TransactionID:" + newTransaction.Id);
            Console.Read();
        }
Пример #30
0
        // payments
        static void getPayments()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            PaymentService paymentService = Paymill.GetService <PaymentService>();

            // list payments
            Console.WriteLine("Waiting request list payments...");

            List <Payment> lstPayments = paymentService.GetPayments();

            foreach (Payment payment in lstPayments)
            {
                Console.WriteLine(String.Format("PaymentID:{0}", payment.Id));
            }

            Console.Read();
        }