예제 #1
0
        private static InitCheckoutRequest CreateInitCheckoutRequest(string countryCode, int storeId)
        {
            var initCheckoutRequest = new InitCheckoutRequest
            {
                CountryCode      = countryCode,
                StoreId          = storeId,
                MerchantTermsUri = "https://collector.se",
                NotificationUri  = "https://collector.se",
                Reference        = "ABC123"
            };

            initCheckoutRequest.Cart.Items.Add(new ArticleItem
            {
                Id          = "ARTICLE001",
                Description = "test article 1",
                Sku         = Guid.NewGuid().ToString(),
                UnitPrice   = 10,
                Quantity    = 10, Vat = 25
            });

            return(initCheckoutRequest);
        }
예제 #2
0
        private static HttpRequestMessage CreateHttpRequestMessage(string pathAndQuery, InitCheckoutRequest request)
        {
            var bodyContent = JsonConvert.SerializeObject(request);

            var httpRequest = new HttpRequestMessage(HttpMethod.Post, pathAndQuery);

            httpRequest.Headers.Authorization = new AuthenticationHeaderValue("SharedKey", CreateAuthorizationHeader(pathAndQuery, bodyContent));
            httpRequest.Content = new StringContent(bodyContent, Encoding.UTF8, "application/json");

            return(httpRequest);
        }