public void createCharge() { getApiKey(); conekta.Api.version = "2.0.0"; Order order = new conekta.Order().create(@"{ ""currency"":""MXN"", ""customer_info"": { ""name"": ""Jul Ceballos"", ""phone"": ""+5215555555555"", ""email"": ""*****@*****.**"" }, ""line_items"": [{ ""name"": ""Box of Cohiba S1s"", ""unit_price"": 35000, ""quantity"": 1 }] }"); order.createCharge(@"{ ""payment_method"": { ""type"": ""card"", ""token_id"": ""tok_test_visa_4242"" }, ""amount"": 35000 }"); order = new Order().find(order.id); Assert.AreEqual(order.id.GetType().ToString(), "System.String"); Assert.AreEqual(order.payment_status, "paid"); Assert.AreEqual(order.amount, 35000); order = new Order().find(order.id); Assert.AreEqual(order.id.GetType().ToString(), "System.String"); Assert.AreEqual(order.payment_status, "paid"); Assert.AreEqual(order.amount, 35000); order = order.createReturn(@"{""amount"": 35000}"); Assert.AreEqual(order.id.GetType().ToString(), "System.String"); Assert.AreEqual(order.payment_status, "refunded"); Assert.AreEqual(order.amount, 35000); Order[] orders = new Order().where (new JObject()); Assert.AreEqual(orders[0].id.GetType().ToString(), "System.String"); }
public void captureCharge() { conekta.Api.apiKey = "key_eYvWV7gSDkNYXsmr"; conekta.Api.version = "2.0.0"; Order order = new conekta.Order().create(@"{ ""currency"":""MXN"", ""customer_info"": { ""name"": ""Jul Ceballos"", ""phone"": ""+5215555555555"", ""email"": ""*****@*****.**"" }, ""line_items"": [{ ""name"": ""Box of Cohiba S1s"", ""unit_price"": 35000, ""quantity"": 1 }], ""pre_authorize"": true }" ); order.createCharge(@"{ ""payment_method"": { ""type"": ""card"", ""token_id"": ""tok_test_visa_4242"" }, ""amount"": 35000 }" ); order = new Order().find(order.id); order = order.capture(); Assert.AreEqual(order.id.GetType().ToString(), "System.String"); Assert.AreEqual(order.payment_status, "paid"); Assert.AreEqual(order.amount, 35000); }