Fexco Central API

Introduction

Rates

Rates are constantly being updated. It is key to notify consumers about this change. We do not want our clients to have to poll our servers to check for new rates.
We publish rate updates in an AMQP topic.
We're using Azure as cloud provider. We use a topic inside a Service-Bus to broadcast the message. Subscribers can filter the topic using their rate plan ID on the label field.

The following is an example of the message you will receive:

{
  "messageId": "ab159659-6f27-4fac-9ce6-b1ae1f8eb15a",
  "label": "fd816033-a959-47d5-9e0b-43d4f7aa7788"
  "contentType": "application/json",
  "messageBody": {
    "correlation_id": "ABC123xyz456",
    "tenant_id": "API_DOC",
    "business_unit": "RFX",
    "location_id": "",
    "pos_id": "",
    "client_id": "",
    "user_id": "",
    "created_time": 1556549638,
    "events": [
      {
        "header": {
          "correlation_id": "654zyx321cba",
          "event_id": "FCAPI_RATES",
          "created_time": 1556549638,
          "priority": "HIGH",
          "consistency_level": "HIGH",
          "comm": {
            "request_stream": "incoming",
            "response_stream": "outgoing",
            "notification_stream": "notification_stream"
          }
        },
        "body": {
          "ratePlanId": "fd816033-a959-47d5-9e0b-43d4f7aa7788",
          "base_currency": "EUR",
          "rates": [
            {
              "fx_currency": "USD",
              "product": "NOTE",
              "buy": [
                {
                  "min": 0,
                  "rate": 1.3553
                },
                {
                  "min": 2500,
                  "rate": 1.3442
                }
              ],
              "sell": [
                {
                  "min": 0,
                  "rate": 1.3553
                },
                {
                  "min": 2500,
                  "rate": 1.3442
                }
              ]
            },
            {
              "currency": "AUD",
              "product": "NOTE",
              "buy": [
                {
                  "min": 0,
                  "rate": 1.9329
                }
              ],
              "sell": [
                {
                  "min": 0,
                  "rate": 1.7912
                }
              ]
            }
          ]
        }
      }
    ]
  }
}
                                

What info you will need.

service bus <servicebusname> Name of the service bus.
topic <topicname> Name of the topic which we want to subscribe
subscription <subscription> Name of own subscription
saskey name <saskeyname> Name of the SAS key
saskey <saskey> SAS key value
connectionString Endpoint=sb://fts-cp-ci-sbns.servicebus.windows.net/;SharedAccessKeyName=<saskeyname>;SharedAccessKey=<saskey> The connection string will be composed with the info above.

There are several ways to consume this info, here are some examples.


Typescript

The easy way is to use the official library.

Python

We will use the official library too.

Price Match

Price Matching is used to match competitors who are offering more competitive rates.
Whenever a price match is created, it is broadcasted to the location in question.
Subscribers can filter the topic using their location ID on the label field.

The following is an example of the message you will receive:

{
  "messageId": "ab159659-6f27-4fac-9ce6-b1ae1f8eb15a",
  "label": "sandbox"
  "contentType": "application/json",
  "messageBody":{
    "tenant_id": "Apiary",
    "business_unit": "RFX",
    "location_id": "LE123",
    "pos_id": "PE123",
    "user_id": "user@fexco.com",
    "correlation_id": "61f3a781e6d985fce2aa7513c2",
    "created_time": 1554135456629,
    "events": [
      {
        "header": {
          "comm": {
            "request_stream": "incoming",
            "response_stream": "outgoing",
            "notification_stream": "notifications"
          },
          "priority": "HIGH",
          "created_time": 1554135456629,
          "correlation_id": "3c0b5b5eade65ce218ae6c8eb19d9097611",
          "consistency_level": "HIGH",
          "event_id": "FCAPI_PRICE_MATCH"
        },
        "body": {
              {
                "action": "SELL",
                "competitor": "Competitor 1",
                "other": null,
                "created": 1567416792178,
                "currency": "EUR",
                "id": "a0000000-b5c5-48ee-97bf-000000000004",
                "location_id": "sandbox",
                "product": "NOTE",
                "user_id": "1342d12e-bf06-4342-be3a-096c26f55968",
                "value": 1
              },
              {
                "action": "BUY",
                "competitor": null,
                "other": "Other",
                "created": 1567416792178,
                "currency": "USD",
                "id": "a0000000-b5c5-48ee-97bf-000000000004",
                "location_id": "sandbox",
                "product": "NOTE",
                "user_id": "1342d12e-bf06-4342-be3a-096c26f55968",
                "value": 1
              }
          }
        }
    ]
  }
}
                                

Special Rate

Special rates are once off rates.
They are used when a location doesn't have the authority to provide a rate competitive enough for the customer. In this scenario, a special rate can be created so as to not lose the transaction.
Special rates must be generated by management. When one is generated it is broadcast to the subscriber. Subscribers can filter the topic using their location ID on the label field.

The following is an example of the message you will receive:

{
  "messageId": "ab159659-6f27-4fac-9ce6-b1ae1f8eb15a",
  "label": "sandbox"
  "contentType": "application/json",
  "messageBody":{
    "business_unit": "RFXUK",
    "client_id": null,
    "correlation_id": "e8f7da6f-bfd5-4e52-8d0f-8cf7b42b3394",
    "created_time": 1529407932178,
    "events": [
      {
        "body": {
          "entity": {
            "currency": "GBP",
            "fx_amount": 150,
            "rate": 0.9,
            "product": "NOTE",
            "action": "BUY",
            "special_rate_id": "e52dd65e-bc5d-4d71-86a0-52579386806e"
          }
        },
        "header": {
          "comm": null,
          "consistency_level": "HIGH",
          "correlation_id": "e8f7da6f-bfd5-4e52-8d0f-8cf7b42b3394",
          "created_time": 1529407972178,
          "event_id": "FCAPI_WHOLESALE_ORDER",
          "priority": "MEDIUM"
        }
      }
    ],
    "location_id": "sandbox",
    "pos_id": "pos-uuid",
    "tenant_id": "APIARY",
    "user_id": "apiary@fexco.com"
  }
}
                                

Wholesale Orders

Wholesale orders can be created, and updated, external to the location.
When a wholesale order is created/update, it is broadcast to the subscriber.
Subscribers can filter the topic using their location ID on the label field.

The following is an example of the message you will receive:

{
  "messageId": "ab159659-6f27-4fac-9ce6-b1ae1f8eb15a",
  "label": "sandbox"
  "contentType": "application/json",
  "messageBody":{
    "business_unit": "RFXUK",
    "correlation_id": "e8f7da6f-bfd5-4e52-8d0f-8cf7b42b3394",
    "created_time": 1529407932178,
    "events": [
      {
        "body": {
          "entity": {
            "line_items": [
              {
                "currency": "USD",
                "fx_amount": 100,
                "rate": 1.1,
                "product": "NOTE"
              },
              {
                "currency": "GBP",
                "fx_amount": 150,
                "rate": 0.9,
                "product": "NOTE"
              }
            ],
            "origin": "236079b3-0fb4-497e-bcdb-07f8d7163957",
            "order_id": "8a24acee-1afc-424f-8b4e-51848e24e04e",
            "operation": "REMIT",
            "status": "Incomplete",
            "wholesaler": "fexco_wholesale"
          }
        },
        "header": {
          "comm": null,
          "consistency_level": "HIGH",
          "correlation_id": "e8f7da6f-bfd5-4e52-8d0f-8cf7b42b3394",
          "created_time": 1529407972178,
          "event_id": "FCAPI_WHOLESALE_ORDER",
          "priority": "MEDIUM"
        }
      }
    ],
    "location_id": "sandbox",
    "pos_id": "pos-uuid",
    "tenant_id": "APIARY",
    "user_id": "apiary@fexco.com"
  }
}