Symptoms
PBA allows to change status of an order via public API according the defined order flow using the OrderStatusChange_API method. The method requires a signature parameter which is an MD5 sum of concatenated order details:
- Order ID
- Order number
- Creation time
- Total amount
- Description
The order details listed above may be obtained with the help of a GetOrder_API API method which returns an XML structure that needs to be carefully parsed to generate signature for OrderStatusChange_API. It may take much time to generate correct signature manually.
Resolution
The following Python script may be used as a helper for a signature generation. It uses GetOrder_API for a specified order ID and then calculates the signature according to rules provided for OrderStatusChange_API. It should be mentioned that the provided script is merely a helper and cannot be used as a part of any production software without proper testing. Official requirements of signature calculation should be taken from the OrderStatusChange_API description.
- Download the attached Python script signature.pysignature.py to any place on the Billing Application server;
Execute the script passing the order ID as an argument:
# python signature.py 10653 91519941f7f39798100b11a0d165747a
- Output of the script (seen in the examples above) is the signature that should be used in the OrderStatusChange_API method.
Script description
Usage:
# python signature.py [-h] [--bm-root BM_ROOT] [-v] order_id
- The script has a built-in help. To see them, call the script with --help parameter.
- The script automatically detects the price precision (taken from /usr/local/stellart/share/currencies.txt) and generates the signature accordingly.
Attachments:
- signature.py (4 KB)