Skip to content

Commit

Permalink
search request
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkadyrov committed Jul 25, 2019
1 parent 6048cf5 commit c9b4a60
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package Fare_MasterPricerTravelBoardSearchRequest_v14_3 // fmptbq143
import (
search "github.com/tmconsulting/amadeus-golang-sdk/structs/fare/masterPricerTravelBoardSearch"
"github.com/tmconsulting/amadeus-golang-sdk/structs/formats"
"gitlab.teamc.io/tm-consulting/tmc24/avia/layer3/amadeus-agent-go/utils/convert"
"github.com/tmconsulting/amadeus-golang-sdk/utils"
)

func MakeRequest(request *search.Request) *Request {
Expand Down Expand Up @@ -117,7 +117,7 @@ func MakeRequest(request *search.Request) *Request {
},
TimeDetails: &DateAndTimeInformationType_181295S{
FirstDateTimeDetail: &DateAndTimeDetailsTypeI{
Date: formats.Date_DDMMYY(convert.DateToAmadeusDate(i.DepartureDate)),
Date: formats.Date_DDMMYY(utils.DateToAmadeusDate(i.DepartureDate)),
},
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package Fare_MasterPricerTravelBoardSearchRequest_v16_3 // fmptbq143

import search "github.com/tmconsulting/amadeus-golang-sdk/structs/fare/masterPricerTravelBoardSearch"
import (
search "github.com/tmconsulting/amadeus-golang-sdk/structs/fare/masterPricerTravelBoardSearch"
"github.com/tmconsulting/amadeus-golang-sdk/structs/formats"
"gitlab.teamc.io/tm-consulting/tmc24/avia/layer3/amadeus-agent-go/utils/convert"
)

func MakeRequest(request *search.Request) *Request {

var query = Request{
NumberOfUnit: &NumberOfUnitsType{
UnitNumberDetail: []*NumberOfUnitDetailsType_260583C{
UnitNumberDetail: []*NumberOfUnitDetailsType_270113C{
{
NumberOfUnits: formats.NumericInteger_Length1To6(request.Passengers.ADT + request.Passengers.CHD),
TypeOfUnit: formats.AlphaNumericString_Length1To3("PX"),
Expand Down Expand Up @@ -38,14 +42,14 @@ func MakeRequest(request *search.Request) *Request {
},
},
},
FeeIdDescription: &CodedAttributeType{
FeeId: []*CodedAttributeInformationType_247829C{
FeeIdDescription: &CodedAttributeType_199259S{
FeeId: []*CodedAttributeInformationType_277155C{
{FeeType: formats.AlphaNumericString_Length1To5("FFI"), FeeIdNumber: formats.AlphaNumericString_Length1To50("2")},
{FeeType: formats.AlphaNumericString_Length1To5("UPH"), FeeIdNumber: formats.AlphaNumericString_Length1To50("6")},
},
},
},
TravelFlightInfo: &TravelFlightInformationType_185853S{
TravelFlightInfo: &TravelFlightInformationType_199258S{
CabinId: &CabinIdentificationType_233500C{
CabinQualifier: formats.AlphaNumericString_Length1To2("MD"),
Cabin: []formats.AlphaString_Length0To1{
Expand Down
6 changes: 6 additions & 0 deletions utils/datetime.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package utils

import (
"fmt"
"strconv"
"time"
)
Expand Down Expand Up @@ -35,3 +36,8 @@ func AmadeusDateTimeConvert(dateStr string, timeStr string) time.Time {
}
return time.Date(year, time.Month(month), day, hour, minute, 0, 0, time.UTC)
}

func DateToAmadeusDate(date time.Time) string {
year := strconv.Itoa(date.Year())
return fmt.Sprintf("%02d%02d%s", date.Day(), date.Month(), year[2:4])
}

0 comments on commit c9b4a60

Please sign in to comment.