Exemplo n.º 1
0
        public async Task <DeliveryResponse> DoRequest()
        {
            var auth = new  Authentication()
            {
                Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()),
                Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode())
            };

            var orderToDeliver = new AdminWS.DeliverOrderInformation()
            {
                ClientId    = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode()),
                SveaOrderId = _builder.Id,
                OrderType   = ConvertPaymentTypeToOrderType(_builder.OrderType)
                              //PrintType // optional for EU-clients, and integration package only supports EU-clients
            };

            var request = new AdminWS.PartialDeliveryRequest()
            {
                Authentication          = auth,
                OrderToDeliver          = orderToDeliver,
                RowNumbers              = _builder.RowIndexesToDeliver.ToArray(),
                InvoiceDistributionType = ConvertDistributionTypeToInvoiceDistributionType(_builder.DistributionType)
            };

            // make request to correct endpoint, return response object
            var endpoint = _builder.GetConfig().GetEndPoint(PaymentType.ADMIN_TYPE);
            var adminWS  = new AdminServiceClient(AdminServiceClient.EndpointConfiguration.WcfAdminSoapService, endpoint);
            var response = await adminWS.DeliverPartialAsync(request);

            return(response);
        }
Exemplo n.º 2
0
        public async Task <DeliveryResponse> DoRequest()
        {
            var auth = new AdminWS.Authentication()
            {
                Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()),
                Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode())
            };

            var ordersToDeliver = new List <AdminWS.DeliverOrderInformation>();
            var clientId        = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode());
            var orderType       = ConvertPaymentTypeToOrderType(_builder.OrderType);

            foreach (var orderId in _builder.OrderIds)
            {
                var orderToDeliver = new AdminWS.DeliverOrderInformation()
                {
                    ClientId    = clientId,
                    SveaOrderId = orderId,
                    OrderType   = orderType
                                  //PrintType // optional for EU-clients
                };
                ordersToDeliver.Add(orderToDeliver);
            }

            var request = new AdminWS.DeliveryRequest()
            {
                Authentication          = auth,
                OrdersToDeliver         = ordersToDeliver.ToArray(),
                InvoiceDistributionType = ConvertDistributionTypeToInvoiceDistributionType(_builder.DistributionType)
            };

            // make request to correct endpoint, return response object
            var endpoint = _builder.GetConfig().GetEndPoint(PaymentType.ADMIN_TYPE);
            var adminWS  = new AdminServiceClient(AdminServiceClient.EndpointConfiguration.WcfAdminSoapService, endpoint);
            var response = await adminWS.DeliverOrdersAsync(request);

            return(response);
        }