Exemple #1
0
        public static LumAPIResultModel GetToken(LUMMiddleWareSetup setup)
        {
            var config = new MiddleWare_Config()
            {
                RequestMethod = HttpMethod.Post,
                RequestUrl    = setup.SecureURL_login
            };
            var caller = new APICaller(config);

            return(caller.GetAuthToken(setup.ClientID, setup.ClientSecret));
        }
Exemple #2
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));
        }