コード例 #1
0
        public static void Courier3rdParty(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();

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

            var verifyOtpResult = gatewayService.VerifyOtp(verifyOtpModel);

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

            #endregion

            #region 3rd Party Verify

            Console.WriteLine("[3rd Verify][Req]");
            var thirdPartyVerifyResult = gatewayService.Verify3rdParty(lockerStationId, lspVerificationResponse.LspId, lspVerificationResponse.LspUserId);

            Console.WriteLine("[3rd Verify][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(thirdPartyVerifyResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");

            #endregion

            #region Courier List
            Console.WriteLine("[Courier List][Req]");
            var courierListResult = gatewayService.CourierList();

            Console.WriteLine("[Courier List][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(courierListResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");
            #endregion

            #region Courier 3rd Party
            Console.WriteLine("[Courier 3rd Party][Req]");

            Console.Write("Lsp Id To Collect: ");
            string lspIdToCollect = Console.ReadLine();

            var courier3rdPartyResult = gatewayService.CourierBooking3rdParty(lockerStationId, lspVerificationResponse.LspId, lspVerificationResponse.LspUserId, lspIdToCollect);

            Console.WriteLine("[Courier 3rd Party][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(courier3rdPartyResult, Formatting.Indented));
            Console.WriteLine("-----------------------------------------------------------------------------");
            #endregion

            #region Courier All
            Console.WriteLine("[Courier All][Req]");

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

            var courierAllResult = gatewayService.CourierBookingAll(lockerStationId, lspVerificationResponse.LspId, lspVerificationResponse.LspUserId, lspIdToCollect, status);

            Console.WriteLine("[Courier All][Res]");
            Console.WriteLine(JsonConvert.SerializeObject(courierAllResult, 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 updateBookingStatus = 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          = updateBookingStatus,
                Reason          = updateBookingReason
            };

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


            #endregion
        }