Exemplo n.º 1
0
        public async Task ShouldThrowExceptionWhenCallbackIsNotSet()
        {
            string json = JsonSerializer.Serialize(new
            {
                Status    = 100,
                Authority = "000000000000000000000000000000012345"
            });

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.When("*")
            .Respond("application/json", json);

            var httpClient = mockHttp.ToHttpClient();

            var options = new ZarinPalOptions
            {
                DefaultCallbackUri = null,
                MerchantId         = "something-that-does-not-matter",
                IsDevelopment      = true
            };

            var service = new ZarinPalService(httpClient, Options.Create(options));

            await Assert.ThrowsAsync <ArgumentException>("callbackUri", async() =>
            {
                await service.RequestPaymentAsync(1000, "From tests", callbackUri: null);
            });
        }
Exemplo n.º 2
0
 public PaymentController(ZarinPalService zarinpal)
 {
     _zarinpal = zarinpal;
 }