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); }
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); }