public async Task MakeRefund_Returns_Location_Header_Values()
        {
            string refundId       = "ABC2D7406ECE4542A80152D909EF9F6B";
            string locationHeader = $"https://mss.swicpc.bankgirot.se/swishcpcapi/v1/refunds/{refundId}";
            var    headerValues   = new Dictionary <string, string>()
            {
                { "Location", locationHeader }
            };
            var responseMessage = Create201HttpJsonResponseMessage(_defaultRefund, headerValues);
            var client          = new SwishClient(MockHttp.WithResponseMessage(responseMessage), _merchantId);

            // Act
            var response = await client.MakeRefundAsync(_defaultRefund);

            // Assert
            Assert.Equal(response.Location, locationHeader);
            Assert.Equal(response.Id, refundId);
        }
        public async Task MakeMCommercePayment_Returns_Location_And_Token_Header_VaLues()
        {
            string paymentId      = "AB23D7406ECE4542A80152D909EF9F6B";
            string locationHeader = $"https://mss.swicpc.bankgirot.se/swishcpcapi/v1/paymentrequests/{paymentId}";
            var    headerValues   = new Dictionary <string, string>()
            {
                { "Location", locationHeader },
                { "PaymentRequestToken", "f34DS34lfd0d03fdDselkfd3ffk21" }
            };
            var responseMessage = Create201HttpJsonResponseMessage(_defaultMCommercePaymentModel, headerValues);
            var client          = new SwishClient(MockHttp.WithResponseMessage(responseMessage), _merchantId);

            // Act
            var response = await client.MakeMCommercePaymentAsync(_defaultMCommercePaymentModel);

            // Assert
            Assert.Equal(locationHeader, response.Location);
            Assert.Equal(paymentId, response.Id);
            Assert.Equal("f34DS34lfd0d03fdDselkfd3ffk21", response.Token);
        }
        public async Task MakeECommercePayment_Should_Fix_PayerAlias()
        {
            string paymentId      = "AB23D7406ECE4542A80152D909EF9F6B";
            string locationHeader = $"https://mss.swicpc.bankgirot.se/swishcpcapi/v1/paymentrequests/{paymentId}";
            var    headerValues   = new Dictionary <string, string>()
            {
                { "Location", locationHeader }
            };

            _defaultECommercePaymentModel.PayerAlias = "0701234567";
            var responseMessage = Create201HttpJsonResponseMessage(_defaultECommercePaymentModel, headerValues);
            var mockHttp        = MockHttp.WithResponseMessage(responseMessage);
            var client          = new SwishClient(mockHttp, _merchantId);

            // Act
            var response = await client.MakeECommercePaymentAsync(_defaultECommercePaymentModel);

            // Assert
            var body = await mockHttp.LastRequest.Content.ReadAsStringAsync();

            var request = JsonConvert.DeserializeObject <ECommercePaymentModel>(body);

            Assert.Equal("46701234567", request.PayerAlias);
        }