Exemple #1
0
 public OrderManagementStoreTests()
 {
     _orderManagementStore = new OrderManagementStore(new ApiSession
     {
         ApiUrl      = ConfigurationManager.AppSettings["Klarna:ApiUrl"],
         UserAgent   = "Klarna Episerver Integration Tests",
         Credentials = new ApiCredentials
         {
             Username = ConfigurationManager.AppSettings["Klarna:Username"],
             Password = ConfigurationManager.AppSettings["Klarna:Password"]
         }
     }, new JsonSerializer());
 }
Exemple #2
0
 /// <summary>
 /// Creates an instance of the Klarna client.
 /// </summary>
 /// <param name="apiSession">Session representation object for communicating with the Klarna API</param>
 /// <param name="jsonSerializer">Instance of a class implementing the IJsonSerializer interface</param>
 public Klarna(ApiSession apiSession, IJsonSerializer jsonSerializer)
 {
     if (string.IsNullOrEmpty(apiSession.UserAgent))
     {
         apiSession.UserAgent = GetDefaultUserAgent();
     }
     Checkout           = new CheckoutStore(apiSession, jsonSerializer);
     Payment            = new PaymentStore(apiSession, jsonSerializer);
     OrderManagement    = new OrderManagementStore(apiSession, jsonSerializer);
     Settlement         = new SettlementStore(apiSession, jsonSerializer);
     CustomerToken      = new CustomerTokenStore(apiSession, jsonSerializer);
     HostedPaymentPage  = new HostedPaymentPageStore(apiSession, jsonSerializer);
     VirtualCardService = new VirtualCardServiceStore(apiSession, jsonSerializer);
     ApiSession         = apiSession;
 }
        public virtual IKlarnaOrderService Create(ConnectionConfiguration connectionConfiguration)
        {
            string userAgent = $"Platform/Episerver.Commerce_{typeof(EPiServer.Commerce.ApplicationContext).Assembly.GetName().Version} Module/Klarna.OrderManagement_{typeof(KlarnaOrderService).Assembly.GetName().Version}";

            var client = new OrderManagementStore(new ApiSession
            {
                ApiUrl      = connectionConfiguration.ApiUrl,
                UserAgent   = userAgent,
                Credentials = new ApiCredentials
                {
                    Username = connectionConfiguration.Username,
                    Password = connectionConfiguration.Password
                }
            }, new JsonSerializer());

            return(new KlarnaOrderService(client));
        }
Exemple #4
0
 internal KlarnaOrderService(OrderManagementStore client)
 {
     _client = client;
 }