Certification Testing Scenarios

This document provides all the tests that must be passed in order to transfer to the production environment with Trip Ninja. The tests ensure that all endpoints and features are implemented correctly and that errors are caught at the pre-production testing stage.

Please carefully implement each test as listed. Once you've done so, our team will review the req/resp with you so that you can move on to production. 

If you have any questions please don't hesitate to reach out to [email protected] 

You can find our API docs here:  API Documentation.
  1. FareStructure Service Test
  2. Mixed Structures Test
  3. Single PNR only test
  4. Multi-PNR mix test
  5. Specify Alliance Test
  6. Permitted Carriers Test
  7. Excluded carriers parameter test
  8. Cabin class parameter test
  9. Source parameter test
  10. Country code parameter test
  11. Passenger type test
  12. Include LCC test *optional
  13. Reporting price confirmation test
  14. Reporting booking test
  15. Reporting ticketing test
  16. Reporting cancellation test


fare_structure_prod Test

Feature: Fare-structure-prod is the production endpoint for your GDS that is used to search for the cheapest flights for a trip. 

Endpoint: ‘/fare-structure-prod/’

Json:

{
	'flights': [
        {'id': 1, 'from_city': 'LON', 'start_type': 'C',
		'to_city': 'SAN', 'end_type': 'C', 'departure_date': 'UPDATE DATE HERE'
	    },
        {'id': 2, 'from_city': 'SAN', 'start_type': 'C',
		'to_city': 'HOU', 'end_type': 'C', 'departure_date': 'UPDATE DATE HERE'
	    },
        {'id': 3, 'from_city': 'HOU', 'start_type': 'C',
        'to_city': 'SFO', 'end_type': 'C', 'departure_date': 'UPDATE DATE HERE'
	}],
	'provider': '1A',
	'PCC': '*Your PCC here*',
	'currency': 'USD',
	'max_cache': 0.4,
	'travellers': 1
}

Please update these with the appropriate variables: 

  • 'PCC' - use your own PCC. 
  • 'departure_date' - add an appropriate departure date to each flight.

Successful when:

  • Trip Ninja returns a 200.
  • The response includes the relevant flight details for the provided search. This includes the correct path_sequeunce and a list of itineraries ordered by weight.


mix_structures Test

Feature: The mix structure feature returns the lowest price flights using a mixture of available flight patterns.

Endpoint: '/fare-structure-prod/'

Json: (use the same fare-structure json and add the following at the root level)

'mix_structures':  true

Successful when:

  • Trip Ninja returns a 200. 
  • The response includes more than one pattern type (for mix_structures the structure is found within each segment, see below). 


single_pnr_only Test

Feature: single_pnr_only returns flights that are all booked on a single ticket with a single PNR.

Endpoint: '/fare-structure-prod/'

Json: (use the same fare-structure json and add the following at the root level)

	'single_pnr_only':  true

Successful when: 

  • Trip Ninja returns a 200.
  • All itineraries in the response have the same structure type (single PNR), the example below. Note that multi-destination, intercontinental flights may return no single_pnr results (we typically see up to 25% of the time).

NOTE: The single pnr structure is always represented as the number of flights inside a tuple. In this example, there are 3 flights and so the structure is '[(0, 1, 2)]'.


multi_pnr_mix Test

Feature: The multi_pnr_mix feature returns a mixture of patterns as well as single_pnr. The resulting itineraries will be a list of the cheapest flights mixed by pattern and by number of PNRs. 

Endpoint: '/fare-structure-prod/'

Json: (use the same fare-structure json and add the following at the root level)

Requirements include single_pnr and mix_structures.

	'mix_structures': true,        
	'multi_pnr_mix': true, 
	'single_pnr': true,

Successful when: 

  • Trip Ninja returns a 200.
  • The response includes more than one pattern type (if there are available single_pnr flights then you may expect examples of these also). 

alliance

Feature: Set the preferred alliance for the search and return only those results if they are available.

Endpoint: '/fare-structure-prod/'

Json: 

	'alliance': '*A'

Assertions: 

  • Trip Ninja returns a 200 if you pass any one of '*A', '*S', '*O'. 
  • Trip Ninja returns a 400 - if you pass anything other than the 3 options above. 
  • If the preferred alliance has results then all the results should be of that alliance. Otherwise other results will be returned. 

permitted_carriers

Feature: To return search results for only those carriers that you have specified, using their 2 digit carrier code.

Endpoint: '/fare-structure-prod/'

Json: 

	'permitted_carriers': ['NZ', 'UA']

Assertions: 

  • Trip Ninja returns a 200.
  • If you pass a carrier name that doesn't exist Trip Ninja returns a 400.
  • If there are no flights available with the carriers provided Trip Ninja returns a 206 - no flights found. 
  • If a 200 is received none of the flights must be of the carriers specified in the request. 

exclude_carriers

Feature: To return search results that exclude all of the carriers specified.

Endpoint: '/fare-structure-prod/'

Json: 

'exclude_carriers': ['NZ', 'UA']

Assertions

  • Trip Ninja returns a 200.
  • If you pass a carrier name that doesn't exist, Trip Ninja returns a 400 - invalid carrier. 
  • If there are no flights available with the carriers provided Trip Ninja returns a 206 - no flights found. 
  • If a 200 is received none of the flights should be with excluded carriers. 

cabin_class

Feature: To retrieve results with a specified cabin class.

Endpoint: '/fare-structure-prod/'

Json: 

'cabin_class': 'E'

Assertions:

  • Trip Ninja returns a 200.
  • All the flights in the request have the cabin class specified in the request. The cabin class in the response will be presented in the form that the GDS provides, i.e. PE passed as cabin class to Trip Ninja using Travelport will return results with 'cabin_class': 'PremiumEconomy'.
  • Passing a non-existent cabin class should return the error below:
'IE22': "Not a valid cabin option. expected one of 'E' , 'PE', 'SE', 'BC','FC', 'PFC'"

passengers

Feature: To indicate the number of passengers and passenger types. 

Endpoint: '/fare-structure-prod/' 

Json:  

	'travellers': ['ADT', 'ADT', 'ADT']

Assertions: 

  • Trip Ninja returns a 200.
  • The returned result with the above 3 adults should return a price 3 times that of the response with 1 ADT. 
  • In place of ADT add CHD or INF and ensure you get results. (Note that in the absence of CHD or INF fares we will return the ADT fares in their place). 
  • Sending a non-existent traveller will return error: 
'IE29': “Invalid Traveller type YHU in list, should be one of ['ADT', ‘CHD', 'MIL', 'INF', 'STU', 'ITX', 'YTH']"

source and country_code

Feature: This feature allows our models to properly learn from past trips and improve your markup models over time. Passing these will affect the markup that is returned from Trip Ninja. The country code is the two character code where the search is coming from i.e. CA for Canada, or US for United States of America. The source is the source of the search, i.e. 'kayak', 'skyscanner'.

Endpoint: '/fare-structure-prod/'

Json: 

'country_code': 'CA','source': 'kayak'

Assertions: 

  • Trip Ninja returns a 200.
  • The markup in the response should be different if you make the same search but with a different source. 

include_lcc

Feature: Optional - include low-cost carrier content from an additional data source such as TripStack or Mystifly in the response. The response will contain a mix of the best flights from GDS and LCC providers. 

Note: you must provide Trip Ninja with your API access tokens and/or credentials before accessing this feature.

Endpoint: '/fare-structure-prod/'

Json: 

'include_lcc': ['tripstack']

Assertions: 

  • Trip Ninja returns a 200 if you pass your provisioned LCC provider name.
  • Check the response parameters 'segment_source' for various segments. There should be results from both your GDS and LCC provider. 

Price Confirmation Report

Note: For the following test, first complete a search with FareStructure and store the response. The trip_id and a list of segment_id fields for the selected flights will be used to complete the requests.

Feature: When a user has selected their flights or arrived on the site from a meta-search, send this request to report it. 

Endpoint: '/pre-booking/'

Request Json: 

 {
  "trip_id": “[[ SET TRIP_ID ]]”,
  "segment_ids": [
    [
      "[[ SET SEGMENT_ID ]]",
    ]
  ],
  "client_generated_trip": false
}

Assertions: 

  • Response status 200.

Booking Report

Note: For the following test, first complete a search with FareStructure and store the response. The trip_id and a list of segment_id fields for the selected flights will be used to complete the requests.

Feature: When a user has completed booking a trip, send this request to report it. 

Endpoint: '/booking/'

Request Json: 

{
  "trip_id": "[[ SET TRIP_ID ]]",
  "segment_ids": [
    [
      "[[ SET SEGMENT_ID ]]",
    ]
  ],
  "client_generated_trip": false
}

Assertions: 

  • Response status 200.

Ticketing Report

Note: For the following test, first complete a search with FareStructure and store the response. The trip_id and a list of segment_id fields for the selected flights will be used to complete the requests.

Feature: When the tickets have been issued for a trip, send this request to report it.

Endpoint: '/ticketing/'

Requeston Json: 

{
  "trip_id": "[[ SET TRIP_ID ]]",
  "segment_ids": [
    [
      "[[ SET SEGMENT_ID ]]",
    ]
  ],
  "client_generated_trip": false
}

Assertions: 

  • Response status 200.

Cancellation Report

Note: For the following test, first complete a search with FareStructure and store the response. The trip_id and a list of segment_id fields for the selected flights will be used to complete the requests.

Feature: If a booking ends up being cancelled, send this request to report it. 

Endpoint: '/cancel/'

Request Json: 

 {
  "trip_id": "[[ SET TRIP_ID ]]"
}

Assertions: 

  • Response status 200. 

Still need help? Contact Us Contact Us