コード例 #1
0
        public static bool VerifyBooking(SendBookingModel booking, string certifiedUrl, string signature)
        {
            string publicKey = GetUrlSslPublicKey(certifiedUrl);
            string input     = JsonConvert.SerializeObject(booking);

            return(VerifySignature(input, publicKey, signature));
        }
コード例 #2
0
        public static string SignBooking(SendBookingModel booking, string privateKey)
        {
            string input     = JsonConvert.SerializeObject(booking);
            string signature = GetSignature(privateKey, input);

            return(signature);
        }
コード例 #3
0
        public async Task <SendBookingResponse> SendBookingAsync(SendBookingModel sendBookingModel, string bookingUri, string messageHash = "")
        {
            /* var headers = new Dictionary<string, string>()
             * {
             *  { "X-Message-Hash", messageHash }
             * };*/

            string input = JsonConvert.SerializeObject(sendBookingModel);

            return(await WindingTreeSender.SendPostRequest <SendBookingResponse>(bookingUri, CREATE_BOOKING, input));
        }
コード例 #4
0
        private static async Task <SendBookingResponse> SendBooking(string hotelId, DateTime from, DateTime to)
        {
            var windingTreeModule = new WindingTreeModule();
            var hotels            = await windingTreeModule.GetAllHotels();

            var hotel = hotels.Items.Where(x => x.Id == hotelId).FirstOrDefault();

            var booking = new SendBookingModel()
            {
                HotelId  = hotelId,
                Customer = CreateCustomer(),
                Pricing  = CreatePricing(),
                Booking  = CreateBooking(hotel, from, to)
            };

            return(await windingTreeModule.SendBookingAsync(booking, hotel.BookingUri));
        }