public void TestFetchInvoice()
        {
            var info    = GetValidInvoiceInfo();
            var payInfo = PaymentTest.GetValidPaymentInfoVisa();

            ServicesMockHelper.MockInvoiceResponse(info, new List <PaymentInfo>
            {
                payInfo,
                payInfo
            });

            var invoice = Invoice.Fetch("some-random-id");

            Assert.Equal(info.Amount, invoice.Amount);
            Assert.Equal(info.Currency, invoice.Currency);
            Assert.Equal(info.Description, invoice.Description);
            Assert.Equal(info.ExpiredAt, invoice.ExpiredAt);
            Assert.Equal(info.CallbackUrl, invoice.CallbackUrl);

            Assert.Equal(2, invoice.Payments.Count);

            Assert.Equal(payInfo.Amount, invoice.Payments[0].Amount);
            Assert.Equal(payInfo.Currency, invoice.Payments[0].Currency);
            Assert.Equal(payInfo.Description, invoice.Payments[0].Description);
        }
        public void TestUpdateInvoice()
        {
            var info    = GetValidInvoiceInfo();
            var payInfo = PaymentTest.GetValidPaymentInfoVisa();

            ServicesMockHelper.MockInvoiceResponse(info, new List <PaymentInfo>
            {
                payInfo,
                payInfo
            });

            var invoice = Invoice.Fetch("some-random-id");

            info.Amount      = 1;
            info.Currency    = "USD";
            info.Description = "NEW";
            ServicesMockHelper.MockInvoiceResponse(info, new List <PaymentInfo>
            {
                payInfo,
                payInfo
            });

            invoice.Update();

            Assert.Equal(info.Amount, invoice.Amount);
            Assert.Equal(info.Currency, invoice.Currency);
            Assert.Equal(info.Description, invoice.Description);
        }
        public void TestCancelInvoice()
        {
            var info    = GetValidInvoiceInfo();
            var payInfo = PaymentTest.GetValidPaymentInfoVisa();

            ServicesMockHelper.MockInvoiceResponse(info, new List <PaymentInfo>
            {
                payInfo,
                payInfo
            });

            var invoice = Invoice.Fetch("some-random-id");

            info.Amount = 1;
            ServicesMockHelper.MockInvoiceResponse(info, new List <PaymentInfo>
            {
                payInfo,
                payInfo
            });

            invoice.Cancel();
            Assert.Equal(info.Amount, invoice.Amount);
        }