public void ReceiverStatus()
        {
            endPoint.BackToRecord(BackToRecordOptions.All);
            endPoint.Replay();
            endPoint.Stub(s => s.DoRequest(Arg <string> .Is.Anything,
                                           Arg <string> .Is.NotNull,
                                           Arg <Dictionary <string, object> > .Is.Anything))
            .Return(new DummyResponse(200, "{\"ready_to_collect\":true,\"type\":\"development\"}"));
            KhipuResponse resp = endPoint.ReceiverStatus();

            Assert.AreEqual(true, resp["ready_to_collect"]);
            Assert.AreEqual("development", resp["type"]);
        }
        public void GetPaymentNotification()
        {
            endPoint.BackToRecord(BackToRecordOptions.All);
            endPoint.Replay();
            endPoint.Stub(s => s.DoRequest(Arg <string> .Is.Anything,
                                           Arg <string> .Is.NotNull,
                                           Arg <Dictionary <string, object> > .Is.Anything))
            .Return(new DummyResponse(200, "{ \"notification_token\":\"khipu_notification_token\", \"receicer_id\":\"asdawsdx\", \"subject\":\"pago de articulo\", \"amount\":2015, \"custom\":\"\",\"transaction_id\":\"\", \"payment_id\":\"1234\", \"currency\":\"CLP\", \"payer_email\":\"[email protected]\"}"));
            KhipuResponse resp = endPoint.GetPaymentNotification(new Dictionary <string, object> {
                { "notification_token", "khipu_notification_token" }
            });

            Assert.AreEqual("khipu_notification_token", resp["notification_token"]);
        }
        public void PaymentStatus()
        {
            endPoint.BackToRecord(BackToRecordOptions.All);
            endPoint.Replay();
            endPoint.Stub(s => s.DoRequest(Arg <string> .Is.Anything,
                                           Arg <string> .Is.NotNull,
                                           Arg <Dictionary <string, object> > .Is.Anything))
            .Return(new DummyResponse(200, "{\"status\":\"done\",\"detail\":\"normal\"}"));
            KhipuResponse resp = endPoint.PaymentStatus(new Dictionary <string, object> {
                { "payment_id", "zdcgmvxxxsd" }
            });

            Assert.AreEqual("done", resp["status"]);
            Assert.AreEqual("normal", resp["detail"]);
        }
        public void CreateEmailWithDestinatariesAsString()
        {
            endPoint.BackToRecord(BackToRecordOptions.All);
            endPoint.Replay();
            endPoint.Stub(s => s.DoRequest(Arg <string> .Is.Anything,
                                           Arg <string> .Is.NotNull,
                                           Arg <Dictionary <string, object> > .Is.Anything))
            .Return(new DummyResponse(200, "{ \"id\": \"HWkZc\", \"payments\": [ {\"id\": \"cghs6n7mtklx\",\"destinataries\":[ { \"name\": \"Juan Rojo\", \"email\": \"[email protected]\" } ], \"url\": \"https://khipu.com/payment/show/cghs6n7mtklx\" }, {\"id\": \"ueqahp3e4xq3\", \"destinataries\":[{\"name\": \"Pedro Piedra\",\"email\": \"[email protected]\"}],\"url\": \"https://khipu.com/payment/show/ueqahp3e4xq3\"}, {\"id\": \"9823ojq8ahs\",\"destinataries\":[{\"name\": \"Ana Soto\",\"email\": \"[email protected]\"}],\"url\": \"https://khipu.com/payment/show/9823ojq8ahs\"}]}"));
            KhipuResponse resp = endPoint.CreateEmail(new Dictionary <string, object> {
                { "subject", "Un cobro desde Ruby" },
                { "pay_directly", true },
                { "send_emails", true },
                { "destinataries", "[ {\"name\": \"Juan Rojo\", \"email\": \"[email protected]\", \"amount\": \"1000\"}, {\"name\": \"Pedro Piedra\", \"email\": \"[email protected]\", \"amount\": \"1000\"}, { \"name\": \"Ana Soto\", \"email\": \"[email protected]\", \"amount\": \"1000\"}]" }
            });

            Assert.IsNotNull(resp ["id"]);
            Assert.IsTrue(resp.isList("payments"));
            Assert.AreEqual(3, resp.list("payments").Count);
            Assert.AreEqual(1, resp.list("payments") [0].list("destinataries").Count);
        }
        public void CreatePaymentUrl()
        {
            endPoint.BackToRecord(BackToRecordOptions.All);
            endPoint.Replay();
            endPoint.Stub(s => s.DoRequest(Arg <string> .Is.Anything,
                                           Arg <string> .Is.NotNull,
                                           Arg <Dictionary <string, object> > .Is.Anything))
            .Return(new DummyResponse(200, "{\"id\":\"5wb665tyvm1p\", \"bill-id\":\"SSRwa\", \"url\":\"https://khipu.com/payment/show/5wb665tyvm1p\", \"manual-url\":\"https://khipu.com/payment/manual/5wb665tyvm1p\", \"mobile-url\":\"khipu:///pos/5wb665tyvm1p\", \"ready-for-terminal\":false }"));

            KhipuResponse resp = endPoint.CreatePaymentUrl(new Dictionary <string, object> {
                { "subject", "Un cobro desde .Net" },
                { "body", "El cuerpo del cobro" },
                { "amount", "1000" },
                { "email", "*****@*****.**" }
            });

            Assert.IsNotNull(resp);
            Assert.IsNotNull(resp ["id"]);
            Assert.IsNotNull(resp ["bill-id"]);
            Assert.IsNotNull(resp ["url"]);
            Assert.IsNotNull(resp ["manual-url"]);
            Assert.IsNotNull(resp ["mobile-url"]);
            Assert.IsNotNull(resp ["ready-for-terminal"]);
        }