Payability internal services
Three clients talk to Payability’s own platform. All three authenticate with PybApiAuth
(pyb-sdk), which exchanges the Basic PAYABILITY_AUTH_TOKEN for an X-Session-Token and
attaches it to every request — no separate credential is needed.
components/payability_internal_api.py
Base URL PAYABILITY_INTERNAL_API_URL (https://api.payability.com/v1/mp in release,
https://<env>.dev.payability.com/database_v2 in dev).
| Method | Call |
|---|---|
|
|
|
|
|
|
|
|
|
|
Per-file metadata on upload
document_type and compliance_key are single values applied to the whole call.
sides, expiration_dates, file_document_types and file_issuing_countries are positional
arrays emitted as repeated form fields — one entry per files part, in order, empty string where
a file has no value — so the server can align them with the uploaded parts. The form field names
differ slightly from the Python argument names:
| Argument | Form field |
|---|---|
|
|
|
|
|
|
|
|
The data payload is built as an ordered list of tuples rather than a dict, precisely so those
keys can repeat.
Error bodies are preserved
The three document methods go through _raise_with_body, which raises requests.HTTPError with
a truncated copy of the upstream body in the message:
def _raise_with_body(response: requests.Response):
if response.ok:
return
body = (response.text or '')[:1000]
raise requests.HTTPError(
'{status} {reason} for url: {url} - response body: {body}'.format(...),
response=response
)
A bare raise_for_status() would discard the rejection reason (an invalid compliance_key, an
unaccepted file, an unknown document id), which is what makes 4xx responses debuggable in the
worker logs and in the SWF failure details.
get_supplier_info and get_user_perms still use plain raise_for_status().
components/pyb_documents.py
Fetches previously uploaded identity-document images from the PYB Documents service
(PYB_DOCUMENTS_URL).
def get_document(self, document_identifier: str) -> bytes:
response = self.__session.get(
url='{}/documents/{}'.format(settings.PYB_DOCUMENTS_URL, document_identifier)
)
if response.status_code == 404:
raise DocumentNotFound(document_identifier)
response.raise_for_status()
return response.content
Used by the Au10tix handle task to obtain the image it submits for verification.
components/b2b_task_manager.py
Starts SWF workflows through the shared B2B Task Manager HTTP service
(B2B_TASK_MANAGER_URL) — the Web API never calls SWF directly.
-
start_swf(domain, workflow_type, workflow_type_version, workflow_identifier, input_body)→POST /executeWorkflow, injectinggcifromB2B_TASK_MANAGER_GCIandtaskList=default. -
A 2xx response carrying
errorMessagesorexceptionMessagesraisesCannotRunWorkflow, which rendersWorkflowExecutionAlreadyStartedas"Task already running". Because it is aTaskExecutionError,task_failure_handlingre-raises it untouched and the API answers400(or409for the Entrust reprocess path).
Full detail: SWF orchestration.
Who uses what
| Consumer | Internal calls |
|---|---|
Au10tix handle task |
|
Entrust session endpoint |
|
Entrust aftermath task |
|
|
|
Every request task, the Entrust webhook, the Entrust reprocess path |
|
The document upload route expects the PermCode.INT_LOGIN carried by the session token that
PybApiAuth obtains, which is why no extra secret is involved.