How do I add a new flight channel in Travel


134
views
0
7 months ago by

2 Answers


0
7 months ago by

OK so I want to add a new flight channel to Travel.

We need to know the credentials we'll be using, EZY (code) for this example and the credentials string also - SFS will be able to provide these. N.B. test / prod credentials may be different, if so the relevant env.properties file entries will be different also

You need to add this new credentials string to all relevant env.properties files

dev

ci

uat

prod (you may want the new creds commented out in prod until we're ready to use therm)

e.g. for EZY

travel.sfs-flights.channel.EZY=QjJCsd23424fjhg34o87tgwlrkjsdkjflsdkjnfgfljfdgJFTLKhlkho87tIHp87GPIugpuibp

Next we need Travel to handle the new credentials

DomainServiceRuntimeConfiguration.sfsFlightsChannelOptions() will need the new credentials adding

new method arg 

@Value("${travel.sfs-flights.channel.EZY:}") final String ezyCreds

handling of new attribute

        if (!ezyCreds.isEmpty()) {

            tmpChannelOptions.put("EZY", ezyCreds);

        }

BookingChannel enum needs updating

EZY("easyJet", TravelType.FLIGHT)

As well as the unit test for BookingChannel enum

Once these changes have been made you should test locally that flights are now being returned via the new channel

 

 

The alterations to the property files are in up to 3 parts. First there's an entry to define the flight channel; for example as above:

travel.sfs-flights.channel.EZY=QjJCQ2xpY2tUcmF2ZWw6Q2wxY2tUcmF2M2w6ZWFzeWpldGIyYkBjbGlja3RyYXZlbC5jb206Q2wxY2tUcmF2M2xCMkI6Q2xpY2sgVHJhdmVsOkNMSUNL

Next you may want to disable access to the channel and then re-enable it selectively for certain organisations only. Do this in 2 parts. Here's a global disable for the EZY channel:

travel.restricted.channels.flights={"channels":["EZY"]}

and then a selective enable for the organisation whose ID is given:

travel.channel.flight.filters={"b3b93815-7b82-4ef2-876d-c68530f5bf6c":["EZY"]}

Instead of globally disabling you can just comment out the channel definition, but then the selective enable won't work.

 

written 6 months ago by Graham Trott  
0
7 months ago by

NB: You may wonder why the code needs to be updated to define the new property in the system, this is because Spring has no way to support obtaining properties using wildcards i.e. it'd be much easier if travel could just use something like:

@Value("${travel.sfs-flights.channel.*:}") final Map<String,String> creds

and then populate the tmpChannelOptions map from there... this is not possible though.

Please login to add an answer/comment or follow this question.

Similar posts:
Search »