Exemplo n.º 1
0
        public async Task <Result> ProcessBookingData(Stream stream, Suppliers supplier)
        {
            var(_, isGettingBookingDetailsFailure, bookingDetails, gettingBookingDetailsError) = await _supplierConnectorManager.Get(supplier).ProcessAsyncResponse(stream);

            if (isGettingBookingDetailsFailure)
            {
                return(Result.Failure(gettingBookingDetailsError.Detail));
            }

            await _responseProcessor.ProcessResponse(bookingDetails, ApiCaller.FromSupplier(supplier), BookingChangeEvents.SupplierWebHook);

            return(Result.Success());
        }
        public async Task <Result> ProcessBookingDetailsResponse(byte[] xmlRequestData)
        {
            var(_, isGetBookingDetailsFailure, bookingDetails, bookingDetailsError) = await GetBookingDetailsFromConnector(xmlRequestData);

            if (isGetBookingDetailsFailure)
            {
                _logger.LogUnableGetBookingDetailsFromNetstormingXml(Encoding.UTF8.GetString(xmlRequestData));
                return(Result.Failure(bookingDetailsError));
            }

            await _responseProcessor.ProcessResponse(bookingDetails, ApiCaller.FromSupplier(Suppliers.Netstorming), Common.Enums.BookingChangeEvents.SupplierWebHook);

            return(Result.Success());
        }