From c45fad8cc7933111d5be36bc81d1489bb1fdebdd Mon Sep 17 00:00:00 2001 From: Vjera Turk Date: Thu, 5 Sep 2024 12:37:16 +0200 Subject: [PATCH] Create new bot version message types v1 (#25) * Added ActivityProductInfo message type * Upgraded protocol version; Replaced v1alpha with v1 * Version upgrade 9.0.0 * Enforced Request Types Grouping and order in code * Changed compression tests to not contain the expected value expressed as bytes * Extended Partner Plugin Examples --- README.MD | 2 +- camino-messenger-bot-supplier.yaml.example | 15 +- docker-compose.yml | 2 +- examples/rpc/client.go | 22 +- examples/rpc/partner-plugin/server.go | 517 +++++++++++++++------ go.mod | 4 +- go.sum | 8 +- internal/app/app.go | 2 +- internal/matrix/matrix_compressor_test.go | 85 +++- internal/matrix/msg_assembler_test.go | 8 +- internal/matrix/types.go | 84 ++-- internal/messaging/mock_list_grpc.pb.go | 10 +- internal/messaging/response_handler.go | 20 +- internal/messaging/service.go | 62 ++- internal/messaging/service_registry.go | 37 +- internal/messaging/types.go | 90 ++-- internal/rpc/server/server.go | 129 ++--- scripts/mocks.mockgen.txt | 2 +- 18 files changed, 716 insertions(+), 383 deletions(-) diff --git a/README.MD b/README.MD index bf34b28b..f670e52a 100644 --- a/README.MD +++ b/README.MD @@ -25,7 +25,7 @@ Camino-Messenger-Bot is designed to facilitate communication through various mes This application depends on the [camino-messenger-protocol](https://github.com/chain4travel/camino-messenger-protocol), which is a separate repository. The protocol defines the protobuf messages and services used for communication between the gRPC server and client. -Currently [release-6](https://github.com/chain4travel/camino-messenger-protocol/releases/tag/release-6) of Camino Messenger Protocol is used. +Currently [release-9](https://github.com/chain4travel/camino-messenger-protocol/releases/tag/release-9) of Camino Messenger Protocol is used. ## Examples and Docker Support diff --git a/camino-messenger-bot-supplier.yaml.example b/camino-messenger-bot-supplier.yaml.example index 3b74f1b6..a3cddf86 100644 --- a/camino-messenger-bot-supplier.yaml.example +++ b/camino-messenger-bot-supplier.yaml.example @@ -48,17 +48,18 @@ partner_plugin_ca_file: ca-cert.pem ### Supported Request Types for this supplier. supported_request_types: - - ActivitySearchRequest - - ActivityProductListRequest - - AccommodationProductInfoRequest - - AccommodationProductListRequest - - AccommodationSearchRequest - GetNetworkFeeRequest - GetPartnerConfigurationRequest - - MintRequest - - ValidationRequest - PingRequest + - AccommodationProductListRequest + - AccommodationProductInfoRequest + - AccommodationSearchRequest + - ActivityProductListRequest + - ActivityProductInfoRequest + - ActivitySearchRequest - TransportSearchRequest + - MintRequest + - ValidationRequest - SeatMapRequest - SeatMapAvailabilityRequest - CountryEntryRequirementsRequest diff --git a/docker-compose.yml b/docker-compose.yml index 26a88ba6..c15ba1da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: CMB_PARTNER_PLUGIN_PORT: "50051" CMB_PARTNER_PLUGIN_UNENCRYPTED: "true" CMB_RESPONSE_TIMEOUT: "10000" - CMB_SUPPORTED_REQUEST_TYPES: "ActivitySearchRequest,AccommodationSearchRequest,GetNetworkFeeRequest,GetPartnerConfigurationRequest,PingRequest,TransportSearchRequest,MintRequest,ValidationRequest,SeatMapRequest,SeatMapAvailabilityRequest,CountryEntryRequirementsRequest" + CMB_SUPPORTED_REQUEST_TYPES: "GetNetworkFeeRequest,GetPartnerConfigurationRequest,PingRequest,AccommodationProductListRequest,AccommodationProductInfoRequest,AccommodationSearchRequest,ActivityProductListRequest,ActivityProductInfoRequest,ActivitySearchRequest,TransportSearchRequest,MintRequest,ValidationRequest,SeatMapRequest,SeatMapAvailabilityRequest,CountryEntryRequirementsRequest" CMB_RPC_URL: "https://columbus.camino.network/ext/bc/C/rpc" CMB_BOOKING_TOKEN_ABI_FILE: abi/BookingTokenV0.abi CMB_SUPPLIER_NAME: SUPPLIER_NAME diff --git a/examples/rpc/client.go b/examples/rpc/client.go index 894f99cb..83b904e3 100755 --- a/examples/rpc/client.go +++ b/examples/rpc/client.go @@ -11,10 +11,10 @@ import ( "sync" "time" - typesv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/types/v1alpha" + typesv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/types/v1" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1alpha/accommodationv1alphagrpc" - accommodationv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1alpha" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1/accommodationv1grpc" + accommodationv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1" internalmetadata "github.com/chain4travel/camino-messenger-bot/internal/metadata" "go.uber.org/zap" "google.golang.org/grpc" @@ -72,17 +72,17 @@ func createClientAndRunRequest(i int, ppConfig config.PartnerPluginConfig, sLogg fmt.Errorf("error starting client: %v", err) return } - request := &accommodationv1alpha.AccommodationSearchRequest{ + request := &accommodationv1.AccommodationSearchRequest{ Header: nil, - SearchParametersGeneric: &typesv1alpha.SearchParameters{ - Language: typesv1alpha.Language_LANGUAGE_UG, + SearchParametersGeneric: &typesv1.SearchParameters{ + Language: typesv1.Language_LANGUAGE_UG, Market: 1, MaxOptions: 2, }, - Queries: []*accommodationv1alpha.AccommodationSearchQuery{ + Queries: []*accommodationv1.AccommodationSearchQuery{ { - SearchParametersAccommodation: &accommodationv1alpha.AccommodationSearchParameters{ - SupplierCodes: []*typesv1alpha.SupplierProductCode{{SupplierCode: "supplier1"}}, + SearchParametersAccommodation: &accommodationv1.AccommodationSearchParameters{ + SupplierCodes: []*typesv1.SupplierProductCode{{SupplierCode: "supplier1"}}, }, }, }, @@ -93,7 +93,7 @@ func createClientAndRunRequest(i int, ppConfig config.PartnerPluginConfig, sLogg }) ctx := metadata.NewOutgoingContext(context.Background(), md) - ass := accommodationv1alphagrpc.NewAccommodationSearchServiceClient(c.ClientConn) + ass := accommodationv1grpc.NewAccommodationSearchServiceClient(c.ClientConn) begin := time.Now() var header metadata.MD resp, err := ass.AccommodationSearch(ctx, request, grpc.Header(&header)) @@ -114,7 +114,7 @@ func createClientAndRunRequest(i int, ppConfig config.PartnerPluginConfig, sLogg c.Shutdown() } -func addToDataset(counter int64, totalTime int64, resp *accommodationv1alpha.AccommodationSearchResponse, metadata *internalmetadata.Metadata, loadTestData [][]string, mu sync.Mutex) { +func addToDataset(counter int64, totalTime int64, resp *accommodationv1.AccommodationSearchResponse, metadata *internalmetadata.Metadata, loadTestData [][]string, mu sync.Mutex) { var data []string var entries []struct { Key string diff --git a/examples/rpc/partner-plugin/server.go b/examples/rpc/partner-plugin/server.go index 0bbaf42d..99ea2735 100644 --- a/examples/rpc/partner-plugin/server.go +++ b/examples/rpc/partner-plugin/server.go @@ -9,48 +9,49 @@ import ( "strconv" "time" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1alpha/accommodationv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1alpha/activityv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/book/v1alpha/bookv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/info/v1alpha/infov1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/network/v1alpha/networkv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/partner/v1alpha/partnerv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/ping/v1alpha/pingv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/seat_map/v1alpha/seat_mapv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/transport/v1alpha/transportv1alphagrpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1/accommodationv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1/activityv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/book/v1/bookv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/info/v1/infov1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/network/v1/networkv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/partner/v1/partnerv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/ping/v1/pingv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/seat_map/v1/seat_mapv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/transport/v1/transportv1grpc" "github.com/chain4travel/camino-messenger-bot/internal/metadata" "google.golang.org/grpc" "google.golang.org/grpc/reflection" "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" - accommodationv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1alpha" - activityv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1alpha" - bookv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/book/v1alpha" - infov1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/info/v1alpha" - networkv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/network/v1alpha" - partnerv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/partner/v1alpha" - pingv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/ping/v1alpha" - seat_mapv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/seat_map/v1alpha" - transportv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/transport/v1alpha" - typesv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/types/v1alpha" + accommodationv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1" + activityv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1" + bookv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/book/v1" + infov1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/info/v1" + networkv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/network/v1" + partnerv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/partner/v1" + pingv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/ping/v1" + seat_mapv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/seat_map/v1" + transportv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/transport/v1" + typesv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/types/v1" ) type partnerPlugin struct { - activityv1alphagrpc.ActivitySearchServiceServer - accommodationv1alphagrpc.AccommodationProductInfoServiceServer - accommodationv1alphagrpc.AccommodationProductListServiceServer - accommodationv1alphagrpc.AccommodationSearchServiceServer - networkv1alphagrpc.GetNetworkFeeServiceServer - partnerv1alphagrpc.GetPartnerConfigurationServiceServer - pingv1alphagrpc.PingServiceServer - transportv1alphagrpc.TransportSearchServiceServer - seat_mapv1alphagrpc.SeatMapServiceServer - seat_mapv1alphagrpc.SeatMapAvailabilityServiceServer - infov1alphagrpc.CountryEntryRequirementsServiceServer + activityv1grpc.ActivitySearchServiceServer + accommodationv1grpc.AccommodationProductInfoServiceServer + accommodationv1grpc.AccommodationProductListServiceServer + accommodationv1grpc.AccommodationSearchServiceServer + networkv1grpc.GetNetworkFeeServiceServer + partnerv1grpc.GetPartnerConfigurationServiceServer + pingv1grpc.PingServiceServer + transportv1grpc.TransportSearchServiceServer + seat_mapv1grpc.SeatMapServiceServer + seat_mapv1grpc.SeatMapAvailabilityServiceServer + infov1grpc.CountryEntryRequirementsServiceServer + activityv1grpc.ActivityProductInfoServiceServer } -func (p *partnerPlugin) Mint(ctx context.Context, _ *bookv1alpha.MintRequest) (*bookv1alpha.MintResponse, error) { +func (p *partnerPlugin) Mint(ctx context.Context, _ *bookv1.MintRequest) (*bookv1.MintResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -59,12 +60,12 @@ func (p *partnerPlugin) Mint(ctx context.Context, _ *bookv1alpha.MintRequest) (* md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - response := bookv1alpha.MintResponse{ - MintId: &typesv1alpha.UUID{Value: md.RequestID}, + response := bookv1.MintResponse{ + MintId: &typesv1.UUID{Value: md.RequestID}, BuyableUntil: ×tamppb.Timestamp{ Seconds: time.Now().Add(5 * time.Minute).Unix(), }, - Price: &typesv1alpha.Price{ + Price: &typesv1.Price{ Value: "1", Decimals: 9, }, @@ -73,7 +74,7 @@ func (p *partnerPlugin) Mint(ctx context.Context, _ *bookv1alpha.MintRequest) (* return &response, nil } -func (p *partnerPlugin) Validation(ctx context.Context, _ *bookv1alpha.ValidationRequest) (*bookv1alpha.ValidationResponse, error) { +func (p *partnerPlugin) Validation(ctx context.Context, _ *bookv1.ValidationRequest) (*bookv1.ValidationResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -82,16 +83,16 @@ func (p *partnerPlugin) Validation(ctx context.Context, _ *bookv1alpha.Validatio md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - response := bookv1alpha.ValidationResponse{ + response := bookv1.ValidationResponse{ Header: nil, - ValidationId: &typesv1alpha.UUID{Value: md.RequestID}, + ValidationId: &typesv1.UUID{Value: md.RequestID}, ValidationObject: nil, } grpc.SendHeader(ctx, md.ToGrpcMD()) return &response, nil } -func (p *partnerPlugin) ActivitySearch(ctx context.Context, _ *activityv1alpha.ActivitySearchRequest) (*activityv1alpha.ActivitySearchResponse, error) { +func (p *partnerPlugin) ActivityProductInfo(ctx context.Context, request *activityv1.ActivityProductInfoRequest) (*activityv1.ActivityProductInfoResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -100,15 +101,225 @@ func (p *partnerPlugin) ActivitySearch(ctx context.Context, _ *activityv1alpha.A md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - response := activityv1alpha.ActivitySearchResponse{ + grpc.SendHeader(ctx, md.ToGrpcMD()) + response := activityv1.ActivityProductInfoResponse{ + Header: nil, + Activities: []*activityv1.ActivityExtendedInfo{ + { + Activity: &activityv1.Activity{ + Context: "ActivityTest", //context + LastModified: timestamppb.New(time.Now()), + ExternalSessionId: "23456", //external_session_id + ProductCode: &typesv1.ProductCode{ + Code: "XPTFAOH15O", //supplier_code + }, + UnitCode: "ActivityTest", //supplier_unit_code + ServiceCode: "TRF", //service_code + Bookability: &typesv1.Bookability{ + Type: typesv1.BookabilityType_BOOKABILITY_TYPE_ON_REQUEST, + ConfirmationTime: &typesv1.Time{ + Hours: 18, + Minutes: 00, + }, + }, + }, + Units: []*activityv1.ActivityUnit{ + { + Schedule: &typesv1.DateTimeRange{ + StartDatetime: timestamppb.New(time.Date(20024, 9, 20, 11, 00, 0, 0, time.UTC)), //summary.start + EndDatetime: timestamppb.New(time.Date(20024, 9, 20, 12, 00, 0, 0, time.UTC)), + }, + Code: "TK0001H1", //unit_code + Name: "Tuk-Tuk Sightseeing Tour (1 hour ) [1]", //unit_code_description + Description: "starts at 11h00", //descriptive_text + }, + { + Schedule: &typesv1.DateTimeRange{ + StartDatetime: timestamppb.New(time.Date(20024, 9, 20, 9, 30, 0, 0, time.UTC)), //summary.start + EndDatetime: timestamppb.New(time.Date(20024, 9, 20, 10, 30, 0, 0, time.UTC)), + }, + Code: "TK0001H0", //unit_code + Name: "Tuk-Tuk Sightseeing Tour (1 hour ) [1]", //unit_code_description + Description: "starts at 09h30", //descriptive_text + }, + { + Schedule: &typesv1.DateTimeRange{ + StartDatetime: timestamppb.New(time.Date(20024, 9, 20, 16, 30, 0, 0, time.UTC)), //summary.start + EndDatetime: timestamppb.New(time.Date(20024, 9, 20, 17, 30, 0, 0, time.UTC)), + }, + Code: "TK0001H2", //unit_code + Name: "Tuk-Tuk Sightseeing Tour (1 hour ) [2]", //unit_code_description + Description: "starts at 16h30", //descriptive_text + }, + }, + Services: []*activityv1.ActivityService{ + { + Code: "TRF", + Name: "incl. pickUp & dropOff", + Description: "incl. pickUp & dropOff", + Included: []string{"Exclusive English or Italian-speaking Musement guide", "Skip-the-line entrance to Leonardo da Vinci's Last Supper"}, + Excluded: []string{}, + }, + }, + Zones: []*activityv1.TransferZone{ + { + Code: "ALT", //zone_code + GeoTree: &typesv1.GeoTree{ + Country: typesv1.Country_COUNTRY_PT, + Region: "Algarve", + CityOrResort: "Albufeira", + }, + PickupDropoffEvents: []*activityv1.PickupDropoffEvent{ + { + LocationCode: "AMTSPT0026", + LocationName: "HOTELENTRANCE / HotelEntrance", + PickupIndicator: true, + OtherInfo: "HOTELENTRANCE", + DateTime: timestamppb.New(time.Date(20024, 9, 20, 16, 30, 0, 0, time.UTC)), + Coordinates: &typesv1.Coordinates{ + Latitude: 37.08472, + Longitude: -8.31469, + }, + }, + }, + }, + }, + Descriptions: []*typesv1.LocalizedDescriptionSet{ + { + Language: typesv1.Language_LANGUAGE_EN, + Descriptions: []*typesv1.Description{{ + Category: "Tours", + Text: "Albufeira Tuk Tuk Experiences offers a range of exciting tours and experiences in the beautiful city of Albufeira.\n\nEmbark on a city tour aboard our comfortable and stylish Tuk Tuks. Explore the vibrant city of Albufeira in a fun and unique way with our City Tour.\n\nLearn about the Albufeira's fascinating past. Our knowledgeable and friendly guides will take you on a journey through the city's charming neighborhoods, the narrow streets of the old town, traditional architecture, local culture and iconic landmarks.\n\nIf you are a tourist visiting Albufeira or a local looking for a new perspective, our tours are designed to provide you with an immersive and memorable experience. \nGet ready to capture stunning photos and create lasting memories.\n\n- City Tour duration: \nChoose how much time you want to spend 1h, 2h or 3h.\n\nIMPORTANT NOTES:\n- Minimum 1 - Maximum 6 people.\n- Price is per vehicle and not per person.\n- Minors must be accompanied by an adult. \n- Reservations can be cancelled free of charge up to 24h before the tour starts. Less than 24h no refund. No shows are not refundable.\n\nNOT RECOMMENDED TO:\n- It\u00b4s not recommended for pregnant women and intoxicated people.\n- Not recommended to mentally or physically incapacitated people.", + }}, + }, + }, + Location: &activityv1.ActivityLocation{}, + Features: []*activityv1.ActivityFeature{ + { + Description: "Difficulty|Easy|", + Code: "EX_DIFFIC|EX_DIF_1", + }, + { + Description: "What`s included|Hotel pickup and drop-off|", + Code: "EX_INCL|EX_INCL_HPD", + }, + { + Description: "English, Spanish, Russian, Portuguese, Romanian", + Code: "Languages:", + }, + { + Description: "We invite you to discover Albufeira by Tuk Tuk!\nEmbark on our City Tour and explore the vibrant streets and rich history of Albufeira.\nGet ready to capture stunning photos and create lasting memories.", + Code: "EN Description", + }, + }, + Tags: []*activityv1.ActivityTag{ + { + Active: true, + Id: 111, + Name: "Guided Tour", + Slug: "guided-tour", + }, + { + Active: true, + Id: 2, + Name: "Entrance Tickets", + Slug: "entrance-tickets", + }, + }, + Languages: []typesv1.Language{ + typesv1.Language_LANGUAGE_EN, + typesv1.Language_LANGUAGE_IT, + }, + ContactInfo: &typesv1.ContactInfo{ + Address: []*typesv1.Address{ + { + Line_1: "Calle Sant Joan 38", + Line_2: "Quarter La Vileta", + ZipCode: "07008", + GeoTree: &typesv1.GeoTree{ + Country: typesv1.Country_COUNTRY_ES, + Region: "Mallorca", + CityOrResort: "Palma", + }, + }, + }, + }, + Images: []*typesv1.Image{}, + Videos: []*typesv1.Video{ + { + File: &typesv1.File{ + Name: "Tuk Tuk Experiences", + Url: "video_url", + LastModified: timestamppb.New(time.Now()), + }, + Codec: "codec", + Bitrate: 90, + Framerate: 90, + AspectRatio: "16:90", + Resolution: "720p", + Format: "mp4", + Category: "Commercial", + }, + }, + }, + }, + } + return &response, nil +} + +func (p *partnerPlugin) ActivityProductList(ctx context.Context, _ *activityv1.ActivityProductListRequest) (*activityv1.ActivityProductListResponse, error) { + md := metadata.Metadata{} + err := md.ExtractMetadata(ctx) + if err != nil { + log.Print("error extracting metadata") + } + md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) + log.Printf("Responding to request: %s", md.RequestID) + + response := activityv1.ActivityProductListResponse{ + Header: nil, + Activities: []*activityv1.Activity{ + { + Context: "ActivityTest", //context + LastModified: timestamppb.New(time.Now()), + ExternalSessionId: "23456", //external_session_id + ProductCode: &typesv1.ProductCode{ + Code: "XPTFAOH15O", //supplier_code + }, + UnitCode: "ActivityTest", //supplier_unit_code + ServiceCode: "TRF", //service_code + Bookability: &typesv1.Bookability{ + Type: typesv1.BookabilityType_BOOKABILITY_TYPE_ON_REQUEST, + ConfirmationTime: &typesv1.Time{ + Hours: 18, + Minutes: 00, + }, + }, + }, + }, + } + grpc.SendHeader(ctx, md.ToGrpcMD()) + return &response, nil + +} +func (p *partnerPlugin) ActivitySearch(ctx context.Context, _ *activityv1.ActivitySearchRequest) (*activityv1.ActivitySearchResponse, error) { + md := metadata.Metadata{} + err := md.ExtractMetadata(ctx) + if err != nil { + log.Print("error extracting metadata") + } + md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) + log.Printf("Responding to request: %s", md.RequestID) + + response := activityv1.ActivitySearchResponse{ Header: nil, - Metadata: &typesv1alpha.SearchResponseMetadata{SearchId: &typesv1alpha.UUID{Value: md.RequestID}}, + Metadata: &typesv1.SearchResponseMetadata{SearchId: &typesv1.UUID{Value: md.RequestID}}, } grpc.SendHeader(ctx, md.ToGrpcMD()) return &response, nil } -func (p *partnerPlugin) AccommodationProductInfo(ctx context.Context, _ *accommodationv1alpha.AccommodationProductInfoRequest) (*accommodationv1alpha.AccommodationProductInfoResponse, error) { +func (p *partnerPlugin) AccommodationProductInfo(ctx context.Context, _ *accommodationv1.AccommodationProductInfoRequest) (*accommodationv1.AccommodationProductInfoResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -117,14 +328,14 @@ func (p *partnerPlugin) AccommodationProductInfo(ctx context.Context, _ *accommo md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - response := accommodationv1alpha.AccommodationProductInfoResponse{ - Properties: []*accommodationv1alpha.PropertyExtendedInfo{{PaymentType: "cash"}}, + response := accommodationv1.AccommodationProductInfoResponse{ + Properties: []*accommodationv1.PropertyExtendedInfo{{PaymentType: "cash"}}, } grpc.SendHeader(ctx, md.ToGrpcMD()) return &response, nil } -func (p *partnerPlugin) AccommodationProductList(ctx context.Context, _ *accommodationv1alpha.AccommodationProductListRequest) (*accommodationv1alpha.AccommodationProductListResponse, error) { +func (p *partnerPlugin) AccommodationProductList(ctx context.Context, _ *accommodationv1.AccommodationProductListRequest) (*accommodationv1.AccommodationProductListResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -133,14 +344,14 @@ func (p *partnerPlugin) AccommodationProductList(ctx context.Context, _ *accommo md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - response := accommodationv1alpha.AccommodationProductListResponse{ - Properties: []*accommodationv1alpha.Property{{Name: "Hotel"}}, + response := accommodationv1.AccommodationProductListResponse{ + Properties: []*accommodationv1.Property{{Name: "Hotel"}}, } grpc.SendHeader(ctx, md.ToGrpcMD()) return &response, nil } -func (p *partnerPlugin) AccommodationSearch(ctx context.Context, _ *accommodationv1alpha.AccommodationSearchRequest) (*accommodationv1alpha.AccommodationSearchResponse, error) { +func (p *partnerPlugin) AccommodationSearch(ctx context.Context, _ *accommodationv1.AccommodationSearchRequest) (*accommodationv1.AccommodationSearchResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -149,15 +360,15 @@ func (p *partnerPlugin) AccommodationSearch(ctx context.Context, _ *accommodatio md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - response := accommodationv1alpha.AccommodationSearchResponse{ + response := accommodationv1.AccommodationSearchResponse{ Header: nil, - Metadata: &typesv1alpha.SearchResponseMetadata{SearchId: &typesv1alpha.UUID{Value: md.RequestID}}, + Metadata: &typesv1.SearchResponseMetadata{SearchId: &typesv1.UUID{Value: md.RequestID}}, } grpc.SendHeader(ctx, md.ToGrpcMD()) return &response, nil } -func (p *partnerPlugin) GetNetworkFee(ctx context.Context, request *networkv1alpha.GetNetworkFeeRequest) (*networkv1alpha.GetNetworkFeeResponse, error) { +func (p *partnerPlugin) GetNetworkFee(ctx context.Context, request *networkv1.GetNetworkFeeRequest) (*networkv1.GetNetworkFeeResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -166,8 +377,8 @@ func (p *partnerPlugin) GetNetworkFee(ctx context.Context, request *networkv1alp md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - response := networkv1alpha.GetNetworkFeeResponse{ - NetworkFee: &networkv1alpha.NetworkFee{ + response := networkv1.GetNetworkFeeResponse{ + NetworkFee: &networkv1.NetworkFee{ Amount: 0, }, CurrentBlockHeight: request.BlockHeight, @@ -176,7 +387,7 @@ func (p *partnerPlugin) GetNetworkFee(ctx context.Context, request *networkv1alp return &response, nil } -func (p *partnerPlugin) GetPartnerConfiguration(ctx context.Context, request *partnerv1alpha.GetPartnerConfigurationRequest) (*partnerv1alpha.GetPartnerConfigurationResponse, error) { +func (p *partnerPlugin) GetPartnerConfiguration(ctx context.Context, request *partnerv1.GetPartnerConfigurationRequest) (*partnerv1.GetPartnerConfigurationResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -185,15 +396,15 @@ func (p *partnerPlugin) GetPartnerConfiguration(ctx context.Context, request *pa md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - response := partnerv1alpha.GetPartnerConfigurationResponse{ - PartnerConfiguration: &partnerv1alpha.PartnerConfiguration{}, + response := partnerv1.GetPartnerConfigurationResponse{ + PartnerConfiguration: &partnerv1.PartnerConfiguration{}, CurrentBlockHeight: request.GetBlockHeight(), } grpc.SendHeader(ctx, md.ToGrpcMD()) return &response, nil } -func (p *partnerPlugin) Ping(ctx context.Context, request *pingv1alpha.PingRequest) (*pingv1alpha.PingResponse, error) { +func (p *partnerPlugin) Ping(ctx context.Context, request *pingv1.PingRequest) (*pingv1.PingResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -202,13 +413,13 @@ func (p *partnerPlugin) Ping(ctx context.Context, request *pingv1alpha.PingReque md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - return &pingv1alpha.PingResponse{ + return &pingv1.PingResponse{ Header: nil, PingMessage: fmt.Sprintf("Ping response to [%s] with request ID: %s", request.PingMessage, md.RequestID), }, nil } -func (p *partnerPlugin) TransportSearch(ctx context.Context, _ *transportv1alpha.TransportSearchRequest) (*transportv1alpha.TransportSearchResponse, error) { +func (p *partnerPlugin) TransportSearch(ctx context.Context, _ *transportv1.TransportSearchRequest) (*transportv1.TransportSearchResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -217,14 +428,14 @@ func (p *partnerPlugin) TransportSearch(ctx context.Context, _ *transportv1alpha md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - response := transportv1alpha.TransportSearchResponse{ + response := transportv1.TransportSearchResponse{ Header: nil, - Metadata: &typesv1alpha.SearchResponseMetadata{SearchId: &typesv1alpha.UUID{Value: md.RequestID}}, + Metadata: &typesv1.SearchResponseMetadata{SearchId: &typesv1.UUID{Value: md.RequestID}}, } grpc.SendHeader(ctx, md.ToGrpcMD()) return &response, nil } -func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.SeatMapRequest) (*seat_mapv1alpha.SeatMapResponse, error) { +func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1.SeatMapRequest) (*seat_mapv1.SeatMapResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -233,29 +444,29 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.Se md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - response := seat_mapv1alpha.SeatMapResponse{ + response := seat_mapv1.SeatMapResponse{ Header: nil, - SeatMap: &typesv1alpha.SeatMap{ + SeatMap: &typesv1.SeatMap{ Id: md.RequestID, - Sections: []*typesv1alpha.Section{{ + Sections: []*typesv1.Section{{ Id: "123ST", - Names: []*typesv1alpha.LocalizedString{{ - Language: typesv1alpha.Language_LANGUAGE_EN, + Names: []*typesv1.LocalizedString{{ + Language: typesv1.Language_LANGUAGE_EN, Text: "North Stand", }, { - Language: typesv1alpha.Language_LANGUAGE_DE, + Language: typesv1.Language_LANGUAGE_DE, Text: "Nordtribüne", }, }, - SeatInfo: &typesv1alpha.Section_SeatList{ - SeatList: &typesv1alpha.SeatList{ - Seats: []*typesv1alpha.Seat{ + SeatInfo: &typesv1.Section_SeatList{ + SeatList: &typesv1.SeatList{ + Seats: []*typesv1.Seat{ { Id: "1A", - Location: &typesv1alpha.SeatLocation{ - Location: &typesv1alpha.SeatLocation_Vector{ - Vector: &typesv1alpha.VectorSeatLocation{ + Location: &typesv1.SeatLocation{ + Location: &typesv1.SeatLocation_Vector{ + Vector: &typesv1.VectorSeatLocation{ Label: "section-North-Stand-26-34-2-label", }, }, @@ -263,17 +474,17 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.Se }, { Id: "2A", - Location: &typesv1alpha.SeatLocation{ - Location: &typesv1alpha.SeatLocation_Vector{ - Vector: &typesv1alpha.VectorSeatLocation{ + Location: &typesv1.SeatLocation{ + Location: &typesv1.SeatLocation_Vector{ + Vector: &typesv1.VectorSeatLocation{ Label: "section-North-Stand-26-34-2-label", }, }, }, - Restrictions: []*typesv1alpha.LocalizedSeatAttributeSet{ + Restrictions: []*typesv1.LocalizedSeatAttributeSet{ { - Language: typesv1alpha.Language_LANGUAGE_EN, - SeatAttributes: []*typesv1alpha.SeatAttribute{ + Language: typesv1.Language_LANGUAGE_EN, + SeatAttributes: []*typesv1.SeatAttribute{ { Name: "Restricted Vision", Description: "Seat behind a column", @@ -281,10 +492,10 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.Se }, }, }, - Features: []*typesv1alpha.LocalizedSeatAttributeSet{ + Features: []*typesv1.LocalizedSeatAttributeSet{ { - Language: typesv1alpha.Language_LANGUAGE_EN, - SeatAttributes: []*typesv1alpha.SeatAttribute{ + Language: typesv1.Language_LANGUAGE_EN, + SeatAttributes: []*typesv1.SeatAttribute{ { Name: "Discount", Description: "Discount due to restricted vision up to 80%", @@ -293,8 +504,8 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.Se }, }, { - Language: typesv1alpha.Language_LANGUAGE_DE, - SeatAttributes: []*typesv1alpha.SeatAttribute{ + Language: typesv1.Language_LANGUAGE_DE, + SeatAttributes: []*typesv1.SeatAttribute{ { Name: "Rabatt", Description: "Hinter der Säule - bis zu 80% Rabatt", @@ -307,8 +518,8 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.Se }, }, }, - Image: &typesv1alpha.Image{ - File: &typesv1alpha.File{ + Image: &typesv1.Image{ + File: &typesv1.File{ Name: "String", Url: "https://camino.network/static/images/6HibYS9gzR-1800.webp", //TODO: replace with an actual image LastModified: timestamppb.New(time.Now()), @@ -316,9 +527,9 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.Se Width: 50, Height: 50, }, - LocalizedDescriptions: []*typesv1alpha.LocalizedDescriptionSet{{ - Language: typesv1alpha.Language_LANGUAGE_EN, - Descriptions: []*typesv1alpha.Description{{ + LocalizedDescriptions: []*typesv1.LocalizedDescriptionSet{{ + Language: typesv1.Language_LANGUAGE_EN, + Descriptions: []*typesv1.Description{{ Category: "General", Text: "Leather Seats", }}, @@ -327,21 +538,21 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.Se }, { Id: "124ST", - Names: []*typesv1alpha.LocalizedString{{ - Language: typesv1alpha.Language_LANGUAGE_EN, + Names: []*typesv1.LocalizedString{{ + Language: typesv1.Language_LANGUAGE_EN, Text: "East Stand", }, { - Language: typesv1alpha.Language_LANGUAGE_DE, + Language: typesv1.Language_LANGUAGE_DE, Text: "Osttribüne", }}, - SeatInfo: &typesv1alpha.Section_SeatList{ - SeatList: &typesv1alpha.SeatList{ - Seats: []*typesv1alpha.Seat{ + SeatInfo: &typesv1.Section_SeatList{ + SeatList: &typesv1.SeatList{ + Seats: []*typesv1.Seat{ { Id: "31F", - Location: &typesv1alpha.SeatLocation{ - Location: &typesv1alpha.SeatLocation_Vector{ - Vector: &typesv1alpha.VectorSeatLocation{ + Location: &typesv1.SeatLocation{ + Location: &typesv1.SeatLocation_Vector{ + Vector: &typesv1.VectorSeatLocation{ Label: "section-East-Stand-26-34-2-label", }, }, @@ -349,9 +560,9 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.Se }, { Id: "32F", - Location: &typesv1alpha.SeatLocation{ - Location: &typesv1alpha.SeatLocation_Vector{ - Vector: &typesv1alpha.VectorSeatLocation{ + Location: &typesv1.SeatLocation{ + Location: &typesv1.SeatLocation_Vector{ + Vector: &typesv1.VectorSeatLocation{ Label: "section-East-Stand-26-34-2-label", }, }, @@ -360,8 +571,8 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.Se }, }, }, - Image: &typesv1alpha.Image{ - File: &typesv1alpha.File{ + Image: &typesv1.Image{ + File: &typesv1.File{ Name: "String", Url: "https://camino.network/static/images/6HibYS9gzR-1800.webp", LastModified: timestamppb.New(time.Now()), @@ -369,15 +580,15 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.Se Width: 50, Height: 50, }, - LocalizedDescriptions: []*typesv1alpha.LocalizedDescriptionSet{{ - Language: typesv1alpha.Language_LANGUAGE_EN, - Descriptions: []*typesv1alpha.Description{{ + LocalizedDescriptions: []*typesv1.LocalizedDescriptionSet{{ + Language: typesv1.Language_LANGUAGE_EN, + Descriptions: []*typesv1.Description{{ Category: "General", Text: "Seats", }}, }, { - Language: typesv1alpha.Language_LANGUAGE_DE, - Descriptions: []*typesv1alpha.Description{{ + Language: typesv1.Language_LANGUAGE_DE, + Descriptions: []*typesv1.Description{{ Category: "Allgemein", Text: "Sitz", }}, @@ -389,7 +600,7 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv1alpha.Se grpc.SendHeader(ctx, md.ToGrpcMD()) return &response, nil } -func (p *partnerPlugin) SeatMapAvailability(ctx context.Context, request *seat_mapv1alpha.SeatMapAvailabilityRequest) (*seat_mapv1alpha.SeatMapAvailabilityResponse, error) { +func (p *partnerPlugin) SeatMapAvailability(ctx context.Context, request *seat_mapv1.SeatMapAvailabilityRequest) (*seat_mapv1.SeatMapAvailabilityResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -398,21 +609,21 @@ func (p *partnerPlugin) SeatMapAvailability(ctx context.Context, request *seat_m md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s", md.RequestID) - response := seat_mapv1alpha.SeatMapAvailabilityResponse{ + response := seat_mapv1.SeatMapAvailabilityResponse{ Header: nil, - SeatMap: &typesv1alpha.SeatMapInventory{ + SeatMap: &typesv1.SeatMapInventory{ Id: "123ST", - Sections: []*typesv1alpha.SectionInventory{ + Sections: []*typesv1.SectionInventory{ { Id: "A", - SeatInfo: &typesv1alpha.SectionInventory_SeatList{ - SeatList: &typesv1alpha.SeatInventory{ + SeatInfo: &typesv1.SectionInventory_SeatList{ + SeatList: &typesv1.SeatInventory{ Ids: []string{"1A", "1B"}, }, }}, { Id: "B", - SeatInfo: &typesv1alpha.SectionInventory_SeatCount{SeatCount: &wrapperspb.Int32Value{Value: 32}}, + SeatInfo: &typesv1.SectionInventory_SeatCount{SeatCount: &wrapperspb.Int32Value{Value: 32}}, }}, }, } @@ -421,7 +632,7 @@ func (p *partnerPlugin) SeatMapAvailability(ctx context.Context, request *seat_m return &response, nil } -func (p *partnerPlugin) CountryEntryRequirements(ctx context.Context, request *infov1alpha.CountryEntryRequirementsRequest) (*infov1alpha.CountryEntryRequirementsResponse, error) { +func (p *partnerPlugin) CountryEntryRequirements(ctx context.Context, request *infov1.CountryEntryRequirementsRequest) (*infov1.CountryEntryRequirementsResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -431,97 +642,99 @@ func (p *partnerPlugin) CountryEntryRequirements(ctx context.Context, request *i log.Printf("Responding to request: %s", md.RequestID) grpc.SendHeader(ctx, md.ToGrpcMD()) - response := infov1alpha.CountryEntryRequirementsResponse{ + response := infov1.CountryEntryRequirementsResponse{ Header: nil, - Categories: []*infov1alpha.CountryEntryRequirementCategory{{ + Categories: []*infov1.CountryEntryRequirementCategory{{ Key: "entry", - Names: []*typesv1alpha.LocalizedString{{ + Names: []*typesv1.LocalizedString{{ Text: "Entry", - Language: typesv1alpha.Language_LANGUAGE_EN, + Language: typesv1.Language_LANGUAGE_EN, }, { Text: "Einreise", - Language: typesv1alpha.Language_LANGUAGE_DE, + Language: typesv1.Language_LANGUAGE_DE, }}, - SubCategories: []*infov1alpha.CountryEntryRequirementCategory{{ + SubCategories: []*infov1.CountryEntryRequirementCategory{{ Key: "entry_documents", - Names: []*typesv1alpha.LocalizedString{{ + Names: []*typesv1.LocalizedString{{ Text: "Required entry forms and documents", - Language: typesv1alpha.Language_LANGUAGE_EN, + Language: typesv1.Language_LANGUAGE_EN, }, { Text: "Erforderliche Formulare und Dokumente für die Einreise", - Language: typesv1alpha.Language_LANGUAGE_DE, + Language: typesv1.Language_LANGUAGE_DE, }}, - Items: []*infov1alpha.CountryEntryRequirementItem{{ + Items: []*infov1.CountryEntryRequirementItem{{ Key: "ErVisaText", - Info: []*infov1alpha.LocalizedItemInfo{{ + Info: []*infov1.LocalizedItemInfo{{ Name: "Visa required for stay", Description: "

A visa is required for the stay. This can be applied for as an e-Visa or on arrival as a \"Visa on Arrival\".

Travellers with eVisa are permitted to stay up to 30 days in Egypt.

Electronic Visa Portal

Visa fees

Visa fees must be paid in cash in euros or US dollars.
", - Language: typesv1alpha.Language_LANGUAGE_EN, + Language: typesv1.Language_LANGUAGE_EN, }, { Name: "Visum erforderlich für Aufenthalt", Description: "

Es ist ein Visum für den Aufenthalt erforderlich. Dieses kann als e-Visum oder bei Ankunft als \"Visa on Arrival\" beantragt werden.

Reisende mit eVisa dürfen sich bis zu 30 Tage im Land aufhalten.

Electronic Visa Portal

Visumgebühren

Die Visumgebühren sind in Euro oder US-Dollar bar zu zahlen.
", - Language: typesv1alpha.Language_LANGUAGE_DE, + Language: typesv1.Language_LANGUAGE_DE, }}, LastSignificantUpdate: timestamppb.New(time.Now()), - Status: infov1alpha.ItemStatus_ITEM_STATUS_TRUE, + Status: infov1.ItemStatus_ITEM_STATUS_TRUE, }, }, }}, }}, - Items: []*infov1alpha.CountryEntryRequirementItem{ + Items: []*infov1.CountryEntryRequirementItem{ { Key: "EntryDocumentsRequired", - Info: []*infov1alpha.LocalizedItemInfo{ + Info: []*infov1.LocalizedItemInfo{ { Name: "Entry forms", Description: "

Individuals must fill out a health form upon entry, which they can complete either at the airport, on the plane, or beforehand.

", - Language: typesv1alpha.Language_LANGUAGE_EN, + Language: typesv1.Language_LANGUAGE_EN, }, { Name: "Einreiseformulare", Description: "

Personen müssen bei Einreise ein Gesundheitsformular abgeben, welches entweder am Flughafen, im Flugzeug oder vor Antritt der Reise ausfüllen.

", - Language: typesv1alpha.Language_LANGUAGE_DE, + Language: typesv1.Language_LANGUAGE_DE, }, }, LastSignificantUpdate: timestamppb.New(time.Now()), - Status: infov1alpha.ItemStatus_ITEM_STATUS_FALSE, + Status: infov1.ItemStatus_ITEM_STATUS_FALSE, }, { Key: "ErVisaText", - Info: []*infov1alpha.LocalizedItemInfo{ + Info: []*infov1.LocalizedItemInfo{ { Name: "Visa required for stay", Description: "

A visa is required for the stay. This can be applied for as an e-Visa or on arrival as a \"Visa on Arrival\".

Travellers with eVisa are permitted to stay up to 30 days in Egypt.

Electronic Visa Portal

Visa fees

Visa fees must be paid in cash in euros or US dollars.
", - Language: typesv1alpha.Language_LANGUAGE_EN, + Language: typesv1.Language_LANGUAGE_EN, }, { Name: "Visum erforderlich für Aufenthalt", Description: "

Es ist ein Visum für den Aufenthalt erforderlich. Dieses kann als e-Visum oder bei Ankunft als \"Visa on Arrival\" beantragt werden.

Reisende mit eVisa dürfen sich bis zu 30 Tage im Land aufhalten.

Electronic Visa Portal

Visumgebühren

Die Visumgebühren sind in Euro oder US-Dollar bar zu zahlen.
", - Language: typesv1alpha.Language_LANGUAGE_DE, + Language: typesv1.Language_LANGUAGE_DE, }, }, LastSignificantUpdate: timestamppb.New(time.Now()), - Status: infov1alpha.ItemStatus_ITEM_STATUS_TRUE, + Status: infov1.ItemStatus_ITEM_STATUS_TRUE, }, }, } return &response, nil } + func main() { grpcServer := grpc.NewServer() - activityv1alphagrpc.RegisterActivitySearchServiceServer(grpcServer, &partnerPlugin{}) - accommodationv1alphagrpc.RegisterAccommodationProductInfoServiceServer(grpcServer, &partnerPlugin{}) - accommodationv1alphagrpc.RegisterAccommodationProductListServiceServer(grpcServer, &partnerPlugin{}) - accommodationv1alphagrpc.RegisterAccommodationSearchServiceServer(grpcServer, &partnerPlugin{}) - networkv1alphagrpc.RegisterGetNetworkFeeServiceServer(grpcServer, &partnerPlugin{}) - partnerv1alphagrpc.RegisterGetPartnerConfigurationServiceServer(grpcServer, &partnerPlugin{}) - bookv1alphagrpc.RegisterMintServiceServer(grpcServer, &partnerPlugin{}) - bookv1alphagrpc.RegisterValidationServiceServer(grpcServer, &partnerPlugin{}) - pingv1alphagrpc.RegisterPingServiceServer(grpcServer, &partnerPlugin{}) - transportv1alphagrpc.RegisterTransportSearchServiceServer(grpcServer, &partnerPlugin{}) - seat_mapv1alphagrpc.RegisterSeatMapServiceServer(grpcServer, &partnerPlugin{}) - seat_mapv1alphagrpc.RegisterSeatMapAvailabilityServiceServer(grpcServer, &partnerPlugin{}) - infov1alphagrpc.RegisterCountryEntryRequirementsServiceServer(grpcServer, &partnerPlugin{}) + activityv1grpc.RegisterActivityProductInfoServiceServer(grpcServer, &partnerPlugin{}) + activityv1grpc.RegisterActivitySearchServiceServer(grpcServer, &partnerPlugin{}) + accommodationv1grpc.RegisterAccommodationProductInfoServiceServer(grpcServer, &partnerPlugin{}) + accommodationv1grpc.RegisterAccommodationProductListServiceServer(grpcServer, &partnerPlugin{}) + accommodationv1grpc.RegisterAccommodationSearchServiceServer(grpcServer, &partnerPlugin{}) + networkv1grpc.RegisterGetNetworkFeeServiceServer(grpcServer, &partnerPlugin{}) + partnerv1grpc.RegisterGetPartnerConfigurationServiceServer(grpcServer, &partnerPlugin{}) + bookv1grpc.RegisterMintServiceServer(grpcServer, &partnerPlugin{}) + bookv1grpc.RegisterValidationServiceServer(grpcServer, &partnerPlugin{}) + pingv1grpc.RegisterPingServiceServer(grpcServer, &partnerPlugin{}) + transportv1grpc.RegisterTransportSearchServiceServer(grpcServer, &partnerPlugin{}) + seat_mapv1grpc.RegisterSeatMapServiceServer(grpcServer, &partnerPlugin{}) + seat_mapv1grpc.RegisterSeatMapAvailabilityServiceServer(grpcServer, &partnerPlugin{}) + infov1grpc.RegisterCountryEntryRequirementsServiceServer(grpcServer, &partnerPlugin{}) port := 55555 var err error p, found := os.LookupEnv("PORT") diff --git a/go.mod b/go.mod index 84a26eed..e541f1ce 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/chain4travel/camino-messenger-bot go 1.20 require ( - buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go v1.5.1-20240812155629-cf8583b47e72.1 - buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go v1.34.2-20240812155629-cf8583b47e72.2 + buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go v1.5.1-20240902074016-adcea0949c54.1 + buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go v1.34.2-20240902074016-adcea0949c54.2 github.com/ava-labs/avalanchego v1.10.18 github.com/ethereum/go-ethereum v1.12.0 github.com/klauspost/compress v1.17.3 diff --git a/go.sum b/go.sum index 702cc7e1..a3489c5a 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go v1.5.1-20240812155629-cf8583b47e72.1 h1:AJzOqps2nQASUURJMsEjJ7wYZKJRHpkQhWqA+QxR5F4= -buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go v1.5.1-20240812155629-cf8583b47e72.1/go.mod h1:L4LJuGUHCFTQFoT/4hvpZghw5qEdl5OoR4UkWwnKnXE= -buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go v1.34.2-20240812155629-cf8583b47e72.2 h1:h5a6wRjwhrM3ucgTxg89KUtbo/YWNT9S9gvXVgYFC9o= -buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go v1.34.2-20240812155629-cf8583b47e72.2/go.mod h1:acWRhCieVmVn3QBIX9Y3y7AtJ+nsSc1BrBXfJHam8Ew= +buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go v1.5.1-20240902074016-adcea0949c54.1 h1:3B9HBy+UepQpEc3p64Eqbl9JgedxZmHx/8dD+NzHfoI= +buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go v1.5.1-20240902074016-adcea0949c54.1/go.mod h1:H7tLtuZ78R6Cigp4zPHpUvLnY42DVpN/U8jHtfA4Vuc= +buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go v1.34.2-20240902074016-adcea0949c54.2 h1:z4R4QQ4RfXE3W7HDstDIVxR4ALovmsn2l29XPOD0zbI= +buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go v1.34.2-20240902074016-adcea0949c54.2/go.mod h1:acWRhCieVmVn3QBIX9Y3y7AtJ+nsSc1BrBXfJHam8Ew= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= diff --git a/internal/app/app.go b/internal/app/app.go index 1dbba28c..ccf55324 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -42,7 +42,7 @@ func NewApp(cfg *config.Config) (*App, error) { defer logger.Sync() //nolint:errcheck // TODO @evlekht use actual git tag/commit - app.logger.Info("version: 8.0.0") + app.logger.Info("version: 9.0.0") return app, nil } diff --git a/internal/matrix/matrix_compressor_test.go b/internal/matrix/matrix_compressor_test.go index d39a7566..8c527c11 100644 --- a/internal/matrix/matrix_compressor_test.go +++ b/internal/matrix/matrix_compressor_test.go @@ -8,13 +8,18 @@ package matrix import ( "testing" - activityv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1alpha" + activityv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1" "github.com/chain4travel/camino-messenger-bot/internal/messaging" "github.com/chain4travel/camino-messenger-bot/internal/metadata" "github.com/stretchr/testify/require" "maunium.net/go/mautrix/event" ) +func compressOnly(msg messaging.Message) []byte { + compressed, _ := compress(msg) // Ignoring the second return value + return compressed +} + func TestChunkingCompressorCompress(t *testing.T) { type args struct { msg messaging.Message @@ -39,9 +44,9 @@ func TestChunkingCompressorCompress(t *testing.T) { Type: messaging.ActivitySearchResponse, Content: messaging.MessageContent{ ResponseContent: messaging.ResponseContent{ - ActivitySearchResponse: &activityv1alpha.ActivitySearchResponse{ - Results: []*activityv1alpha.ActivitySearchResult{ - {Info: &activityv1alpha.Activity{ServiceCode: "test"}}, + ActivitySearchResponse: &activityv1.ActivitySearchResponse{ + Results: []*activityv1.ActivitySearchResult{ + {Info: &activityv1.Activity{ServiceCode: "test"}}, }, }, }, @@ -58,7 +63,19 @@ func TestChunkingCompressorCompress(t *testing.T) { NumberOfChunks: 1, ChunkIndex: 0, }, - CompressedContent: []byte{40, 181, 47, 253, 4, 0, 81, 0, 0, 26, 8, 18, 6, 42, 4, 116, 101, 115, 116, 39, 101, 69, 66}, + CompressedContent: compressOnly( + messaging.Message{ + Type: messaging.ActivitySearchResponse, + Content: messaging.MessageContent{ + ResponseContent: messaging.ResponseContent{ + ActivitySearchResponse: &activityv1.ActivitySearchResponse{ + Results: []*activityv1.ActivitySearchResult{ + {Info: &activityv1.Activity{ServiceCode: "test"}}, + }, + }, + }, + }, + }), }, }, }, @@ -68,9 +85,9 @@ func TestChunkingCompressorCompress(t *testing.T) { Type: messaging.ActivitySearchResponse, Content: messaging.MessageContent{ ResponseContent: messaging.ResponseContent{ - ActivitySearchResponse: &activityv1alpha.ActivitySearchResponse{ - Results: []*activityv1alpha.ActivitySearchResult{ - {Info: &activityv1alpha.Activity{ServiceCode: "test"}}, + ActivitySearchResponse: &activityv1.ActivitySearchResponse{ + Results: []*activityv1.ActivitySearchResult{ + {Info: &activityv1.Activity{ServiceCode: "test"}}, }, }, }, @@ -87,7 +104,19 @@ func TestChunkingCompressorCompress(t *testing.T) { NumberOfChunks: 1, ChunkIndex: 0, }, - CompressedContent: []byte{40, 181, 47, 253, 4, 0, 81, 0, 0, 26, 8, 18, 6, 42, 4, 116, 101, 115, 116, 39, 101, 69, 66}, + CompressedContent: compressOnly( + messaging.Message{ + Type: messaging.ActivitySearchResponse, + Content: messaging.MessageContent{ + ResponseContent: messaging.ResponseContent{ + ActivitySearchResponse: &activityv1.ActivitySearchResponse{ + Results: []*activityv1.ActivitySearchResult{ + {Info: &activityv1.Activity{ServiceCode: "test"}}, + }, + }, + }, + }, + }), }, }, }, @@ -97,9 +126,9 @@ func TestChunkingCompressorCompress(t *testing.T) { Type: messaging.ActivitySearchResponse, Content: messaging.MessageContent{ ResponseContent: messaging.ResponseContent{ - ActivitySearchResponse: &activityv1alpha.ActivitySearchResponse{ - Results: []*activityv1alpha.ActivitySearchResult{ - {Info: &activityv1alpha.Activity{ServiceCode: "test"}}, + ActivitySearchResponse: &activityv1.ActivitySearchResponse{ + Results: []*activityv1.ActivitySearchResult{ + {Info: &activityv1.Activity{ServiceCode: "test"}}, }, }, }, @@ -116,7 +145,21 @@ func TestChunkingCompressorCompress(t *testing.T) { NumberOfChunks: 2, ChunkIndex: 0, }, - CompressedContent: []byte{40, 181, 47, 253, 4, 0, 81, 0, 0, 26, 8, 18, 6, 42, 4, 116, 101, 115, 116, 39, 101, 69}, + CompressedContent: func() []byte { + compressedContent := compressOnly(messaging.Message{ + Type: messaging.ActivitySearchResponse, + Content: messaging.MessageContent{ + ResponseContent: messaging.ResponseContent{ + ActivitySearchResponse: &activityv1.ActivitySearchResponse{ + Results: []*activityv1.ActivitySearchResult{ + {Info: &activityv1.Activity{ServiceCode: "test"}}, + }, + }, + }, + }, + }) + return compressedContent[:22] // First Chunk - TODO: remove 22 as length and use variable + }(), }, { MessageEventContent: event.MessageEventContent{ @@ -126,7 +169,21 @@ func TestChunkingCompressorCompress(t *testing.T) { NumberOfChunks: 2, ChunkIndex: 1, }, - CompressedContent: []byte{66}, + CompressedContent: func() []byte { + compressedContent := compressOnly(messaging.Message{ + Type: messaging.ActivitySearchResponse, + Content: messaging.MessageContent{ + ResponseContent: messaging.ResponseContent{ + ActivitySearchResponse: &activityv1.ActivitySearchResponse{ + Results: []*activityv1.ActivitySearchResult{ + {Info: &activityv1.Activity{ServiceCode: "test"}}, + }, + }, + }, + }, + }) + return compressedContent[22:] // Second Chunk + }(), }, }, }, diff --git a/internal/matrix/msg_assembler_test.go b/internal/matrix/msg_assembler_test.go index 93572ca6..5b3a536b 100644 --- a/internal/matrix/msg_assembler_test.go +++ b/internal/matrix/msg_assembler_test.go @@ -10,7 +10,7 @@ import ( "maunium.net/go/mautrix/event" - activityv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1alpha" + activityv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1" "github.com/chain4travel/camino-messenger-bot/internal/compression" "github.com/chain4travel/camino-messenger-bot/internal/messaging" "github.com/chain4travel/camino-messenger-bot/internal/metadata" @@ -23,9 +23,9 @@ func TestAssembleMessage(t *testing.T) { Type: messaging.ActivitySearchResponse, Content: messaging.MessageContent{ ResponseContent: messaging.ResponseContent{ - ActivitySearchResponse: &activityv1alpha.ActivitySearchResponse{ - Results: []*activityv1alpha.ActivitySearchResult{ - {Info: &activityv1alpha.Activity{ServiceCode: "test"}}, + ActivitySearchResponse: &activityv1.ActivitySearchResponse{ + Results: []*activityv1.ActivitySearchResult{ + {Info: &activityv1.Activity{ServiceCode: "test"}}, }, }, }, diff --git a/internal/matrix/types.go b/internal/matrix/types.go index dcf91de2..a59351a3 100644 --- a/internal/matrix/types.go +++ b/internal/matrix/types.go @@ -1,13 +1,15 @@ package matrix import ( - accommodationv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1alpha" - activityv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1alpha" - bookv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/book/v1alpha" - networkv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/network/v1alpha" - partnerv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/partner/v1alpha" - pingv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/ping/v1alpha" - transportv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/transport/v1alpha" + accommodationv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1" + activityv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1" + bookv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/book/v1" + infov1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/info/v1" + networkv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/network/v1" + partnerv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/partner/v1" + pingv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/ping/v1" + seat_mapv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/seat_map/v1" + transportv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/transport/v1" "github.com/chain4travel/camino-messenger-bot/internal/messaging" "github.com/chain4travel/camino-messenger-bot/internal/metadata" "google.golang.org/protobuf/proto" @@ -32,72 +34,96 @@ func (b ByChunkIndex) Swap(i, j int) { b[i], b[j] = b[j], b[i] } func (m *CaminoMatrixMessage) UnmarshalContent(src []byte) error { switch messaging.MessageType(m.MsgType) { + case messaging.ActivityProductInfoRequest: + m.Content.RequestContent.ActivityProductInfoRequest = &activityv1.ActivityProductInfoRequest{} + return proto.Unmarshal(src, m.Content.RequestContent.ActivityProductInfoRequest) + case messaging.ActivityProductInfoResponse: + m.Content.ResponseContent.ActivityProductInfoResponse = &activityv1.ActivityProductInfoResponse{} + return proto.Unmarshal(src, m.Content.ResponseContent.ActivityProductInfoResponse) case messaging.ActivityProductListRequest: - m.Content.RequestContent.ActivityProductListRequest = &activityv1alpha.ActivityProductListRequest{} + m.Content.RequestContent.ActivityProductListRequest = &activityv1.ActivityProductListRequest{} return proto.Unmarshal(src, m.Content.RequestContent.ActivityProductListRequest) case messaging.ActivityProductListResponse: - m.Content.ResponseContent.ActivityProductListResponse = &activityv1alpha.ActivityProductListResponse{} + m.Content.ResponseContent.ActivityProductListResponse = &activityv1.ActivityProductListResponse{} return proto.Unmarshal(src, m.Content.ResponseContent.ActivityProductListResponse) case messaging.ActivitySearchRequest: - m.Content.RequestContent.ActivitySearchRequest = &activityv1alpha.ActivitySearchRequest{} + m.Content.RequestContent.ActivitySearchRequest = &activityv1.ActivitySearchRequest{} return proto.Unmarshal(src, m.Content.RequestContent.ActivitySearchRequest) case messaging.ActivitySearchResponse: - m.Content.ResponseContent.ActivitySearchResponse = &activityv1alpha.ActivitySearchResponse{} + m.Content.ResponseContent.ActivitySearchResponse = &activityv1.ActivitySearchResponse{} return proto.Unmarshal(src, m.Content.ResponseContent.ActivitySearchResponse) case messaging.AccommodationProductInfoRequest: - m.Content.RequestContent.AccommodationProductInfoRequest = &accommodationv1alpha.AccommodationProductInfoRequest{} + m.Content.RequestContent.AccommodationProductInfoRequest = &accommodationv1.AccommodationProductInfoRequest{} return proto.Unmarshal(src, m.Content.RequestContent.AccommodationProductInfoRequest) case messaging.AccommodationProductInfoResponse: - m.Content.ResponseContent.AccommodationProductInfoResponse = &accommodationv1alpha.AccommodationProductInfoResponse{} + m.Content.ResponseContent.AccommodationProductInfoResponse = &accommodationv1.AccommodationProductInfoResponse{} return proto.Unmarshal(src, m.Content.ResponseContent.AccommodationProductInfoResponse) case messaging.AccommodationProductListRequest: - m.Content.RequestContent.AccommodationProductListRequest = &accommodationv1alpha.AccommodationProductListRequest{} + m.Content.RequestContent.AccommodationProductListRequest = &accommodationv1.AccommodationProductListRequest{} return proto.Unmarshal(src, m.Content.RequestContent.AccommodationProductListRequest) case messaging.AccommodationProductListResponse: - m.Content.ResponseContent.AccommodationProductListResponse = &accommodationv1alpha.AccommodationProductListResponse{} + m.Content.ResponseContent.AccommodationProductListResponse = &accommodationv1.AccommodationProductListResponse{} return proto.Unmarshal(src, m.Content.ResponseContent.AccommodationProductListResponse) case messaging.AccommodationSearchRequest: - m.Content.RequestContent.AccommodationSearchRequest = &accommodationv1alpha.AccommodationSearchRequest{} + m.Content.RequestContent.AccommodationSearchRequest = &accommodationv1.AccommodationSearchRequest{} return proto.Unmarshal(src, m.Content.RequestContent.AccommodationSearchRequest) case messaging.AccommodationSearchResponse: - m.Content.ResponseContent.AccommodationSearchResponse = &accommodationv1alpha.AccommodationSearchResponse{} + m.Content.ResponseContent.AccommodationSearchResponse = &accommodationv1.AccommodationSearchResponse{} return proto.Unmarshal(src, m.Content.ResponseContent.AccommodationSearchResponse) case messaging.GetNetworkFeeRequest: - m.Content.RequestContent.GetNetworkFeeRequest = &networkv1alpha.GetNetworkFeeRequest{} + m.Content.RequestContent.GetNetworkFeeRequest = &networkv1.GetNetworkFeeRequest{} return proto.Unmarshal(src, m.Content.RequestContent.GetNetworkFeeRequest) case messaging.GetNetworkFeeResponse: - m.Content.ResponseContent.GetNetworkFeeResponse = &networkv1alpha.GetNetworkFeeResponse{} + m.Content.ResponseContent.GetNetworkFeeResponse = &networkv1.GetNetworkFeeResponse{} return proto.Unmarshal(src, m.Content.ResponseContent.GetNetworkFeeResponse) case messaging.GetPartnerConfigurationRequest: - m.Content.RequestContent.GetPartnerConfigurationRequest = &partnerv1alpha.GetPartnerConfigurationRequest{} + m.Content.RequestContent.GetPartnerConfigurationRequest = &partnerv1.GetPartnerConfigurationRequest{} return proto.Unmarshal(src, m.Content.RequestContent.GetPartnerConfigurationRequest) case messaging.GetPartnerConfigurationResponse: - m.Content.ResponseContent.GetPartnerConfigurationResponse = &partnerv1alpha.GetPartnerConfigurationResponse{} + m.Content.ResponseContent.GetPartnerConfigurationResponse = &partnerv1.GetPartnerConfigurationResponse{} return proto.Unmarshal(src, m.Content.ResponseContent.GetPartnerConfigurationResponse) case messaging.MintRequest: - m.Content.RequestContent.MintRequest = &bookv1alpha.MintRequest{} + m.Content.RequestContent.MintRequest = &bookv1.MintRequest{} return proto.Unmarshal(src, m.Content.RequestContent.MintRequest) case messaging.MintResponse: - m.Content.ResponseContent.MintResponse = &bookv1alpha.MintResponse{} + m.Content.ResponseContent.MintResponse = &bookv1.MintResponse{} return proto.Unmarshal(src, m.Content.ResponseContent.MintResponse) case messaging.ValidationRequest: - m.Content.RequestContent.ValidationRequest = &bookv1alpha.ValidationRequest{} + m.Content.RequestContent.ValidationRequest = &bookv1.ValidationRequest{} return proto.Unmarshal(src, m.Content.RequestContent.ValidationRequest) case messaging.ValidationResponse: - m.Content.ResponseContent.ValidationResponse = &bookv1alpha.ValidationResponse{} + m.Content.ResponseContent.ValidationResponse = &bookv1.ValidationResponse{} return proto.Unmarshal(src, m.Content.ResponseContent.ValidationResponse) case messaging.PingRequest: - m.Content.RequestContent.PingRequest = &pingv1alpha.PingRequest{} + m.Content.RequestContent.PingRequest = &pingv1.PingRequest{} return proto.Unmarshal(src, m.Content.RequestContent.PingRequest) case messaging.PingResponse: - m.Content.ResponseContent.PingResponse = &pingv1alpha.PingResponse{} + m.Content.ResponseContent.PingResponse = &pingv1.PingResponse{} return proto.Unmarshal(src, m.Content.ResponseContent.PingResponse) case messaging.TransportSearchRequest: - m.Content.RequestContent.TransportSearchRequest = &transportv1alpha.TransportSearchRequest{} + m.Content.RequestContent.TransportSearchRequest = &transportv1.TransportSearchRequest{} return proto.Unmarshal(src, m.Content.RequestContent.TransportSearchRequest) case messaging.TransportSearchResponse: - m.Content.ResponseContent.TransportSearchResponse = &transportv1alpha.TransportSearchResponse{} + m.Content.ResponseContent.TransportSearchResponse = &transportv1.TransportSearchResponse{} return proto.Unmarshal(src, m.Content.ResponseContent.TransportSearchResponse) + case messaging.SeatMapRequest: + m.Content.RequestContent.SeatMapRequest = &seat_mapv1.SeatMapRequest{} + return proto.Unmarshal(src, m.Content.RequestContent.SeatMapRequest) + case messaging.SeatMapResponse: + m.Content.ResponseContent.SeatMapResponse = &seat_mapv1.SeatMapResponse{} + return proto.Unmarshal(src, m.Content.ResponseContent.SeatMapResponse) + case messaging.SeatMapAvailabilityRequest: + m.Content.RequestContent.SeatMapAvailabilityRequest = &seat_mapv1.SeatMapAvailabilityRequest{} + return proto.Unmarshal(src, m.Content.RequestContent.SeatMapAvailabilityRequest) + case messaging.SeatMapAvailabilityResponse: + m.Content.ResponseContent.SeatMapAvailabilityResponse = &seat_mapv1.SeatMapAvailabilityResponse{} + return proto.Unmarshal(src, m.Content.ResponseContent.SeatMapResponse) + case messaging.CountryEntryRequirementsRequest: + m.Content.RequestContent.CountryEntryRequirementsRequest = &infov1.CountryEntryRequirementsRequest{} + return proto.Unmarshal(src, m.Content.RequestContent.CountryEntryRequirementsRequest) + case messaging.CountryEntryRequirementsResponse: + m.Content.ResponseContent.CountryEntryRequirementsResponse = &infov1.CountryEntryRequirementsResponse{} + return proto.Unmarshal(src, m.Content.ResponseContent.CountryEntryRequirementsResponse) default: return messaging.ErrUnknownMessageType } diff --git a/internal/messaging/mock_list_grpc.pb.go b/internal/messaging/mock_list_grpc.pb.go index c7b77eb3..752c35d6 100644 --- a/internal/messaging/mock_list_grpc.pb.go +++ b/internal/messaging/mock_list_grpc.pb.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1alpha/activityv1alphagrpc (interfaces: ActivityProductListServiceClient) +// Source: buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1/activityv1grpc (interfaces: ActivityProductListServiceClient) // // Generated by this command: // -// mockgen -package=messaging -destination=internal/messaging/mock_list_grpc.pb.go buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1alpha/activityv1alphagrpc ActivityProductListServiceClient +// mockgen -package=messaging -destination=internal/messaging/mock_list_grpc.pb.go buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1/activityv1grpc ActivityProductListServiceClient // // Package messaging is a generated GoMock package. @@ -13,7 +13,7 @@ import ( context "context" reflect "reflect" - activityv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1alpha" + activityv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1" gomock "go.uber.org/mock/gomock" grpc "google.golang.org/grpc" ) @@ -42,14 +42,14 @@ func (m *MockActivityProductListServiceClient) EXPECT() *MockActivityProductList } // ActivityProductList mocks base method. -func (m *MockActivityProductListServiceClient) ActivityProductList(arg0 context.Context, arg1 *activityv1alpha.ActivityProductListRequest, arg2 ...grpc.CallOption) (*activityv1alpha.ActivityProductListResponse, error) { +func (m *MockActivityProductListServiceClient) ActivityProductList(arg0 context.Context, arg1 *activityv1.ActivityProductListRequest, arg2 ...grpc.CallOption) (*activityv1.ActivityProductListResponse, error) { m.ctrl.T.Helper() varargs := []any{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "ActivityProductList", varargs...) - ret0, _ := ret[0].(*activityv1alpha.ActivityProductListResponse) + ret0, _ := ret[0].(*activityv1.ActivityProductListResponse) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/internal/messaging/response_handler.go b/internal/messaging/response_handler.go index b59bd7d9..9d75404e 100644 --- a/internal/messaging/response_handler.go +++ b/internal/messaging/response_handler.go @@ -14,8 +14,8 @@ import ( "strings" "time" - bookv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/book/v1alpha" - typesv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/types/v1alpha" + bookv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/book/v1" + typesv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/types/v1" "google.golang.org/protobuf/types/known/timestamppb" "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" @@ -109,7 +109,7 @@ func (h *evmResponseHandler) HandleRequest(_ context.Context, msgType MessageTyp func (h *evmResponseHandler) handleMintResponse(ctx context.Context, response *ResponseContent, request *RequestContent) bool { if response.MintResponse.Header == nil { - response.MintResponse.Header = &typesv1alpha.ResponseHeader{} + response.MintResponse.Header = &typesv1.ResponseHeader{} } packedData, err := h.tokenABI.Pack("getSupplierName", h.cChainAddress) @@ -188,15 +188,15 @@ func (h *evmResponseHandler) handleMintResponse(ctx context.Context, response *R } h.logger.Infof("NFT minted with txID: %s\n", txID) - response.MintResponse.Header.Status = typesv1alpha.StatusType_STATUS_TYPE_SUCCESS - response.MintResponse.BookingToken = &typesv1alpha.BookingToken{TokenId: int32(tokenID.Int64())} + response.MintResponse.Header.Status = typesv1.StatusType_STATUS_TYPE_SUCCESS + response.MintResponse.BookingToken = &typesv1.BookingToken{TokenId: int32(tokenID.Int64())} response.MintTransactionId = txID return false } func (h *evmResponseHandler) handleMintRequest(ctx context.Context, response *ResponseContent) bool { if response.MintResponse.Header == nil { - response.MintResponse.Header = &typesv1alpha.ResponseHeader{} + response.MintResponse.Header = &typesv1.ResponseHeader{} } if response.MintTransactionId == "" { addErrorToResponseHeader(response, "missing mint transaction id") @@ -485,7 +485,7 @@ func generateAndEncodeJSON(name, description, date, externalURL, image string, a // TODO: @havan: We need decide what data needs to be in the tokenURI JSON and add // those fields to the MintResponse. These will be shown in the UI of wallets, // explorers etc. -func createTokenURIforMintResponse(mintResponse *bookv1alpha.MintResponse) (string, string, error) { +func createTokenURIforMintResponse(mintResponse *bookv1.MintResponse) (string, string, error) { // TODO: What should we use for a token name? This will be shown in the UI of wallets, explorers etc. name := "CM Booking Token" @@ -530,9 +530,9 @@ func createTokenURIforMintResponse(mintResponse *bookv1alpha.MintResponse) (stri } func addErrorToResponseHeader(response *ResponseContent, errMessage string) { - response.MintResponse.Header.Status = typesv1alpha.StatusType_STATUS_TYPE_FAILURE - response.MintResponse.Header.Alerts = append(response.MintResponse.Header.Alerts, &typesv1alpha.Alert{ + response.MintResponse.Header.Status = typesv1.StatusType_STATUS_TYPE_FAILURE + response.MintResponse.Header.Alerts = append(response.MintResponse.Header.Alerts, &typesv1.Alert{ Message: errMessage, - Type: typesv1alpha.AlertType_ALERT_TYPE_ERROR, + Type: typesv1.AlertType_ALERT_TYPE_ERROR, }) } diff --git a/internal/messaging/service.go b/internal/messaging/service.go index a3d00fcc..4fcb8ff7 100644 --- a/internal/messaging/service.go +++ b/internal/messaging/service.go @@ -9,23 +9,24 @@ import ( "context" "fmt" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1alpha/activityv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/book/v1alpha/bookv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/info/v1alpha/infov1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/seat_map/v1alpha/seat_mapv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/transport/v1alpha/transportv1alphagrpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1/activityv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/book/v1/bookv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/info/v1/infov1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/seat_map/v1/seat_mapv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/transport/v1/transportv1grpc" - networkv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/network/v1alpha" - partnerv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/partner/v1alpha" - pingv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/ping/v1alpha" + networkv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/network/v1" + partnerv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/partner/v1" + pingv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/ping/v1" "github.com/chain4travel/camino-messenger-bot/internal/metadata" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1alpha/accommodationv1alphagrpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1/accommodationv1grpc" "google.golang.org/grpc" ) var ( + _ Service = (*activityProductInfoService)(nil) _ Service = (*activityProductListService)(nil) _ Service = (*activityService)(nil) _ Service = (*accommodationProductInfoService)(nil) @@ -45,8 +46,21 @@ var ( type Service interface { Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) } +type activityProductInfoService struct { + client *activityv1grpc.ActivityProductInfoServiceClient +} + +func (s activityProductInfoService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { + response, err := (*s.client).ActivityProductInfo(ctx, request.ActivityProductInfoRequest, opts...) + ResponseContent := ResponseContent{} + if err == nil { + ResponseContent.ActivityProductInfoResponse = response + } + return &ResponseContent, ActivityProductInfoResponse, err +} + type activityProductListService struct { - client activityv1alphagrpc.ActivityProductListServiceClient + client activityv1grpc.ActivityProductListServiceClient } func (a activityProductListService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { @@ -59,7 +73,7 @@ func (a activityProductListService) Call(ctx context.Context, request *RequestCo } type activityService struct { - client *activityv1alphagrpc.ActivitySearchServiceClient + client *activityv1grpc.ActivitySearchServiceClient } func (s activityService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { @@ -72,7 +86,7 @@ func (s activityService) Call(ctx context.Context, request *RequestContent, opts } type accommodationProductInfoService struct { - client *accommodationv1alphagrpc.AccommodationProductInfoServiceClient + client *accommodationv1grpc.AccommodationProductInfoServiceClient } func (a accommodationProductInfoService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { @@ -85,7 +99,7 @@ func (a accommodationProductInfoService) Call(ctx context.Context, request *Requ } type accommodationProductListService struct { - client *accommodationv1alphagrpc.AccommodationProductListServiceClient + client *accommodationv1grpc.AccommodationProductListServiceClient } func (a accommodationProductListService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { @@ -98,7 +112,7 @@ func (a accommodationProductListService) Call(ctx context.Context, request *Requ } type accommodationService struct { - client *accommodationv1alphagrpc.AccommodationSearchServiceClient + client *accommodationv1grpc.AccommodationSearchServiceClient } func (s accommodationService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { @@ -111,7 +125,7 @@ func (s accommodationService) Call(ctx context.Context, request *RequestContent, } type mintService struct { - client *bookv1alphagrpc.MintServiceClient + client *bookv1grpc.MintServiceClient } func (m mintService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { @@ -124,7 +138,7 @@ func (m mintService) Call(ctx context.Context, request *RequestContent, opts ... } type validationService struct { - client *bookv1alphagrpc.ValidationServiceClient + client *bookv1grpc.ValidationServiceClient } func (v validationService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { @@ -140,8 +154,8 @@ type networkService struct{} func (s networkService) Call(_ context.Context, _ *RequestContent, _ ...grpc.CallOption) (*ResponseContent, MessageType, error) { return &ResponseContent{ - GetNetworkFeeResponse: &networkv1alpha.GetNetworkFeeResponse{ - NetworkFee: &networkv1alpha.NetworkFee{Amount: 100000}, // TODO implement + GetNetworkFeeResponse: &networkv1.GetNetworkFeeResponse{ + NetworkFee: &networkv1.NetworkFee{Amount: 100000}, // TODO implement }, }, GetNetworkFeeResponse, nil } @@ -150,7 +164,7 @@ type partnerService struct{} func (s partnerService) Call(_ context.Context, _ *RequestContent, _ ...grpc.CallOption) (*ResponseContent, MessageType, error) { return &ResponseContent{ - GetPartnerConfigurationResponse: &partnerv1alpha.GetPartnerConfigurationResponse{ + GetPartnerConfigurationResponse: &partnerv1.GetPartnerConfigurationResponse{ PartnerConfiguration: nil, // TODO implement CurrentBlockHeight: 0, }, @@ -165,7 +179,7 @@ func (s pingService) Call(ctx context.Context, request *RequestContent, _ ...grp if err != nil { return nil, PingResponse, err } - return &ResponseContent{PingResponse: &pingv1alpha.PingResponse{ + return &ResponseContent{PingResponse: &pingv1.PingResponse{ Header: nil, PingMessage: fmt.Sprintf("Ping response to [%s] with request ID: %s", request.PingMessage, md.RequestID), Timestamp: nil, @@ -173,7 +187,7 @@ func (s pingService) Call(ctx context.Context, request *RequestContent, _ ...grp } type transportService struct { - client *transportv1alphagrpc.TransportSearchServiceClient + client *transportv1grpc.TransportSearchServiceClient } func (s transportService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { @@ -186,7 +200,7 @@ func (s transportService) Call(ctx context.Context, request *RequestContent, opt } type seatMapService struct { - client *seat_mapv1alphagrpc.SeatMapServiceClient + client *seat_mapv1grpc.SeatMapServiceClient } func (s seatMapService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { @@ -199,7 +213,7 @@ func (s seatMapService) Call(ctx context.Context, request *RequestContent, opts } type seatMapAvailabilityService struct { - client *seat_mapv1alphagrpc.SeatMapAvailabilityServiceClient + client *seat_mapv1grpc.SeatMapAvailabilityServiceClient } func (s seatMapAvailabilityService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { @@ -213,7 +227,7 @@ func (s seatMapAvailabilityService) Call(ctx context.Context, request *RequestCo } type countryEntryRequirementsService struct { - client *infov1alphagrpc.CountryEntryRequirementsServiceClient + client *infov1grpc.CountryEntryRequirementsServiceClient } func (s countryEntryRequirementsService) Call(ctx context.Context, request *RequestContent, opts ...grpc.CallOption) (*ResponseContent, MessageType, error) { diff --git a/internal/messaging/service_registry.go b/internal/messaging/service_registry.go index bd21f03a..736e7ead 100644 --- a/internal/messaging/service_registry.go +++ b/internal/messaging/service_registry.go @@ -8,12 +8,12 @@ package messaging import ( "sync" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1alpha/accommodationv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1alpha/activityv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/book/v1alpha/bookv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/info/v1alpha/infov1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/seat_map/v1alpha/seat_mapv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/transport/v1alpha/transportv1alphagrpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1/accommodationv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1/activityv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/book/v1/bookv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/info/v1/infov1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/seat_map/v1/seat_mapv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/transport/v1/transportv1grpc" "github.com/chain4travel/camino-messenger-bot/config" "github.com/chain4travel/camino-messenger-bot/internal/rpc/client" "go.uber.org/zap" @@ -44,44 +44,47 @@ func (s *serviceRegistry) RegisterServices(requestTypes config.SupportedRequestT for _, requestType := range requestTypes { var service Service switch MessageType(requestType) { + case ActivityProductInfoRequest: + c := activityv1grpc.NewActivityProductInfoServiceClient(rpcClient.ClientConn) + service = activityProductInfoService{client: &c} case ActivityProductListRequest: - c := activityv1alphagrpc.NewActivityProductListServiceClient(rpcClient.ClientConn) + c := activityv1grpc.NewActivityProductListServiceClient(rpcClient.ClientConn) service = activityProductListService{client: c} case ActivitySearchRequest: - c := activityv1alphagrpc.NewActivitySearchServiceClient(rpcClient.ClientConn) + c := activityv1grpc.NewActivitySearchServiceClient(rpcClient.ClientConn) service = activityService{client: &c} case AccommodationProductInfoRequest: - c := accommodationv1alphagrpc.NewAccommodationProductInfoServiceClient(rpcClient.ClientConn) + c := accommodationv1grpc.NewAccommodationProductInfoServiceClient(rpcClient.ClientConn) service = accommodationProductInfoService{client: &c} case AccommodationProductListRequest: - c := accommodationv1alphagrpc.NewAccommodationProductListServiceClient(rpcClient.ClientConn) + c := accommodationv1grpc.NewAccommodationProductListServiceClient(rpcClient.ClientConn) service = accommodationProductListService{client: &c} case AccommodationSearchRequest: - c := accommodationv1alphagrpc.NewAccommodationSearchServiceClient(rpcClient.ClientConn) + c := accommodationv1grpc.NewAccommodationSearchServiceClient(rpcClient.ClientConn) service = accommodationService{client: &c} case GetNetworkFeeRequest: service = networkService{} // this service does not talk to partner plugin case GetPartnerConfigurationRequest: service = partnerService{} // this service does not talk to partner plugin case MintRequest: - c := bookv1alphagrpc.NewMintServiceClient(rpcClient.ClientConn) + c := bookv1grpc.NewMintServiceClient(rpcClient.ClientConn) service = mintService{client: &c} case ValidationRequest: - c := bookv1alphagrpc.NewValidationServiceClient(rpcClient.ClientConn) + c := bookv1grpc.NewValidationServiceClient(rpcClient.ClientConn) service = validationService{client: &c} case PingRequest: service = pingService{} // this service does not talk to partner plugin case TransportSearchRequest: - c := transportv1alphagrpc.NewTransportSearchServiceClient(rpcClient.ClientConn) + c := transportv1grpc.NewTransportSearchServiceClient(rpcClient.ClientConn) service = transportService{client: &c} case SeatMapRequest: - c := seat_mapv1alphagrpc.NewSeatMapServiceClient(rpcClient.ClientConn) + c := seat_mapv1grpc.NewSeatMapServiceClient(rpcClient.ClientConn) service = seatMapService{client: &c} case SeatMapAvailabilityRequest: - c := seat_mapv1alphagrpc.NewSeatMapAvailabilityServiceClient(rpcClient.ClientConn) + c := seat_mapv1grpc.NewSeatMapAvailabilityServiceClient(rpcClient.ClientConn) service = seatMapAvailabilityService{client: &c} case CountryEntryRequirementsRequest: - c := infov1alphagrpc.NewCountryEntryRequirementsServiceClient(rpcClient.ClientConn) + c := infov1grpc.NewCountryEntryRequirementsServiceClient(rpcClient.ClientConn) service = countryEntryRequirementsService{client: &c} default: s.logger.Infof("Skipping registration of unknown request type: %s", requestType) diff --git a/internal/messaging/types.go b/internal/messaging/types.go index 1ab2f16f..90915db3 100644 --- a/internal/messaging/types.go +++ b/internal/messaging/types.go @@ -3,15 +3,15 @@ package messaging import ( "errors" - accommodationv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1alpha" - activityv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1alpha" - bookv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/book/v1alpha" - infov1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/info/v1alpha" - networkv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/network/v1alpha" - partnerv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/partner/v1alpha" - pingv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/ping/v1alpha" - seat_mapv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/seat_map/v1alpha" - transportv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/transport/v1alpha" + accommodationv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1" + activityv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1" + bookv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/book/v1" + infov1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/info/v1" + networkv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/network/v1" + partnerv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/partner/v1" + pingv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/ping/v1" + seat_mapv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/seat_map/v1" + transportv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/transport/v1" "github.com/chain4travel/camino-messenger-bot/internal/metadata" @@ -21,37 +21,39 @@ import ( var ErrUnknownMessageType = errors.New("unknown message type") type RequestContent struct { - *activityv1alpha.ActivityProductListRequest - *activityv1alpha.ActivitySearchRequest - *accommodationv1alpha.AccommodationProductInfoRequest - *accommodationv1alpha.AccommodationProductListRequest - *accommodationv1alpha.AccommodationSearchRequest - *networkv1alpha.GetNetworkFeeRequest - *partnerv1alpha.GetPartnerConfigurationRequest - *bookv1alpha.MintRequest - *bookv1alpha.ValidationRequest - *pingv1alpha.PingRequest - *transportv1alpha.TransportSearchRequest - *seat_mapv1alpha.SeatMapRequest - *seat_mapv1alpha.SeatMapAvailabilityRequest - *infov1alpha.CountryEntryRequirementsRequest + *activityv1.ActivityProductInfoRequest + *activityv1.ActivityProductListRequest + *activityv1.ActivitySearchRequest + *accommodationv1.AccommodationProductInfoRequest + *accommodationv1.AccommodationProductListRequest + *accommodationv1.AccommodationSearchRequest + *networkv1.GetNetworkFeeRequest + *partnerv1.GetPartnerConfigurationRequest + *bookv1.MintRequest + *bookv1.ValidationRequest + *pingv1.PingRequest + *transportv1.TransportSearchRequest + *seat_mapv1.SeatMapRequest + *seat_mapv1.SeatMapAvailabilityRequest + *infov1.CountryEntryRequirementsRequest } type ResponseContent struct { - *activityv1alpha.ActivityProductListResponse - *activityv1alpha.ActivitySearchResponse - *accommodationv1alpha.AccommodationProductInfoResponse - *accommodationv1alpha.AccommodationProductListResponse - *accommodationv1alpha.AccommodationSearchResponse - *networkv1alpha.GetNetworkFeeResponse - *partnerv1alpha.GetPartnerConfigurationResponse - *bookv1alpha.MintResponse - *bookv1alpha.ValidationResponse - *pingv1alpha.PingResponse - *transportv1alpha.TransportSearchResponse - *seat_mapv1alpha.SeatMapResponse - *seat_mapv1alpha.SeatMapAvailabilityResponse - *infov1alpha.CountryEntryRequirementsResponse + *activityv1.ActivityProductInfoResponse + *activityv1.ActivityProductListResponse + *activityv1.ActivitySearchResponse + *accommodationv1.AccommodationProductInfoResponse + *accommodationv1.AccommodationProductListResponse + *accommodationv1.AccommodationSearchResponse + *networkv1.GetNetworkFeeResponse + *partnerv1.GetPartnerConfigurationResponse + *bookv1.MintResponse + *bookv1.ValidationResponse + *pingv1.PingResponse + *transportv1.TransportSearchResponse + *seat_mapv1.SeatMapResponse + *seat_mapv1.SeatMapAvailabilityResponse + *infov1.CountryEntryRequirementsResponse } type MessageContent struct { @@ -78,6 +80,8 @@ const ( Unknown // message types + ActivityProductInfoRequest MessageType = "ActivityProductInfoRequest" + ActivityProductInfoResponse MessageType = "ActivityProductInfoResponse" ActivityProductListRequest MessageType = "ActivityProductListRequest" ActivityProductListResponse MessageType = "ActivityProductListResponse" ActivitySearchRequest MessageType = "ActivitySearchRequest" @@ -110,20 +114,24 @@ const ( func (mt MessageType) Category() MessageCategory { switch mt { - case ActivityProductListRequest, + case ActivityProductInfoRequest, + ActivityProductListRequest, ActivitySearchRequest, AccommodationProductInfoRequest, AccommodationProductListRequest, AccommodationSearchRequest, MintRequest, ValidationRequest, + GetNetworkFeeRequest, + GetPartnerConfigurationRequest, PingRequest, TransportSearchRequest, SeatMapRequest, SeatMapAvailabilityRequest, CountryEntryRequirementsRequest: return Request - case ActivityProductListResponse, + case ActivityProductInfoResponse, + ActivityProductListResponse, ActivitySearchResponse, AccommodationProductInfoResponse, AccommodationProductListResponse, @@ -153,6 +161,10 @@ func (m *Message) MarshalContent() ([]byte, error) { return proto.Marshal(m.Content.ActivitySearchRequest) case ActivitySearchResponse: return proto.Marshal(m.Content.ActivitySearchResponse) + case ActivityProductInfoRequest: + return proto.Marshal(m.Content.ActivityProductInfoRequest) + case ActivityProductInfoResponse: + return proto.Marshal(m.Content.ActivityProductInfoResponse) case AccommodationProductInfoRequest: return proto.Marshal(m.Content.AccommodationProductInfoRequest) case AccommodationProductInfoResponse: diff --git a/internal/rpc/server/server.go b/internal/rpc/server/server.go index 581e334a..1f1ad54b 100644 --- a/internal/rpc/server/server.go +++ b/internal/rpc/server/server.go @@ -7,25 +7,25 @@ import ( "github.com/chain4travel/camino-messenger-bot/internal/tracing" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1alpha/activityv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/book/v1alpha/bookv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/info/v1alpha/infov1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/seat_map/v1alpha/seat_mapv1alphagrpc" - bookv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/book/v1alpha" - seat_mapv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/seat_map/v1alpha" - - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1alpha/accommodationv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/network/v1alpha/networkv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/partner/v1alpha/partnerv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/ping/v1alpha/pingv1alphagrpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/transport/v1alpha/transportv1alphagrpc" - accommodationv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1alpha" - activityv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1alpha" - infov1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/info/v1alpha" - networkv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/network/v1alpha" - partnerv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/partner/v1alpha" - pingv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/ping/v1alpha" - transportv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/transport/v1alpha" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1/activityv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/book/v1/bookv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/info/v1/infov1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/seat_map/v1/seat_mapv1grpc" + bookv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/book/v1" + seat_mapv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/seat_map/v1" + + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1/accommodationv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/network/v1/networkv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/partner/v1/partnerv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/ping/v1/pingv1grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/transport/v1/transportv1grpc" + accommodationv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1" + activityv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/activity/v1" + infov1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/info/v1" + networkv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/network/v1" + partnerv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/partner/v1" + pingv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/ping/v1" + transportv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/transport/v1" "github.com/chain4travel/camino-messenger-bot/config" "github.com/chain4travel/camino-messenger-bot/internal/messaging" "github.com/chain4travel/camino-messenger-bot/internal/metadata" @@ -38,20 +38,21 @@ import ( var ( _ Server = (*server)(nil) - _ accommodationv1alphagrpc.AccommodationProductInfoServiceServer = (*server)(nil) - _ accommodationv1alphagrpc.AccommodationProductListServiceServer = (*server)(nil) - _ accommodationv1alphagrpc.AccommodationSearchServiceServer = (*server)(nil) - _ activityv1alphagrpc.ActivityProductListServiceServer = (*server)(nil) - _ activityv1alphagrpc.ActivitySearchServiceServer = (*server)(nil) - _ networkv1alphagrpc.GetNetworkFeeServiceServer = (*server)(nil) - _ partnerv1alphagrpc.GetPartnerConfigurationServiceServer = (*server)(nil) - _ bookv1alphagrpc.MintServiceServer = (*server)(nil) - _ bookv1alphagrpc.ValidationServiceServer = (*server)(nil) - _ pingv1alphagrpc.PingServiceServer = (*server)(nil) - _ transportv1alphagrpc.TransportSearchServiceServer = (*server)(nil) - _ seat_mapv1alphagrpc.SeatMapServiceServer = (*server)(nil) - _ seat_mapv1alphagrpc.SeatMapAvailabilityServiceServer = (*server)(nil) - _ infov1alphagrpc.CountryEntryRequirementsServiceServer = (*server)(nil) + _ accommodationv1grpc.AccommodationProductInfoServiceServer = (*server)(nil) + _ accommodationv1grpc.AccommodationProductListServiceServer = (*server)(nil) + _ accommodationv1grpc.AccommodationSearchServiceServer = (*server)(nil) + _ activityv1grpc.ActivityProductListServiceServer = (*server)(nil) + _ activityv1grpc.ActivitySearchServiceServer = (*server)(nil) + _ networkv1grpc.GetNetworkFeeServiceServer = (*server)(nil) + _ partnerv1grpc.GetPartnerConfigurationServiceServer = (*server)(nil) + _ bookv1grpc.MintServiceServer = (*server)(nil) + _ bookv1grpc.ValidationServiceServer = (*server)(nil) + _ pingv1grpc.PingServiceServer = (*server)(nil) + _ transportv1grpc.TransportSearchServiceServer = (*server)(nil) + _ seat_mapv1grpc.SeatMapServiceServer = (*server)(nil) + _ seat_mapv1grpc.SeatMapAvailabilityServiceServer = (*server)(nil) + _ infov1grpc.CountryEntryRequirementsServiceServer = (*server)(nil) + _ activityv1grpc.ActivityProductInfoServiceServer = (*server)(nil) ) type Server interface { @@ -90,20 +91,21 @@ func NewServer(cfg *config.RPCServerConfig, logger *zap.SugaredLogger, tracer tr func createGrpcServerAndRegisterServices(server *server, opts ...grpc.ServerOption) *grpc.Server { grpcServer := grpc.NewServer(opts...) - activityv1alphagrpc.RegisterActivityProductListServiceServer(grpcServer, server) - activityv1alphagrpc.RegisterActivitySearchServiceServer(grpcServer, server) - accommodationv1alphagrpc.RegisterAccommodationProductInfoServiceServer(grpcServer, server) - accommodationv1alphagrpc.RegisterAccommodationProductListServiceServer(grpcServer, server) - accommodationv1alphagrpc.RegisterAccommodationSearchServiceServer(grpcServer, server) - networkv1alphagrpc.RegisterGetNetworkFeeServiceServer(grpcServer, server) - partnerv1alphagrpc.RegisterGetPartnerConfigurationServiceServer(grpcServer, server) - bookv1alphagrpc.RegisterMintServiceServer(grpcServer, server) - bookv1alphagrpc.RegisterValidationServiceServer(grpcServer, server) - pingv1alphagrpc.RegisterPingServiceServer(grpcServer, server) - transportv1alphagrpc.RegisterTransportSearchServiceServer(grpcServer, server) - seat_mapv1alphagrpc.RegisterSeatMapServiceServer(grpcServer, server) - seat_mapv1alphagrpc.RegisterSeatMapAvailabilityServiceServer(grpcServer, server) - infov1alphagrpc.RegisterCountryEntryRequirementsServiceServer(grpcServer, server) + activityv1grpc.RegisterActivityProductListServiceServer(grpcServer, server) + activityv1grpc.RegisterActivitySearchServiceServer(grpcServer, server) + accommodationv1grpc.RegisterAccommodationProductInfoServiceServer(grpcServer, server) + accommodationv1grpc.RegisterAccommodationProductListServiceServer(grpcServer, server) + accommodationv1grpc.RegisterAccommodationSearchServiceServer(grpcServer, server) + networkv1grpc.RegisterGetNetworkFeeServiceServer(grpcServer, server) + partnerv1grpc.RegisterGetPartnerConfigurationServiceServer(grpcServer, server) + bookv1grpc.RegisterMintServiceServer(grpcServer, server) + bookv1grpc.RegisterValidationServiceServer(grpcServer, server) + pingv1grpc.RegisterPingServiceServer(grpcServer, server) + transportv1grpc.RegisterTransportSearchServiceServer(grpcServer, server) + seat_mapv1grpc.RegisterSeatMapServiceServer(grpcServer, server) + seat_mapv1grpc.RegisterSeatMapAvailabilityServiceServer(grpcServer, server) + infov1grpc.RegisterCountryEntryRequirementsServiceServer(grpcServer, server) + activityv1grpc.RegisterActivityProductInfoServiceServer(grpcServer, server) return grpcServer } @@ -120,72 +122,77 @@ func (s *server) Stop() { s.grpcServer.Stop() } -func (s *server) AccommodationProductInfo(ctx context.Context, request *accommodationv1alpha.AccommodationProductInfoRequest) (*accommodationv1alpha.AccommodationProductInfoResponse, error) { +func (s *server) AccommodationProductInfo(ctx context.Context, request *accommodationv1.AccommodationProductInfoRequest) (*accommodationv1.AccommodationProductInfoResponse, error) { response, err := s.processExternalRequest(ctx, messaging.AccommodationProductInfoRequest, &messaging.RequestContent{AccommodationProductInfoRequest: request}) return response.AccommodationProductInfoResponse, err } -func (s *server) AccommodationProductList(ctx context.Context, request *accommodationv1alpha.AccommodationProductListRequest) (*accommodationv1alpha.AccommodationProductListResponse, error) { +func (s *server) AccommodationProductList(ctx context.Context, request *accommodationv1.AccommodationProductListRequest) (*accommodationv1.AccommodationProductListResponse, error) { response, err := s.processExternalRequest(ctx, messaging.AccommodationProductListRequest, &messaging.RequestContent{AccommodationProductListRequest: request}) return response.AccommodationProductListResponse, err } -func (s *server) AccommodationSearch(ctx context.Context, request *accommodationv1alpha.AccommodationSearchRequest) (*accommodationv1alpha.AccommodationSearchResponse, error) { +func (s *server) AccommodationSearch(ctx context.Context, request *accommodationv1.AccommodationSearchRequest) (*accommodationv1.AccommodationSearchResponse, error) { response, err := s.processExternalRequest(ctx, messaging.AccommodationSearchRequest, &messaging.RequestContent{AccommodationSearchRequest: request}) return response.AccommodationSearchResponse, err // TODO set specific errors according to https://grpc.github.io/grpc/core/md_doc_statuscodes.html ? } -func (s *server) Ping(ctx context.Context, request *pingv1alpha.PingRequest) (*pingv1alpha.PingResponse, error) { +func (s *server) Ping(ctx context.Context, request *pingv1.PingRequest) (*pingv1.PingResponse, error) { response, err := s.processExternalRequest(ctx, messaging.PingRequest, &messaging.RequestContent{PingRequest: request}) return response.PingResponse, err } -func (s *server) GetNetworkFee(ctx context.Context, request *networkv1alpha.GetNetworkFeeRequest) (*networkv1alpha.GetNetworkFeeResponse, error) { +func (s *server) GetNetworkFee(ctx context.Context, request *networkv1.GetNetworkFeeRequest) (*networkv1.GetNetworkFeeResponse, error) { response, err := s.processInternalRequest(ctx, messaging.GetNetworkFeeRequest, &messaging.RequestContent{GetNetworkFeeRequest: request}) return response.GetNetworkFeeResponse, err } -func (s *server) GetPartnerConfiguration(ctx context.Context, request *partnerv1alpha.GetPartnerConfigurationRequest) (*partnerv1alpha.GetPartnerConfigurationResponse, error) { +func (s *server) GetPartnerConfiguration(ctx context.Context, request *partnerv1.GetPartnerConfigurationRequest) (*partnerv1.GetPartnerConfigurationResponse, error) { response, err := s.processInternalRequest(ctx, messaging.GetPartnerConfigurationRequest, &messaging.RequestContent{GetPartnerConfigurationRequest: request}) return response.GetPartnerConfigurationResponse, err } -func (s *server) ActivityProductList(ctx context.Context, request *activityv1alpha.ActivityProductListRequest) (*activityv1alpha.ActivityProductListResponse, error) { +func (s *server) ActivityProductInfo(ctx context.Context, request *activityv1.ActivityProductInfoRequest) (*activityv1.ActivityProductInfoResponse, error) { + response, err := s.processExternalRequest(ctx, messaging.ActivityProductInfoRequest, &messaging.RequestContent{ActivityProductInfoRequest: request}) + return response.ActivityProductInfoResponse, err +} + +func (s *server) ActivityProductList(ctx context.Context, request *activityv1.ActivityProductListRequest) (*activityv1.ActivityProductListResponse, error) { response, err := s.processExternalRequest(ctx, messaging.ActivityProductListRequest, &messaging.RequestContent{ActivityProductListRequest: request}) return response.ActivityProductListResponse, err } -func (s *server) ActivitySearch(ctx context.Context, request *activityv1alpha.ActivitySearchRequest) (*activityv1alpha.ActivitySearchResponse, error) { +func (s *server) ActivitySearch(ctx context.Context, request *activityv1.ActivitySearchRequest) (*activityv1.ActivitySearchResponse, error) { response, err := s.processExternalRequest(ctx, messaging.ActivitySearchRequest, &messaging.RequestContent{ActivitySearchRequest: request}) return response.ActivitySearchResponse, err } -func (s *server) Mint(ctx context.Context, request *bookv1alpha.MintRequest) (*bookv1alpha.MintResponse, error) { +func (s *server) Mint(ctx context.Context, request *bookv1.MintRequest) (*bookv1.MintResponse, error) { response, err := s.processExternalRequest(ctx, messaging.MintRequest, &messaging.RequestContent{MintRequest: request}) return response.MintResponse, err } -func (s *server) Validation(ctx context.Context, request *bookv1alpha.ValidationRequest) (*bookv1alpha.ValidationResponse, error) { +func (s *server) Validation(ctx context.Context, request *bookv1.ValidationRequest) (*bookv1.ValidationResponse, error) { response, err := s.processExternalRequest(ctx, messaging.ValidationRequest, &messaging.RequestContent{ValidationRequest: request}) return response.ValidationResponse, err } -func (s *server) TransportSearch(ctx context.Context, request *transportv1alpha.TransportSearchRequest) (*transportv1alpha.TransportSearchResponse, error) { +func (s *server) TransportSearch(ctx context.Context, request *transportv1.TransportSearchRequest) (*transportv1.TransportSearchResponse, error) { response, err := s.processExternalRequest(ctx, messaging.TransportSearchRequest, &messaging.RequestContent{TransportSearchRequest: request}) return response.TransportSearchResponse, err } -func (s *server) SeatMap(ctx context.Context, request *seat_mapv1alpha.SeatMapRequest) (*seat_mapv1alpha.SeatMapResponse, error) { +func (s *server) SeatMap(ctx context.Context, request *seat_mapv1.SeatMapRequest) (*seat_mapv1.SeatMapResponse, error) { response, err := s.processExternalRequest(ctx, messaging.SeatMapRequest, &messaging.RequestContent{SeatMapRequest: request}) return response.SeatMapResponse, err } -func (s *server) SeatMapAvailability(ctx context.Context, request *seat_mapv1alpha.SeatMapAvailabilityRequest) (*seat_mapv1alpha.SeatMapAvailabilityResponse, error) { +func (s *server) SeatMapAvailability(ctx context.Context, request *seat_mapv1.SeatMapAvailabilityRequest) (*seat_mapv1.SeatMapAvailabilityResponse, error) { response, err := s.processExternalRequest(ctx, messaging.SeatMapAvailabilityRequest, &messaging.RequestContent{SeatMapAvailabilityRequest: request}) return response.SeatMapAvailabilityResponse, err } -func (s *server) CountryEntryRequirements(ctx context.Context, request *infov1alpha.CountryEntryRequirementsRequest) (*infov1alpha.CountryEntryRequirementsResponse, error) { +func (s *server) CountryEntryRequirements(ctx context.Context, request *infov1.CountryEntryRequirementsRequest) (*infov1.CountryEntryRequirementsResponse, error) { response, err := s.processExternalRequest(ctx, messaging.CountryEntryRequirementsRequest, &messaging.RequestContent{CountryEntryRequirementsRequest: request}) return response.CountryEntryRequirementsResponse, err } diff --git a/scripts/mocks.mockgen.txt b/scripts/mocks.mockgen.txt index 4f607a7a..dd142db9 100644 --- a/scripts/mocks.mockgen.txt +++ b/scripts/mocks.mockgen.txt @@ -1,5 +1,5 @@ github.com/chain4travel/camino-messenger-bot/internal/compression=Decompressor=internal/compression/mock_decompress.go github.com/chain4travel/camino-messenger-bot/internal/matrix=Client=internal/matrix/mock_room_handler.go -buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1alpha/activityv1alphagrpc=ActivityProductListServiceClient=internal/messaging/mock_list_grpc.pb.go +buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/activity/v1/activityv1grpc=ActivityProductListServiceClient=internal/messaging/mock_list_grpc.pb.go github.com/chain4travel/camino-messenger-bot/internal/messaging=ServiceRegistry=internal/messaging/mock_service_registry.go github.com/chain4travel/camino-messenger-bot/internal/messaging=Messenger=internal/messaging/mock_messenger.go