From fa13953f69b6eb23eca109fb5845ed3e05fc31eb Mon Sep 17 00:00:00 2001 From: Chris Knight Date: Fri, 18 Oct 2019 13:09:11 +0100 Subject: [PATCH 01/50] update with jeans input on authentication --- docs/index.html | 84 +++++++++++++++++++++++++++------------- source/includes/FXOps.md | 34 ++++++++-------- source/includes/main.md | 58 +++++++++++++++++++++------ 3 files changed, 120 insertions(+), 56 deletions(-) diff --git a/docs/index.html b/docs/index.html index e2303742..bf1b320f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,26 +43,56 @@

Introduction

-

Welcome to the Clear Payments API - Powered by Clear Treasury. With international payments a daily necessity for many, we have developed our online payments platform that dramatically streamlines the process.

+
+

Base [ENV] url variables

+
+
sandbox: api-test.cleartreasury.co.uk/api
+live: api.cleartreasury.co.uk/api

Welcome to the Clear Payments API - Powered by Clear Treasury. With international payments a daily necessity for many, we have developed our online payments platform that dramatically streamlines the process.

We have designed the Clear Payments API to integrate directly into your process, product or software.

Authentication

-

To authorize, use this code:

+

use this code:

# With shell, you can just pass the correct header with each request
-curl "api_endpoint_here"
-  -H "Authorization: --yourAuthKey--"
const kittn = require('kittn');
+curl -X POST \
+  http://[ENV].cleartreasury.co.uk/api/token \
+  -H 'Content-Type: application/x-www-form-urlencoded' \
+  -d 'login=--YOUR LOGIN--&password=--YOUR PASSWORD--'
var settings = {
+  "async": true,
+  "crossDomain": true,
+  "url": "http://[ENV].cleartreasury.co.uk/api/token",
+  "method": "POST",
+  "headers": {
+    "Content-Type": "application/x-www-form-urlencoded",
+   },
+  "data": {
+    "login": "--YOUR LOGIN--",
+    "password": "--YOUR PASSWORD--"
+  }
+}
 
-let api = kittn.authorize('--yourAuthKey--');
-

Make sure to replace --yourAuthKey-- with your API key.

+$.ajax(settings).done(function (response) { + console.log(response); +});
+

Clear Payments expects the API Token to be included in all API requests to the server in a header that looks like the following:

-

Clear Payments uses API keys to allow access to the API. You can register a new API key at our developer portal.

-

Clear Payments expects for the API key to be included in all API requests to the server in a header that looks like the following:

-

Authorization: --yourAuthKey--

+
curl -X POST \
+  '[ENV].cleartreasury.co.uk/--ENDPOINT--' \
+  -H 'Authorization: Bearer --YOUR TOKEN--' \ 
+

Clear API uses a token that needs to be set in the header of each call.

+

To generate your token you can use /api/Token endpoint

+ + +

This Token is valid for 6 months.

+

Bookquote

@@ -87,7 +117,7 @@

Bookquote

"OurSWIFTCode": "string", "Message": "string" }

HTTP Request

-

POST /api/BookQuote/BookQuote

+

POST /BookQuote/BookQuote

Parameters

@@ -168,7 +198,7 @@

GET

"exportedDate": "2019-10-17T11:27:23.691Z" } ]

HTTP Request

-

GET /api/PaymentInstruction/GetValues

+

GET /PaymentInstruction/GetValues

Parameters

@@ -210,7 +240,7 @@

GET

POST

HTTP Request

-

POST /api/PaymentInstruction/PostValue

+

POST /PaymentInstruction/PostValue

Parameters

@@ -246,7 +276,7 @@

HTTP Request

Quote

POST

HTTP Request

-

POST /api/Quote/PostValue

+

POST /Quote/PostValue

Parameters

@@ -316,7 +346,7 @@

HTTP Request

GET

HTTP Request

-

GET /api/Quote/GetValue

+

GET /Quote/GetValue

Parameters

@@ -367,7 +397,7 @@

calculatequote

"Message": "string", "Status": true }

HTTP Request

-

POST /api/Quote/CalculateQuote

+

POST /Quote/CalculateQuote

Parameters

@@ -416,7 +446,7 @@

GET

"Balance": 0 } ]

HTTP Request

-

GET /api/Statement/GetValues

+

GET /Statement/GetValues

Parameters

@@ -511,7 +541,7 @@

GET

"pin_check_count": 0 } ]

HTTP Request

-

GET /api/Template/GetValues

+

GET /Template/GetValues

Responses

@@ -528,7 +558,7 @@

GET

Token

POST

HTTP Request

-

POST /api/Token/PostValues

+

POST /Token/PostValues

Parameters

@@ -583,7 +613,7 @@

GET

"Beneficiary": "string" } ]

HTTP Request

-

GET /api/Trade/GetValues

+

GET /Trade/GetValues

Parameters

@@ -634,7 +664,7 @@

Filters

"Description": "string" } ]

HTTP Request

-

GET /api/webhooks/filters

+

GET /webhooks/filters

Responses

@@ -666,7 +696,7 @@

Registrations

"Properties": {} } ]

HTTP Request

-

GET /api/webhooks/registrations

+

GET /webhooks/registrations

Responses

@@ -681,7 +711,7 @@

Registrations

HTTP Request

-

POST /api/webhooks/registrations

+

POST /webhooks/registrations

Parameters

@@ -715,7 +745,7 @@

HTTP Request

HTTP Request

-

DELETE /api/webhooks/registrations

+

DELETE /webhooks/registrations

Responses

@@ -732,7 +762,7 @@

HTTP Request

Registrations/{id}

GET

HTTP Request

-

GET /api/webhooks/registrations/{id}

+

GET /webhooks/registrations/{id}

Parameters

@@ -767,7 +797,7 @@

HTTP Request

PUT

HTTP Request

-

PUT /api/webhooks/registrations/{id}

+

PUT /webhooks/registrations/{id}

Parameters

@@ -809,7 +839,7 @@

HTTP Request

DELETE

HTTP Request

-

DELETE /api/webhooks/registrations/{id}

+

DELETE /webhooks/registrations/{id}

Parameters

diff --git a/source/includes/FXOps.md b/source/includes/FXOps.md index bc5d0ce1..7aa3be64 100644 --- a/source/includes/FXOps.md +++ b/source/includes/FXOps.md @@ -24,7 +24,7 @@ ``` ### HTTP Request -`POST /api/BookQuote/BookQuote` +`POST /BookQuote/BookQuote` **Parameters** @@ -79,7 +79,7 @@ ``` ### HTTP Request -`GET /api/PaymentInstruction/GetValues` +`GET /PaymentInstruction/GetValues` **Parameters** @@ -97,7 +97,7 @@ ## POST ### HTTP Request -`POST /api/PaymentInstruction/PostValue` +`POST /PaymentInstruction/PostValue` **Parameters** @@ -115,7 +115,7 @@ ## POST ### HTTP Request -`POST /api/Quote/PostValue` +`POST /Quote/PostValue` **Parameters** @@ -137,7 +137,7 @@ ## GET ### HTTP Request -`GET /api/Quote/GetValue` +`GET /Quote/GetValue` **Parameters** @@ -172,7 +172,7 @@ ``` ### HTTP Request -`POST /api/Quote/CalculateQuote` +`POST /Quote/CalculateQuote` **Parameters** @@ -207,7 +207,7 @@ ``` ### HTTP Request -`GET /api/Statement/GetValues` +`GET /Statement/GetValues` **Parameters** @@ -276,7 +276,7 @@ ``` ### HTTP Request -`GET /api/Template/GetValues` +`GET /Template/GetValues` **Responses** @@ -288,7 +288,7 @@ ## POST ### HTTP Request -`POST /api/Token/PostValues` +`POST /Token/PostValues` **Parameters** @@ -329,7 +329,7 @@ ``` ### HTTP Request -`GET /api/Trade/GetValues` +`GET /Trade/GetValues` **Parameters** @@ -358,7 +358,7 @@ ``` ### HTTP Request -`GET /api/webhooks/filters` +`GET /webhooks/filters` **Responses** @@ -387,7 +387,7 @@ ``` ### HTTP Request -`GET /api/webhooks/registrations` +`GET /webhooks/registrations` **Responses** @@ -397,7 +397,7 @@ ### HTTP Request -`POST /api/webhooks/registrations` +`POST /webhooks/registrations` **Parameters** @@ -413,7 +413,7 @@ ### HTTP Request -`DELETE /api/webhooks/registrations` +`DELETE /webhooks/registrations` **Responses** @@ -425,7 +425,7 @@ ### GET ### HTTP Request -`GET /api/webhooks/registrations/{id}` +`GET /webhooks/registrations/{id}` **Parameters** @@ -442,7 +442,7 @@ ### PUT ### HTTP Request -`PUT /api/webhooks/registrations/{id}` +`PUT /webhooks/registrations/{id}` **Parameters** @@ -460,7 +460,7 @@ ### DELETE ### HTTP Request -`DELETE /api/webhooks/registrations/{id}` +`DELETE /webhooks/registrations/{id}` **Parameters** diff --git a/source/includes/main.md b/source/includes/main.md index 238f1f1c..d368a9d8 100644 --- a/source/includes/main.md +++ b/source/includes/main.md @@ -1,33 +1,67 @@ + # Introduction +> Base [ENV] url variables +``` +sandbox: api-test.cleartreasury.co.uk/api +live: api.cleartreasury.co.uk/api +``` + Welcome to the Clear Payments API - Powered by Clear Treasury. With international payments a daily necessity for many, we have developed our online payments platform that dramatically streamlines the process. We have designed the Clear Payments API to integrate directly into your process, product or software. # Authentication -> To authorize, use this code: +> use this code: ```bash # With shell, you can just pass the correct header with each request -curl "api_endpoint_here" - -H "Authorization: --yourAuthKey--" +curl -X POST \ + http://[ENV].cleartreasury.co.uk/api/token \ + -H 'Content-Type: application/x-www-form-urlencoded' \ + -d 'login=--YOUR LOGIN--&password=--YOUR PASSWORD--' ``` ```javascript -const kittn = require('kittn'); +var settings = { + "async": true, + "crossDomain": true, + "url": "http://[ENV].cleartreasury.co.uk/api/token", + "method": "POST", + "headers": { + "Content-Type": "application/x-www-form-urlencoded", + }, + "data": { + "login": "--YOUR LOGIN--", + "password": "--YOUR PASSWORD--" + } +} -let api = kittn.authorize('--yourAuthKey--'); +$.ajax(settings).done(function (response) { + console.log(response); +}); +``` +> Clear Payments expects the API Token to be included in all API requests to the server in a header that looks like the following: +``` +curl -X POST \ + '[ENV].cleartreasury.co.uk/--ENDPOINT--' \ + -H 'Authorization: Bearer --YOUR TOKEN--' \ + ``` -> Make sure to replace `--yourAuthKey--` with your API key. - -Clear Payments uses API keys to allow access to the API. You can register a new API key at our [developer portal](https://payments.cleartreasury.co.uk). - -Clear Payments expects for the API key to be included in all API requests to the server in a header that looks like the following: +Clear API uses a token that needs to be set in the header of each call. -`Authorization: --yourAuthKey--` +To generate your token you can use /api/Token endpoint + + + +This Token is valid for 6 months. \ No newline at end of file From fa724c4d9d15ed34eb7356d571a994d54004b5ee Mon Sep 17 00:00:00 2001 From: Chris Knight Date: Thu, 5 Dec 2019 17:03:58 +0000 Subject: [PATCH 02/50] update documentation based from swagger/ generated docs --- source/includes/FXOps.md | 176 ++++++++++++++++++++++++++++++------- source/includes/_errors.md | 8 +- 2 files changed, 148 insertions(+), 36 deletions(-) diff --git a/source/includes/FXOps.md b/source/includes/FXOps.md index 7aa3be64..56ecd876 100644 --- a/source/includes/FXOps.md +++ b/source/includes/FXOps.md @@ -22,15 +22,19 @@ "Message": "string" } ``` +### Description +Book a Trade ### HTTP Request -`POST /BookQuote/BookQuote` +`POST /BookQuote` + +`POST /BookQuote?quote_id={quote_id}&sourceOfFunds={sourceOfFunds}&ReasonForTrading={ReasonForTrading}` **Parameters** | Name | Located in | Description | Required | Type | | ---- | ---------- | ----------- | -------- | ---- | -| quote_id | query | | Yes | integer | +| quote_id | query | Quote Id to Validate | Yes | integer | | sourceOfFunds | query | | Yes | string | | ReasonForTrading | query | | Yes | string | @@ -42,7 +46,9 @@ # Payment instruction -## GET +## Retrieve list by date + +Retrieve payment instruction list yyyyMMdd inclusive from dateyyyyMMdd inclusive to date > Example JSON response: @@ -79,7 +85,9 @@ ``` ### HTTP Request -`GET /PaymentInstruction/GetValues` +`GET PaymentInstruction` + +`GET PaymentInstruction?fromDate={fromDate}&toDate={toDate}` **Parameters** @@ -94,16 +102,74 @@ | ---- | ----------- | | 200 | OK | -## POST +## Retrieve by GUID +Retrieve payment instruction by GUID ### HTTP Request -`POST /PaymentInstruction/PostValue` +`GET api/PaymentInstruction/{id}` **Parameters** | Name | Located in | Description | Required | Type | | ---- | ---------- | ----------- | -------- | ---- | -| tr | body | | Yes | | +| id | query | payment GUID | yes | string | + +## Instruct a new Payment + +> Example JSON value: + +```json +[ + { + "Intermediary": "string", + "AccountName": "string", + "AccountNumber": "string", + "Address": "string", + "BankName": "string", + "CCY": "string", + "Notes": "string", + "SortCode": "string", + "Swift": "string", + "CountryCode": "string", + "Email": "string", + "BenAddress": "string", + "CNAPS": "string", + "Purpose": "string", + "FEE": "string", + "Amount": "string", + "PaymentReference": "string", + "TradeReference": "string", + "PaymentGuid": "00000000-0000-0000-0000-000000000000" + } +] +``` + +### HTTP Request +`POST /PaymentInstruction/` + +**Parameters** + +| Name | Description | Required | Type | Additional information | +| ---- | ----------- | -------- | ---- | ----------- | +| Intermediary | Intermediary SWIFT of the Bank | | string | Max length: 50 | +| AccountName | Beneficiary Name | yes | string | +| AccountNumber | Account number or IBAN | yes | string | +| Address | Bank Address | | string | +| BankName | Instructed bank name | | string | +| CCY | 3 letters currency code | yes | string | String length: inclusive between 3 and 3| +| Notes | Payment notes | | string | +| SortCode | For UK payments | | string | String length: inclusive between 6 and 6 | +| Swift | SWIFT or BIC code | | string | +| CountryCode | 2 letters ISO country code | yes | string | +| Email | Beneficiary Email | | string | +| BenAddress | Address of Beneficiary | | string | +| CNAPS | For payment to China only | | string | +| Purpose | Purpose of payment | | string | +| FEE | Charge direction OUR/SHA/BEN (default to SHA) | | string | +| Amount | Amount instructed | yes | string | +| PaymentReference | Your Reference on payment | | string | +| TradeReference | The trade Reference of the trade used to instruct this payment, set to blank if this Payment is not linked to FX trade, or set to "auto" to attempt to retrieve available trade. | | string | +| PaymentGuid | A GUID defined by yourself that can be used to retrieve payment | | globally unique identifier | **Responses** @@ -112,20 +178,22 @@ | 200 | OK | # Quote -## POST +## Place a Quote ### HTTP Request -`POST /Quote/PostValue` +`POST /Quote` + +`POST api/Quote?ccy_sell={ccy_sell}&ccy_buy={ccy_buy}&value_date={value_date}&sell_amount={sell_amount}&buy_amount={buy_amount}"eID={quoteID}` **Parameters** | Name | Located in | Description | Required | Type | | ---- | ---------- | ----------- | -------- | ---- | -| ccy_sell | query | | No | string | -| ccy_buy | query | | No | string | -| value_date | query | | No | string | -| sell_amount | query | | No | double | -| buy_amount | query | | No | double | +| ccy_sell | query | ISO 3 letters currency | No | string | +| ccy_buy | query | ISO 3 letters currency | No | string | +| value_date | query | yyyyMMdd date | No | string | +| sell_amount | query | Selling Amount | No | double | +| buy_amount | query | Buying Amount | No | double | | quoteID | query | | No | integer | **Responses** @@ -134,16 +202,18 @@ | ---- | ----------- | | 200 | OK | -## GET +## Get a refreshed price for a quote ### HTTP Request -`GET /Quote/GetValue` +`GET /Quote` + +`GET api/Quote?quote_id={quote_id}` **Parameters** | Name | Located in | Description | Required | Type | | ---- | ---------- | ----------- | -------- | ---- | -| quote_id | query | | Yes | integer | +| quote_id | query | Quote Id to Refresh | Yes | integer | **Responses** @@ -151,8 +221,8 @@ | ---- | ----------- | | 200 | OK | -## calculatequote -> Example JSON response: +## Calculate a quote +> Example JSON value: ```json { @@ -172,7 +242,9 @@ ``` ### HTTP Request -`POST /Quote/CalculateQuote` +`POST api/Quote` + +`POST api/Quote?quote_id={quote_id}` **Parameters** @@ -188,7 +260,8 @@ # Statement -## GET +## Retrieve a Statement +Retrieve Statement per currency - optionally specify from/ to dates (inclusive) > Example JSON response: @@ -207,7 +280,9 @@ ``` ### HTTP Request -`GET /Statement/GetValues` +`GET api/Statement` + +`GET api/Statement?ccy={ccy}&fromDate={fromDate}&toDate={toDate}` **Parameters** @@ -223,9 +298,10 @@ | ---- | ----------- | | 200 | OK | -# Template +# Beneficiary Templates -## GET +## List Templates +Get a list of Beneficiary Templates > Example JSON response: @@ -276,7 +352,7 @@ ``` ### HTTP Request -`GET /Template/GetValues` +`GET /Template/` **Responses** @@ -285,16 +361,17 @@ | 200 | OK | # Token -## POST +## Build your Auth Token ### HTTP Request -`POST /Token/PostValues` +`POST /Token` -**Parameters** +**Body Parameters** | Name | Located in | Description | Required | Type | | ---- | ---------- | ----------- | -------- | ---- | -| uc | body | | Yes | | +| Login | body | Login | Yes | string | +| Password| body | Password| Yes | string | **Responses** @@ -302,9 +379,10 @@ | ---- | ----------- | | 200 | OK | -# Trade +# Trade History -## GET +## Retrieve a Trade list between two dates +From yyyyMMdd to yyyyMMdd inclusive > Example JSON response: @@ -329,7 +407,9 @@ ``` ### HTTP Request -`GET /Trade/GetValues` +`GET /Trade` + +`GET /Trade?fromDate={fromDate}&toDate={toDate}` **Parameters** @@ -344,6 +424,38 @@ | ---- | ----------- | | 200 | OK | +## Retrieve payment instruction by GUID + +> Example JSON response: + +```json +[ + { + "ID": 0, + "Trade_Date": "string", + "Value_Date": "string", + "CCY_Bought": "string", + "CCY_Sold": "string", + "Rate": 0, + "Bought_Amount": 0, + "Sold_Amount": 0, + "Payment_Fee": 0, + "Trade_ID": "string", + "Trade_Type": "string", + "Status": "string", + "Beneficiary": "string" + } +] +``` +### HTTP Request +`GET /Trade/{id}` + +**Parameters** + +| Name | Located in | Description | Required | Type | +| ---- | ---------- | ----------- | -------- | ---- | +| id | query | payment GUID | yes | string | + # Webhooks ## Filters > Example JSON response: diff --git a/source/includes/_errors.md b/source/includes/_errors.md index 79fac275..654be8ad 100644 --- a/source/includes/_errors.md +++ b/source/includes/_errors.md @@ -1,11 +1,11 @@ # Errors -
@@ -132,7 +135,7 @@

Bookquote

- + @@ -165,7 +168,8 @@

Bookquote

quote_id queryQuote Id to Validate Yes integer

Payment instruction

-

GET

+

Retrieve list by date

+

Retrieve payment instruction list yyyyMMdd inclusive from dateyyyyMMdd inclusive to date

Example JSON response:

@@ -198,7 +202,8 @@

GET

"exportedDate": "2019-10-17T11:27:23.691Z" } ]

HTTP Request

-

GET /PaymentInstruction/GetValues

+

GET PaymentInstruction

+

GET PaymentInstruction?fromDate={fromDate}&toDate={toDate}

Parameters

@@ -238,9 +243,10 @@

GET

OK
-

POST

+

Retrieve by GUID

+

Retrieve payment instruction by GUID

HTTP Request

-

POST /PaymentInstruction/PostValue

+

GET api/PaymentInstruction/{id}

Parameters

@@ -253,10 +259,183 @@

HTTP Request

- - + + + + + + +
trbodyidquerypayment GUIDyesstring
+

Instruct a new Payment

+
+

Example JSON value:

+
+
[
+  {
+    "Intermediary": "string",
+    "AccountName": "string",
+    "AccountNumber": "string",
+    "Address": "string",
+    "BankName": "string",
+    "CCY": "string",
+    "Notes": "string",
+    "SortCode": "string",
+    "Swift": "string",
+    "CountryCode": "string",
+    "Email": "string",
+    "BenAddress": "string",
+    "CNAPS": "string",
+    "Purpose": "string",
+    "FEE": "string",
+    "Amount": "string",
+    "PaymentReference": "string",
+    "TradeReference": "string",
+    "PaymentGuid": "00000000-0000-0000-0000-000000000000"
+  }
+]

HTTP Request

+

POST /PaymentInstruction/

+

Parameters

+ + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionRequiredTypeAdditional information
IntermediaryIntermediary SWIFT of the Bank YesstringMax length: 50
AccountNameBeneficiary Nameyesstring
AccountNumberAccount number or IBANyesstring
AddressBank Addressstring
BankNameInstructed bank namestring
CCY3 letters currency codeyesstringString length: inclusive between 3 and 3
NotesPayment notesstring
SortCodeFor UK paymentsstringString length: inclusive between 6 and 6
SwiftSWIFT or BIC codestring
CountryCode2 letters ISO country codeyesstring
EmailBeneficiary Emailstring
BenAddressAddress of Beneficiarystring
CNAPSFor payment to China onlystring
PurposePurpose of paymentstring
FEECharge direction OUR/SHA/BEN (default to SHA)string
AmountAmount instructedyesstring
PaymentReferenceYour Reference on paymentstring
TradeReferenceThe trade Reference of the trade used to instruct this payment, set to blank if this Payment is not linked to FX trade, or set to "auto" to attempt to retrieve available trade.string
PaymentGuidA GUID defined by yourself that can be used to retrieve paymentglobally unique identifier
@@ -274,9 +453,10 @@

HTTP Request

Quote

-

POST

-

HTTP Request

-

POST /Quote/PostValue

+

Place a Quote

+

HTTP Request

+

POST /Quote

+

POST api/Quote?ccy_sell={ccy_sell}&ccy_buy={ccy_buy}&value_date={value_date}&sell_amount={sell_amount}&buy_amount={buy_amount}&quoteID={quoteID}

Parameters

@@ -291,35 +471,35 @@

HTTP Request

- + - + - + - + - + @@ -344,9 +524,10 @@

HTTP Request

ccy_sell queryISO 3 letters currency No string
ccy_buy queryISO 3 letters currency No string
value_date queryyyyyMMdd date No string
sell_amount querySelling Amount No double
buy_amount queryBuying Amount No double
OK
-

GET

-

HTTP Request

-

GET /Quote/GetValue

+

Get a refreshed price for a quote

+

HTTP Request

+

GET /Quote

+

GET api/Quote?quote_id={quote_id}

Parameters

@@ -361,7 +542,7 @@

HTTP Request

- + @@ -379,9 +560,9 @@

HTTP Request

quote_id queryQuote Id to Refresh Yes integer
OK
-

calculatequote

+

Calculate a quote

-

Example JSON response:

+

Example JSON value:

{
   "ID": "string",
@@ -396,8 +577,9 @@ 

calculatequote

"value_date": "string", "Message": "string", "Status": true -}

HTTP Request

-

POST /Quote/CalculateQuote

+}

HTTP Request

+

POST api/Quote

+

POST api/Quote?quote_id={quote_id}

Parameters

@@ -431,7 +613,8 @@

calculatequote

Statement

-

GET

+

Retrieve a Statement

+

Retrieve Statement per currency - optionally specify from/ to dates (inclusive)

Example JSON response:

@@ -445,8 +628,9 @@

GET

"Bank_Account": "string", "Balance": 0 } -]

HTTP Request

-

GET /Statement/GetValues

+]

HTTP Request

+

GET api/Statement

+

GET api/Statement?ccy={ccy}&fromDate={fromDate}&toDate={toDate}

Parameters

@@ -493,8 +677,9 @@

GET

OK
-

Template

-

GET

+

Beneficiary Templates

+

List Templates

+

Get a list of Beneficiary Templates

Example JSON response:

@@ -540,8 +725,8 @@

GET

"pin_partner": 0, "pin_check_count": 0 } -]

HTTP Request

-

GET /Template/GetValues

+]

HTTP Request

+

GET /Template/

Responses

@@ -556,10 +741,10 @@

GET

Token

-

POST

-

HTTP Request

-

POST /Token/PostValues

-

Parameters

+

Build your Auth Token

+

HTTP Request

+

POST /Token

+

Body Parameters

@@ -571,11 +756,18 @@

HTTP Request

- + - + - + + + + + + + +
ucLogin bodyLogin Yesstring
PasswordbodyPasswordYesstring

Responses

@@ -591,8 +783,9 @@

HTTP Request

OK -

Trade

-

GET

+

Trade History

+

Retrieve a Trade list between two dates

+

From yyyyMMdd to yyyyMMdd inclusive

Example JSON response:

@@ -612,8 +805,9 @@

GET

"Status": "string", "Beneficiary": "string" } -]

HTTP Request

-

GET /Trade/GetValues

+]

HTTP Request

+

GET /Trade

+

GET /Trade?fromDate={fromDate}&toDate={toDate}

Parameters

@@ -653,6 +847,47 @@

GET

OK
+

Retrieve payment instruction by GUID

+
+

Example JSON response:

+
+
[
+  {
+    "ID": 0,
+    "Trade_Date": "string",
+    "Value_Date": "string",
+    "CCY_Bought": "string",
+    "CCY_Sold": "string",
+    "Rate": 0,
+    "Bought_Amount": 0,
+    "Sold_Amount": 0,
+    "Payment_Fee": 0,
+    "Trade_ID": "string",
+    "Trade_Type": "string",
+    "Status": "string",
+    "Beneficiary": "string"
+  }
+]

HTTP Request

+

GET /Trade/{id}

+

Parameters

+ + + + + + + + + + + + + + + + + +
NameLocated inDescriptionRequiredType
idquerypayment GUIDyesstring

Webhooks

Filters

@@ -663,7 +898,7 @@

Filters

"Name": "string", "Description": "string" } -]

HTTP Request

+]

HTTP Request

GET /webhooks/filters

Responses

@@ -695,7 +930,7 @@

Registrations

"Headers": {}, "Properties": {} } -]

HTTP Request

+]

HTTP Request

GET /webhooks/registrations

Responses

@@ -710,7 +945,7 @@

Registrations

OK
-

HTTP Request

+

HTTP Request

POST /webhooks/registrations

Parameters

@@ -744,7 +979,7 @@

HTTP Request

OK
-

HTTP Request

+

HTTP Request

DELETE /webhooks/registrations

Responses

@@ -760,8 +995,8 @@

HTTP Request

Registrations/{id}

-

GET

-

HTTP Request

+

GET

+

HTTP Request

GET /webhooks/registrations/{id}

Parameters

@@ -796,7 +1031,7 @@

HTTP Request

PUT

-

HTTP Request

+

HTTP Request

PUT /webhooks/registrations/{id}

Parameters

@@ -838,7 +1073,7 @@

HTTP Request

DELETE

-

HTTP Request

+

HTTP Request

DELETE /webhooks/registrations/{id}

Parameters

@@ -875,11 +1110,13 @@

HTTP Request

Errors

-
From 965d03ef1a37507c45d071391f4462061d87a59f Mon Sep 17 00:00:00 2001 From: Chris Knight Date: Thu, 5 Dec 2019 17:24:47 +0000 Subject: [PATCH 05/50] remove webhooks from docs --- docs/index.html | 219 --------------------------------------- source/includes/FXOps.md | 130 ----------------------- 2 files changed, 349 deletions(-) diff --git a/docs/index.html b/docs/index.html index c0040a58..90128970 100644 --- a/docs/index.html +++ b/docs/index.html @@ -887,225 +887,6 @@

Retrieve payment instruction by GU

-
yes string
-

Webhooks

-

Filters

-
-

Example JSON response:

-
-
[
-  {
-    "Name": "string",
-    "Description": "string"
-  }
-]

HTTP Request

-

GET /webhooks/filters

-

Responses

- - - - - - - - - - - -
CodeDescription
200OK
-

Registrations

-
-

Example JSON response:

-
-
[
-  {
-    "Id": "string",
-    "WebHookUri": "string",
-    "Secret": "string",
-    "Description": "string",
-    "IsPaused": true,
-    "Filters": [
-      "string"
-    ],
-    "Headers": {},
-    "Properties": {}
-  }
-]

HTTP Request

-

GET /webhooks/registrations

-

Responses

- - - - - - - - - - - -
CodeDescription
200OK
-

HTTP Request

-

POST /webhooks/registrations

-

Parameters

- - - - - - - - - - - - - - - - - -
NameLocated inDescriptionRequiredType
webHookbodyYes
-

Responses

- - - - - - - - - - - -
CodeDescription
200OK
-

HTTP Request

-

DELETE /webhooks/registrations

-

Responses

- - - - - - - - - - - -
CodeDescription
200OK
-

Registrations/{id}

-

GET

-

HTTP Request

-

GET /webhooks/registrations/{id}

-

Parameters

- - - - - - - - - - - - - - - - - -
NameLocated inDescriptionRequiredType
idpathYesstring
-

Responses

- - - - - - - - - - - -
CodeDescription
200OK
-

PUT

-

HTTP Request

-

PUT /webhooks/registrations/{id}

-

Parameters

- - - - - - - - - - - - - - - - - - - - - - - - -
NameLocated inDescriptionRequiredType
idpathYesstring
webHookbodyYes
-

Responses

- - - - - - - - - - - -
CodeDescription
200OK
-

DELETE

-

HTTP Request

-

DELETE /webhooks/registrations/{id}

-

Parameters

- - - - - - - - - - - - - - - - - -
NameLocated inDescriptionRequiredType
idpathYesstring
-

Responses

- - - - - - - - - - -
CodeDescription
200OK
diff --git a/source/includes/FXOps.md b/source/includes/FXOps.md index aa207cf2..2c63603a 100644 --- a/source/includes/FXOps.md +++ b/source/includes/FXOps.md @@ -456,133 +456,3 @@ From yyyyMMdd to yyyyMMdd inclusive | ---- | ---------- | ----------- | -------- | ---- | | id | query | payment GUID | yes | string | -# Webhooks -## Filters -> Example JSON response: - -```json -[ - { - "Name": "string", - "Description": "string" - } -] -``` - -### HTTP Request -`GET /webhooks/filters` - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - -## Registrations -> Example JSON response: - -```json -[ - { - "Id": "string", - "WebHookUri": "string", - "Secret": "string", - "Description": "string", - "IsPaused": true, - "Filters": [ - "string" - ], - "Headers": {}, - "Properties": {} - } -] -``` - -### HTTP Request -`GET /webhooks/registrations` - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - - -### HTTP Request -`POST /webhooks/registrations` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| webHook | body | | Yes | | - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - - -### HTTP Request -`DELETE /webhooks/registrations` - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - -## Registrations/{id} -### GET - -### HTTP Request -`GET /webhooks/registrations/{id}` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| id | path | | Yes | string | - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - -### PUT - -### HTTP Request -`PUT /webhooks/registrations/{id}` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| id | path | | Yes | string | -| webHook | body | | Yes | | - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - -### DELETE - -### HTTP Request -`DELETE /webhooks/registrations/{id}` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| id | path | | Yes | string | - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - From 80295873b85010c88fca0b1d5e5dc373961b5370 Mon Sep 17 00:00:00 2001 From: Rory Powis Date: Thu, 16 Jan 2020 15:25:33 +0100 Subject: [PATCH 06/50] Update all docs to latest generated --- package.json | 129 ++-- source/includes/FXOps.md | 884 ++++++++++++++++-------- source/includes/_errors.md | 28 +- source/includes/main.md | 95 ++- source/index.yml | 13 +- source/stylesheets/screen.css.scss | 1003 +++++++++++++++------------- 6 files changed, 1264 insertions(+), 888 deletions(-) diff --git a/package.json b/package.json index bed9b830..399f30ed 100644 --- a/package.json +++ b/package.json @@ -1,68 +1,65 @@ { - "name": "node-slate", - "version": "1.9.2", - "description": "Node port of lord/slate", - "license": "Apache-2.0", - "main": "build/index.html", - "repository": "github:center-key/node-slate", - "homepage": "https://github.com/center-key/node-slate", - "bugs": "https://github.com/center-key/node-slate/issues", - "docs": "https://github.com/center-key/node-slate#readme", - "author": "Various", - "keywords": [ - "slate", - "nodejs", - "api", - "api-documentation", - "static-site-generator" - ], - "jshintConfig": { - "esversion": 9, - "strict": "implied", - "eqeqeq": true, - "node": true, - "undef": true, - "unused": true - }, - "scripts": { - "test": "jshint gulpfile.js", - "prestart": "gulp build-uncompressed", - "start": "gulp serve", - "prebuild": "gulp clean", - "build": "gulp build-static-site", - "postbuild": "gulp lint && gulp publish", - "deploy": "deploy.sh" - }, - "dependencies": { - "del": "~5.1", - "gulp": "~4.0", - "gulp-clean-css": "~4.2", - "gulp-cli": "~2.2", - "gulp-concat": "~2.6", - "gulp-ejs": "~4.1", - "gulp-htmlhint": "~2.2", - "gulp-if": "~3.0", - "gulp-jshint": "~2.1", - "gulp-live-server": "~0.0", - "gulp-open": "~3.0", - "gulp-prettify": "~0.5", - "gulp-rename": "~1.4", - "gulp-sass": "~4.0", - "gulp-uglify": "~3.0", - "gulp-w3c-html-validator": "~1.4", - "highlight.js": "~9.15", - "imagesloaded": "~4.1", - "jquery": "~3.4", - "jquery-highlight": "~3.5", - "jquery-ui": "~1.12", - "jquery-ui-dist": "~1.12", - "jquery.tocify": "~1.9", - "js-yaml": "~3.13", - "jshint": "~2.10", - "lunr": "~2.3", - "marked": "~0.7", - "merge-stream": "~2.0", - "node-sass": "~4.12", - "tocbot": "~4.8" - } + "name": "api-documentation", + "version": "1.0.0", + "description": "Documentation for Clear Treasury's FXOps API", + "license": "Apache-2.0", + "main": "build/index.html", + "repository": "github:clear-treasury/api-documentation", + "homepage": "https://github.com/clear-treasury/api-documentation", + "bugs": "https://github.com/clear-treasury/api-documentation/issues", + "docs": "https://github.com/clear-treasury/api-documentation#readme", + "author": "Clear Treasury UK", + "keywords": [ + "api", + "api-documentation" + ], + "jshintConfig": { + "esversion": 9, + "strict": "implied", + "eqeqeq": true, + "node": true, + "undef": true, + "unused": true + }, + "scripts": { + "test": "jshint gulpfile.js", + "prestart": "gulp build-uncompressed", + "start": "gulp serve", + "prebuild": "gulp clean", + "build": "gulp build-static-site", + "postbuild": "gulp lint && gulp publish", + "deploy": "deploy.sh" + }, + "dependencies": { + "del": "~5.1", + "gulp": "~4.0", + "gulp-clean-css": "~4.2", + "gulp-cli": "~2.2", + "gulp-concat": "~2.6", + "gulp-ejs": "~4.1", + "gulp-htmlhint": "~2.2", + "gulp-if": "~3.0", + "gulp-jshint": "~2.1", + "gulp-live-server": "~0.0", + "gulp-open": "~3.0", + "gulp-prettify": "~0.5", + "gulp-rename": "~1.4", + "gulp-sass": "~4.0", + "gulp-uglify": "~3.0", + "gulp-w3c-html-validator": "~1.4", + "highlight.js": "~9.15", + "imagesloaded": "~4.1", + "jquery": "~3.4", + "jquery-highlight": "~3.5", + "jquery-ui": "~1.12", + "jquery-ui-dist": "~1.12", + "jquery.tocify": "~1.9", + "js-yaml": "~3.13", + "jshint": "~2.10", + "lunr": "~2.3", + "marked": "~0.7", + "merge-stream": "~2.0", + "node-sass": "~4.12", + "tocbot": "~4.8" + } } diff --git a/source/includes/FXOps.md b/source/includes/FXOps.md index 2c63603a..d4520031 100644 --- a/source/includes/FXOps.md +++ b/source/includes/FXOps.md @@ -1,5 +1,297 @@ +# Quote + +There are four steps to executing a trade: + +**Step 1: Create a quote** + +Step 2: Create a beneficiary + +Step 3: Book a trade + +Step 4: Instruct a payment + +### Description + +A quote can be used to create a trade. You need `quoteID` as an input to create a trade. + +## Place a Quote + +Before you can book a trade you need to have been issued a quote and have created a beneficiary. + +> Example request: + +```bash +curl -X POST http://api-test.cleartreasury.co.uk/api/quote \ + -H 'Authorization: Bearer ' + -H 'Content-Type: application/json' \ + -d '{ + "ccy_sell": "GBP", + "ccy_buy": "EUR", + "value_date": "20193112", + "sell_amount": 600.00 + }' +``` + +> Example response: + +```json +{ + "ID": "sample string 1", + "sell_amount": 2.1, + "buy_amount": 3.1, + "client_rate": 4.1, + "bank_rate": 5.1, + "ccy_sell": "sample string 6", + "fee": 7.1, + "fee_ccy": 8.1, + "ccy_buy": "sample string 9", + "value_date": "sample string 10", + "Message": "sample string 11", + "Status": true +} +``` + +### Request + +`POST /quote` + +| Name | Description | Required | Type | +| ----------- | --------------------------------------------------------------------------- | -------- | ------- | +| ccy_sell | The currency the end customer is wanting to sell.
ISO 3 letters currency | No | string | +| ccy_buy | The currency the end customer is wanting to sell.
ISO 3 letters currency | No | string | +| value_date | Date. In yyyyMMdd format | No | string | +| sell_amount | Selling Amount | No | decimal | +| buy_amount | Buying Amount | No | decimal | +| quoteID | | No | integer | + +### Response + +Quote id is needed for booking a trade in step 3. + +| Name | Description | Type | +| ----------- | ------------------------------------------------------------ | ------- | +| ID | Quote ID | string | +| sell_amount | Sell Amount | decimal | +| buy_amount | Sell Amount | decimal | +| client_rate | Client Rate | decimal | +| bank_rate | Bank Rate | decimal | +| ccy_sell | Sell Currency | string | +| fee | Charge amount | decimal | +| fee_ccy | Charge Currency | decimal | +| ccy_buy | Buy Currency | string | +| value_date | yyyyMMdd Date | string | +| Message | Free Message | string | +| Status | Returns true if quote is value or false if there is an error | boolean | + +## Get a refreshed price for a quote + + + +You can request a new price for a previously requested quote. + +> Example request: + +```bash +curl -X GET http://api-test.cleartreasury.co.uk/api/quote?quote_id={quote_id} \ + -H 'Authorization: Bearer ' +``` + +> Example response: + +```json +{ + "ID": "string", + "sell_amount": 0, + "buy_amount": 0, + "client_rate": 0, + "bank_rate": 0, + "ccy_sell": "string", + "fee": 0, + "fee_ccy": 0, + "ccy_buy": "string", + "value_date": "string", + "Message": "string", + "Status": true +} +``` + +### Request + +`GET /quote?quote_id={quote_id}` + +| Name | Description | Required | Type | +| -------- | ------------------- | -------- | ------- | +| quote_id | Quote Id to refresh | Yes | integer | + +### Response + + + +| Code | Description | +| ---- | ----------- | +| 200 | OK | + +# Beneficiary Templates + +There are four steps to executing a trade: + +Step 1: Create a quote + +**Step 2: Create a beneficiary** + +Step 3: Book a trade + +Step 4: Instruct a payment + +### Description + +Beneficiary is a person or institution who is the ultimate recipient of your payment. + +In order to book a trade you must have created a beneficiary. + +## List Templates + +Get a list of Beneficiary Templates + +> Example request: + +```bash +curl -X GET http://api-test.cleartreasury.co.uk/api/template \ + -H 'Authorization: Bearer ' +``` + +> Example response: + +```json +[ + { + "pin_id": 0, + "pin_link_id": 0, + "pin_link_type": 0, + "pin_ccy": "string", + "pin_bank_name": "string", + "pin_address": "string", + "pin_account_name": "string", + "pin_account_number": "string", + "pin_sort_code": "string", + "pin_iban": "string", + "pin_swift_bic": "string", + "pin_fedwire_bank_code": "string", + "pin_details": "string", + "pin_notes": "string", + "pin_country_code": "string", + "pin_intermediary": "string", + "pin_email": "string", + "pin_alert_date": "string", + "pin_archived": true, + "pin_ben_name": "string", + "pin_ben_contact_name": "string", + "pin_ben_address": "string", + "pin_ben_activity": "string", + "pin_ben_post_code": "string", + "pin_ben_Town": "string", + "pin_bank_post_code": "string", + "pin_bank_Town": "string", + "pin_bank_code": "string", + "pin_bank_branch": "string", + "pin_CPF": "string", + "pin_account_type": "string", + "pin_cnaps": "string", + "pin_purpose": "string", + "pin_validate_date": "string", + "pin_last_external_check_date": "string", + "pin_low_risk": 0, + "pin_recurrent": 0, + "pin_partner": 0, + "pin_check_count": 0 + } +] +``` + +### Request + +`GET /template` + +### Response + +Beneficiary id is needed for booking a trade in step 3. + +| Name | Description | Type | +| ---------------------------- | ----------- | ------- | +| pin_id | | integer | +| pin_link_id | | integer | +| pin_link_type | | integer | +| pin_ccy | | string | +| pin_bank_name | | string | +| pin_address | | string | +| pin_account_name | | string | +| pin_account_number | | string | +| pin_sort_code | | string | +| pin_iban | | string | +| pin_swift_bic | | string | +| pin_fedwire_bank_code | | string | +| pin_details | | string | +| pin_notes | | string | +| pin_country_code | | string | +| pin_intermediary | | string | +| pin_email | | string | +| pin_alert_date | | string | +| pin_archived | | boolean | +| pin_ben_name | | string | +| pin_ben_contact_name | | string | +| pin_ben_address | | string | +| pin_ben_activity | | string | +| pin_ben_post_code | | string | +| pin_ben_Town | | string | +| pin_bank_post_code | | string | +| pin_bank_Town | | string | +| pin_bank_code | | string | +| pin_bank_branch | | string | +| pin_CPF | | string | +| pin_account_type | | string | +| pin_cnaps | | string | +| pin_purpose | | string | +| pin_validate_date | | string | +| pin_last_external_check_date | | string | +| pin_low_risk | | integer | +| pin_recurrent | | integer | +| pin_partner | | integer | +| pin_check_count | | integer | + # Book a Trade -> Example JSON response: + +There are four steps to executing a trade: + +Step 1: Create a quote + +Step 2: Create a beneficiary + +**Step 3: Book a trade** + +Step 4: Instruct a payment + +### Description + +Trade is a payment order to a beneficiary account based on a quote. + +## Book Quote + +Book a trade by verifying acceptance of a quote. + +> Example request: + +```bash +curl -X POST http://api-test.cleartreasury.co.uk/api/bookquote \ + -H 'Authorization: Bearer ' + -H 'Content-Type: application/json' \ + -d '{ + "quote_id": 6, + "sourceOfFunds": "", + "ReasonForTrading": "" + }' +``` + +> Example response: ```json { @@ -22,35 +314,69 @@ "Message": "string" } ``` -### Description -Book a trade by verifying acceptance of a quote. -### HTTP Request -`POST /BookQuote` +### Request -`POST /BookQuote?quote_id={quote_id}&sourceOfFunds={sourceOfFunds}&ReasonForTrading={ReasonForTrading}` +`POST /bookquote` -**Parameters** +| Name | Description | Required | Type | +| ---------------- | -------------------- | -------- | ------- | +| quote_id | Quote Id to Validate | Yes | integer | +| sourceOfFunds | | Yes | string | +| ReasonForTrading | | Yes | string | -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| quote_id | query | Quote Id to Validate | Yes | integer | -| sourceOfFunds | query | | Yes | string | -| ReasonForTrading | query | | Yes | string | +### Response -**Responses** +| Name | Description | Type | +| -------------- | ---------------- | ------- | +| ID | Trade ID | integer | +| Trade_Date | Trade Date | string | +| Value_Date | Value Date | string | +| CCY_Bought | CCY Bought | string | +| CCY_Sold | CCY Sold | string | +| Rate | Rate | decimal | +| Bought_Amount | Bought_Amount | decimal | +| Sold_Amount | Sold_Amount | decimal | +| Payment_Fee | Payment_Fee | decimal | +| Trade_ID | Trade ID | string | +| Trade_Type | Trade Type | string | +| OurAccountName | Our Account Name | string | +| OurBankName | Our Bank Name | string | +| OurIBAN | Our Iban | string | +| OurSortCode | Our Sort Code | string | +| OurSWIFTCode | Our SWIFT Code | string | +| Message | Message | string | -| Code | Description | -| ---- | ----------- | -| 200 | OK | +# Payment Instruction + +There are four steps to executing a trade: + +Step 1: Create a quote + +Step 2: Create a beneficiary + +Step 3: Book a trade + +**Step 4: Instruct a payment** -# Payment instruction +### Description + +This API call is the final step for executing trades. + + ## Retrieve list by date -Retrieve payment instruction list yyyyMMdd inclusive from dateyyyyMMdd inclusive to date +Retrieve payment instruction list inclusive of from and to dates. + +> Example request: + +```bash +curl -X GET http://api-test.cleartreasury.co.uk/api/paymentinstruction?fromDate={fromDate}&toDate={toDate} \ + -H 'Authorization: Bearer ' +``` -> Example JSON response: +> Example response: ```json [ @@ -75,7 +401,7 @@ Retrieve payment instruction list yyyyMMdd inclusive from dateyyyyMMdd inclusive "TradeReference": "string", "tra_client_id": 0, "pin_id": 0, - "PaymentGUID": "string", + "PaymentGUID": "00000000-0000-0000-0000-000000000000", "opi_id": 0, "CreationDate": "2019-10-17T11:27:23.691Z", "Status": "string", @@ -84,39 +410,158 @@ Retrieve payment instruction list yyyyMMdd inclusive from dateyyyyMMdd inclusive ] ``` -### HTTP Request -`GET PaymentInstruction` - -`GET PaymentInstruction?fromDate={fromDate}&toDate={toDate}` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| fromDate | query | | No | string | -| toDate | query | | No | string | - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - -## Retrieve by GUID -Retrieve payment instruction by GUID +### Request + +`GET /paymentinstruction?fromDate={fromDate}&toDate={toDate}` + +| Name | Description | Required | Type | +| -------- | ----------------------------------------- | -------- | ------ | +| fromDate | Inclusive from date. In `yyyyMMdd` format | Yes | string | +| toDate | Inclusive to date. In `yyyyMMdd` format | Yes | string | + +### Response + +| Name | Description | Type | +| ---------------- | ----------- | ------- | +| Intermediary | | string | +| AccountName | | string | +| AccountNumber | | string | +| Address | | string | +| BankName | | string | +| CCY | | string | +| Notes | | string | +| SortCode | | string | +| Swift | | string | +| CountryCode | | string | +| Email | | string | +| BenAddress | | string | +| CNAPS | | string | +| Purpose | | string | +| ChargeCode | | string | +| Amount | | decimal | +| PaymentReference | | string | +| TradeReference | | string | +| tra_client_id | | integer | +| pin_id | | integer | +| PaymentGUID | | string | +| opi_id | | integer | +| CreationDate | | date | +| Status | | string | +| exportedDate | | date | + +## Get by ID + +Get payment instruction by ID + +> Example request: + +```bash +curl -X POST http://api-test.cleartreasury.co.uk/api/paymentinstruction/{id} \ + -H 'Authorization: Bearer ' +``` -### HTTP Request -`GET api/PaymentInstruction/{id}` +> Example response: -**Parameters** +```json +{ + "Intermediary": "string", + "AccountName": "string", + "AccountNumber": "string", + "Address": "string", + "BankName": "string", + "CCY": "string", + "Notes": "string", + "SortCode": "string", + "Swift": "string", + "CountryCode": "string", + "Email": "string", + "BenAddress": "string", + "CNAPS": "string", + "Purpose": "string", + "ChargeCode": "string", + "Amount": 0, + "PaymentReference": "string", + "TradeReference": "string", + "tra_client_id": 0, + "pin_id": 0, + "PaymentGUID": "00000000-0000-0000-0000-000000000000", + "opi_id": 0, + "CreationDate": "2019-10-17T11:27:23.691Z", + "Status": "string", + "exportedDate": "2019-10-17T11:27:23.691Z" +} +``` -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| id | query | payment GUID | yes | string | +### Request + +`GET /paymentinstruction/{id}` + +| Name | Located in | Description | Required | Type | +| ---- | ---------- | ------------ | -------- | ------ | +| id | query | payment GUID | yes | string | + +### Response + +| Name | Description | Type | +| ---------------- | ----------- | ------- | +| Intermediary | | string | +| AccountName | | string | +| AccountNumber | | string | +| Address | | string | +| BankName | | string | +| CCY | | string | +| Notes | | string | +| SortCode | | string | +| Swift | | string | +| CountryCode | | string | +| Email | | string | +| BenAddress | | string | +| CNAPS | | string | +| Purpose | | string | +| ChargeCode | | string | +| Amount | | decimal | +| PaymentReference | | string | +| TradeReference | | string | +| tra_client_id | | integer | +| pin_id | | integer | +| PaymentGUID | | string | +| opi_id | | integer | +| CreationDate | | date | +| Status | | string | +| exportedDate | | date | ## Instruct a new Payment -> Example JSON value: +> Example request: + +```bash +curl -X POST http://api-test.cleartreasury.co.uk/api/paymentinstruction \ + -H 'Authorization: Bearer ' + -H 'Content-Type: application/json' \ + -d '{ + "Intermediary": "sample string 1", + "AccountName": "sample string 2", + "AccountNumber": "sample string 3", + "Address": "sample string 4", + "BankName": "sample string 5", + "CCY": "sample string 6", + "Notes": "sample string 7", + "SortCode": "sample string 8", + "Swift": "sample string 9", + "CountryCode": "sample string 10", + "Email": "sample string 11", + "BenAddress": "sample string 12", + "CNAPS": "sample string 13", + "Purpose": "sample string 14", + "FEE": "sample string 15", + "Amount": "sample string 16", + "PaymentReference": "sample string 17", + "TradeReference": "sample string 18", + "PaymentGuid": "00000000-0000-0000-0000-000000000000" + }' +``` + +> Example response: ```json [ @@ -144,126 +589,54 @@ Retrieve payment instruction by GUID ] ``` -### HTTP Request -`POST /PaymentInstruction/` - -**Parameters** - -| Name | Description | Required | Type | Additional information | -| ---- | ----------- | -------- | ---- | ----------- | -| Intermediary | Intermediary SWIFT of the Bank | | string | Max length: 50 | -| AccountName | Beneficiary Name | yes | string | -| AccountNumber | Account number or IBAN | yes | string | -| Address | Bank Address | | string | -| BankName | Instructed bank name | | string | -| CCY | 3 letters currency code | yes | string | String length: inclusive between 3 and 3| -| Notes | Payment notes | | string | -| SortCode | For UK payments | | string | String length: inclusive between 6 and 6 | -| Swift | SWIFT or BIC code | | string | -| CountryCode | 2 letters ISO country code | yes | string | -| Email | Beneficiary Email | | string | -| BenAddress | Address of Beneficiary | | string | -| CNAPS | For payment to China only | | string | -| Purpose | Purpose of payment | | string | -| FEE | Charge direction OUR/SHA/BEN (default to SHA) | | string | -| Amount | Amount instructed | yes | string | -| PaymentReference | Your Reference on payment | | string | -| TradeReference | The trade Reference of the trade used to instruct this payment, set to blank if this Payment is not linked to FX trade, or set to "auto" to attempt to retrieve available trade. | | string | -| PaymentGuid | A GUID defined by yourself that can be used to retrieve payment | | globally unique identifier | - -**Responses** +### Request + +`POST /paymentinstruction` + +| Name | Description | Required | Type | Additional information | +| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------ | ---------------------------------------- | +| Intermediary | Intermediary SWIFT of the Bank | | string | Max length: 50 | +| AccountName | Beneficiary Name | yes | string | +| AccountNumber | Account number or IBAN | yes | string | +| Address | Bank Address | | string | +| BankName | Instructed bank name | | string | +| CCY | 3 letters currency code | yes | string | String length: inclusive between 3 and 3 | +| Notes | Payment notes | | string | +| SortCode | For UK payments | | string | String length: inclusive between 6 and 6 | +| Swift | SWIFT or BIC code | | string | +| CountryCode | 2 letters ISO country code | yes | string | +| Email | Beneficiary Email | | string | +| BenAddress | Address of Beneficiary | | string | +| CNAPS | For payment to China only | | string | +| Purpose | Purpose of payment | | string | +| FEE | Charge direction OUR/SHA/BEN (default to SHA) | | string | +| Amount | Amount instructed | yes | string | +| PaymentReference | Your Reference on payment | | string | +| TradeReference | The reference of the trade used to instruct this payment, set to blank if this Payment is not linked to FX trade, or set to "auto" to attempt to retrieve available trade. | | string | +| PaymentGuid | A GUID defined by yourself that can be used to retrieve payment | | string | + +### Response + + | Code | Description | | ---- | ----------- | -| 200 | OK | - -# Quote -## Place a Quote - -### HTTP Request -`POST /Quote` - -`POST api/Quote?ccy_sell={ccy_sell}&ccy_buy={ccy_buy}&value_date={value_date}&sell_amount={sell_amount}&buy_amount={buy_amount}"eID={quoteID}` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| ccy_sell | query | ISO 3 letters currency | No | string | -| ccy_buy | query | ISO 3 letters currency | No | string | -| value_date | query | yyyyMMdd date | No | string | -| sell_amount | query | Selling Amount | No | double | -| buy_amount | query | Buying Amount | No | double | -| quoteID | query | | No | integer | - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - -## Get a refreshed price for a quote - -### HTTP Request -`GET /Quote` - -`GET api/Quote?quote_id={quote_id}` - -**Parameters** +| 200 | OK | -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| quote_id | query | Quote Id to Refresh | Yes | integer | +# Statement -**Responses** +## Retrieve a Statement -| Code | Description | -| ---- | ----------- | -| 200 | OK | +Retrieve a statement for a given currency, optionally filtered by inclusive from and to dates. -## Calculate a quote -> Example JSON value: +> Example request: -```json -{ - "ID": "string", - "sell_amount": 0, - "buy_amount": 0, - "client_rate": 0, - "bank_rate": 0, - "ccy_sell": "string", - "fee": 0, - "fee_ccy": 0, - "ccy_buy": "string", - "value_date": "string", - "Message": "string", - "Status": true -} +```bash +curl -X GET http://api-test.cleartreasury.co.uk/api/statement?ccy={ccy}&fromDate={fromDate}&toDate={toDate} \ + -H 'Authorization: Bearer ' ``` -### HTTP Request -`POST api/Quote` - -`POST api/Quote?quote_id={quote_id}` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| quote_id | query | | Yes | integer | - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - -# Statement - -## Retrieve a Statement -Retrieve Statement per currency - optionally specify from/ to dates (inclusive) - -> Example JSON response: +> Example response: ```json [ @@ -279,112 +652,42 @@ Retrieve Statement per currency - optionally specify from/ to dates (inclusive) ] ``` -### HTTP Request -`GET api/Statement` +### Request -`GET api/Statement?ccy={ccy}&fromDate={fromDate}&toDate={toDate}` +`GET /statement?ccy={ccy}&fromDate={fromDate}&toDate={toDate}` -**Parameters** +| Name | Description | Required | Type | +| -------- | ----------------------------------------- | -------- | ------ | +| ccy | | Yes | string | +| fromDate | Inclusive from date. In `yyyyMMdd` format | No | string | +| toDate | Inclusive to date. In `yyyyMMdd` format | No | string | -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| ccy | query | | Yes | string | -| fromDate | query | | No | string | -| toDate | query | | No | string | +### Response -**Responses** +| Name | Description | Type | +| ------------ | ----------- | ------- | +| Date | | date | +| Reference | | string | +| Detail | | string | +| Receipts | | decimal | +| Payments | | decimal | +| Bank_Account | | string | +| Balance | | decimal | -| Code | Description | -| ---- | ----------- | -| 200 | OK | +# Trade History -# Beneficiary Templates +## Retrieve a Trade list between two dates -## List Templates -Get a list of Beneficiary Templates +Retreive a list of trades between inclusive from and to dates. -> Example JSON response: +> Example request: -```json -[ - { - "pin_id": 0, - "pin_link_id": 0, - "pin_link_type": 0, - "pin_ccy": "string", - "pin_bank_name": "string", - "pin_address": "string", - "pin_account_name": "string", - "pin_account_number": "string", - "pin_sort_code": "string", - "pin_iban": "string", - "pin_swift_bic": "string", - "pin_fedwire_bank_code": "string", - "pin_details": "string", - "pin_notes": "string", - "pin_country_code": "string", - "pin_intermediary": "string", - "pin_email": "string", - "pin_alert_date": "string", - "pin_archived": true, - "pin_ben_name": "string", - "pin_ben_contact_name": "string", - "pin_ben_address": "string", - "pin_ben_activity": "string", - "pin_ben_post_code": "string", - "pin_ben_Town": "string", - "pin_bank_post_code": "string", - "pin_bank_Town": "string", - "pin_bank_code": "string", - "pin_bank_branch": "string", - "pin_CPF": "string", - "pin_account_type": "string", - "pin_cnaps": "string", - "pin_purpose": "string", - "pin_validate_date": "string", - "pin_last_external_check_date": "string", - "pin_low_risk": 0, - "pin_recurrent": 0, - "pin_partner": 0, - "pin_check_count": 0 - } -] +```bash +curl -X POST http://api-test.cleartreasury.co.uk/api/trade?fromDate={fromDate}&toDate={toDate} \ + -H 'Authorization: Bearer ' ``` -### HTTP Request -`GET /Template/` - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - -# Token -## Build your Auth Token - -### HTTP Request -`POST /Token` - -**Body Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| Login | body | Login | Yes | string | -| Password| body | Password| Yes | string | - -**Responses** - -| Code | Description | -| ---- | ----------- | -| 200 | OK | - -# Trade History - -## Retrieve a Trade list between two dates -From yyyyMMdd to yyyyMMdd inclusive - -> Example JSON response: +> Example response: ```json [ @@ -406,27 +709,43 @@ From yyyyMMdd to yyyyMMdd inclusive ] ``` -### HTTP Request -`GET /Trade` +### Request -`GET /Trade?fromDate={fromDate}&toDate={toDate}` +`GET /trade?fromDate={fromDate}&toDate={toDate}` -**Parameters** +| Name | Located in | Description | Required | Type | +| -------- | ---------- | ----------- | -------- | ------ | +| fromDate | query | | No | string | +| toDate | query | | No | string | -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| fromDate | query | | No | string | -| toDate | query | | No | string | +### Response -**Responses** +| Name | Description | Type | +| ------------- | ------------- | ------- | +| ID | Trade ID | integer | +| Trade_Date | Trade Date | string | +| Value_Date | Value Date | string | +| CCY_Bought | CCY Bought | string | +| CCY_Sold | CCY Sold | string | +| Rate | Rate | decimal | +| Bought_Amount | Bought_Amount | decimal | +| Sold_Amount | Sold_Amount | decimal | +| Payment_Fee | Payment_Fee | decimal | +| Trade_ID | Trade ID | string | +| Trade_Type | Trade Type | string | +| Status | Status | string | +| Beneficiary | Beneficiary | string | -| Code | Description | -| ---- | ----------- | -| 200 | OK | +## Retrieve payment instruction by ID -## Retrieve payment instruction by GUID +> Example request: -> Example JSON response: +```bash +curl -X GET http://api-test.cleartreasury.co.uk/api/trade/{id} \ + -H 'Authorization: Bearer ' +``` + +> Example response: ```json [ @@ -447,12 +766,29 @@ From yyyyMMdd to yyyyMMdd inclusive } ] ``` -### HTTP Request -`GET /Trade/{id}` - -**Parameters** - -| Name | Located in | Description | Required | Type | -| ---- | ---------- | ----------- | -------- | ---- | -| id | query | payment GUID | yes | string | +### Request + +`GET /trade/{id}` + +| Name | Description | Required | Type | +| ---- | ------------ | -------- | ------ | +| id | Payment GUID | Yes | string | + +### Response + +| Name | Description | Type | +| ------------- | ------------- | ------- | +| ID | Trade ID | integer | +| Trade_Date | Trade Date | string | +| Value_Date | Value Date | string | +| CCY_Bought | CCY Bought | string | +| CCY_Sold | CCY Sold | string | +| Rate | Rate | decimal | +| Bought_Amount | Bought_Amount | decimal | +| Sold_Amount | Sold_Amount | decimal | +| Payment_Fee | Payment_Fee | decimal | +| Trade_ID | Trade ID | string | +| Trade_Type | Trade Type | string | +| Status | Status | string | +| Beneficiary | Beneficiary | string | diff --git a/source/includes/_errors.md b/source/includes/_errors.md index 654be8ad..c6951c33 100644 --- a/source/includes/_errors.md +++ b/source/includes/_errors.md @@ -1,22 +1,18 @@ # Errors - -Error Code | Meaning ----------- | ------- -400 | Bad Request -- The request could not be understood by the server due to malformed syntax. -401 | Unauthorized -- Your API key is wrong. -403 | Forbidden -- The value requested is hidden for administrators only. -404 | Not Found -- The specified value could not be found. -405 | Method Not Allowed -- You tried to access a value with an invalid method. -406 | Not Acceptable -- You requested a format that isn't JSON. -410 | Gone -- The value requested has been removed from our servers. -418 | I'm a teapot. -429 | Too Many Requests -- You're requesting too many values! Slow down! -500 | Internal Server Error -- We had a problem with our server. Try again later. -503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. +| Error Code | Meaning | +| ---------- | ----------------------------------------------------------------------------------------- | +| 400 | Bad Request -- The request could not be understood by the server due to malformed syntax. | +| 401 | Unauthorized -- Your API key is wrong. | +| 403 | Forbidden -- The value requested is hidden for administrators only. | +| 404 | Not Found -- The specified value could not be found. | +| 405 | Method Not Allowed -- You tried to access a value with an invalid method. | +| 406 | Not Acceptable -- You requested a format that isn't JSON. | +| 410 | Gone -- The value requested has been removed from our servers. | +| 429 | Too Many Requests -- You're requesting too many values! Slow down! | +| 500 | Internal Server Error -- We had a problem with our server. Try again later. | +| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. | diff --git a/source/includes/main.md b/source/includes/main.md index d368a9d8..4c6a864a 100644 --- a/source/includes/main.md +++ b/source/includes/main.md @@ -1,67 +1,60 @@ - # Introduction -> Base [ENV] url variables +> Base URL Sandbox + +```bash +http://api-test.cleartreasury.co.uk/api ``` -sandbox: api-test.cleartreasury.co.uk/api -live: api.cleartreasury.co.uk/api + +> Base URL Live + +```bash +http://api.cleartreasury.co.uk/api ``` -Welcome to the Clear Payments API - Powered by Clear Treasury. With international payments a daily necessity for many, we have developed our online payments platform that dramatically streamlines the process. +Welcome to the Clear Payments API - Powered by Clear Treasury. + +With international payments being a daily necessity for many, we have developed our online payments platform to dramatically streamline the process. -We have designed the Clear Payments API to integrate directly into your process, product or software. +Our aim is to make the Clear Payments API as simple as possible for you to integrate into your process, product or software. -# Authentication +# API access -> use this code: +Every call to the Clear Payments API requires an authorization token that needs to be set in the header of each subsequent call. + +## Token ```bash -# With shell, you can just pass the correct header with each request -curl -X POST \ - http://[ENV].cleartreasury.co.uk/api/token \ - -H 'Content-Type: application/x-www-form-urlencoded' \ - -d 'login=--YOUR LOGIN--&password=--YOUR PASSWORD--' +curl -X POST http://api-test.cleartreasury.co.uk/api/token \ + -H 'Content-Type: application/json' \ + -d '{ + "login": , + "password": + }' ``` -```javascript -var settings = { - "async": true, - "crossDomain": true, - "url": "http://[ENV].cleartreasury.co.uk/api/token", - "method": "POST", - "headers": { - "Content-Type": "application/x-www-form-urlencoded", - }, - "data": { - "login": "--YOUR LOGIN--", - "password": "--YOUR PASSWORD--" - } -} - -$.ajax(settings).done(function (response) { - console.log(response); -}); -``` -> Clear Payments expects the API Token to be included in all API requests to the server in a header that looks like the following: -``` -curl -X POST \ - '[ENV].cleartreasury.co.uk/--ENDPOINT--' \ - -H 'Authorization: Bearer --YOUR TOKEN--' \ - -``` +Use your provided login details to request an authorization token. The resulting token is then sent in a header in every subsequent request. + +The Token is valid for 6 months. + +### Request + +`POST /token` -Clear API uses a token that needs to be set in the header of each call. +**Parameters** -To generate your token you can use /api/Token endpoint +| Name | Description | Required | Type | +| -------- | ------------------- | -------- | ------ | +| login | Your given username | Yes | string | +| password | Your given password | Yes | string | + +## Authorization + +```bash +curl -X GET http://api-test.cleartreasury.co.uk/api/quote \ + -H "Authorization: Bearer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx" +``` - - - +Once you have your API token, add it as a header parameter to every request like this: -This Token is valid for 6 months. \ No newline at end of file +`Authorization: Bearer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx` diff --git a/source/index.yml b/source/index.yml index 1bbd2ef6..b329b17b 100644 --- a/source/index.yml +++ b/source/index.yml @@ -1,17 +1,12 @@ title: API Reference -language_tabs: - - javascript - - bash - - toc_footers: - - Sign up for a developer key + - Sign up for a developer key includes: - - main - - FXOps - - _errors + - main + - FXOps + - _errors search: true diff --git a/source/stylesheets/screen.css.scss b/source/stylesheets/screen.css.scss index 9f5595ca..075610f4 100644 --- a/source/stylesheets/screen.css.scss +++ b/source/stylesheets/screen.css.scss @@ -25,264 +25,283 @@ under the License. // GENERAL STUFF //////////////////////////////////////////////////////////////////////////////// -html, body { - color: $main-text; - padding: 0; - margin: 0; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - @extend %default-font; - background-color: $main-bg; - height: 100%; - -webkit-text-size-adjust: none; /* Never autoresize text */ - } +html, +body { + color: $main-text; + padding: 0; + margin: 0; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + @extend %default-font; + background-color: $main-bg; + height: 100%; + -webkit-text-size-adjust: none; /* Never autoresize text */ +} //////////////////////////////////////////////////////////////////////////////// // TABLE OF CONTENTS //////////////////////////////////////////////////////////////////////////////// #toc > ul > li > a > span { - float: right; - background-color: #2484FF; - border-radius: 40px; - width: 20px; - } + float: right; + background-color: #2484ff; + border-radius: 40px; + width: 20px; +} @mixin embossed-bg { - background: - linear-gradient(to bottom, rgba(black, 0.2), rgba(black, 0) 8px), - linear-gradient(to top, rgba(black, 0.2), rgba(black, 0) 8px), - linear-gradient(to bottom, rgba($nav-embossed-border-top, 1), rgba($nav-embossed-border-top, 0) 1.5px), - linear-gradient(to top, rgba($nav-embossed-border-bottom, 1), rgba($nav-embossed-border-bottom, 0) 1.5px), - $nav-subitem-bg; - } + background: linear-gradient(to bottom, rgba(black, 0.2), rgba(black, 0) 8px), + linear-gradient(to top, rgba(black, 0.2), rgba(black, 0) 8px), + linear-gradient( + to bottom, + rgba($nav-embossed-border-top, 1), + rgba($nav-embossed-border-top, 0) 1.5px + ), + linear-gradient( + to top, + rgba($nav-embossed-border-bottom, 1), + rgba($nav-embossed-border-bottom, 0) 1.5px + ), + $nav-subitem-bg; +} .tocify-wrapper { - transition: left 0.3s ease-in-out; - overflow-y: auto; - overflow-x: hidden; - position: fixed; - z-index: 30; - top: 0; - left: 0; - bottom: 0; - width: $nav-width; - background-color: $nav-bg; - font-size: 13px; - font-weight: bold; - .lang-selector { //language selector for mobile devices - display: none; - a { - padding-top: 0.5em; - padding-bottom: 0.5em; - } - } - &>img { //logo at the top of the ToC - display: block; - max-width: 80%; - max-height: 100px; - margin: $logo-margin auto 0px auto; - } - &>.search { - position: relative; - input { - background: $nav-bg; - border-width: 0 0 1px 0; - border-color: $search-box-border-color; - padding: 6px 0 6px 20px; - box-sizing: border-box; - margin: $nav-v-padding $nav-padding; - width: $nav-width - 30; - outline: none; - color: $nav-text; - border-radius: 0; /* ios has a default border radius */ - } - &:before { - position: absolute; - top: 17px; - left: $nav-padding; - color: $nav-text; - @extend %icon-search; - } - } - img+.tocify { - margin-top: $logo-margin; - } - .search-results { - margin-top: 0; + transition: left 0.3s ease-in-out; + overflow-y: auto; + overflow-x: hidden; + position: fixed; + z-index: 30; + top: 0; + left: 0; + bottom: 0; + width: $nav-width; + background-color: $nav-bg; + font-size: 13px; + font-weight: bold; + .lang-selector { + //language selector for mobile devices + display: none; + a { + padding-top: 0.5em; + padding-bottom: 0.5em; + } + } + & > img { + //logo at the top of the ToC + display: block; + max-width: 80%; + max-height: 100px; + margin: $logo-margin auto 0px auto; + } + & > .search { + position: relative; + input { + background: $nav-bg; + border-width: 0 0 1px 0; + border-color: $search-box-border-color; + padding: 6px 0 6px 20px; box-sizing: border-box; - height: 0; - overflow-y: auto; - overflow-x: hidden; - transition-property: height, margin; - transition-duration: 180ms; - transition-timing-function: ease-in-out; - &.visible { - height: 30%; - margin-bottom: 1em; - } - @include embossed-bg; - li { - margin: 1em $nav-padding; - line-height: 1; - } - a { - color: $nav-text; - text-decoration: none; - &:hover { - text-decoration: underline; - } - } - } - .tocify-item>a, .toc-footer li { - padding: 0 $nav-padding 0 $nav-padding; - display: block; - overflow-x: hidden; - white-space: nowrap; - text-overflow: ellipsis; - } - // The Table of Contents is composed of multiple nested - // unordered lists. These styles remove the default - // styling of an unordered list because it is ugly. - ul, li { - list-style: none; - margin: 0; - padding: 0; - line-height: 28px; - } - li { + margin: $nav-v-padding $nav-padding; + width: $nav-width - 30; + outline: none; color: $nav-text; - transition: background-color 230ms linear; - } - .tocify-focus { //currently selected ToC entry - box-shadow: 0px 1px 0px $nav-active-shadow; - background-color: $nav-active-bg; - color: $nav-active-text; - } - // Subheaders are the submenus that slide open - // in the table of contents. - .tocify-subheader { - display: none; // tocify will override this when needed - background-color: $nav-subitem-bg; - font-weight: 500; - .tocify-item>a { - padding-left: $nav-padding + $nav-indent; - font-size: 12px; - } - // for embossed look: - @include embossed-bg; - &>li:last-child { - box-shadow: none; // otherwise it'll overflow out of the subheader - } - } - .toc-footer { - padding: 1em 0; - margin-top: 1em; - border-top: 1px dashed $nav-footer-border-color; - li,a { - color: $nav-text; - text-decoration: none; - } - a:hover { - text-decoration: underline; - } - li { - font-size: 0.8em; - line-height: 1.7; - text-decoration: none; - } - } - } + border-radius: 0; /* ios has a default border radius */ + } + &:before { + position: absolute; + top: 17px; + left: $nav-padding; + color: $nav-text; + @extend %icon-search; + } + } + img + .tocify { + margin-top: $logo-margin; + } + .search-results { + margin-top: 0; + box-sizing: border-box; + height: 0; + overflow-y: auto; + overflow-x: hidden; + transition-property: height, margin; + transition-duration: 180ms; + transition-timing-function: ease-in-out; + &.visible { + height: 30%; + margin-bottom: 1em; + } + @include embossed-bg; + li { + margin: 1em $nav-padding; + line-height: 1; + } + a { + color: $nav-text; + text-decoration: none; + &:hover { + text-decoration: underline; + } + } + } + .tocify-item > a, + .toc-footer li { + padding: 0 $nav-padding 0 $nav-padding; + display: block; + overflow-x: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + // The Table of Contents is composed of multiple nested + // unordered lists. These styles remove the default + // styling of an unordered list because it is ugly. + ul, + li { + list-style: none; + margin: 0; + padding: 0; + line-height: 28px; + } + li { + color: $nav-text; + transition: background-color 230ms linear; + } + .tocify-focus { + //currently selected ToC entry + box-shadow: 0px 1px 0px $nav-active-shadow; + background-color: $nav-active-bg; + color: $nav-active-text; + } + // Subheaders are the submenus that slide open + // in the table of contents. + .tocify-subheader { + display: none; // tocify will override this when needed + background-color: $nav-subitem-bg; + font-weight: 500; + .tocify-item > a { + padding-left: $nav-padding + $nav-indent; + font-size: 12px; + } + // for embossed look: + @include embossed-bg; + & > li:last-child { + box-shadow: none; // otherwise it'll overflow out of the subheader + } + } + .toc-footer { + padding: 1em 0; + margin-top: 1em; + border-top: 1px dashed $nav-footer-border-color; + li, + a { + color: $nav-text; + text-decoration: none; + } + a:hover { + text-decoration: underline; + } + li { + font-size: 0.8em; + line-height: 1.7; + text-decoration: none; + } + } +} // button to show navigation on mobile devices #nav-button { - span { - display: block; - $side-pad: $main-padding / 2 - 8px; - padding: $side-pad $side-pad $side-pad; - background-color: rgba($main-bg, 0.7); - transform-origin: 0 0; - transform: rotate(-90deg) translate(-100%, 0); - border-radius: 0 0 0 5px; - } - padding: 0 1.5em 5em 0; // increase touch size area - display: none; - position: fixed; - top: 0; - left: 0; - z-index: 100; - color: black; - text-decoration: none; - font-weight: bold; - opacity: 0.7; - line-height: 16px; - img { - height: 16px; - vertical-align: bottom; - } - transition: left 0.3s ease-in-out; - &:hover { opacity: 1; } - &.open {left: $nav-width} - } + span { + display: block; + $side-pad: $main-padding / 2 - 8px; + padding: $side-pad $side-pad $side-pad; + background-color: rgba($main-bg, 0.7); + transform-origin: 0 0; + transform: rotate(-90deg) translate(-100%, 0); + border-radius: 0 0 0 5px; + } + padding: 0 1.5em 5em 0; // increase touch size area + display: none; + position: fixed; + top: 0; + left: 0; + z-index: 100; + color: black; + text-decoration: none; + font-weight: bold; + opacity: 0.7; + line-height: 16px; + img { + height: 16px; + vertical-align: bottom; + } + transition: left 0.3s ease-in-out; + &:hover { + opacity: 1; + } + &.open { + left: $nav-width; + } +} //////////////////////////////////////////////////////////////////////////////// // PAGE LAYOUT AND CODE SAMPLE BACKGROUND //////////////////////////////////////////////////////////////////////////////// .page-wrapper { - margin-left: $nav-width; - position: relative; - z-index: 10; - background-color: $main-bg; - min-height: 100%; - padding-bottom: 1px; // prevent margin overflow - // The dark box is what gives the code samples their dark background. - // It sits essentially under the actual content block, which has a - // transparent background. - // I know, it's hackish, but it's the simplist way to make the left - // half of the content always this background color. - .dark-box { - width: $examples-width; - background-color: $examples-bg; - position: absolute; - right: 0; - top: 0; - bottom: 0; - } - .lang-selector { - position: fixed; - z-index: 50; - border-bottom: 5px solid $lang-select-active-bg; - } - } + margin-left: $nav-width; + position: relative; + z-index: 10; + background-color: $main-bg; + min-height: 100%; + padding-bottom: 1px; // prevent margin overflow + // The dark box is what gives the code samples their dark background. + // It sits essentially under the actual content block, which has a + // transparent background. + // I know, it's hackish, but it's the simplist way to make the left + // half of the content always this background color. + .dark-box { + width: $examples-width; + background-color: $examples-bg; + position: absolute; + right: 0; + top: 0; + bottom: 0; + } + .lang-selector { + position: fixed; + z-index: 50; + border-bottom: 5px solid $lang-select-active-bg; + } +} .lang-selector { - background-color: $lang-select-bg; - width: 100%; - font-weight: bold; - a { - display: block; - float:left; - color: $lang-select-text; - text-decoration: none; - padding: 0 10px; - line-height: 30px; - outline: 0; - &:active, &:focus { - background-color: $lang-select-pressed-bg; - color: $lang-select-pressed-text; - } - &.active { - background-color: $lang-select-active-bg; - color: $lang-select-active-text; - } - } - &:after { - content: ''; - clear: both; - display: block; - } - } + background-color: $lang-select-bg; + width: 100%; + font-weight: bold; + a { + display: block; + float: left; + color: $lang-select-text; + text-decoration: none; + padding: 0 10px; + line-height: 30px; + outline: 0; + &:active, + &:focus { + background-color: $lang-select-pressed-bg; + color: $lang-select-pressed-text; + } + &.active { + background-color: $lang-select-active-bg; + color: $lang-select-active-text; + } + } + &:after { + content: ""; + clear: both; + display: block; + } +} //////////////////////////////////////////////////////////////////////////////// // CONTENT STYLES @@ -290,170 +309,199 @@ html, body { // This is all the stuff with the light background in the left half of the page .content { - // to place content above the dark box - position: relative; - z-index: 30; - &:after { - content: ''; - display: block; - clear: both; - } - &>h1, &>h2, &>h3, &>h4, &>h5, &>h6, &>p, &>table, &>ul, &>ol, &>aside, &>dl { - margin-right: $examples-width; - padding: 0 $main-padding; - box-sizing: border-box; - display: block; - text-shadow: $main-embossed-text-shadow; - @extend %left-col; - } - &>ul, &>ol { - padding-left: $main-padding + 15px; - } - &>h1, &>h2, &>div { //tocify hidden div for placeholding stuff - clear:both; - } - h1 { - @extend %header-font; - font-size: 30px; - padding-top: 0.5em; - padding-bottom: 0.5em; - border-bottom: 1px solid #ccc; - margin-bottom: $h1-margin-bottom; - margin-top: 2em; - border-top: 1px solid #ddd; - background-image: linear-gradient(to bottom, #fff, #f9f9f9); - } - h1:first-child, div:first-child + h1 { - border-top-width: 0; - margin-top: 0; - } - h2 { - @extend %header-font; - font-size: 20px; - margin-top: 4em; - margin-bottom: 0; - border-top: 1px solid #ccc; - padding-top: 1.2em; - padding-bottom: 1.2em; - background-image: linear-gradient(to bottom, rgba(#fff, 0.4), rgba(#fff, 0)); - } - // h2s right after h1s should bump right up - // against the h1s. - h1 + h2, h1 + div + h2 { - margin-top: $h1-margin-bottom * -1; - border-top: none; - } - h3, h4, h5, h6 { - @extend %header-font; - font-size: 15px; - margin-top: 2.5em; - margin-bottom: 0.8em; - } - h4, h5, h6 { - font-size: 10px; - } - hr { - margin: 2em 0; - border-top: 2px solid $examples-bg; - border-bottom: 2px solid $main-bg; - } - table { - margin-bottom: 1em; - overflow: auto; - th,td { - text-align: left; - vertical-align: top; - line-height: 1.6; - } - th { - padding: 5px 10px; - border-bottom: 1px solid #ccc; - vertical-align: bottom; - } - td { - padding: 10px; - } - tr:last-child { - border-bottom: 1px solid #ccc; - } - tr:nth-child(odd)>td { - background-color: lighten($main-bg,4.2%); - } - tr:nth-child(even)>td { - background-color: lighten($main-bg,2.4%); - } - } - dt { - font-weight: bold; - } - dd { - margin-left: 15px; - } - p, li, dt, dd { + // to place content above the dark box + position: relative; + z-index: 30; + &:after { + content: ""; + display: block; + clear: both; + } + & > h1, + & > h2, + & > h3, + & > h4, + & > h5, + & > h6, + & > p, + & > table, + & > ul, + & > ol, + & > aside, + & > dl { + margin-right: $examples-width; + padding: 0 $main-padding; + box-sizing: border-box; + display: block; + text-shadow: $main-embossed-text-shadow; + @extend %left-col; + } + & > ul, + & > ol { + padding-left: $main-padding + 15px; + } + & > h1, + & > h2, + & > div { + //tocify hidden div for placeholding stuff + clear: both; + } + h1 { + @extend %header-font; + font-size: 30px; + padding-top: 0.5em; + padding-bottom: 0.5em; + border-bottom: 1px solid #ccc; + margin-bottom: 0; + margin-top: 0; + border-top: 1px solid #ddd; + background-image: linear-gradient(to bottom, #fff, #f9f9f9); + } + h1:first-child, + div:first-child + h1 { + border-top-width: 0; + margin-top: 0; + } + h2 { + @extend %header-font; + font-size: 20px; + margin-top: 0; + margin-bottom: 0; + border-top: 1px solid #ccc; + padding-top: 1.2em; + padding-bottom: 1.2em; + background-image: linear-gradient( + to bottom, + rgba(#fff, 0.4), + rgba(#fff, 0) + ); + } + // h2s right after h1s should bump right up + // against the h1s. + h1 + h2, + h1 + div + h2 { + margin-top: $h1-margin-bottom * -1; + border-top: none; + } + h3, + h4, + h5, + h6 { + @extend %header-font; + font-size: 15px; + margin-top: 2.5em; + margin-bottom: 0.8em; + } + h4, + h5, + h6 { + font-size: 10px; + } + hr { + margin: 2em 0; + border-top: 2px solid $examples-bg; + border-bottom: 2px solid $main-bg; + } + table { + margin-bottom: 1em; + overflow: auto; + th, + td { + text-align: left; + vertical-align: top; line-height: 1.6; - margin-top: 0; - } - img { - max-width: 100%; - } - code { - background-color: rgba(0,0,0,0.05); - padding: 3px; - border-radius: 3px; - @extend %break-words; - @extend %code-font; - } - pre>code { - background-color: transparent; - padding: 0; - } - aside { - padding-top: 1em; - padding-bottom: 1em; - text-shadow: 0 1px 0 lighten($aside-notice-bg, 15%); - margin-top: 1.5em; - margin-bottom: 1.5em; - background: $aside-notice-bg; - line-height: 1.6; - &.success { - background-color: $aside-success-bg; - text-shadow: 0 1px 0 lighten($aside-success-bg, 15%); - } - &.warning { - background-color: $aside-warning-bg; - text-shadow: 0 1px 0 lighten($aside-warning-bg, 15%); - } - &.error { - background-color: $aside-error-bg; - text-shadow: 0 1px 0 lighten($aside-error-bg, 15%); - } - } - aside:before { - vertical-align: middle; - padding-right: 0.5em; - font-size: 14px; - &.notice { - @extend %icon-info-sign; - } - &.success { - @extend %icon-ok-sign; - } - &.warning { - @extend %icon-exclamation-sign; - } - &.error { - @extend %icon-exclamation-sign; - } - } - .search-highlight { - padding: 2px; - margin: -2px; - border-radius: 4px; - border: 1px solid #F7E633; - text-shadow: 1px 1px 0 #666; - background: linear-gradient(to top left, #F7E633 0%, #F1D32F 100%); - } - } + } + th { + padding: 5px 10px; + border-bottom: 1px solid #ccc; + vertical-align: bottom; + } + td { + padding: 10px; + } + tr:last-child { + border-bottom: 1px solid #ccc; + } + tr:nth-child(odd) > td { + background-color: lighten($main-bg, 4.2%); + } + tr:nth-child(even) > td { + background-color: lighten($main-bg, 2.4%); + } + } + dt { + font-weight: bold; + } + dd { + margin-left: 15px; + } + p, + li, + dt, + dd { + line-height: 1.6; + } + img { + max-width: 100%; + } + code { + background-color: rgba(0, 0, 0, 0.05); + padding: 3px; + border-radius: 3px; + @extend %break-words; + @extend %code-font; + } + pre > code { + background-color: transparent; + padding: 0; + } + aside { + padding-top: 1em; + padding-bottom: 1em; + text-shadow: 0 1px 0 lighten($aside-notice-bg, 15%); + margin-top: 1.5em; + margin-bottom: 1.5em; + background: $aside-notice-bg; + line-height: 1.6; + &.success { + background-color: $aside-success-bg; + text-shadow: 0 1px 0 lighten($aside-success-bg, 15%); + } + &.warning { + background-color: $aside-warning-bg; + text-shadow: 0 1px 0 lighten($aside-warning-bg, 15%); + } + &.error { + background-color: $aside-error-bg; + text-shadow: 0 1px 0 lighten($aside-error-bg, 15%); + } + } + aside:before { + vertical-align: middle; + padding-right: 0.5em; + font-size: 14px; + &.notice { + @extend %icon-info-sign; + } + &.success { + @extend %icon-ok-sign; + } + &.warning { + @extend %icon-exclamation-sign; + } + &.error { + @extend %icon-exclamation-sign; + } + } + .search-highlight { + padding: 2px; + margin: -2px; + border-radius: 4px; + border: 1px solid #f7e633; + text-shadow: 1px 1px 0 #666; + background: linear-gradient(to top left, #f7e633 0%, #f1d32f 100%); + } +} //////////////////////////////////////////////////////////////////////////////// // CODE SAMPLE STYLES @@ -461,38 +509,45 @@ html, body { // This is all the stuff that appears in the right half of the page .content { - pre, blockquote { - background-color: $code-bg; - color: white; - padding: 2em $main-padding; + pre, + blockquote { + background-color: $code-bg; + color: white; + margin: 0; + width: $examples-width; + float: right; + clear: right; + box-sizing: border-box; + text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.4); + @extend %right-col; + & > p { margin: 0; - width: $examples-width; - float:right; - clear:right; - box-sizing: border-box; - text-shadow: 0px 1px 2px rgba(0,0,0,0.4); - @extend %right-col; - &>p { margin: 0; } - a { - color: white; - text-decoration: none; - border-bottom: dashed 1px #ccc; - } - } - pre { - @extend %code-font; - } - blockquote { - &>p { - background-color: $code-annotation-bg; - border-radius: 5px; - padding: $code-annotation-padding; - color: #ccc; - border-top: 1px solid black; - border-bottom: 1px solid #404040; - } - } - } + } + a { + color: white; + text-decoration: none; + border-bottom: dashed 1px #ccc; + } + } + + pre { + @extend %code-font; + padding: 2em $main-padding; + } + + blockquote { + & > p { + background-color: $code-annotation-bg; + border-radius: 5px; + font-size: medium; + padding: $code-annotation-padding; + color: #ccc; + border-top: 1px solid black; + border-bottom: 1px solid #404040; + padding: 1em $main-padding; + } + } +} //////////////////////////////////////////////////////////////////////////////// // RESPONSIVE DESIGN @@ -501,50 +556,54 @@ html, body { // There are also a couple styles disperesed @media (max-width: $tablet-width) { - .tocify-wrapper { - left: -$nav-width; - &.open { - left: 0; - } - } - .page-wrapper { - margin-left: 0; - } - #nav-button { - display: block; - } - .tocify-wrapper .tocify-item > a { - padding-top: 0.3em; - padding-bottom: 0.3em; - } - } + .tocify-wrapper { + left: -$nav-width; + &.open { + left: 0; + } + } + .page-wrapper { + margin-left: 0; + } + #nav-button { + display: block; + } + .tocify-wrapper .tocify-item > a { + padding-top: 0.3em; + padding-bottom: 0.3em; + } +} @media (max-width: $phone-width) { - .dark-box { - display: none; - } - %left-col { - margin-right: 0; - } - .tocify-wrapper .lang-selector { - display: block; - } - .page-wrapper .lang-selector { - display: none; - } - %right-col { - width: auto; - float: none; - } - %right-col + %left-col { - margin-top: $main-padding; - } - } + .dark-box { + display: none; + } + %left-col { + margin-right: 0; + } + .tocify-wrapper .lang-selector { + display: block; + } + .page-wrapper .lang-selector { + display: none; + } + %right-col { + width: auto; + float: none; + } + %right-col + %left-col { + margin-top: $main-padding; + } +} -.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs { - color: #909090; - } +.highlight .c, +.highlight .cm, +.highlight .c1, +.highlight .cs { + color: #909090; +} -.highlight, .highlight .w { - background-color: $code-bg; - } +.highlight, +.highlight .w { + background-color: $code-bg; +} From 819f5b1a1ebc6b0fecb92854b3b49e3e814035a1 Mon Sep 17 00:00:00 2001 From: Rory Powis Date: Thu, 16 Jan 2020 15:29:44 +0100 Subject: [PATCH 07/50] Link error code 418 to MDN page explaining it --- source/includes/_errors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/source/includes/_errors.md b/source/includes/_errors.md index c6951c33..dd78b87a 100644 --- a/source/includes/_errors.md +++ b/source/includes/_errors.md @@ -13,6 +13,7 @@ The Clear Payments API uses the following error codes: | 405 | Method Not Allowed -- You tried to access a value with an invalid method. | | 406 | Not Acceptable -- You requested a format that isn't JSON. | | 410 | Gone -- The value requested has been removed from our servers. | +| 418 | [I'm a teapot](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/418) | | 429 | Too Many Requests -- You're requesting too many values! Slow down! | | 500 | Internal Server Error -- We had a problem with our server. Try again later. | | 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. | From 36467fa4fcd61d96e7ae59f535044f9051063ca1 Mon Sep 17 00:00:00 2001 From: Rory Powis Date: Thu, 16 Jan 2020 15:47:06 +0100 Subject: [PATCH 08/50] Build and deploy --- docs/CNAME | 2 +- docs/index.html | 1802 +++++++++++++++++++++++++---------- docs/javascripts/all.js | 2 +- docs/stylesheets/screen.css | 2 +- 4 files changed, 1299 insertions(+), 509 deletions(-) diff --git a/docs/CNAME b/docs/CNAME index f69e37ce..93337e3b 100644 --- a/docs/CNAME +++ b/docs/CNAME @@ -1 +1 @@ -api-docs.cleartreasury.co.uk \ No newline at end of file +api.cleartreasury.co.uk diff --git a/docs/index.html b/docs/index.html index 90128970..ffb51977 100644 --- a/docs/index.html +++ b/docs/index.html @@ -7,7 +7,7 @@ - + NAV navbar @@ -16,10 +16,6 @@
- javascript - - bash -
@@ -44,231 +40,1127 @@

Introduction

-

Base [ENV] url variables

+

Base URL Sandbox

-
sandbox: api-test.cleartreasury.co.uk/api
-live: api.cleartreasury.co.uk/api

Welcome to the Clear Payments API - Powered by Clear Treasury. With international payments a daily necessity for many, we have developed our online payments platform that dramatically streamlines the process.

-

We have designed the Clear Payments API to integrate directly into your process, product or software.

-

Authentication

-
-

use this code:

+
http://api-test.cleartreasury.co.uk/api
+

Base URL Live

-
# With shell, you can just pass the correct header with each request
-curl -X POST \
-  http://[ENV].cleartreasury.co.uk/api/token \
-  -H 'Content-Type: application/x-www-form-urlencoded' \
-  -d 'login=--YOUR LOGIN--&password=--YOUR PASSWORD--'
var settings = {
-  "async": true,
-  "crossDomain": true,
-  "url": "http://[ENV].cleartreasury.co.uk/api/token",
-  "method": "POST",
-  "headers": {
-    "Content-Type": "application/x-www-form-urlencoded",
-   },
-  "data": {
-    "login": "--YOUR LOGIN--",
-    "password": "--YOUR PASSWORD--"
-  }
-}
+
http://api.cleartreasury.co.uk/api

Welcome to the Clear Payments API - Powered by Clear Treasury.

+

With international payments being a daily necessity for many, we have developed our online payments platform to dramatically streamline the process.

+

Our aim is to make the Clear Payments API as simple as possible for you to integrate into your process, product or software.

+

API access

+

Every call to the Clear Payments API requires an authorization token that needs to be set in the header of each subsequent call.

+

Token

+
curl -X POST http://api-test.cleartreasury.co.uk/api/token \
+     -H 'Content-Type: application/json' \
+     -d '{
+           "login": <your username>,
+           "password": <your password>
+         }'

Use your provided login details to request an authorization token. The resulting token is then sent in a header in every subsequent request.

+

The Token is valid for 6 months.

+

Request

+

POST /token

+

Parameters

+ + + + + + + + + + + + + + + + + + + + + +
NameDescriptionRequiredType
loginYour given usernameYesstring
passwordYour given passwordYesstring
+

Authorization

+
curl -X GET http://api-test.cleartreasury.co.uk/api/quote \
+     -H "Authorization: Bearer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"

Once you have your API token, add it as a header parameter to every request like this:

+

Authorization: Bearer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx

-$.ajax(settings).done(function (response) { - console.log(response); -});
-

Clear Payments expects the API Token to be included in all API requests to the server in a header that looks like the following:

+ +

Quote

+

There are four steps to executing a trade:

+

Step 1: Create a quote

+

Step 2: Create a beneficiary

+

Step 3: Book a trade

+

Step 4: Instruct a payment

+

Description

+

A quote can be used to create a trade. You need quoteID as an input to create a trade.

+

Place a Quote

+

Before you can book a trade you need to have been issued a quote and have created a beneficiary.

+
+

Example request:

-
curl -X POST \
-  '[ENV].cleartreasury.co.uk/--ENDPOINT--' \
-  -H 'Authorization: Bearer --YOUR TOKEN--' \ 
-

Clear API uses a token that needs to be set in the header of each call.

-

To generate your token you can use /api/Token endpoint

- - - - -

This Token is valid for 6 months.

+
curl -X POST http://api-test.cleartreasury.co.uk/api/quote \
+     -H 'Authorization: Bearer <your api token>'
+     -H 'Content-Type: application/json' \
+     -d '{
+            "ccy_sell": "GBP",
+            "ccy_buy": "EUR",
+            "value_date": "20193112",
+            "sell_amount": 600.00
+        }'
+

Example response:

+
+
{
+  "ID": "sample string 1",
+  "sell_amount": 2.1,
+  "buy_amount": 3.1,
+  "client_rate": 4.1,
+  "bank_rate": 5.1,
+  "ccy_sell": "sample string 6",
+  "fee": 7.1,
+  "fee_ccy": 8.1,
+  "ccy_buy": "sample string 9",
+  "value_date": "sample string 10",
+  "Message": "sample string 11",
+  "Status": true
+}

Request

+

POST /quote

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionRequiredType
ccy_sellThe currency the end customer is wanting to sell.
ISO 3 letters currency
Nostring
ccy_buyThe currency the end customer is wanting to sell.
ISO 3 letters currency
Nostring
value_dateDate. In yyyyMMdd formatNostring
sell_amountSelling AmountNodecimal
buy_amountBuying AmountNodecimal
quoteIDNointeger
+

Response

+

Quote id is needed for booking a trade in step 3.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionType
IDQuote IDstring
sell_amountSell Amountdecimal
buy_amountSell Amountdecimal
client_rateClient Ratedecimal
bank_rateBank Ratedecimal
ccy_sellSell Currencystring
feeCharge amountdecimal
fee_ccyCharge Currencydecimal
ccy_buyBuy Currencystring
value_dateyyyyMMdd Datestring
MessageFree Messagestring
StatusReturns true if quote is value or false if there is an errorboolean
+

Get a refreshed price for a quote

+ - -

Book a Trade

+

You can request a new price for a previously requested quote.

-

Example JSON response:

+

Example request:

+
+
curl -X GET http://api-test.cleartreasury.co.uk/api/quote?quote_id={quote_id} \
+     -H 'Authorization: Bearer <your api token>'
+

Example response:

{
-  "ID": 0,
-  "Trade_Date": "string",
-  "Value_Date": "string",
-  "CCY_Bought": "string",
-  "CCY_Sold": "string",
-  "Rate": 0,
-  "Bought_Amount": 0,
-  "Sold_Amount": 0,
-  "Payment_Fee": 0,
-  "Trade_ID": "string",
-  "Trade_Type": "string",
-  "OurAccountName": "string",
-  "OurBankName": "string",
-  "OurIBAN": "string",
-  "OurSortCode": "string",
-  "OurSWIFTCode": "string",
-  "Message": "string"
-}

Description

-

Book a trade by verifying acceptance of a quote.

-

HTTP Request

-

POST /BookQuote

-

POST /BookQuote?quote_id={quote_id}&sourceOfFunds={sourceOfFunds}&ReasonForTrading={ReasonForTrading}

-

Parameters

+ "ID": "string", + "sell_amount": 0, + "buy_amount": 0, + "client_rate": 0, + "bank_rate": 0, + "ccy_sell": "string", + "fee": 0, + "fee_ccy": 0, + "ccy_buy": "string", + "value_date": "string", + "Message": "string", + "Status": true +}

Request

+

GET /quote?quote_id={quote_id}

- - - - - - - - + + + + + + + +
NameLocated in Description Required Type
quote_idqueryQuote Id to ValidateYesinteger
quote_idQuote Id to refreshYesinteger
+

Response

+ + + + + + + + + + + + + +
CodeDescription
200OK
+

Beneficiary Templates

+

There are four steps to executing a trade:

+

Step 1: Create a quote

+

Step 2: Create a beneficiary

+

Step 3: Book a trade

+

Step 4: Instruct a payment

+

Description

+

Beneficiary is a person or institution who is the ultimate recipient of your payment.

+

In order to book a trade you must have created a beneficiary.

+

List Templates

+

Get a list of Beneficiary Templates

+
+

Example request:

+
+
curl -X GET http://api-test.cleartreasury.co.uk/api/template \
+     -H 'Authorization: Bearer <your api token>'
+

Example response:

+
+
[
+  {
+    "pin_id": 0,
+    "pin_link_id": 0,
+    "pin_link_type": 0,
+    "pin_ccy": "string",
+    "pin_bank_name": "string",
+    "pin_address": "string",
+    "pin_account_name": "string",
+    "pin_account_number": "string",
+    "pin_sort_code": "string",
+    "pin_iban": "string",
+    "pin_swift_bic": "string",
+    "pin_fedwire_bank_code": "string",
+    "pin_details": "string",
+    "pin_notes": "string",
+    "pin_country_code": "string",
+    "pin_intermediary": "string",
+    "pin_email": "string",
+    "pin_alert_date": "string",
+    "pin_archived": true,
+    "pin_ben_name": "string",
+    "pin_ben_contact_name": "string",
+    "pin_ben_address": "string",
+    "pin_ben_activity": "string",
+    "pin_ben_post_code": "string",
+    "pin_ben_Town": "string",
+    "pin_bank_post_code": "string",
+    "pin_bank_Town": "string",
+    "pin_bank_code": "string",
+    "pin_bank_branch": "string",
+    "pin_CPF": "string",
+    "pin_account_type": "string",
+    "pin_cnaps": "string",
+    "pin_purpose": "string",
+    "pin_validate_date": "string",
+    "pin_last_external_check_date": "string",
+    "pin_low_risk": 0,
+    "pin_recurrent": 0,
+    "pin_partner": 0,
+    "pin_check_count": 0
+  }
+]

Request

+

GET /template

+

Response

+

Beneficiary id is needed for booking a trade in step 3.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionType
pin_idinteger
pin_link_idinteger
pin_link_typeinteger
pin_ccystring
pin_bank_namestring
pin_addressstring
pin_account_namestring
pin_account_numberstring
pin_sort_codestring
pin_ibanstring
pin_swift_bicstring
pin_fedwire_bank_codestring
pin_detailsstring
pin_notesstring
pin_country_codestring
pin_intermediarystring
pin_emailstring
pin_alert_datestring
pin_archivedboolean
pin_ben_namestring
pin_ben_contact_namestring
pin_ben_addressstring
pin_ben_activitystring
pin_ben_post_codestring
pin_ben_Townstring
pin_bank_post_codestring
pin_bank_Townstring
pin_bank_codestring
pin_bank_branchstring
pin_CPFstring
pin_account_typestring
pin_cnapsstring
pin_purposestring
pin_validate_datestring
pin_last_external_check_datestring
pin_low_riskinteger
pin_recurrentinteger
pin_partnerinteger
pin_check_countinteger
+

Book a Trade

+

There are four steps to executing a trade:

+

Step 1: Create a quote

+

Step 2: Create a beneficiary

+

Step 3: Book a trade

+

Step 4: Instruct a payment

+

Description

+

Trade is a payment order to a beneficiary account based on a quote.

+

Book Quote

+

Book a trade by verifying acceptance of a quote.

+
+

Example request:

+
+
curl -X POST http://api-test.cleartreasury.co.uk/api/bookquote \
+     -H 'Authorization: Bearer <your api token>'
+     -H 'Content-Type: application/json' \
+     -d '{
+            "quote_id": 6,
+            "sourceOfFunds": "",
+            "ReasonForTrading": ""
+        }'
+

Example response:

+
+
{
+  "ID": 0,
+  "Trade_Date": "string",
+  "Value_Date": "string",
+  "CCY_Bought": "string",
+  "CCY_Sold": "string",
+  "Rate": 0,
+  "Bought_Amount": 0,
+  "Sold_Amount": 0,
+  "Payment_Fee": 0,
+  "Trade_ID": "string",
+  "Trade_Type": "string",
+  "OurAccountName": "string",
+  "OurBankName": "string",
+  "OurIBAN": "string",
+  "OurSortCode": "string",
+  "OurSWIFTCode": "string",
+  "Message": "string"
+}

Request

+

POST /bookquote

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionRequiredType
quote_idQuote Id to ValidateYesinteger
sourceOfFundsYesstring
ReasonForTradingYesstring
+

Response

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionType
IDTrade IDinteger
Trade_DateTrade Datestring
Value_DateValue Datestring
CCY_BoughtCCY Boughtstring
CCY_SoldCCY Soldstring
RateRatedecimal
Bought_AmountBought_Amountdecimal
Sold_AmountSold_Amountdecimal
Payment_FeePayment_Feedecimal
Trade_IDTrade IDstring
Trade_TypeTrade Typestring
OurAccountNameOur Account Namestring
OurBankNameOur Bank Namestring
OurIBANOur Ibanstring
OurSortCodeOur Sort Codestring
OurSWIFTCodeOur SWIFT Codestring
MessageMessagestring
+

Payment Instruction

+

There are four steps to executing a trade:

+

Step 1: Create a quote

+

Step 2: Create a beneficiary

+

Step 3: Book a trade

+

Step 4: Instruct a payment

+

Description

+

This API call is the final step for executing trades.

+ + +

Retrieve list by date

+

Retrieve payment instruction list inclusive of from and to dates.

+
+

Example request:

+
+
curl -X GET http://api-test.cleartreasury.co.uk/api/paymentinstruction?fromDate={fromDate}&toDate={toDate} \
+     -H 'Authorization: Bearer <your api token>'
+

Example response:

+
+
[
+  {
+    "Intermediary": "string",
+    "AccountName": "string",
+    "AccountNumber": "string",
+    "Address": "string",
+    "BankName": "string",
+    "CCY": "string",
+    "Notes": "string",
+    "SortCode": "string",
+    "Swift": "string",
+    "CountryCode": "string",
+    "Email": "string",
+    "BenAddress": "string",
+    "CNAPS": "string",
+    "Purpose": "string",
+    "ChargeCode": "string",
+    "Amount": 0,
+    "PaymentReference": "string",
+    "TradeReference": "string",
+    "tra_client_id": 0,
+    "pin_id": 0,
+    "PaymentGUID": "00000000-0000-0000-0000-000000000000",
+    "opi_id": 0,
+    "CreationDate": "2019-10-17T11:27:23.691Z",
+    "Status": "string",
+    "exportedDate": "2019-10-17T11:27:23.691Z"
+  }
+]

Request

+

GET /paymentinstruction?fromDate={fromDate}&toDate={toDate}

+ + + + + + + + + + + + + + + + + + + + + +
NameDescriptionRequiredType
fromDateInclusive from date. In yyyyMMdd formatYesstring
toDateInclusive to date. In yyyyMMdd formatYesstring
+

Response

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionType
Intermediarystring
AccountNamestring
AccountNumberstring
Addressstring
BankNamestring
CCYstring
Notesstring
SortCodestring
Swiftstring
CountryCodestring
Emailstring
BenAddressstring
CNAPSstring
Purposestring
ChargeCodestring
Amountdecimal
PaymentReferencestring
TradeReferencestring
tra_client_idinteger
pin_idinteger
PaymentGUIDstring
opi_idinteger
CreationDatedate
Statusstring
exportedDatedate
+

Get by ID

+

Get payment instruction by ID

+
+

Example request:

+
+
curl -X POST http://api-test.cleartreasury.co.uk/api/paymentinstruction/{id} \
+     -H 'Authorization: Bearer <your api token>'
+

Example response:

+
+
{
+  "Intermediary": "string",
+  "AccountName": "string",
+  "AccountNumber": "string",
+  "Address": "string",
+  "BankName": "string",
+  "CCY": "string",
+  "Notes": "string",
+  "SortCode": "string",
+  "Swift": "string",
+  "CountryCode": "string",
+  "Email": "string",
+  "BenAddress": "string",
+  "CNAPS": "string",
+  "Purpose": "string",
+  "ChargeCode": "string",
+  "Amount": 0,
+  "PaymentReference": "string",
+  "TradeReference": "string",
+  "tra_client_id": 0,
+  "pin_id": 0,
+  "PaymentGUID": "00000000-0000-0000-0000-000000000000",
+  "opi_id": 0,
+  "CreationDate": "2019-10-17T11:27:23.691Z",
+  "Status": "string",
+  "exportedDate": "2019-10-17T11:27:23.691Z"
+}

Request

+

GET /paymentinstruction/{id}

+ + + + + + + + + + + + + + + + + +
NameLocated inDescriptionRequiredType
idquerypayment GUIDyesstring
+

Response

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - + - -
NameDescriptionType
Intermediarystring
AccountNamestring
AccountNumberstring
Addressstring
BankNamestring
CCYstring
Notesstring
SortCodestring
Swiftstring
CountryCodestring
sourceOfFundsqueryEmail Yes string
ReasonForTradingqueryBenAddress Yes string
-

Responses

- - - - + + + - - - - + + + + -
CodeDescriptionCNAPSstring
200OK
Purposestring
-

Payment instruction

-

Retrieve list by date

-

Retrieve payment instruction list yyyyMMdd inclusive from dateyyyyMMdd inclusive to date

-
-

Example JSON response:

-
-
[
-  {
-    "Intermediary": "string",
-    "AccountName": "string",
-    "AccountNumber": "string",
-    "Address": "string",
-    "BankName": "string",
-    "CCY": "string",
-    "Notes": "string",
-    "SortCode": "string",
-    "Swift": "string",
-    "CountryCode": "string",
-    "Email": "string",
-    "BenAddress": "string",
-    "CNAPS": "string",
-    "Purpose": "string",
-    "ChargeCode": "string",
-    "Amount": 0,
-    "PaymentReference": "string",
-    "TradeReference": "string",
-    "tra_client_id": 0,
-    "pin_id": 0,
-    "PaymentGUID": "string",
-    "opi_id": 0,
-    "CreationDate": "2019-10-17T11:27:23.691Z",
-    "Status": "string",
-    "exportedDate": "2019-10-17T11:27:23.691Z"
-  }
-]

HTTP Request

-

GET PaymentInstruction

-

GET PaymentInstruction?fromDate={fromDate}&toDate={toDate}

-

Parameters

- - - - - - - + + + - - - - + + + + + + + - - - + - -
NameLocated inDescriptionRequiredTypeChargeCodestring
fromDatequery
Amountdecimal
PaymentReference No string
toDatequeryTradeReference No string
-

Responses

- - - - + + + - - - - + + + + -
CodeDescriptiontra_client_idinteger
200OK
pin_idinteger
-

Retrieve by GUID

-

Retrieve payment instruction by GUID

-

HTTP Request

-

GET api/PaymentInstruction/{id}

-

Parameters

- - - - - - - + + + - - - - - - + + + + + + + + + + + + + + + + + +
NameLocated inDescriptionRequiredTypePaymentGUIDstring
idquerypayment GUIDyes
opi_idinteger
CreationDatedate
Status string
exportedDatedate

Instruct a new Payment

-

Example JSON value:

+

Example request:

+
+
curl -X POST http://api-test.cleartreasury.co.uk/api/paymentinstruction \
+     -H 'Authorization: Bearer <your api token>'
+     -H 'Content-Type: application/json' \
+     -d '{
+          "Intermediary": "sample string 1",
+          "AccountName": "sample string 2",
+          "AccountNumber": "sample string 3",
+          "Address": "sample string 4",
+          "BankName": "sample string 5",
+          "CCY": "sample string 6",
+          "Notes": "sample string 7",
+          "SortCode": "sample string 8",
+          "Swift": "sample string 9",
+          "CountryCode": "sample string 10",
+          "Email": "sample string 11",
+          "BenAddress": "sample string 12",
+          "CNAPS": "sample string 13",
+          "Purpose": "sample string 14",
+          "FEE": "sample string 15",
+          "Amount": "sample string 16",
+          "PaymentReference": "sample string 17",
+          "TradeReference": "sample string 18",
+          "PaymentGuid": "00000000-0000-0000-0000-000000000000"
+        }'
+

Example response:

[
   {
@@ -292,9 +1184,8 @@ 

Instruct a new Payment

"TradeReference": "string", "PaymentGuid": "00000000-0000-0000-0000-000000000000" } -]

HTTP Request

-

POST /PaymentInstruction/

-

Parameters

+]

Request

+

POST /paymentinstruction

@@ -411,195 +1302,37 @@

Instruct a new Payment

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
AmountAmount instructedyesstring
PaymentReferenceYour Reference on paymentstring
TradeReferenceThe trade Reference of the trade used to instruct this payment, set to blank if this Payment is not linked to FX trade, or set to "auto" to attempt to retrieve available trade.string
PaymentGuidA GUID defined by yourself that can be used to retrieve paymentglobally unique identifier
-

Responses

- - - - - - - - - - - -
CodeDescription
200OK
-

Quote

-

Place a Quote

-

HTTP Request

-

POST /Quote

-

POST api/Quote?ccy_sell={ccy_sell}&ccy_buy={ccy_buy}&value_date={value_date}&sell_amount={sell_amount}&buy_amount={buy_amount}&quoteID={quoteID}

-

Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameLocated inDescriptionRequiredType
ccy_sellqueryISO 3 letters currencyNostring
ccy_buyqueryISO 3 letters currencyNostring
value_datequeryyyyyMMdd dateNostring
sell_amountquerySelling AmountNodouble
buy_amountqueryBuying AmountNodouble
quoteIDqueryNointeger
-

Responses

- - - - - - - - - - - -
CodeDescription
200OK
-

Get a refreshed price for a quote

-

HTTP Request

-

GET /Quote

-

GET api/Quote?quote_id={quote_id}

-

Parameters

- - - - - - - - - - - - - - - - - -
NameLocated inDescriptionRequiredType
quote_idqueryQuote Id to RefreshYesinteger
-

Responses

- - - - - + + + + + - - - - + + + + + + -
CodeDescriptionAmountAmount instructedyesstring
200OK
PaymentReferenceYour Reference on paymentstring
-

Calculate a quote

-
-

Example JSON value:

-
-
{
-  "ID": "string",
-  "sell_amount": 0,
-  "buy_amount": 0,
-  "client_rate": 0,
-  "bank_rate": 0,
-  "ccy_sell": "string",
-  "fee": 0,
-  "fee_ccy": 0,
-  "ccy_buy": "string",
-  "value_date": "string",
-  "Message": "string",
-  "Status": true
-}

HTTP Request

-

POST api/Quote

-

POST api/Quote?quote_id={quote_id}

-

Parameters

- - - - - - - + + + + + - - - - + + + + + - -
NameLocated inDescriptionRequiredTypeTradeReferenceThe reference of the trade used to instruct this payment, set to blank if this Payment is not linked to FX trade, or set to "auto" to attempt to retrieve available trade.string
quote_idquery
PaymentGuidA GUID defined by yourself that can be used to retrieve paymentstring Yesinteger
-

Responses

+

Response

+ + @@ -614,9 +1347,13 @@

Calculate a quote

Statement

Retrieve a Statement

-

Retrieve Statement per currency - optionally specify from/ to dates (inclusive)

+

Retrieve a statement for a given currency, optionally filtered by inclusive from and to dates.

-

Example JSON response:

+

Example request:

+
+
curl -X GET http://api-test.cleartreasury.co.uk/api/statement?ccy={ccy}&fromDate={fromDate}&toDate={toDate} \
+     -H 'Authorization: Bearer <your api token>'
+

Example response:

[
   {
@@ -628,15 +1365,12 @@ 

Retrieve a Statement

"Bank_Account": "string", "Balance": 0 } -]

HTTP Request

-

GET api/Statement

-

GET api/Statement?ccy={ccy}&fromDate={fromDate}&toDate={toDate}

-

Parameters

+]

Request

+

GET /statement?ccy={ccy}&fromDate={fromDate}&toDate={toDate}

- @@ -644,150 +1378,77 @@

Retrieve a Statement

- - - + - - +
NameLocated in Description Required Type
ccyquery Yes string
fromDatequeryInclusive from date. In yyyyMMdd format No string
toDatequeryInclusive to date. In yyyyMMdd format No string
-

Responses

+

Response

- + + - - + + + -
CodeName DescriptionType
200OKDatedate
-

Beneficiary Templates

-

List Templates

-

Get a list of Beneficiary Templates

-
-

Example JSON response:

-
-
[
-  {
-    "pin_id": 0,
-    "pin_link_id": 0,
-    "pin_link_type": 0,
-    "pin_ccy": "string",
-    "pin_bank_name": "string",
-    "pin_address": "string",
-    "pin_account_name": "string",
-    "pin_account_number": "string",
-    "pin_sort_code": "string",
-    "pin_iban": "string",
-    "pin_swift_bic": "string",
-    "pin_fedwire_bank_code": "string",
-    "pin_details": "string",
-    "pin_notes": "string",
-    "pin_country_code": "string",
-    "pin_intermediary": "string",
-    "pin_email": "string",
-    "pin_alert_date": "string",
-    "pin_archived": true,
-    "pin_ben_name": "string",
-    "pin_ben_contact_name": "string",
-    "pin_ben_address": "string",
-    "pin_ben_activity": "string",
-    "pin_ben_post_code": "string",
-    "pin_ben_Town": "string",
-    "pin_bank_post_code": "string",
-    "pin_bank_Town": "string",
-    "pin_bank_code": "string",
-    "pin_bank_branch": "string",
-    "pin_CPF": "string",
-    "pin_account_type": "string",
-    "pin_cnaps": "string",
-    "pin_purpose": "string",
-    "pin_validate_date": "string",
-    "pin_last_external_check_date": "string",
-    "pin_low_risk": 0,
-    "pin_recurrent": 0,
-    "pin_partner": 0,
-    "pin_check_count": 0
-  }
-]

HTTP Request

-

GET /Template/

-

Responses

- - - - + + + - - - - + + + + -
CodeDescriptionReferencestring
200OK
Detailstring
-

Token

-

Build your Auth Token

-

HTTP Request

-

POST /Token

-

Body Parameters

- - - - - - - + + + - - - - - - - + + + + - - - - + + -
NameLocated inDescriptionRequiredTypeReceiptsdecimal
LoginbodyLoginYesstring
Paymentsdecimal
PasswordbodyPasswordYesBank_Account string
-

Responses

- - - - - - - - - + + +
CodeDescription
200OKBalancedecimal

Trade History

Retrieve a Trade list between two dates

-

From yyyyMMdd to yyyyMMdd inclusive

+

Retreive a list of trades between inclusive from and to dates.

-

Example JSON response:

+

Example request:

+
+
curl -X POST http://api-test.cleartreasury.co.uk/api/trade?fromDate={fromDate}&toDate={toDate} \
+     -H 'Authorization: Bearer <your api token>'
+

Example response:

[
   {
@@ -805,10 +1466,8 @@ 

Retrieve a Trade list between t "Status": "string", "Beneficiary": "string" } -]

HTTP Request

-

GET /Trade

-

GET /Trade?fromDate={fromDate}&toDate={toDate}

-

Parameters

+]

Request

+

GET /trade?fromDate={fromDate}&toDate={toDate}

@@ -834,22 +1493,88 @@

Retrieve a Trade list between t

string
-

Responses

+

Response

- + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeName DescriptionType
200OKIDTrade IDinteger
Trade_DateTrade Datestring
Value_DateValue Datestring
CCY_BoughtCCY Boughtstring
CCY_SoldCCY Soldstring
RateRatedecimal
Bought_AmountBought_Amountdecimal
Sold_AmountSold_Amountdecimal
Payment_FeePayment_Feedecimal
Trade_IDTrade IDstring
Trade_TypeTrade Typestring
StatusStatusstring
BeneficiaryBeneficiarystring
-

Retrieve payment instruction by GUID

+

Retrieve payment instruction by ID

-

Example JSON response:

+

Example request:

+
+
curl -X GET http://api-test.cleartreasury.co.uk/api/trade/{id} \
+     -H 'Authorization: Bearer <your api token>'
+

Example response:

[
   {
@@ -867,14 +1592,12 @@ 

Retrieve payment instruction by GU "Status": "string", "Beneficiary": "string" } -]

HTTP Request

-

GET /Trade/{id}

-

Parameters

+]

Request

+

GET /trade/{id}

- @@ -882,18 +1605,89 @@

Retrieve payment instruction by GU

- - - + + + + +
NameLocated in Description Required Type
idquerypayment GUIDyesPayment GUIDYesstring
+

Response

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionType
IDTrade IDinteger
Trade_DateTrade Datestring
Value_DateValue Datestring
CCY_BoughtCCY Boughtstring
CCY_SoldCCY Soldstring
RateRatedecimal
Bought_AmountBought_Amountdecimal
Sold_AmountSold_Amountdecimal
Payment_FeePayment_Feedecimal
Trade_IDTrade IDstring
Trade_TypeTrade Typestring
StatusStatusstring
BeneficiaryBeneficiary string

Errors

- @@ -935,7 +1729,7 @@

Errors

418 -I'm a teapot. +I'm a teapot 429 @@ -957,10 +1751,6 @@

Errors

- javascript - - bash -
diff --git a/docs/javascripts/all.js b/docs/javascripts/all.js index 0524a583..27fdf6e3 100644 --- a/docs/javascripts/all.js +++ b/docs/javascripts/all.js @@ -1 +1 @@ -!function(t,e){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)}("undefined"!=typeof window?window:this,function(x,t){"use strict";function g(t){return null!=t&&t===t.window}var e=[],B=x.document,n=Object.getPrototypeOf,r=e.slice,m=e.concat,l=e.push,s=e.indexOf,i={},o=i.toString,b=i.hasOwnProperty,a=b.toString,c=a.call(Object),v={},y=function(t){return"function"==typeof t&&"number"!=typeof t.nodeType},h={type:!0,src:!0,nonce:!0,noModule:!0};function I(t,e,i){var n,s,o=(i=i||B).createElement("script");if(o.text=t,e)for(n in h)(s=e[n]||e.getAttribute&&e.getAttribute(n))&&o.setAttribute(n,s);i.head.appendChild(o).parentNode.removeChild(o)}function _(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?i[o.call(t)]||"object":typeof t}var u="3.4.1",G=function(t,e){return new G.fn.init(t,e)},d=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function p(t){var e=!!t&&"length"in t&&t.length,i=_(t);return!y(t)&&!g(t)&&("array"===i||0===e||"number"==typeof e&&0>10|55296,1023&n|56320)}function s(){C()}var t,p,I,o,a,f,d,g,_,l,c,C,x,r,B,m,h,b,v,G="sizzle"+1*new Date,y=i.document,w=0,n=0,A=lt(),k=lt(),Q=lt(),F=lt(),N=function(t,e){return t===e&&(c=!0),0},W={}.hasOwnProperty,e=[],T=e.pop,D=e.push,S=e.push,Z=e.slice,E=function(t,e){for(var i=0,n=t.length;i+~]|"+R+")"+R+"*"),M=new RegExp(R+"|>"),P=new RegExp(U),j=new RegExp("^"+V+"$"),J={ID:new RegExp("^#("+V+")"),CLASS:new RegExp("^\\.("+V+")"),TAG:new RegExp("^("+V+"|[*])"),ATTR:new RegExp("^"+X),PSEUDO:new RegExp("^"+U),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+R+"*(even|odd|(([+-]|)(\\d*)n|)"+R+"*(?:([+-]|)"+R+"*(\\d+)|))"+R+"*\\)|)","i"),bool:new RegExp("^(?:"+H+")$","i"),needsContext:new RegExp("^"+R+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+R+"*((?:-\\d)?\\d*)"+R+"*\\)|)(?=[^-]|$)","i")},K=/HTML$/i,q=/^(?:input|select|textarea|button)$/i,$=/^h\d$/i,tt=/^[^{]+\{\s*\[native \w/,et=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,it=/[+~]/,nt=new RegExp("\\\\([\\da-f]{1,6}"+R+"?|("+R+")|.)","ig"),st=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ot=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},at=It(function(t){return!0===t.disabled&&"fieldset"===t.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{S.apply(e=Z.call(y.childNodes),y.childNodes),e[y.childNodes.length].nodeType}catch(t){S={apply:e.length?function(t,e){D.apply(t,Z.call(e))}:function(t,e){for(var i=t.length,n=0;t[i++]=e[n++];);t.length=i-1}}}function rt(e,t,i,n){var s,o,a,r,l,c,h,u=t&&t.ownerDocument,d=t?t.nodeType:9;if(i=i||[],"string"!=typeof e||!e||1!==d&&9!==d&&11!==d)return i;if(!n&&((t?t.ownerDocument||t:y)!==x&&C(t),t=t||x,B)){if(11!==d&&(l=et.exec(e)))if(s=l[1]){if(9===d){if(!(a=t.getElementById(s)))return i;if(a.id===s)return i.push(a),i}else if(u&&(a=u.getElementById(s))&&v(t,a)&&a.id===s)return i.push(a),i}else{if(l[2])return S.apply(i,t.getElementsByTagName(e)),i;if((s=l[3])&&p.getElementsByClassName&&t.getElementsByClassName)return S.apply(i,t.getElementsByClassName(s)),i}if(p.qsa&&!F[e+" "]&&(!m||!m.test(e))&&(1!==d||"object"!==t.nodeName.toLowerCase())){if(h=e,u=t,1===d&&M.test(e)){for((r=t.getAttribute("id"))?r=r.replace(st,ot):t.setAttribute("id",r=G),o=(c=f(e)).length;o--;)c[o]="#"+r+" "+yt(c[o]);h=c.join(","),u=it.test(e)&&bt(t.parentNode)||t}try{return S.apply(i,u.querySelectorAll(h)),i}catch(t){F(e,!0)}finally{r===G&&t.removeAttribute("id")}}}return g(e.replace(L,"$1"),t,i,n)}function lt(){var n=[];return function t(e,i){return n.push(e+" ")>I.cacheLength&&delete t[n.shift()],t[e+" "]=i}}function ct(t){return t[G]=!0,t}function ht(t){var e=x.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function ut(t,e){for(var i=t.split("|"),n=i.length;n--;)I.attrHandle[i[n]]=e}function dt(t,e){var i=e&&t,n=i&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(n)return n;if(i)for(;i=i.nextSibling;)if(i===e)return-1;return t?1:-1}function pt(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function ft(i){return function(t){var e=t.nodeName.toLowerCase();return("input"===e||"button"===e)&&t.type===i}}function gt(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&at(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function mt(a){return ct(function(o){return o=+o,ct(function(t,e){for(var i,n=a([],t.length,o),s=n.length;s--;)t[i=n[s]]&&(t[i]=!(e[i]=t[i]))})})}function bt(t){return t&&void 0!==t.getElementsByTagName&&t}for(t in p=rt.support={},a=rt.isXML=function(t){var e=t.namespaceURI,i=(t.ownerDocument||t).documentElement;return!K.test(e||i&&i.nodeName||"HTML")},C=rt.setDocument=function(t){var e,i,n=t?t.ownerDocument||t:y;return n!==x&&9===n.nodeType&&n.documentElement&&(r=(x=n).documentElement,B=!a(x),y!==x&&(i=x.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",s,!1):i.attachEvent&&i.attachEvent("onunload",s)),p.attributes=ht(function(t){return t.className="i",!t.getAttribute("className")}),p.getElementsByTagName=ht(function(t){return t.appendChild(x.createComment("")),!t.getElementsByTagName("*").length}),p.getElementsByClassName=tt.test(x.getElementsByClassName),p.getById=ht(function(t){return r.appendChild(t).id=G,!x.getElementsByName||!x.getElementsByName(G).length}),p.getById?(I.filter.ID=function(t){var e=t.replace(nt,u);return function(t){return t.getAttribute("id")===e}},I.find.ID=function(t,e){if(void 0!==e.getElementById&&B){var i=e.getElementById(t);return i?[i]:[]}}):(I.filter.ID=function(t){var i=t.replace(nt,u);return function(t){var e=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return e&&e.value===i}},I.find.ID=function(t,e){if(void 0!==e.getElementById&&B){var i,n,s,o=e.getElementById(t);if(o){if((i=o.getAttributeNode("id"))&&i.value===t)return[o];for(s=e.getElementsByName(t),n=0;o=s[n++];)if((i=o.getAttributeNode("id"))&&i.value===t)return[o]}return[]}}),I.find.TAG=p.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):p.qsa?e.querySelectorAll(t):void 0}:function(t,e){var i,n=[],s=0,o=e.getElementsByTagName(t);if("*"!==t)return o;for(;i=o[s++];)1===i.nodeType&&n.push(i);return n},I.find.CLASS=p.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&B)return e.getElementsByClassName(t)},h=[],m=[],(p.qsa=tt.test(x.querySelectorAll))&&(ht(function(t){r.appendChild(t).innerHTML="",t.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+R+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||m.push("\\["+R+"*(?:value|"+H+")"),t.querySelectorAll("[id~="+G+"-]").length||m.push("~="),t.querySelectorAll(":checked").length||m.push(":checked"),t.querySelectorAll("a#"+G+"+*").length||m.push(".#.+[+~]")}),ht(function(t){t.innerHTML="";var e=x.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&m.push("name"+R+"*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),r.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),m.push(",.*:")})),(p.matchesSelector=tt.test(b=r.matches||r.webkitMatchesSelector||r.mozMatchesSelector||r.oMatchesSelector||r.msMatchesSelector))&&ht(function(t){p.disconnectedMatch=b.call(t,"*"),b.call(t,"[s!='']:x"),h.push("!=",U)}),m=m.length&&new RegExp(m.join("|")),h=h.length&&new RegExp(h.join("|")),e=tt.test(r.compareDocumentPosition),v=e||tt.test(r.contains)?function(t,e){var i=9===t.nodeType?t.documentElement:t,n=e&&e.parentNode;return t===n||!(!n||1!==n.nodeType||!(i.contains?i.contains(n):t.compareDocumentPosition&&16&t.compareDocumentPosition(n)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},N=e?function(t,e){if(t===e)return c=!0,0;var i=!t.compareDocumentPosition-!e.compareDocumentPosition;return i||(1&(i=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!p.sortDetached&&e.compareDocumentPosition(t)===i?t===x||t.ownerDocument===y&&v(y,t)?-1:e===x||e.ownerDocument===y&&v(y,e)?1:l?E(l,t)-E(l,e):0:4&i?-1:1)}:function(t,e){if(t===e)return c=!0,0;var i,n=0,s=t.parentNode,o=e.parentNode,a=[t],r=[e];if(!s||!o)return t===x?-1:e===x?1:s?-1:o?1:l?E(l,t)-E(l,e):0;if(s===o)return dt(t,e);for(i=t;i=i.parentNode;)a.unshift(i);for(i=e;i=i.parentNode;)r.unshift(i);for(;a[n]===r[n];)n++;return n?dt(a[n],r[n]):a[n]===y?-1:r[n]===y?1:0}),x},rt.matches=function(t,e){return rt(t,null,null,e)},rt.matchesSelector=function(t,e){if((t.ownerDocument||t)!==x&&C(t),p.matchesSelector&&B&&!F[e+" "]&&(!h||!h.test(e))&&(!m||!m.test(e)))try{var i=b.call(t,e);if(i||p.disconnectedMatch||t.document&&11!==t.document.nodeType)return i}catch(t){F(e,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(nt,u),t[3]=(t[3]||t[4]||t[5]||"").replace(nt,u),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||rt.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&rt.error(t[0]),t},PSEUDO:function(t){var e,i=!t[6]&&t[2];return J.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":i&&P.test(i)&&(e=f(i,!0))&&(e=i.indexOf(")",i.length-e)-i.length)&&(t[0]=t[0].slice(0,e),t[2]=i.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(nt,u).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=A[t+" "];return e||(e=new RegExp("(^|"+R+")"+t+"("+R+"|$)"))&&A(t,function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(i,n,s){return function(t){var e=rt.attr(t,i);return null==e?"!="===n:!n||(e+="","="===n?e===s:"!="===n?e!==s:"^="===n?s&&0===e.indexOf(s):"*="===n?s&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function F(t,i,n){return y(i)?G.grep(t,function(t,e){return!!i.call(t,e,t)!==n}):i.nodeType?G.grep(t,function(t){return t===i!==n}):"string"!=typeof i?G.grep(t,function(t){return-1)[^>]*|#([\w-]+))$/;(G.fn.init=function(t,e,i){var n,s;if(!t)return this;if(i=i||N,"string"!=typeof t)return t.nodeType?(this[0]=t,this.length=1,this):y(t)?void 0!==i.ready?i.ready(t):t(G):G.makeArray(t,this);if(!(n="<"===t[0]&&">"===t[t.length-1]&&3<=t.length?[null,t,null]:W.exec(t))||!n[1]&&e)return!e||e.jquery?(e||i).find(t):this.constructor(e).find(t);if(n[1]){if(e=e instanceof G?e[0]:e,G.merge(this,G.parseHTML(n[1],e&&e.nodeType?e.ownerDocument||e:B,!0)),Q.test(n[1])&&G.isPlainObject(e))for(n in e)y(this[n])?this[n](e[n]):this.attr(n,e[n]);return this}return(s=B.getElementById(n[2]))&&(this[0]=s,this.length=1),this}).prototype=G.fn,N=G(B);var T=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};function S(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}G.fn.extend({has:function(t){var e=G(t,this),i=e.length;return this.filter(function(){for(var t=0;t\x20\t\r\n\f]*)/i,ft=/^$|^module$|\/(?:java|ecma)script/i,gt={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function mt(t,e){var i;return i=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&k(t,e)?G.merge([t],i):i}function bt(t,e){for(var i=0,n=t.length;ix",v.noCloneChecked=!!vt.cloneNode(!0).lastChild.defaultValue;var Ct=/^key/,xt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Bt=/^([^.]*)(?:\.(.+)|)/;function Gt(){return!0}function wt(){return!1}function At(t,e){return t===function(){try{return B.activeElement}catch(t){}}()==("focus"===e)}function kt(t,e,i,n,s,o){var a,r;if("object"==typeof e){for(r in"string"!=typeof i&&(n=n||i,i=void 0),e)kt(t,r,i,n,e[r],o);return t}if(null==n&&null==s?(s=i,n=i=void 0):null==s&&("string"==typeof i?(s=n,n=void 0):(s=n,n=i,i=void 0)),!1===s)s=wt;else if(!s)return t;return 1===o&&(a=s,(s=function(t){return G().off(t),a.apply(this,arguments)}).guid=a.guid||(a.guid=G.guid++)),t.each(function(){G.event.add(this,e,s,n,i)})}function Qt(t,s,o){o?(J.set(t,s,!1),G.event.add(t,s,{namespace:!1,handler:function(t){var e,i,n=J.get(this,s);if(1&t.isTrigger&&this[s]){if(n.length)(G.event.special[s]||{}).delegateType&&t.stopPropagation();else if(n=r.call(arguments),J.set(this,s,n),e=o(this,s),this[s](),n!==(i=J.get(this,s))||e?J.set(this,s,!1):i={},n!==i)return t.stopImmediatePropagation(),t.preventDefault(),i.value}else n.length&&(J.set(this,s,{value:G.event.trigger(G.extend(n[0],G.Event.prototype),n.slice(1),this)}),t.stopImmediatePropagation())}})):void 0===J.get(t,s)&&G.event.add(t,s,Gt)}G.event={global:{},add:function(e,t,i,n,s){var o,a,r,l,c,h,u,d,p,f,g,m=J.get(e);if(m)for(i.handler&&(i=(o=i).handler,s=o.selector),s&&G.find.matchesSelector(st,s),i.guid||(i.guid=G.guid++),(l=m.events)||(l=m.events={}),(a=m.handle)||(a=m.handle=function(t){return void 0!==G&&G.event.triggered!==t.type?G.event.dispatch.apply(e,arguments):void 0}),c=(t=(t||"").match(Z)||[""]).length;c--;)p=g=(r=Bt.exec(t[c])||[])[1],f=(r[2]||"").split(".").sort(),p&&(u=G.event.special[p]||{},p=(s?u.delegateType:u.bindType)||p,u=G.event.special[p]||{},h=G.extend({type:p,origType:g,data:n,handler:i,guid:i.guid,selector:s,needsContext:s&&G.expr.match.needsContext.test(s),namespace:f.join(".")},o),(d=l[p])||((d=l[p]=[]).delegateCount=0,u.setup&&!1!==u.setup.call(e,n,f,a)||e.addEventListener&&e.addEventListener(p,a)),u.add&&(u.add.call(e,h),h.handler.guid||(h.handler.guid=i.guid)),s?d.splice(d.delegateCount++,0,h):d.push(h),G.event.global[p]=!0)},remove:function(t,e,i,n,s){var o,a,r,l,c,h,u,d,p,f,g,m=J.hasData(t)&&J.get(t);if(m&&(l=m.events)){for(c=(e=(e||"").match(Z)||[""]).length;c--;)if(p=g=(r=Bt.exec(e[c])||[])[1],f=(r[2]||"").split(".").sort(),p){for(u=G.event.special[p]||{},d=l[p=(n?u.delegateType:u.bindType)||p]||[],r=r[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=d.length;o--;)h=d[o],!s&&g!==h.origType||i&&i.guid!==h.guid||r&&!r.test(h.namespace)||n&&n!==h.selector&&("**"!==n||!h.selector)||(d.splice(o,1),h.selector&&d.delegateCount--,u.remove&&u.remove.call(t,h));a&&!d.length&&(u.teardown&&!1!==u.teardown.call(t,f,m.handle)||G.removeEvent(t,p,m.handle),delete l[p])}else for(p in l)G.event.remove(t,p+e[c],i,n,!0);G.isEmptyObject(l)&&J.remove(t,"handle events")}},dispatch:function(t){var e,i,n,s,o,a,r=G.event.fix(t),l=new Array(arguments.length),c=(J.get(this,"events")||{})[r.type]||[],h=G.event.special[r.type]||{};for(l[0]=r,e=1;e\x20\t\r\n\f]*)[^>]*)\/>/gi,Nt=/\s*$/g;function Dt(t,e){return k(t,"table")&&k(11!==e.nodeType?e:e.firstChild,"tr")&&G(t).children("tbody")[0]||t}function St(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function Zt(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function Et(t,e){var i,n,s,o,a,r,l,c;if(1===e.nodeType){if(J.hasData(t)&&(o=J.access(t),a=J.set(e,o),c=o.events))for(s in delete a.handle,a.events={},c)for(i=0,n=c[s].length;i")},clone:function(t,e,i){var n,s,o,a,r,l,c,h=t.cloneNode(!0),u=ot(t);if(!(v.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||G.isXMLDoc(t)))for(a=mt(h),n=0,s=(o=mt(t)).length;n").attr(i.scriptAttrs||{}).prop({charset:i.scriptCharset,src:i.url}).on("load error",s=function(t){n.remove(),s=null,t&&e("error"===t.type?404:200,t.type)}),B.head.appendChild(n[0])},abort:function(){s&&s()}}});var ii,ni=[],si=/(=)\?(?=&|$)|\?\?/;G.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=ni.pop()||G.expando+"_"+De++;return this[t]=!0,t}}),G.ajaxPrefilter("json jsonp",function(t,e,i){var n,s,o,a=!1!==t.jsonp&&(si.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&si.test(t.data)&&"data");if(a||"jsonp"===t.dataTypes[0])return n=t.jsonpCallback=y(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a?t[a]=t[a].replace(si,"$1"+n):!1!==t.jsonp&&(t.url+=(Se.test(t.url)?"&":"?")+t.jsonp+"="+n),t.converters["script json"]=function(){return o||G.error(n+" was not called"),o[0]},t.dataTypes[0]="json",s=x[n],x[n]=function(){o=arguments},i.always(function(){void 0===s?G(x).removeProp(n):x[n]=s,t[n]&&(t.jsonpCallback=e.jsonpCallback,ni.push(n)),o&&y(s)&&s(o[0]),o=s=void 0}),"script"}),v.createHTMLDocument=((ii=B.implementation.createHTMLDocument("").body).innerHTML="
",2===ii.childNodes.length),G.parseHTML=function(t,e,i){return"string"!=typeof t?[]:("boolean"==typeof e&&(i=e,e=!1),e||(v.createHTMLDocument?((n=(e=B.implementation.createHTMLDocument("")).createElement("base")).href=B.location.href,e.head.appendChild(n)):e=B),o=!i&&[],(s=Q.exec(t))?[e.createElement(s[1])]:(s=_t([t],e,o),o&&o.length&&G(o).remove(),G.merge([],s.childNodes)));var n,s,o},G.fn.load=function(t,e,i){var n,s,o,a=this,r=t.indexOf(" ");return-1").append(G.parseHTML(t)).find(n):t)}).always(i&&function(t,e){a.each(function(){i.apply(this,o||[t.responseText,e,t])})}),this},G.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){G.fn[e]=function(t){return this.on(e,t)}}),G.expr.pseudos.animated=function(e){return G.grep(G.timers,function(t){return e===t.elem}).length},G.offset={setOffset:function(t,e,i){var n,s,o,a,r,l,c=G.css(t,"position"),h=G(t),u={};"static"===c&&(t.style.position="relative"),r=h.offset(),o=G.css(t,"top"),l=G.css(t,"left"),s=("absolute"===c||"fixed"===c)&&-1<(o+l).indexOf("auto")?(a=(n=h.position()).top,n.left):(a=parseFloat(o)||0,parseFloat(l)||0),y(e)&&(e=e.call(t,i,G.extend({},r))),null!=e.top&&(u.top=e.top-r.top+a),null!=e.left&&(u.left=e.left-r.left+s),"using"in e?e.using.call(t,u):h.css(u)}},G.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){G.offset.setOffset(this,e,t)});var t,i,n=this[0];return n?n.getClientRects().length?(t=n.getBoundingClientRect(),i=n.ownerDocument.defaultView,{top:t.top+i.pageYOffset,left:t.left+i.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var t,e,i,n=this[0],s={top:0,left:0};if("fixed"===G.css(n,"position"))e=n.getBoundingClientRect();else{for(e=this.offset(),i=n.ownerDocument,t=n.offsetParent||i.documentElement;t&&(t===i.body||t===i.documentElement)&&"static"===G.css(t,"position");)t=t.parentNode;t&&t!==n&&1===t.nodeType&&((s=G(t).offset()).top+=G.css(t,"borderTopWidth",!0),s.left+=G.css(t,"borderLeftWidth",!0))}return{top:e.top-s.top-G.css(n,"marginTop",!0),left:e.left-s.left-G.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent;t&&"static"===G.css(t,"position");)t=t.offsetParent;return t||st})}}),G.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,s){var o="pageYOffset"===s;G.fn[e]=function(t){return Y(this,function(t,e,i){var n;if(g(t)?n=t:9===t.nodeType&&(n=t.defaultView),void 0===i)return n?n[s]:t[e];n?n.scrollTo(o?n.pageXOffset:i,o?i:n.pageYOffset):t[e]=i},e,t,arguments.length)}}),G.each(["top","left"],function(t,i){G.cssHooks[i]=$t(v.pixelPosition,function(t,e){if(e)return e=qt(t,i),Mt.test(e)?G(t).position()[i]+"px":e})}),G.each({Height:"height",Width:"width"},function(a,r){G.each({padding:"inner"+a,content:r,"":"outer"+a},function(n,o){G.fn[o]=function(t,e){var i=arguments.length&&(n||"boolean"!=typeof t),s=n||(!0===t||!0===e?"margin":"border");return Y(this,function(t,e,i){var n;return g(t)?0===o.indexOf("outer")?t["inner"+a]:t.document.documentElement["client"+a]:9===t.nodeType?(n=t.documentElement,Math.max(t.body["scroll"+a],n["scroll"+a],t.body["offset"+a],n["offset"+a],n["client"+a])):void 0===i?G.css(t,e,s):G.style(t,e,i,s)},r,i?t:void 0,i)}})}),G.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(t,i){G.fn[i]=function(t,e){return 0",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,n,s,o=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(n=o[t]=x.widget.extend({},this.options[t]),s=0;s
"),n=i.children()[0];return x("body").append(i),t=n.offsetWidth,i.css("overflow","scroll"),t===(e=n.offsetWidth)&&(e=i[0].clientWidth),i.remove(),o=t-e},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===e||"auto"===e&&t.widthC(B(n),B(s))?o.important="horizontal":o.important="vertical",u.using.call(this,t,o)}),a.offset(x.extend(c,{using:t}))})},x.ui.position={fit:{left:function(t,e){var i,n=e.within,s=n.isWindow?n.scrollLeft:n.offset.left,o=n.width,a=t.left-e.collisionPosition.marginLeft,r=s-a,l=a+e.collisionWidth-o-s;e.collisionWidth>o?0o?0")[0],_=u.each,I.style.cssText="background-color:rgba(1,1,1,.5)",y.rgba=-1o.mod/2?n+=o.mod:n-s>o.mod/2&&(n-=o.mod)),c[i]=X((s-n)*a+n,e)))}),this[e](c)},blend:function(t){if(1===this._rgba[3])return this;var e=this._rgba.slice(),i=e.pop(),n=m(t)._rgba;return m(u.map(e,function(t,e){return(1-i)*n[e]+i*t}))},toRgbaString:function(){var t="rgba(",e=u.map(this._rgba,function(t,e){return null==t?2").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:i.width(),height:i.height()},s=document.activeElement;try{s.id}catch(t){s=document.body}return i.wrap(t),i[0]!==s&&!x.contains(i[0],s)||x(s).trigger("focus"),t=i.parent(),"static"===i.css("position")?(t.css({position:"relative"}),i.css({position:"relative"})):(x.extend(n,{position:i.css("position"),zIndex:i.css("z-index")}),x.each(["top","left","bottom","right"],function(t,e){n[e]=i.css(e),isNaN(parseInt(n[e],10))&&(n[e]="auto")}),i.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),i.css(e),t.css(n).show()},removeWrapper:function(t){var e=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),t[0]!==e&&!x.contains(t[0],e)||x(e).trigger("focus")),t}}),x.extend(x.effects,{version:"1.12.1",define:function(t,e,i){return i||(i=e,e="effect"),x.effects.effect[t]=i,x.effects.effect[t].mode=e,i},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var n="horizontal"!==i?(e||100)/100:1,s="vertical"!==i?(e||100)/100:1;return{height:t.height()*s,width:t.width()*n,outerHeight:t.outerHeight()*s,outerWidth:t.outerWidth()*n}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var n=t.queue();1").insertAfter(t).css({display:/^(inline|ruby)/.test(t.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight"),float:t.css("float")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).addClass("ui-effects-placeholder"),t.data(E+"placeholder",e)),t.css({position:i,left:n.left,top:n.top}),e},removePlaceholder:function(t){var e=E+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(t){x.effects.restoreStyle(t),x.effects.removePlaceholder(t)},setTransition:function(n,t,s,o){return o=o||{},x.each(t,function(t,e){var i=n.cssUnit(e);0").appendTo("body").addClass(t.className).css({top:h.top-a,left:h.left-r,height:i.innerHeight(),width:i.innerWidth(),position:s?"fixed":"absolute"}).animate(c,t.duration,t.easing,function(){u.remove(),x.isFunction(e)&&e()})}}),x.fx.step.clip=function(t){t.clipInit||(t.start=x(t.elem).cssClip(),"string"==typeof t.end&&(t.end=M(t.end,t.elem)),t.clipInit=!0),x(t.elem).cssClip({top:t.pos*(t.end.top-t.start.top)+t.start.top,right:t.pos*(t.end.right-t.start.right)+t.start.right,bottom:t.pos*(t.end.bottom-t.start.bottom)+t.start.bottom,left:t.pos*(t.end.left-t.start.left)+t.start.left})},Z={},x.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,t){Z[t]=function(t){return Math.pow(t,e+2)}}),x.extend(Z,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),x.each(Z,function(t,e){x.easing["easeIn"+t]=e,x.easing["easeOut"+t]=function(t){return 1-e(1-t)},x.easing["easeInOut"+t]=function(t){return t<.5?e(2*t)/2:1-e(-2*t+2)/2}});x.effects,x.effects.define("blind","hide",function(t,e){var i={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},n=x(this),s=t.direction||"up",o=n.cssClip(),a={clip:x.extend({},o)},r=x.effects.createPlaceholder(n);a.clip[i[s][0]]=a.clip[i[s][1]],"show"===t.mode&&(n.cssClip(a.clip),r&&r.css(x.effects.clipToBox(a)),a.clip=o),r&&r.animate(x.effects.clipToBox(a),t.duration,t.easing),n.animate(a,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),x.effects.define("bounce",function(t,e){var i,n,s,o=x(this),a=t.mode,r="hide"===a,l="show"===a,c=t.direction||"up",h=t.distance,u=t.times||5,d=2*u+(l||r?1:0),p=t.duration/d,f=t.easing,g="up"===c||"down"===c?"top":"left",m="up"===c||"left"===c,b=0,v=o.queue().length;for(x.effects.createPlaceholder(o),s=o.css(g),h=h||o["top"==g?"outerHeight":"outerWidth"]()/3,l&&((n={opacity:1})[g]=s,o.css("opacity",0).css(g,m?2*-h:2*h).animate(n,p,f)),r&&(h/=Math.pow(2,u-1)),(n={})[g]=s;b").css({position:"absolute",visibility:"visible",left:-n*p,top:-i*f}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:p,height:f,left:s+(u?a*p:0),top:o+(u?r*f:0),opacity:u?0:1}).animate({left:s+(u?0:a*p),top:o+(u?0:r*f),opacity:u?1:0},t.duration||500,t.easing,m)}),x.effects.define("fade","toggle",function(t,e){var i="show"===t.mode;x(this).css("opacity",i?0:1).animate({opacity:i?1:0},{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),x.effects.define("fold","hide",function(e,t){var i=x(this),n=e.mode,s="show"===n,o="hide"===n,a=e.size||15,r=/([0-9]+)%/.exec(a),l=!!e.horizFirst?["right","bottom"]:["bottom","right"],c=e.duration/2,h=x.effects.createPlaceholder(i),u=i.cssClip(),d={clip:x.extend({},u)},p={clip:x.extend({},u)},f=[u[l[0]],u[l[1]]],g=i.queue().length;r&&(a=parseInt(r[1],10)/100*f[o?0:1]),d.clip[l[0]]=a,p.clip[l[0]]=a,p.clip[l[1]]=0,s&&(i.cssClip(p.clip),h&&h.css(x.effects.clipToBox(p)),p.clip=u),i.queue(function(t){h&&h.animate(x.effects.clipToBox(d),c,e.easing).animate(x.effects.clipToBox(p),c,e.easing),t()}).animate(d,c,e.easing).animate(p,c,e.easing).queue(t),x.effects.unshift(i,g,4)}),x.effects.define("highlight","show",function(t,e){var i=x(this),n={backgroundColor:i.css("backgroundColor")};"hide"===t.mode&&(n.opacity=0),x.effects.saveStyle(i),i.css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(n,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),x.effects.define("size",function(s,e){var t,o,i,n=x(this),a=["fontSize"],r=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],l=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=s.mode,h="effect"!==c,u=s.scale||"both",d=s.origin||["middle","center"],p=n.css("position"),f=n.position(),g=x.effects.scaledDimensions(n),m=s.from||g,b=s.to||x.effects.scaledDimensions(n,0);x.effects.createPlaceholder(n),"show"===c&&(i=m,m=b,b=i),o={from:{y:m.height/g.height,x:m.width/g.width},to:{y:b.height/g.height,x:b.width/g.width}},"box"!==u&&"both"!==u||(o.from.y!==o.to.y&&(m=x.effects.setTransition(n,r,o.from.y,m),b=x.effects.setTransition(n,r,o.to.y,b)),o.from.x!==o.to.x&&(m=x.effects.setTransition(n,l,o.from.x,m),b=x.effects.setTransition(n,l,o.to.x,b))),"content"!==u&&"both"!==u||o.from.y!==o.to.y&&(m=x.effects.setTransition(n,a,o.from.y,m),b=x.effects.setTransition(n,a,o.to.y,b)),d&&(t=x.effects.getBaseline(d,g),m.top=(g.outerHeight-m.outerHeight)*t.y+f.top,m.left=(g.outerWidth-m.outerWidth)*t.x+f.left,b.top=(g.outerHeight-b.outerHeight)*t.y+f.top,b.left=(g.outerWidth-b.outerWidth)*t.x+f.left),n.css(m),"content"!==u&&"both"!==u||(r=r.concat(["marginTop","marginBottom"]).concat(a),l=l.concat(["marginLeft","marginRight"]),n.find("*[width]").each(function(){var t=x(this),e=x.effects.scaledDimensions(t),i={height:e.height*o.from.y,width:e.width*o.from.x,outerHeight:e.outerHeight*o.from.y,outerWidth:e.outerWidth*o.from.x},n={height:e.height*o.to.y,width:e.width*o.to.x,outerHeight:e.height*o.to.y,outerWidth:e.width*o.to.x};o.from.y!==o.to.y&&(i=x.effects.setTransition(t,r,o.from.y,i),n=x.effects.setTransition(t,r,o.to.y,n)),o.from.x!==o.to.x&&(i=x.effects.setTransition(t,l,o.from.x,i),n=x.effects.setTransition(t,l,o.to.x,n)),h&&x.effects.saveStyle(t),t.css(i),t.animate(n,s.duration,s.easing,function(){h&&x.effects.restoreStyle(t)})})),n.animate(b,{queue:!1,duration:s.duration,easing:s.easing,complete:function(){var t=n.offset();0===b.opacity&&n.css("opacity",m.opacity),h||(n.css("position","static"===p?"relative":p).offset(t),x.effects.saveStyle(n)),e()}})}),x.effects.define("scale",function(t,e){var i=x(this),n=t.mode,s=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"effect"!==n?0:100),o=x.extend(!0,{from:x.effects.scaledDimensions(i),to:x.effects.scaledDimensions(i,s,t.direction||"both"),origin:t.origin||["middle","center"]},t);t.fade&&(o.from.opacity=1,o.to.opacity=0),x.effects.effect.size.call(this,o,e)}),x.effects.define("puff","hide",function(t,e){var i=x.extend(!0,{},t,{fade:!0,percent:parseInt(t.percent,10)||150});x.effects.effect.scale.call(this,i,e)}),x.effects.define("pulsate","show",function(t,e){var i=x(this),n=t.mode,s="show"===n,o=s||"hide"===n,a=2*(t.times||5)+(o?1:0),r=t.duration/a,l=0,c=1,h=i.queue().length;for(!s&&i.is(":visible")||(i.css("opacity",0).show(),l=1);c?@[\]^`{|}~])/g,function(t){return t.replace(P,"\\$1")}),x.fn.labels=function(){var t,e,i,n,s;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),(i=this.attr("id"))&&(s=(t=this.eq(0).parents().last()).add(t.length?t.siblings():this.siblings()),e="label[for='"+x.ui.escapeSelector(i)+"']",n=n.add(s.find(e).addBack(e))),this.pushStack(n))},x.fn.scrollParent=function(t){var e=this.css("position"),i="absolute"===e,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,s=this.parents().filter(function(){var t=x(this);return(!i||"static"!==t.css("position"))&&n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&s.length?s:x(this[0].ownerDocument||document)},x.extend(x.expr[":"],{tabbable:function(t){var e=x.attr(t,"tabindex"),i=null!=e;return(!i||0<=e)&&x.ui.focusable(t,i)}}),x.fn.extend({uniqueId:(j=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++j)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&x(this).removeAttr("id")})}}),x.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=x(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),t.collapsible||!1!==t.active&&null!=t.active||(t.active=0),this._processPanels(),t.active<0&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():x()}},_createIcons:function(){var t,e,i=this.options.icons;i&&(t=x(""),this._addClass(t,"ui-accordion-header-icon","ui-icon "+i.header),t.prependTo(this.headers),e=this.active.children(".ui-accordion-header-icon"),this._removeClass(e,i.header)._addClass(e,null,i.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){"active"!==t?("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||!1!==this.options.active||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons())):this._activate(e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var e=x.ui.keyCode,i=this.headers.length,n=this.headers.index(t.target),s=!1;switch(t.keyCode){case e.RIGHT:case e.DOWN:s=this.headers[(n+1)%i];break;case e.LEFT:case e.UP:s=this.headers[(n-1+i)%i];break;case e.SPACE:case e.ENTER:this._eventHandler(t);break;case e.HOME:s=this.headers[0];break;case e.END:s=this.headers[i-1]}s&&(x(t.target).attr("tabIndex",-1),x(s).attr("tabIndex",0),x(s).trigger("focus"),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===x.ui.keyCode.UP&&t.ctrlKey&&x(t.currentTarget).prev().trigger("focus")},refresh:function(){var t=this.options;this._processPanels(),!1===t.active&&!0===t.collapsible||!this.headers.length?(t.active=!1,this.active=x()):!1===t.active?this._activate(0):this.active.length&&!x.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=x()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var i,t=this.options,e=t.heightStyle,n=this.element.parent();this.active=this._findActive(t.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var t=x(this),e=t.uniqueId().attr("id"),i=t.next(),n=i.uniqueId().attr("id");t.attr("aria-controls",n),i.attr("aria-labelledby",e)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(t.event),"fill"===e?(i=n.height(),this.element.siblings(":visible").each(function(){var t=x(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=x(this).outerHeight(!0)}),this.headers.next().each(function(){x(this).height(Math.max(0,i-x(this).innerHeight()+x(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.headers.next().each(function(){var t=x(this).is(":visible");t||x(this).show(),i=Math.max(i,x(this).css("height","").height()),t||x(this).hide()}).height(i))},_activate:function(t){var e=this._findActive(t)[0];e!==this.active[0]&&(e=e||this.active[0],this._eventHandler({target:e,currentTarget:e,preventDefault:x.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):x()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&x.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var e,i,n=this.options,s=this.active,o=x(t.currentTarget),a=o[0]===s[0],r=a&&n.collapsible,l=r?x():o.next(),c=s.next(),h={oldHeader:s,oldPanel:c,newHeader:r?x():o,newPanel:l};t.preventDefault(),a&&!n.collapsible||!1===this._trigger("beforeActivate",t,h)||(n.active=!r&&this.headers.index(o),this.active=a?x():o,this._toggle(h),this._removeClass(s,"ui-accordion-header-active","ui-state-active"),n.icons&&(e=s.children(".ui-accordion-header-icon"),this._removeClass(e,null,n.icons.activeHeader)._addClass(e,null,n.icons.header)),a||(this._removeClass(o,"ui-accordion-header-collapsed")._addClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.header)._addClass(i,null,n.icons.activeHeader)),this._addClass(o.next(),"ui-accordion-content-active")))},_toggle:function(t){var e=t.newPanel,i=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=e,this.prevHide=i,this.options.animate?this._animate(e,i,t):(i.hide(),e.show(),this._toggleComplete(t)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),e.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):e.length&&this.headers.filter(function(){return 0===parseInt(x(this).attr("tabIndex"),10)}).attr("tabIndex",-1),e.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,i,e){function n(){r._toggleComplete(e)}var s,o,a,r=this,l=0,c=t.css("box-sizing"),h=t.length&&(!i.length||t.index()",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(t){var e=x(t.target),i=x(x.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&i.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var e=x(t.target).closest(".ui-menu-item"),i=x(t.currentTarget);e[0]===i[0]&&(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(t,i))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(t){this._delay(function(){x.contains(this.element[0],x.ui.safeActiveElement(this.document[0]))||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var t=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),t.children().each(function(){var t=x(this);t.data("ui-menu-submenu-caret")&&t.remove()})},_keydown:function(t){var e,i,n,s,o=!0;switch(t.keyCode){case x.ui.keyCode.PAGE_UP:this.previousPage(t);break;case x.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case x.ui.keyCode.HOME:this._move("first","first",t);break;case x.ui.keyCode.END:this._move("last","last",t);break;case x.ui.keyCode.UP:this.previous(t);break;case x.ui.keyCode.DOWN:this.next(t);break;case x.ui.keyCode.LEFT:this.collapse(t);break;case x.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case x.ui.keyCode.ENTER:case x.ui.keyCode.SPACE:this._activate(t);break;case x.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,i=this.previousFilter||"",s=!1,n=96<=t.keyCode&&t.keyCode<=105?(t.keyCode-96).toString():String.fromCharCode(t.keyCode),clearTimeout(this.filterTimer),n===i?s=!0:n=i+n,e=this._filterMenuItems(n),(e=s&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(n=String.fromCharCode(t.keyCode),e=this._filterMenuItems(n)),e.length?(this.focus(t,e),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var t,e,i,n,s=this,o=this.options.icons.submenu,a=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),e=a.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=x(this),e=t.prev(),i=x("").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+o),e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),this._addClass(e,"ui-menu","ui-widget ui-widget-content ui-front"),(t=a.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=x(this);s._isDivider(t)&&s._addClass(t,"ui-menu-divider","ui-widget-content")}),n=(i=t.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(i,"ui-menu-item")._addClass(n,"ui-menu-item-wrapper"),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!x.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,n,s;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),n=this.active.children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",n.attr("id")),s=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,n,s,o,a;this._hasScroll()&&(e=parseFloat(x.css(this.activeMenu[0],"borderTopWidth"))||0,i=parseFloat(x.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset().top-this.activeMenu.offset().top-e-i,s=this.activeMenu.scrollTop(),o=this.activeMenu.height(),a=t.outerHeight(),n<0?this.activeMenu.scrollTop(s+n):o",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var i,n,s,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,o="input"===t;this.isMultiLine=e||!o&&this._isContentEditable(this.element),this.valueMethod=this.element[e||o?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))n=s=i=!0;else{n=s=i=!1;var e=x.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:n=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)return i=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||t.preventDefault());if(!n){var e=x.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){if(s)return s=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){this.cancelBlur?delete this.cancelBlur:(clearTimeout(this.searching),this.close(t),this._change(t))}}),this._initSource(),this.menu=x("