Back to top
Vastuu Group

SignSpace connector with tests

Version: 1.0
Last updated: June 11, 2020
|
Reading time: 2 min

Get it now

SignSpace is a platform for creating, signing, and storing agreements, contracts and documents. The SignSpace connector fetches agreements from the SignSpace API and lists them (displaying a quantity of so-called “Signing requests” in a response to a PoT Broker request).

Using appropriate parameters, you can specify, for example, to list contracts which were “Cancelled” or “In progress” of signing etc. You can set the startDate and/or endDate, etc. boundaries and other similar things.

Below is a sample python script to test the connector via the Broker requests:

import base64
import hashlib
import hmac
import json
import sys
from pprint import pprint
import requests
BROKER_URL = "https://api-test.oftrust.net/broker/v1/fetch-data-product"
DATA_PRODUCT = "<data-product-name>"
CLIENT_SECRET = "GFtQtZ...1vr70dQ"
CLIENT_TOKEN = "eyJ0eXAiO...WHTb37f6F5U9JzerQ"
connector_body = json.loads(sys.argv[1])
body = {
    "productCode": DATA_PRODUCT,
    "parameters": connector_body,
    "timestamp": "2020-06-03T11:32:00+03:00",
}
signature = base64.b64encode(
    hmac.new(
        CLIENT_SECRET.encode("utf-8"),
        json.dumps(body, sort_keys=True, indent=None, separators=(",", ": "))
        .strip()
        .encode("utf-8"),
        hashlib.sha256,
    ).digest()
).decode()
resp = requests.post(
    BROKER_URL,
    json=body,
    headers={"X-Pot-Signature": signature, "X-App-Token": CLIENT_TOKEN},
)
print(resp)
pprint(resp.json())

DATA_PRODUCT contains the name of the Data Product that you want to use to fetch the data.

CLIENT_SECRET and CLIENT_TOKEN can be obtained from the Application that you register to consume the data product.

Run the following command in shell to list a set of contracts that were made between 2019-10-19T13:20:09+03:00 and 2020-10-19T13:20:09+03:00, from the country Finland and with statuses: Cancelled, In Progress and Open:

python3.7 <script-name>.py '{"idOfficial":"3042282-9","country":"fi","status":["Canceled","In Progress","Open"],"endTime":"2020-10-19T13:20:09+03:00","startTime":"2019-10-19T13:20:09+03:00","limit":5,"offset":0,"queryText":"","filter":[]}'

You can access the associated tests in robot framework here

Get the SignSpace connector and tests

Something not working?

Identified an issue? Report it to GitHub