コード例 #1
0
ファイル: InvoiceTest.cs プロジェクト: procd92/moyasar-dotnet
        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);
        }
コード例 #2
0
ファイル: InvoiceTest.cs プロジェクト: procd92/moyasar-dotnet
        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);
        }
コード例 #3
0
ファイル: InvoiceTest.cs プロジェクト: procd92/moyasar-dotnet
        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);
        }