2023-03-27 18:54:56 +00:00
|
|
|
package ocssapi
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
2023-03-30 06:44:58 +00:00
|
|
|
"github.com/rs/zerolog/log"
|
2023-03-27 18:54:56 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (s *OCSSApiService) PostBookings(ctx context.Context, booking ocss.Booking) (*ocss.Booking, error) {
|
2023-03-30 06:44:58 +00:00
|
|
|
result, err := s.Handler.Book(booking)
|
|
|
|
if err != nil {
|
|
|
|
log.Error().Err(err).Msg("issue in booking")
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return &result.BookingDefinition, nil
|
2023-03-27 18:54:56 +00:00
|
|
|
}
|
2023-03-29 22:45:18 +00:00
|
|
|
func (s *OCSSApiService) PatchBookings(ctx context.Context, bookingId string, status ocss.BookingStatus, message *string) error {
|
2023-03-30 06:44:58 +00:00
|
|
|
return errors.New("booking not found")
|
2023-03-27 18:54:56 +00:00
|
|
|
}
|
2023-03-29 22:45:18 +00:00
|
|
|
func (s *OCSSApiService) GetBookings(ctx context.Context, bookingId string) (*ocss.Booking, error) {
|
2023-03-30 06:44:58 +00:00
|
|
|
result, err := s.Handler.GetBooking(bookingId)
|
|
|
|
if err != nil {
|
|
|
|
log.Error().Err(err).Msg("issue retrieving booking in handler")
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return &result.BookingDefinition, nil
|
2023-03-27 18:54:56 +00:00
|
|
|
}
|