Sample 3 - Customer management

This sample document is designed to provide you with a sample journey that would allow you manage bookings on behalf of a customer.
Please note the products defined in the journey are imaginary products and will not work in the test system, this journey is for illustrative purposes only.

A typical customer journey


Diagram of Sample 3 flow - Customer Management

This sample is designed to show you how you can use the API to retrieve a customer's details and use various API calls to extract information that can be shown to him/her.

Once you have authenticated a customer you can do a range of things:

  • /api/customer/documentsReturns a list of documents the customer can download
  • /api/customer/paymentAllows a payment to be lodged against the account
  • /api/customer/booking/listReturns a list of bookings and quotes for the customer
  • /api/customer/statementReturns an up to date financial statement
  • /api/passenger/address/storeAdds or updates a passenger address
  • /api/passenger/document/storeAdds or updates a passenger document (APIS data)
  • /api/passenger/loyalty/storeAdds or updates a passenger loyalty card (Frequent flyer)
  • /api/passenger/medical/storeAdds or updates a passenger medical information
  • /api/passenger/notes/storeAdds or updates a passenger note

The process to authenticate a customer is explained in detail here

Example messaging

In the example flow set out below we have not shown the booking process, you will find an example of that in Sample 1 by clicking here. Please click on any of the messages below to expand them and view sample JSON requests and responses.

In truth there is no need to use this message, the stateless messages mean we will run the authentication process for each 'customer' request. However, we consider it good practice and would recommend you do so as part of your customer login process

{
  "timeStamp": "2022-11-08T15:12:37.329Z",
  "channel": 0,
  "authenticate": {
    "email": "Email Address",
    "password": "Password",
    "type": "B2C"
  }
}                                

The response will either be a success status or an error message

{
  "timeStamp": "2022-11-08T15:12:37.330Z",
  "channel": 0,
  "success": true,
}
                                

This next request is used to return the current information

{
  "channel": 0,
  "currency": "GBP",
  "language": "EN",
  "timeStamp": "{{isoTime}}",
  "reference" : "C96NGFPQ",
  "includeBookings" : false,
  "includePassengers" : false,
  "includeNotes" : true,
  "includeDiscounts" : true,
  "includeBookingCount" : true
  "authenticate": {
    "email": "Email Address",
    "password": "Password",
    "type": "B2C"
  }
}
                                    

The response is to return the non-privileged information we hold about the customer

{
    "channel": 0,
    "currency": "GBP",
    "language": "EN",
    "timeStamp": "2019-09-02T18:58:48",
    "success": true,
    "customerDetails": [
        {
            "id": 57,
            "reference": "C96NGFPQ",
            "name": "Jon Smith",
            "customerType": "DIRECT",
            "deleted": false,
            "primaryDetail": {
                "addresses": [
                    {
                        "id": 5052,
                        "addr1": "12 Example Close",
                        "addr2": "Town",
                        "city": "City",
                        "postCode": "PR9 0PO",
                        "country": "United Kingdom",
                        "preferred": true
                    }
                ],
                "contacts": [
                    {
                        "id": 8005,
                        "type": "EMAIL",/api/passenger
                        "preferred": true,
                        "data": "exampleCustomerEmail@email.com"
                    },
                    {
                        "id": 8006,
                        "type": "PHONE",
                        "preferred": true,
                        "data": "01632 960076"
                    }
                ],
                "loyaltyCards": [
                    {
                        "id": 652,
                        "supplier": "EK",
                        "number": "217234"
                    }
                ],
                "medicalDetails": [
                    {
                        "id": 502,
                        "medicalInformation": "Has a history of Fainting"
                    }
                ],
                "notes": [
                    {
                        "id": 702,
                        "body": "Has a speech impediment suggest we chat to him using facetime",
                        "creationDateTime": "2019-01-30T15:44:20",
                        "type": "INTERNAL",
                        "html": false,
                        "createdBy": "Mr Alan Creator",
                        "mandatory": false
                    }
                ],
                "customerDetails": {
                    "id": 57,
                    "reference": "C96NGFPQ",
                    "name": "Jon Smith",
                    "customerType": "DIRECT",
                    "deleted": false,
                    "noBookings": 0,
                    "enabled": true,
                    "language": "EN",
                    "currency": "GBP",
                    "locked": false,
                    "passwordChangeRequired": false
                },
                "id": 8558,
                "title": "Mr",
                "familyName": "Smith",
                "givenName": "Jon",
                "genderId": 2,
                "type": "ADULT",
                "emailList": true,
                "gdprContactByEmail": false,
                "gdprContactByMail": false,
                "gdprContactByPhone": false,
                "gdprContactBySms": false,
                "gdprHoldInformation": false
            },
            "noBookings": 7,
            "enabled": true,
            "language": "EN",
            "currency": "GBP",
            "locked": false,
            "passwordChangeRequired": false
        }
    ]
}
                                    

This message returns the current fiscal statement for the client

{
  "timeStamp": "2022-11-08T15:12:37.329Z",
  "channel": 0,
  "authenticate": {
    "email": "Email Address",
    "password": "Password",
    "type": "B2C"
  }
}
                                

The response is obviously determinate on real world availability and pricing setup in the system

{
  "channel": 0,
  "currencyCode": "AED",
  "language": "DE",
  "timeStamp": "2022-11-10T10:05:43.295Z",
  "echoToken": "string",
  "transactionIdentifier": "string",
  "success": true,
  "customerStatementDetails": [
        {
            "bookingId": 23345,
            "bookingReference": "68538",
            "bookingDate": "2019-11-18T13:40:46",
            "departureDate": "2019-11-24",
            "leadName": "Jon Smith",
            "bookingCost": 2127.37,
            "totalPayment": 2007.37,
            "paymentDetails": [
                {
                    "amount": 150.00,
                    "currencyCode": "GBP",
                    "description": "Cash deposit",
                    "language": "EN",
                    "transactionReference": "Cash deposit",
                    "transactionDateTime": "2019-12-03T15:55:48"
                },
                {
                    "amount": 400.00,
                    "currencyCode": "GBP",
                    "description": "Second instalment",
                    "language": "EN",
                    "transactionReference": "Second instalment",
                    "transactionDateTime": "2019-12-09T14:17:13"
                },
                {
                    "amount": 100.00,
                    "currencyCode": "GBP",
                    "description": "Balance of second instalment",
                    "language": "EN",
                    "transactionReference": "Balance of second instalment",
                    "transactionDateTime": "2019-12-09T14:18:54"
                },
                {
                    "amount": -50.00,
                    "currencyCode": "GBP",
                    "description": "Cash refund",
                    "language": "EN",
                    "transactionReference": "Cash refund",
                    "transactionDateTime": "2019-12-09T14:48:29"
                },
                {
                    "amount": 550.00,
                    "currencyCode": "GBP",
                    "description": "Part payment",
                    "language": "EN",
                    "transactionReference": "UGO8A64K",
                    "transactionDateTime": "2020-01-06T16:33:01"
                },
                {
                    "amount": -250.00,
                    "currencyCode": "GBP",
                    "description": "Refund",
                    "language": "EN",
                    "transactionReference": "Refund",
                    "transactionDateTime": "2020-01-08T13:10:42"
                },
                {
                    "amount": 300.00,
                    "currencyCode": "GBP",
                    "description": "Cheque payment",
                    "language": "EN",
                    "transactionReference": "Cheque payment ",
                    "transactionDateTime": "2020-01-08T13:13:25"
                },
                {
                    "amount": 927.37,
                    "currencyCode": "GBP",
                    "description": "Balance",
                    "language": "EN",
                    "transactionReference": "Balance",
                    "transactionDateTime": "2020-01-08T13:18:45"
                },
                {
                    "amount": -120.00,
                    "currencyCode": "GBP",
                    "description": "Cash refund",
                    "language": "EN",
                    "transactionReference": "Cash refund",
                    "transactionDateTime": "2020-01-08T13:19:58"
                }
            ]
        },
    ]
}
                                

This message allows you to lodge a payment taken against a card to this customer account

{
    "timeStamp": "2022-11-08T15:12:37.329Z",
    "channel": 0,
    "authenticate": {
        "email": "Email Address",
        "password": "Password",
        "type": "B2C"
    }
    "transactionType" : "STORE",
    "customerPaymentDetails" : {
        "cardAuthorisationCode" : "73636",
        "cardPaymentReference" : "2358764091",
        "cardTrailingDigits" : "3445",
        "paymentType" : "CARD",
        "cardType" : "VISA",
        "currencyCode" : "GBP",
        "transactionDateTime" : "2022-11-08T15:12:37",
        "items" : {
            "bookingId" : 23345,
            "amount" : 258.75
        }
    }
}
                                    

The id of the payment stored in the booking

{
    "timeStamp": "2022-07-06T13:47:22",
    "success": true,
    "affectedIds": [
        39393
    ]
}