/// <summary>
        /// Sets the change locker size by locker station id, booking id and size.
        /// </summary>
        /// <returns>
        ///  Gets the success bool flag, booking id, assigned lockers, hardware door number and locker preview.
        /// </returns>
        public LockerResponse ChangeLockerSize(ChangeLockerSize model)
        {
            var request = SerializerHelper <ChangeLockerSize> .SerializeObject(model);

            Log.Information("[Change Locker Size][Req]" + "[" + request + "]");

            var response = HttpHandler.PostRequestResolver(request, HttpMethod.Post, MemberInfo.Version, MemberInfo.ClientId, MemberInfo.ClientSecret, UriAbsolutePath.ChangeLockerSize, TokenResponse.AccessToken, TokenResponse.DateTime);
            var result   = JsonConvert.DeserializeObject <LockerResponse>(response);

            Log.Information("[Change Locker Size][Res]" + "[" + response + "]");

            return(result);
        }
示例#2
0
        /// <summary>
        /// Sets the change locker size by locker station id, booking id and size.
        /// </summary>
        /// <returns>
        ///  Gets the success bool flag, booking id, assigned lockers, hardware door number and locker preview.
        /// </returns>
        public JObject ChangeLockerSize(ChangeLockerSize model)
        {
            JObject result;

            if (TokenResponse.StatusCode == 200)
            {
                var request = SerializerHelper <ChangeLockerSize> .SerializeObject(model);

                Log.Information("[Change Locker Size][Req]" + "[" + request + "]");

                var response = HttpHandler.PostRequestResolver(request, HttpMethod.Post, MemberInfo.Version, MemberInfo.ClientId, MemberInfo.ClientSecret, UriAbsolutePath.ChangeLockerSize, TokenResponse.AccessToken, TokenResponse.DateTime);
                Log.Information("[Change Locker Size][Res]" + "[" + response + "]");

                result = JObject.Parse(response);
                return(result);
            }
            return(JObject.Parse(SerializerHelper <AuthenticationError> .SerializeObject(new AuthenticationError(false, "401", "Unauthenticated"))));
        }
        public static void CourierDropOff(string lockerStationId, GatewayService gatewayService)
        {
            #region Health Check

            var healthCheckResult = gatewayService.HealthCheck();
            Console.WriteLine("[Health Check][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(healthCheckResult, Formatting.Indented));

            #endregion

            #region Lsp Verification

            Console.Write("-----------------------------------------------------------------------------\n");
            Console.Write("[Lsp Verification][Req]\n");

            Console.Write("Key: ");
            string key = Console.ReadLine();

            Console.Write("Pin: ");
            string pin = Console.ReadLine();


            var lspVerification = new LspUserAccess
            {
                LockerStationid = lockerStationId,
                Key             = key,
                Pin             = pin
            };
            var lspVerificationResult = gatewayService.LspVerification(lspVerification);

            Console.WriteLine("[Lsp Verification][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(lspVerificationResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");

            var lspVerificationResponse = JsonConvert.DeserializeObject <LspVerificationResponse>(lspVerificationResult.ToString());

            #endregion

            #region Verify Otp

            Console.WriteLine("[Verify Otp][Req]");

            Console.Write("Code: ");
            string code = Console.ReadLine();

            Console.Write("Phone Number: ");
            string phoneNumber = Console.ReadLine();


            var verifyOtpModel = new VerifyOtp
            {
                LockerStationId = lockerStationId,
                LspId           = lspVerificationResponse.LspId,
                Code            = code,
                PhoneNumber     = phoneNumber,
                RefCode         = lspVerificationResponse.RefCode
            };

            var verifyOtpResult = gatewayService.VerifyOtp(verifyOtpModel);

            Console.WriteLine("[Verify Otp][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(verifyOtpResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");

            #endregion

            #region Receive Locker Station Details
            Console.WriteLine("[Receive Locker Station Details][Req]");
            var lockerStationDetailsResult = gatewayService.LockerStationDetails(lockerStationId);

            Console.WriteLine("[Receive Locker Station Details][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(lockerStationDetailsResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");

            var lockerStationDetailsResponse = JsonConvert.DeserializeObject <LspVerificationResponse>(lspVerificationResult.ToString());

            #endregion

            #region Find Booking By Tracking Number

            Console.WriteLine("[Find Booking By Tracking Number][Req]");

            Console.Write("Tracking Number: ");
            string trackingNumber = Console.ReadLine();

            if (lspVerificationResponse.LspId == null)
            {
                lspVerificationResponse.LspId = string.Empty;
            }
            var findBookingResult = gatewayService.FindBooking(trackingNumber, lockerStationId, lspVerificationResponse.LspId);

            Console.WriteLine("[Find Booking By Tracking Number][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(findBookingResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");

            #endregion

            //#region Assign Similar Size Locker
            //Console.WriteLine("[Assign Similar Size Locker][Req]");

            //Console.Write("Booking Id: ");
            //string bookingId = Console.ReadLine();

            //Console.Write("Reason: ");
            //string reason = Console.ReadLine();

            //var assignSimilarSizeLocker = new AssignSimilarSizeLocker()
            //{
            //    LockerStationId = lockerStationId,
            //    BookingId = Convert.ToInt32(bookingId),
            //    Reason = reason
            //};

            //var similarSizeLockerResult = gatewayService.AssignSimilarSizeLocker(assignSimilarSizeLocker);
            //Console.WriteLine("[Assign Similar Size Locker][Res]");
            //Console.WriteLine(JsonConvert.SerializeObject(similarSizeLockerResult, Formatting.Indented));
            //Console.WriteLine("-----------------------------------------------------------------------------");

            //#endregion

            #region Get Available Sizes
            Console.WriteLine("[Get Available Sizes][Req]");
            Console.Write("Locker Station Id: c17fb923-70f9-4d3c-b081-4226096d6905\n");

            var getAvailableSizesResult = gatewayService.GetAvailableSizes(lockerStationId);
            Console.WriteLine("[Get Available Sizes][Res]");

            Console.WriteLine(JsonConvert.SerializeObject(getAvailableSizesResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");
            #endregion

            #region Change Locker Size
            Console.WriteLine("[Change Locker Size][Req]");

            Console.Write("Booking Id: ");
            string changeLockerSizeBookingId = Console.ReadLine();

            Console.Write("Size: ");
            string size = Console.ReadLine();

            var changeLockerSize = new ChangeLockerSize()
            {
                LockerStationId = lockerStationId,
                BookingId       = changeLockerSizeBookingId,
                Size            = size
            };

            var changeLockerSizeResult = gatewayService.ChangeLockerSize(changeLockerSize);
            Console.WriteLine("[Change Locker Size][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(changeLockerSizeResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");



            #endregion

            #region Open Compartment

            Console.WriteLine("[Open Compartment][Req]");
            string transactionId = Guid.NewGuid().ToString();

            Console.Write("Locker Id: ");
            string lockerId = Console.ReadLine();

            Console.Write("Compartment Id: ");
            string   compartmentIds = Console.ReadLine();
            string[] compartmentId  = compartmentIds.Split(',');

            var openCompartment       = new HCM.Core.DataObjects.Models.Compartment(transactionId, lockerId, compartmentId, false, string.Empty, string.Empty);
            var openCompartmentResult = gatewayService.OpenCompartment(openCompartment);

            Console.WriteLine("[Open Compartment][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(openCompartmentResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");

            #endregion

            #region Compartment Status

            Console.WriteLine("[Compartment Status][Req]");

            Console.Write("Locker Id: ");
            lockerId = Console.ReadLine();

            Console.Write("Compartment Id: ");
            compartmentIds = Console.ReadLine();
            compartmentId  = compartmentIds.Split(',');

            var compartmentStatus       = new HCM.Core.DataObjects.Models.Compartment(transactionId, lockerId, compartmentId, false, string.Empty, string.Empty);
            var compartmentStatusResult = gatewayService.CompartmentStatus(compartmentStatus);

            Console.WriteLine("[Compartment Status][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(compartmentStatusResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");
            #endregion

            #region Capture Image

            Console.WriteLine("[Capture Image][Req]");

            Console.Write("Locker Id: ");
            lockerId = Console.ReadLine();

            var captureImage       = new Capture(transactionId, lockerId, false, string.Empty, string.Empty);
            var captureImageResult = gatewayService.CaptureImage(captureImage);

            Console.WriteLine("[Capture Image][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(captureImageResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");


            #endregion

            #region Update Booking Status

            Console.WriteLine("[Update Booking Status][Req]");

            Console.Write("Booking Id: ");
            string UpdateBookingStatusBookingId = Console.ReadLine();

            Console.Write("Status: ");
            string status = Console.ReadLine();

            Console.Write("MobileNumber: ");
            string mobileNumber = Console.ReadLine();

            Console.Write("Reason: ");
            string updateBookingReason = Console.ReadLine();

            var bookingStatusUpdate = new BookingStatus()
            {
                LockerStationId = lockerStationId,
                BookingId       = Convert.ToInt32(UpdateBookingStatusBookingId),
                LspId           = lspVerificationResponse.LspId,
                LspUserId       = lspVerificationResponse.LspUserId,
                MobileNumber    = mobileNumber,
                Status          = status,
                Reason          = updateBookingReason
            };

            var bookingStatusUpdateResult = gatewayService.UpdateBookingStatus(bookingStatusUpdate);
            Console.WriteLine("[Update Booking Status][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(bookingStatusUpdateResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");


            #endregion
        }