Пример #1
0
        /// <summary> Call DCL To Create Shipment </summary>
        public static LumAPIResultModel CallDCLToCreateShipment(LUMVendCntrlSetup setup, DCLShipmentRequestEntity metadataShipemt)
        {
            var config = new DCL_Config()
            {
                RequestMethod = HttpMethod.Post,
                RequestUrl    = setup.SecureURLbatches,
                AuthType      = setup.AuthType,
                Token         = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{setup.ClientID}:{setup.ClientSecret}"))
            };
            var caller = new APICaller(config);

            return(caller.CallApi(metadataShipemt));
        }
Пример #2
0
        /// <summary> Call DCL To Get SO. By OrderNumbers </summary>
        public static LumAPIResultModel CallDCLToGetSOByOrderNumbers(LUMVendCntrlSetup setup, string _orderNumbers)
        {
            // If No _orderNumbers then query NoN
            _orderNumbers = string.IsNullOrEmpty(_orderNumbers) ? "NoNeedToQuery" : _orderNumbers;
            var config = new DCL_Config()
            {
                RequestMethod = HttpMethod.Get,
                RequestUrl    = APIHelper.CombineQueryString(
                    setup.SecureURL,
                    new
                {
                    order_numbers = _orderNumbers
                }),
                AuthType = setup.AuthType,
                Token    = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{setup.ClientID}:{setup.ClientSecret}"))
            };
            var caller = new APICaller(config);

            return(caller.CallApi());
        }
Пример #3
0
        /// <summary> Call DCL To Get SO. By Filter </summary>
        public static LumAPIResultModel CallDCLToGetSOByFilter(LUMVendCntrlSetup setup, DCLFilter filter)
        {
            var config = new DCL_Config()
            {
                RequestMethod = HttpMethod.Get,
                RequestUrl    = APIHelper.CombineQueryString(
                    setup.SecureURL,
                    new
                {
                    Received_from = filter.Received_from?.ToString("yyyy-MM-dd"),
                    Received_to   = filter.Received_to?.ToString("yyyy-MM-dd"),
                    Filter        = $"Customer_number eq {filter.Customer_number}"
                }),
                AuthType = setup.AuthType,
                Token    = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{setup.ClientID}:{setup.ClientSecret}"))
            };
            var caller = new APICaller(config);

            return(caller.CallApi());
        }
Пример #4
0
        public static LumAPIResultModel CallMiddleWareToUpdateFBM(LUMMiddleWareSetup setup, MiddleWare_Shipment metadataShipemt)
        {
            // Get Middle ware Token
            var tokenResult = MiddleWareHelper.GetToken(setup);

            if (tokenResult.StatusCode != System.Net.HttpStatusCode.OK)
            {
                throw new Exception($"Can not Get Midlle Ware Token, status code:{tokenResult.StatusCode} ");
            }
            setup.AuthToken = JsonConvert.DeserializeObject <MiddleWareSingInModel>(tokenResult.ContentResult).data.Jwt;

            var config = new MiddleWare_Config()
            {
                RequestMethod = HttpMethod.Post,
                RequestUrl    = setup.SecureURL_fbm,
                Token         = setup.AuthToken
            };
            var caller = new APICaller(config);

            return(caller.CallApi(metadataShipemt));
        }