예제 #1
0
        public void when_creating_a_refund_transaction()
        {
            var stubHttp = HttpMockRepository.At("http://localhost:9191");

            stubHttp.Stub(x => x.Post("/v2/transactions/refunds"))
            .Return(TaxjarFixture.GetJSON("refunds/show.json"))
            .WithStatus(HttpStatusCode.Created);

            var refund = client.CreateRefund(new
            {
                transaction_id           = "321",
                transaction_date         = "2015/05/04",
                transaction_reference_id = "123",
                to_country = "US",
                to_zip     = "90002",
                to_city    = "Los Angeles",
                to_street  = "123 Palm Grove Ln",
                amount     = 17.95,
                shipping   = 2,
                sales_tax  = 0.95,
                line_items = new[] {
                    new {
                        quantity           = 1,
                        product_identifier = "12-34243-0",
                        description        = "Heavy Widget",
                        product_tax_code   = "20010",
                        unit_price         = 15,
                        sales_tax          = 0.95
                    }
                }
            });

            this.AssertRefund(refund);
        }