Overview
This documentation outlines the required imports and initializations for the Purchase Order module in both Python and PHP. These imports ensure that the necessary classes, services, and configurations are available to manage purchase orders.
Common Imports Requirements
The following imports are required for running the Purchase Order module in Python and PHP:
from exsited.exsited.common.dto.common_dto import TaxDTO
from exsited.exsited.exsited_sdk import ExsitedSDK
from exsited.exsited.purchase_order.dto.purchase_order_dto import (
PurchaseOrderListDTO, PurchaseOrderDetailsDTO, PurchaseOrderDTO,PurchaseOrderCreateDTO, PurchaseOrderDataDTO
)
from exsited.common.ab_exception import ABException
from exsited.common.sdk_conf import SDKConfig
from config import CommonData
require '../../vendor/autoload.php';
use Api\Component\ApiConfig;
use Api\AppService\PurchaseOrder\PurchaseOrderData;
use Api\ApiHelper\Config\ConfigManager;
Function: listPurchaseOrdersBasic
Purpose
listPurchaseOrdersBasic()
is used to obtain a complete list of purchase orders, allowing users to view details for multiple orders in one request. This function manages the request, processes the response, and handles exceptions, supporting straightforward integration in both Python and PHP environments.
Parameters
This function does not require any input parameters.
Use Case
The listPurchaseOrdersBasic()
function retrieves and displays a list of all purchase orders in the Exsited Portal. This feature is designed to allow users to view and manage purchase orders from various suppliers easily. By calling list() in Python or readAll() in PHP, the function fetches purchase orders and outputs them in a readable format. In case of any errors during the request, the code captures and displays relevant error messages for debugging. This functionality is beneficial for supplier-based order tracking, ensuring that users can access comprehensive purchase order details directly in the Exsited Portal.
def list_PurchaseOrders_Basic():
SDKConfig.PRINT_REQUEST_DATA = False
SDKConfig.PRINT_RAW_RESPONSE = False
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = exsited_sdk.purchase_order.list()
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function listPurchaseOrdersBasic()
{
try {
$response = $this->purchaseOrderService->readAll();
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The output of listPurchaseOrdersBasic()
is a JSON object containing a purchase_orders array, where each entry represents a purchase order with details such as id, accountId, item, quantity, currency, price, date, and status. This standardized output allows for efficient tracking and management of purchase orders across both Python and PHP implementations.
{
purchaseOrders: [
{
status: "ACTIVE",
id: "PURCHASE_ORDER_ID",
currency: {
uuid: "CURRENCY_UUID",
name: "CURRENCY_NAME",
link: "CURRENCY_LINK"
},
supplierInvoiceId: "SUPPLIER_INVOICE_ID",
issueDate: "ISSUE_DATE",
dueDate: "DUE_DATE",
expectedCompletionDate: "EXPECTED_COMPLETION_DATE",
subtotal: "SUBTOTAL",
tax: "TAX",
total: "TOTAL",
priceTaxInclusive: "PRICE_TAX_INCLUSIVE",
purchaseOrderNote: "PURCHASE_ORDER_NOTE",
accountId: "ACCOUNT_ID",
createdBy: "CREATED_BY",
createdOn: "CREATED_ON",
lastUpdatedBy: "LAST_UPDATED_BY",
lastUpdatedOn: "LAST_UPDATED_ON",
uuid: "PURCHASE_ORDER_UUID",
version: "VERSION",
customAttributes: [],
customObjects: [],
lines: [
{
subtotal: "LINE_SUBTOTAL",
total: "LINE_TOTAL",
tax: "LINE_TAX",
itemUuid: "ITEM_UUID",
itemId: "ITEM_ID",
itemName: "ITEM_NAME",
itemQuantity: "ITEM_QUANTITY",
itemPriceSnapshot: {
pricingRule: {
uuid: "PRICING_RULE_UUID",
version: "PRICING_RULE_VERSION",
priceType: "PRICE_TYPE",
price: "PRICE",
uom: "UNIT_OF_MEASURE",
warehouse: "WAREHOUSE",
pricingVersion: "PRICING_VERSION",
latestUsedPricingVersion: "LATEST_USED_PRICING_VERSION"
}
},
itemPurchaseTaxConfiguration: {
purchasePriceIsTaxInclusive: "PURCHASE_PRICE_TAX_INCLUSIVE",
taxCode: {
uuid: "TAX_CODE_UUID",
code: "TAX_CODE",
rate: "TAX_RATE",
link: "TAX_LINK"
}
},
itemPriceTaxExempt: "ITEM_PRICE_TAX_EXEMPT",
itemPriceTax: {
uuid: "ITEM_TAX_UUID",
code: "ITEM_TAX_CODE",
rate: "ITEM_TAX_RATE",
link: "ITEM_TAX_LINK"
},
purchaseOrderNote: "LINE_PURCHASE_ORDER_NOTE",
itemAccountingCode: {
costOfGoodsSold: "COST_OF_GOODS_SOLD"
},
uuid: "LINE_UUID",
version: "LINE_VERSION",
itemSerialOrBatchNumber: "ITEM_SERIAL_OR_BATCH_NUMBER"
}
],
kpis: {
totalExpense: "TOTAL_EXPENSE",
estimatedTotal: "ESTIMATED_TOTAL",
totalOutstanding: "TOTAL_OUTSTANDING",
totalOverdue: "TOTAL_OVERDUE",
lastInvoiceIssueDate: "LAST_INVOICE_ISSUE_DATE",
lastInvoiceTotal: "LAST_INVOICE_TOTAL",
totalPurchaseInvoice: "TOTAL_PURCHASE_INVOICE",
lastReactivatedOn: "LAST_REACTIVATED_ON",
lastCancelledOn: "LAST_CANCELLED_ON",
lastChangedOn: "LAST_CHANGED_ON",
lastDeletedOn: "LAST_DELETED_ON",
issueDate: "KPI_ISSUE_DATE"
}
}
]
}
{
{
"purchase_orders": [
{
"status": "{STATUS}",
"id": "{PURCHASE_ORDER_ID}",
"currency": {
"uuid": "{CURRENCY_UUID}",
"name": "{CURRENCY_NAME}",
"link": "{CURRENCY_LINK}"
},
"supplier_invoice_id": "{SUPPLIER_INVOICE_ID}",
"issue_date": "{ISSUE_DATE}",
"due_date": "{DUE_DATE}",
"expected_completion_date": "{EXPECTED_COMPLETION_DATE}",
"subtotal": "{SUBTOTAL}",
"tax": "{TAX}",
"total": "{TOTAL}",
"price_tax_inclusive": "{PRICE_TAX_INCLUSIVE}",
"purchase_order_note": "{PURCHASE_ORDER_NOTE}",
"account_id": "{ACCOUNT_ID}",
"created_by": "{CREATED_BY}",
"created_on": "{CREATED_ON}",
"last_updated_by": "{LAST_UPDATED_BY}",
"last_updated_on": "{LAST_UPDATED_ON}",
"uuid": "{PURCHASE_ORDER_UUID}",
"version": "{VERSION}",
"custom_attributes": [],
"custom_objects": [],
"lines": [
{
"subtotal": "{LINE_SUBTOTAL}",
"total": "{LINE_TOTAL}",
"tax": "{LINE_TAX}",
"item_uuid": "{ITEM_UUID}",
"item_id": "{ITEM_ID}",
"item_name": "{ITEM_NAME}",
"item_quantity": "{ITEM_QUANTITY}",
"item_price_snapshot": {
"pricing_rule": {
"uuid": "{PRICING_RULE_UUID}",
"version": "{PRICING_RULE_VERSION}",
"price_type": "{PRICE_TYPE}",
"price": "{PRICE}",
"uom": "{UNIT_OF_MEASURE}",
"warehouse": "{WAREHOUSE}",
"pricing_version": "{PRICING_VERSION}",
"latest_used_pricing_version": "{LATEST_USED_PRICING_VERSION}"
}
},
"item_purchase_tax_configuration": {
"purchase_price_is_tax_inclusive": "{PURCHASE_PRICE_TAX_INCLUSIVE}",
"tax_code": {
"uuid": "{TAX_CODE_UUID}",
"code": "{TAX_CODE}",
"rate": "{TAX_RATE}",
"link": "{TAX_LINK}"
}
},
"item_price_tax_exempt": "{ITEM_PRICE_TAX_EXEMPT}",
"item_price_tax": {
"uuid": "{ITEM_TAX_UUID}",
"code": "{ITEM_TAX_CODE}",
"rate": "{ITEM_TAX_RATE}",
"link": "{ITEM_TAX_LINK}"
},
"purchase_order_note": "{LINE_PURCHASE_ORDER_NOTE}",
"item_accounting_code": {
"cost_of_goods_sold": "{COST_OF_GOODS_SOLD}"
},
"uuid": "{LINE_UUID}",
"version": "{LINE_VERSION}"
}
],
"kpis": {
"total_expense": "{TOTAL_EXPENSE}",
"estimated_total": "{ESTIMATED_TOTAL}",
"total_outstanding": "{TOTAL_OUTSTANDING}",
"total_overdue": "{TOTAL_OVERDUE}",
"last_invoice_issue_date": "{LAST_INVOICE_ISSUE_DATE}",
"last_invoice_total": "{LAST_INVOICE_TOTAL}",
"total_purchase_invoice": "{TOTAL_PURCHASE_INVOICE}",
"last_reactivated_on": "{LAST_REACTIVATED_ON}",
"last_calcelled_on": "{LAST_CANCELLED_ON}",
"last_changed_on": "{LAST_CHANGED_ON}",
"last_deleted_on": "{LAST_DELETED_ON}",
"issue_date": "{KPI_ISSUE_DATE}"
}
}
// Additional purchase orders follow the same structure
]
}
},
Function: getPurchaseOrderDetails
Purpose
getPurchaseOrderDetails()
is used to obtain detailed information about a specific purchase order, allowing users to view all relevant details in one request. This function manages the request, processes the response, and handles exceptions, ensuring seamless integration in both Python and PHP environments.
Parameters
Parameter | Type | Description |
---|---|---|
id | string | Unique identifier for the purchase order |
Use Case
The getPurchaseOrderDetails()
function in Python and PHP retrieves detailed information for a specific purchase order in the Exsited Portal, using the unique order ID. This function is helpful for users needing a closer look at individual purchase order data. By calling "details(id)" in Python or "readDetails(id)" in PHP, the function fetches and displays purchase order information in a structured format. In cases where the retrieval fails, relevant error messages are provided for troubleshooting. This functionality enhances visibility into each purchase order's specifics, supporting detailed supplier order management in the Exsited Portal.
def getPurchaseOrderDetails():
SDKConfig.PRINT_REQUEST_DATA = False
SDKConfig.PRINT_RAW_RESPONSE = False
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = exsited_sdk.purchase_order.details(id="PO-ID")
print(response)
return response
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function GetPurchaseOrderDetails()
{
$id = 'PO-ID';
try {
$response = $this->purchaseOrderService->readDetails($id);
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The output of getPurchaseOrderDetails()
is a JSON object containing detailed information about the specified purchase order. This includes attributes such as id, accountId, item, quantity, currency, price, date, status, and additional details like supplier, billingTerm, fulfillmentDate, and deliveryMethod. This output format provides comprehensive insights into the purchase order for tracking and management in both Python and PHP implementations.
{
"purchaseOrder": {
"status": "{STATUS}",
"id": "{PURCHASE_ORDER_ID}",
"currency": {
"uuid": "{CURRENCY_UUID}",
"name": "{CURRENCY_NAME}",
"link": "{CURRENCY_LINK}"
},
"supplierInvoiceId": "{SUPPLIER_INVOICE_ID}",
"issueDate": "{ISSUE_DATE}",
"dueDate": "{DUE_DATE}",
"expectedCompletionDate": "{EXPECTED_COMPLETION_DATE}",
"subtotal": "{SUBTOTAL}",
"tax": "{TAX}",
"total": "{TOTAL}",
"priceTaxInclusive": "{PRICE_TAX_INCLUSIVE}",
"purchaseOrderNote": "{PURCHASE_ORDER_NOTE}",
"accountId": "{ACCOUNT_ID}",
"createdBy": "{CREATED_BY}",
"createdOn": "{CREATED_ON}",
"lastUpdatedBy": "{LAST_UPDATED_BY}",
"lastUpdatedOn": "{LAST_UPDATED_ON}",
"uuid": "{PURCHASE_ORDER_UUID}",
"version": "{VERSION}",
"customAttributes": [],
"customObjects": [],
"lines": [
{
"subtotal": "{LINE_SUBTOTAL}",
"total": "{LINE_TOTAL}",
"tax": "{LINE_TAX}",
"itemUuid": "{ITEM_UUID}",
"itemId": "{ITEM_ID}",
"itemName": "{ITEM_NAME}",
"itemQuantity": "{ITEM_QUANTITY}",
"itemPriceSnapshot": {
"pricingRule": {
"uuid": "{PRICING_RULE_UUID}",
"version": "{PRICING_RULE_VERSION}",
"priceType": "{PRICE_TYPE}",
"price": "{PRICE}",
"uom": "{UOM}",
"warehouse": "{WAREHOUSE}",
"pricingVersion": "{PRICING_VERSION}",
"latestUsedPricingVersion": "{LATEST_USED_PRICING_VERSION}"
}
},
"itemPurchaseTaxConfiguration": {
"purchasePriceIsTaxInclusive": "{TAX_INCLUSIVE}",
"taxCode": {
"uuid": "{TAX_CODE_UUID}",
"code": "{TAX_CODE}",
"rate": "{TAX_RATE}",
"link": "{TAX_CODE_LINK}"
}
},
"itemPriceTaxExempt": "{PRICE_TAX_EXEMPT}",
"itemPriceTax": {
"uuid": "{ITEM_TAX_UUID}",
"code": "{ITEM_TAX_CODE}",
"rate": "{ITEM_TAX_RATE}",
"link": "{ITEM_TAX_LINK}"
},
"purchaseOrderNote": "{LINE_PURCHASE_ORDER_NOTE}",
"itemAccountingCode": {
"costOfGoodsSold": "{COST_OF_GOODS_SOLD}"
},
"uuid": "{LINE_UUID}",
"version": "{LINE_VERSION}",
"itemSerialOrBatchNumber": "{ITEM_SERIAL_OR_BATCH_NUMBER}"
}
],
"kpis": {
"totalExpense": "{TOTAL_EXPENSE}",
"estimatedTotal": "{ESTIMATED_TOTAL}",
"totalOutstanding": "{TOTAL_OUTSTANDING}",
"totalOverdue": "{TOTAL_OVERDUE}",
"lastInvoiceIssueDate": "{LAST_INVOICE_ISSUE_DATE}",
"lastInvoiceTotal": "{LAST_INVOICE_TOTAL}",
"totalPurchaseInvoice": "{TOTAL_PURCHASE_INVOICE}",
"lastReactivatedOn": "{LAST_REACTIVATED_ON}",
"lastCancelledOn": "{LAST_CANCELLED_ON}",
"lastChangedOn": "{LAST_CHANGED_ON}",
"lastDeletedOn": "{LAST_DELETED_ON}",
"issueDate": "{KPI_ISSUE_DATE}"
}
}
}{
"purchaseOrder": {
"status": "{STATUS}",
"id": "{PURCHASE_ORDER_ID}",
"currency": {
"uuid": "{CURRENCY_UUID}",
"name": "{CURRENCY_NAME}",
"link": "{CURRENCY_LINK}"
},
"supplierInvoiceId": "{SUPPLIER_INVOICE_ID}",
"issueDate": "{ISSUE_DATE}",
"dueDate": "{DUE_DATE}",
"expectedCompletionDate": "{EXPECTED_COMPLETION_DATE}",
"subtotal": "{SUBTOTAL}",
"tax": "{TAX}",
"total": "{TOTAL}",
"priceTaxInclusive": "{PRICE_TAX_INCLUSIVE}",
"purchaseOrderNote": "{PURCHASE_ORDER_NOTE}",
"accountId": "{ACCOUNT_ID}",
"createdBy": "{CREATED_BY}",
"createdOn": "{CREATED_ON}",
"lastUpdatedBy": "{LAST_UPDATED_BY}",
"lastUpdatedOn": "{LAST_UPDATED_ON}",
"uuid": "{PURCHASE_ORDER_UUID}",
"version": "{VERSION}",
"customAttributes": [],
"customObjects": [],
"lines": [
{
"subtotal": "{LINE_SUBTOTAL}",
"total": "{LINE_TOTAL}",
"tax": "{LINE_TAX}",
"itemUuid": "{ITEM_UUID}",
"itemId": "{ITEM_ID}",
"itemName": "{ITEM_NAME}",
"itemQuantity": "{ITEM_QUANTITY}",
"itemPriceSnapshot": {
"pricingRule": {
"uuid": "{PRICING_RULE_UUID}",
"version": "{PRICING_RULE_VERSION}",
"priceType": "{PRICE_TYPE}",
"price": "{PRICE}",
"uom": "{UOM}",
"warehouse": "{WAREHOUSE}",
"pricingVersion": "{PRICING_VERSION}",
"latestUsedPricingVersion": "{LATEST_USED_PRICING_VERSION}"
}
},
"itemPurchaseTaxConfiguration": {
"purchasePriceIsTaxInclusive": "{TAX_INCLUSIVE}",
"taxCode": {
"uuid": "{TAX_CODE_UUID}",
"code": "{TAX_CODE}",
"rate": "{TAX_RATE}",
"link": "{TAX_CODE_LINK}"
}
},
"itemPriceTaxExempt": "{PRICE_TAX_EXEMPT}",
"itemPriceTax": {
"uuid": "{ITEM_TAX_UUID}",
"code": "{ITEM_TAX_CODE}",
"rate": "{ITEM_TAX_RATE}",
"link": "{ITEM_TAX_LINK}"
},
"purchaseOrderNote": "{LINE_PURCHASE_ORDER_NOTE}",
"itemAccountingCode": {
"costOfGoodsSold": "{COST_OF_GOODS_SOLD}"
},
"uuid": "{LINE_UUID}",
"version": "{LINE_VERSION}",
"itemSerialOrBatchNumber": "{ITEM_SERIAL_OR_BATCH_NUMBER}"
}
],
"kpis": {
"totalExpense": "{TOTAL_EXPENSE}",
"estimatedTotal": "{ESTIMATED_TOTAL}",
"totalOutstanding": "{TOTAL_OUTSTANDING}",
"totalOverdue": "{TOTAL_OVERDUE}",
"lastInvoiceIssueDate": "{LAST_INVOICE_ISSUE_DATE}",
"lastInvoiceTotal": "{LAST_INVOICE_TOTAL}",
"totalPurchaseInvoice": "{TOTAL_PURCHASE_INVOICE}",
"lastReactivatedOn": "{LAST_REACTIVATED_ON}",
"lastCancelledOn": "{LAST_CANCELLED_ON}",
"lastChangedOn": "{LAST_CHANGED_ON}",
"lastDeletedOn": "{LAST_DELETED_ON}",
"issueDate": "{KPI_ISSUE_DATE}"
}
}
}
{
{
"purchase_order": {
"status": "{STATUS}",
"id": "{PURCHASE_ORDER_ID}",
"currency": {
"uuid": "{CURRENCY_UUID}",
"name": "{CURRENCY_NAME}",
"link": "{CURRENCY_LINK}"
},
"supplier_invoice_id": "{SUPPLIER_INVOICE_ID}",
"issue_date": "{ISSUE_DATE}",
"due_date": "{DUE_DATE}",
"expected_completion_date": "{EXPECTED_COMPLETION_DATE}",
"subtotal": "{SUBTOTAL}",
"tax": "{TAX}",
"total": "{TOTAL}",
"price_tax_inclusive": "{PRICE_TAX_INCLUSIVE}",
"purchase_order_note": "{PURCHASE_ORDER_NOTE}",
"account_id": "{ACCOUNT_ID}",
"created_by": "{CREATED_BY}",
"created_on": "{CREATED_ON}",
"last_updated_by": "{LAST_UPDATED_BY}",
"last_updated_on": "{LAST_UPDATED_ON}",
"uuid": "{PURCHASE_ORDER_UUID}",
"version": "{VERSION}",
"custom_attributes": [],
"custom_objects": [],
"lines": [
{
"subtotal": "{LINE_SUBTOTAL}",
"total": "{LINE_TOTAL}",
"tax": "{LINE_TAX}",
"item_uuid": "{ITEM_UUID}",
"item_id": "{ITEM_ID}",
"item_name": "{ITEM_NAME}",
"item_quantity": "{ITEM_QUANTITY}",
"item_price_snapshot": {
"pricing_rule": {
"uuid": "{PRICING_RULE_UUID}",
"version": "{PRICING_RULE_VERSION}",
"price_type": "{PRICE_TYPE}",
"price": "{PRICE}",
"uom": "{UNIT_OF_MEASURE}",
"warehouse": "{WAREHOUSE}",
"pricing_version": "{PRICING_VERSION}",
"latest_used_pricing_version": "{LATEST_USED_PRICING_VERSION}"
}
},
"item_purchase_tax_configuration": {
"purchase_price_is_tax_inclusive": "{PURCHASE_PRICE_TAX_INCLUSIVE}",
"tax_code": {
"uuid": "{TAX_CODE_UUID}",
"code": "{TAX_CODE}",
"rate": "{TAX_RATE}",
"link": "{TAX_LINK}"
}
},
"item_price_tax_exempt": "{ITEM_PRICE_TAX_EXEMPT}",
"item_price_tax": {
"uuid": "{ITEM_TAX_UUID}",
"code": "{ITEM_TAX_CODE}",
"rate": "{ITEM_TAX_RATE}",
"link": "{ITEM_TAX_LINK}"
},
"purchase_order_note": "{LINE_PURCHASE_ORDER_NOTE}",
"item_accounting_code": {
"cost_of_goods_sold": "{COST_OF_GOODS_SOLD}"
},
"uuid": "{LINE_UUID}",
"version": "{LINE_VERSION}"
}
],
"kpis": {
"total_expense": "{TOTAL_EXPENSE}",
"estimated_total": "{ESTIMATED_TOTAL}",
"total_outstanding": "{TOTAL_OUTSTANDING}",
"total_overdue": "{TOTAL_OVERDUE}",
"last_invoice_issue_date": "{LAST_INVOICE_ISSUE_DATE}",
"last_invoice_total": "{LAST_INVOICE_TOTAL}",
"total_purchase_invoice": "{TOTAL_PURCHASE_INVOICE}",
"last_reactivated_on": "{LAST_REACTIVATED_ON}",
"last_calcelled_on": "{LAST_CANCELLED_ON}",
"last_changed_on": "{LAST_CHANGED_ON}",
"last_deleted_on": "{LAST_DELETED_ON}",
"issue_date": "{KPI_ISSUE_DATE}"
}
}
}
Function: createPurchaseOrder
Purpose
createPurchaseOrder()
facilitates the creation of a detailed purchase order, including information such as item quantity, pricing, tax configuration, and supplier account details. The function manages the creation request, processes the response, and handles exceptions for seamless integration in Python and PHP.
Note: For successful purchase order creation:
- Item quantity must be set to "unlimited."
- Each item must have both sale and purchase prices configured.
- The account ID provided must be a valid supplier ID.
Parameters
Parameter |
Type |
Description |
---|---|---|
currency |
String |
Currency code for the purchase order |
issueDate |
Date |
Date the purchase order is issued |
dueDate |
Date |
Payment due date for the purchase order |
expectedCompletionDate |
Date |
Expected completion date for the order |
priceTaxInclusive |
Boolean |
Flag to include tax in price |
accountId |
String |
Supplier’s account ID |
itemUuid |
String |
Unique identifier for the item |
itemQuantity |
Integar |
Quantity of the item |
priceType |
String |
Pricing model for the item |
price |
Integar |
Price of the item |
Use Case
The createPurchaseOrder()
function in both Python and PHP creates a new purchase order in the Exsited Portal. Users can define various order details, such as currency, issue date, due date, item details, tax information, and pricing rules. The Python version assembles a "PurchaseOrderDataDTO" object with these specifications, while the PHP version builds a structured array ("$params") with corresponding details. This function enables seamless integration of new orders into the system, allowing businesses to automate order management efficiently. Error handling is implemented to display specific error messages if order creation fails, improving user troubleshooting and reliability in order creation.
def CreatePurchaseOrder():
SDKConfig.PRINT_REQUEST_DATA = False
SDKConfig.PRINT_RAW_RESPONSE = False
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
purchase_order_data = PurchaseOrderDataDTO(
currency="{CURRENCY}",
issueDate="{ISSUE_DATE}",
dueDate="{DUE_DATE}",
expectedCompletionDate="{EXPECTED_COMPLETION_DATE}",
priceTaxInclusive="{PRICE_TAX_INCLUSIVE}",
purchaseOrderNote="{PURCHASE_ORDER_NOTE}",
accountId="{ACCOUNT_ID}",
lines=[
PurchaseOrderLineDTO(
itemUuid="{ITEM_UUID}",
itemQuantity="{ITEM_QUANTITY}",
itemPriceSnapshot=PurchaseOrderItemPriceSnapshotDTO(
pricingRule=PurchaseOrderPricingRuleDTO(
priceType="{PRICE_TYPE}",
price="{PRICE}"
)
),
itemPurchaseTaxConfiguration=PurchaseOrderItemPurchaseTaxConfigurationDTO(
purchasePriceIsTaxInclusive="{PURCHASE_PRICE_TAX_INCLUSIVE}",
taxCode=PurchaseOrderTaxCodeDTO(
uuid="{TAX_UUID}",
code="{TAX_CODE}",
rate="{TAX_RATE}",
link="{TAX_LINK}"
)
),
itemPriceTaxExempt="{ITEM_PRICE_TAX_EXEMPT}",
itemPriceTax=TaxDTO(
uuid="{TAX_UUID}",
code="{TAX_CODE}",
rate="{TAX_RATE}",
link="{TAX_LINK}"
),
purchaseOrderNote="{LINE_PURCHASE_ORDER_NOTE}",
itemAccountingCode=PurchaseOrderItemAccountingCodeDTO(
costOfGoodsSold="{COST_OF_GOODS_SOLD}"
)
)
]
)
request_obj = PurchaseOrderCreateDTO(purchaseOrder=purchase_order_data)
response = exsited_sdk.purchase_order.create(request_data=request_obj)
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function CreatePurchaseOrder()
{
$params = [
"purchase-order" => [
"currency" => "{CURRENCY}",
"price_tax_inclusive" => "{PRICE_TAX_INCLUSIVE}",
"account_id" => "{ACCOUNT_ID}",
"lines" => [
[
"item_uuid" => "{ITEM_UUID}",
"item_quantity" => "{ITEM_QUANTITY}",
"item_price_snapshot" => [
"pricing_rule" => [
"price_type" => "{PRICE_TYPE}",
"price" => "{PRICE}"
]
],
"item_purchase_tax_configuration" => [
"purchase_price_is_tax_inclusive" => "{PURCHASE_PRICE_IS_TAX_INCLUSIVE}",
"tax_code" => [
"uuid" => "{TAX_UUID}",
"code" => "{TAX_CODE}",
"rate" => "{TAX_RATE}"
]
],
"item_price_tax_exempt" => "{ITEM_PRICE_TAX_EXEMPT}",
"item_price_tax" => [
"uuid" => "{ITEM_TAX_UUID}",
"code" => "{ITEM_TAX_CODE}",
"rate" => "{ITEM_TAX_RATE}"
]
]
]
]
];
try {
$response = $this->purchaseOrderService->create($params);
echo '' . json_encode($response, JSON_PRETTY_PRINT) . '';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The output of createPurchaseOrder()
is a JSON object confirming the successful creation of the purchase order. It includes status, message, and details of the purchase order, such as id, accountId, currency, issueDate, dueDate, and item-specific information under lines. This response provides a clear and detailed confirmation of the new purchase order in both Python and PHP implementations.
{
"purchaseOrder": {
"status": "{STATUS}",
"id": "{PURCHASE_ORDER_ID}",
"currency": {
"uuid": "{CURRENCY_UUID}",
"name": "{CURRENCY_NAME}",
"link": "{CURRENCY_LINK}"
},
"supplierInvoiceId": "{SUPPLIER_INVOICE_ID}",
"issueDate": "{ISSUE_DATE}",
"dueDate": "{DUE_DATE}",
"expectedCompletionDate": "{EXPECTED_COMPLETION_DATE}",
"subtotal": "{SUBTOTAL}",
"tax": "{TAX}",
"total": "{TOTAL}",
"priceTaxInclusive": "{PRICE_TAX_INCLUSIVE}",
"purchaseOrderNote": "{PURCHASE_ORDER_NOTE}",
"accountId": "{ACCOUNT_ID}",
"createdBy": "{CREATED_BY}",
"createdOn": "{CREATED_ON}",
"lastUpdatedBy": "{LAST_UPDATED_BY}",
"lastUpdatedOn": "{LAST_UPDATED_ON}",
"uuid": "{PURCHASE_ORDER_UUID}",
"version": "{VERSION}",
"customAttributes": [],
"customObjects": [],
"lines": [
{
"subtotal": "{LINE_SUBTOTAL}",
"total": "{LINE_TOTAL}",
"tax": "{LINE_TAX}",
"itemUuid": "{ITEM_UUID}",
"itemId": "{ITEM_ID}",
"itemName": "{ITEM_NAME}",
"itemQuantity": "{ITEM_QUANTITY}",
"itemPriceSnapshot": {
"pricingRule": {
"uuid": "{PRICING_RULE_UUID}",
"version": "{PRICING_RULE_VERSION}",
"priceType": "{PRICE_TYPE}",
"price": "{PRICE}",
"uom": "{UOM}",
"warehouse": "{WAREHOUSE}",
"pricingVersion": "{PRICING_VERSION}",
"latestUsedPricingVersion": "{LATEST_USED_PRICING_VERSION}"
}
},
"itemPurchaseTaxConfiguration": {
"purchasePriceIsTaxInclusive": "{TAX_INCLUSIVE}",
"taxCode": {
"uuid": "{TAX_CODE_UUID}",
"code": "{TAX_CODE}",
"rate": "{TAX_RATE}",
"link": "{TAX_CODE_LINK}"
}
},
"itemPriceTaxExempt": "{PRICE_TAX_EXEMPT}",
"itemPriceTax": {
"uuid": "{ITEM_TAX_UUID}",
"code": "{ITEM_TAX_CODE}",
"rate": "{ITEM_TAX_RATE}",
"link": "{ITEM_TAX_LINK}"
},
"purchaseOrderNote": "{LINE_PURCHASE_ORDER_NOTE}",
"itemAccountingCode": {
"costOfGoodsSold": "{COST_OF_GOODS_SOLD}"
},
"uuid": "{LINE_UUID}",
"version": "{LINE_VERSION}",
"itemSerialOrBatchNumber": "{ITEM_SERIAL_OR_BATCH_NUMBER}"
}
],
"kpis": {
"totalExpense": "{TOTAL_EXPENSE}",
"estimatedTotal": "{ESTIMATED_TOTAL}",
"totalOutstanding": "{TOTAL_OUTSTANDING}",
"totalOverdue": "{TOTAL_OVERDUE}",
"lastInvoiceIssueDate": "{LAST_INVOICE_ISSUE_DATE}",
"lastInvoiceTotal": "{LAST_INVOICE_TOTAL}",
"totalPurchaseInvoice": "{TOTAL_PURCHASE_INVOICE}",
"lastReactivatedOn": "{LAST_REACTIVATED_ON}",
"lastCancelledOn": "{LAST_CANCELLED_ON}",
"lastChangedOn": "{LAST_CHANGED_ON}",
"lastDeletedOn": "{LAST_DELETED_ON}",
"issueDate": "{KPI_ISSUE_DATE}"
}
}
}
{
{
"purchase_order": {
"status": "{STATUS}",
"id": "{PURCHASE_ORDER_ID}",
"currency": {
"uuid": "{CURRENCY_UUID}",
"name": "{CURRENCY_NAME}",
"link": "{CURRENCY_LINK}"
},
"supplier_invoice_id": "{SUPPLIER_INVOICE_ID}",
"issue_date": "{ISSUE_DATE}",
"due_date": "{DUE_DATE}",
"expected_completion_date": "{EXPECTED_COMPLETION_DATE}",
"subtotal": "{SUBTOTAL}",
"tax": "{TAX}",
"total": "{TOTAL}",
"price_tax_inclusive": "{PRICE_TAX_INCLUSIVE}",
"purchase_order_note": "{PURCHASE_ORDER_NOTE}",
"account_id": "{ACCOUNT_ID}",
"created_by": "{CREATED_BY}",
"created_on": "{CREATED_ON}",
"last_updated_by": "{LAST_UPDATED_BY}",
"last_updated_on": "{LAST_UPDATED_ON}",
"uuid": "{UUID}",
"version": "{VERSION}",
"custom_attributes": [],
"custom_objects": [],
"lines": [
{
"subtotal": "{LINE_SUBTOTAL}",
"total": "{LINE_TOTAL}",
"tax": "{LINE_TAX}",
"item_uuid": "{ITEM_UUID}",
"item_id": "{ITEM_ID}",
"item_name": "{ITEM_NAME}",
"item_quantity": "{ITEM_QUANTITY}",
"item_price_snapshot": {
"pricing_rule": {
"uuid": "{PRICING_RULE_UUID}",
"version": "{PRICING_RULE_VERSION}",
"price_type": "{PRICE_TYPE}",
"price": "{PRICE}",
"uom": "{UNIT_OF_MEASURE}",
"warehouse": "{WAREHOUSE}",
"pricing_version": "{PRICING_VERSION}",
"latest_used_pricing_version": "{LATEST_USED_PRICING_VERSION}"
}
},
"item_purchase_tax_configuration": {
"purchase_price_is_tax_inclusive": "{PURCHASE_PRICE_TAX_INCLUSIVE}",
"tax_code": {
"uuid": "{TAX_CODE_UUID}",
"code": "{TAX_CODE}",
"rate": "{TAX_RATE}",
"link": "{TAX_LINK}"
}
},
"item_price_tax_exempt": "{ITEM_PRICE_TAX_EXEMPT}",
"item_price_tax": {
"uuid": "{ITEM_TAX_UUID}",
"code": "{ITEM_TAX_CODE}",
"rate": "{ITEM_TAX_RATE}",
"link": "{ITEM_TAX_LINK}"
},
"purchase_order_note": "{LINE_PURCHASE_ORDER_NOTE}",
"item_accounting_code": {
"cost_of_goods_sold": "{COST_OF_GOODS_SOLD}"
},
"uuid": "{LINE_UUID}",
"version": "{LINE_VERSION}"
}
],
"kpis": {
"total_expense": "{TOTAL_EXPENSE}",
"estimated_total": "{ESTIMATED_TOTAL}",
"total_outstanding": "{TOTAL_OUTSTANDING}",
"total_overdue": "{TOTAL_OVERDUE}",
"last_invoice_issue_date": "{LAST_INVOICE_ISSUE_DATE}",
"last_invoice_total": "{LAST_INVOICE_TOTAL}",
"total_purchase_invoice": "{TOTAL_PURCHASE_INVOICE}",
"last_reactivated_on": "{LAST_REACTIVATED_ON}",
"last_calcelled_on": "{LAST_CANCELLED_ON}",
"last_changed_on": "{LAST_CHANGED_ON}",
"last_deleted_on": "{LAST_DELETED_ON}",
"issue_date": "{KPI_ISSUE_DATE}"
}
}
}
Deleting a Purchase Order
Function: purchase_order_delete()
Purpose
Deletes a purchase order by its ID in both Python and PHP implementations.
Parameters
Parameter | Type | Description |
---|---|---|
id | String | The unique identifier of the purchase order to delete |
Use Case
Used to remove a purchase order from the system by specifying its ID. This function is essential for managing and maintaining accurate records, allowing businesses to clean up obsolete or incorrect purchase orders.
def purchase_order_delete():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.purchase_order.delete(id='PO-DQLP9B-0002')
print(response)
return response
# ResponseToObj().process(response=response["purchase_order"])
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testDelete()
{
$id = 'PO-DQLP9B-0004';
try {
$response = $this->purchaseOrderService->delete($id,'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
A response object indicating success or failure of the purchase order deletion.
{'success': True, 'status_code': 204}
null
Getting Purchase Order Information
Function: purchase_order_information()
Purpose
Retrieves detailed information about a specific purchase order by its ID.
Parameters
Parameter | Type | Description |
---|---|---|
id | String | The unique identifier of the purchase order |
Use Case
Used to fetch the details of an existing purchase order using the specified order ID. readPurchaseOrderInformation()
function allows businesses to access and review purchase order information, ensuring visibility and accuracy in procurement processes.
def purchase_order_information():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.purchase_order.information(id='PO-DQLP9B-0003')
print(response)
return response
# ResponseToObj().process(response=response["purchase_order"])
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testReadDetailsInformation()
{
$id = 'PO-DQLP9B-0003';
try {
$response = $this->purchaseOrderService->readDetailsInformation($id,'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
A response object containing the detailed information of the specified purchase order.
PurchaseOrderDetailsDTO(
purchaseOrder=PurchaseOrderDTO(
status='ACTIVE',
id='PO-DQLP9B-0003',
currency=PurchaseOrderCurrencyDTO(
uuid='4f444464-defa-4180-a18e-e2bf4b5a84a1',
name='AUD',
link='https://dev-api.exsited.com/api/v1/currencies/4f444464-defa-4180-a18e-e2bf4b5a84a1'
),
supplierInvoiceId='',
issueDate='2025-07-29T00:00:00Z',
dueDate='2025-07-29T00:00:00Z',
expectedCompletionDate='2025-07-29T00:00:00Z',
subtotal='100.000000',
tax='0.000000',
total='100.000000',
priceTaxInclusive='true',
purchaseOrderNote='',
accountId='DQLP9B',
createdBy='Implementer',
createdOn='2025-07-29T11:01:33Z',
lastUpdatedBy='',
lastUpdatedOn='2025-07-29T11:01:33Z',
uuid='b9a9c19c-16d8-4b72-89a2-5438d0bb847b',
version='3',
customAttributes=[],
customObjects=[],
lines=None,
kpis=None
)
)
{
"purchase_order": {
"status": "ACTIVE",
"id": "PO-DQLP9B-0003",
"currency": {
"uuid": "4f444464-defa-4180-a18e-e2bf4b5a84a1",
"name": "AUD",
"link": "https:\/\/dev-api.exsited.com\/api\/v1\/currencies\/4f444464-defa-4180-a18e-e2bf4b5a84a1"
},
"supplier_invoice_id": "",
"issue_date": "2025-07-29T00:00:00Z",
"due_date": "2025-07-29T00:00:00Z",
"expected_completion_date": "2025-07-29T00:00:00Z",
"subtotal": "100.000000",
"tax": "0.000000",
"total": "100.000000",
"price_tax_inclusive": "true",
"purchase_order_note": "",
"account_id": "DQLP9B",
"created_by": "Implementer",
"created_on": "2025-07-29T11:01:33Z",
"last_updated_by": "",
"last_updated_on": "2025-07-29T11:01:33Z",
"uuid": "b9a9c19c-16d8-4b72-89a2-5438d0bb847b",
"version": "3",
"custom_attributes": [],
"custom_objects": []
},
"autobillCredential": {
"apiUrl": "https:\/\/dev-api.exsited.com\/api\/v3\/purchase-orders\/PO-DQLP9B-0003\/information",
"appUrl": null,
"ClientId": "DTgOBjoFCTsCCDU3DAY5OWUCBwsKNgIJOgs6Ag0KDgcCCjg3CTkLBwYKBzo3Ag4FBwwCBQwKBjg=",
"ClientSecret": "NmE3L2MuMmQrL2YyYWJgMjErNDViYysyMjU3K2BiNTcrMWI3YDEvZF81NzEzKzcuMDUrYTY3M2E=",
"file_path": "C:\\Users\\saeedullah\\Desktop\\PROJECTS\\exsited\\php-sdk\\exsited-app-sdk-php\/token.json"
}
}
Canceling a Purchase Order
Function: purchase_order_cancel()
Purpose
This function cancels a specific purchase order using its unique identifier.
Parameters
Parameter | Type | Description |
---|---|---|
id |
string | The unique identifier of the purchase order to cancel. |
Use Case
Used to cancel an active or pending purchase order by providing its ID. Cancellation requests may include optional parameters or contextual data.
def purchase_order_cancel():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.purchase_order.cancel(id="PO-DQLP9B-0003")
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testCancel()
{
$id = 'PO-DQLP9B-0004';
try {
$response = $this->purchaseOrderService->cancel($id,'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
A response confirming the cancellation of the specified purchase order, or an error message if the cancellation fails.
{'success': True, 'status_code': 204}
null
Reactivating a Purchase Order
Function: purchase_order_reactivate()
Purpose
This function reactivates a previously canceled purchase order using its unique identifier.
Parameters
Parameter | Type | Description |
---|---|---|
id |
string | Unique identifier of the purchase order to reactivate. |
Use Case
Used to bring a canceled purchase order back into an active state, allowing further processing or transactions.
def purchase_order_reactivate():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.purchase_order.reactivate(id="PO-DQLP9B-0003")
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testReactivate()
{
$id = 'PO-DQLP9B-0004';
try {
$response = $this->purchaseOrderService->reactivate($id,'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
A response confirming the successful reactivation of the specified purchase order, or an error message if the reactivation fails.
{'success': True, 'status_code': 204}
NULL
Function: GetPurchaseOrderLineDetails
Purpose
Retrieves detailed information about a specific line item within a purchase order using its unique line UUID. This allows you to review the exact status, pricing, quantities, and related metadata of a particular line in the purchase order.
Parameters
Parameter |
Type |
Description |
---|---|---|
id |
String |
The unique identifier of the purchase order |
uuid |
String |
The unique line UUID associated with the order |
Use Case
Use this function when you need to inspect or verify the details of a specific line in a purchase order. For example, a retailer might need to confirm pricing, quantity, item specifications, or other key attributes before processing a shipment or updating inventory. This can also help in identifying discrepancies in a complex order where multiple items, custom attributes, or special conditions are involved, ensuring that each line is accurately managed and accounted for in operational workflows.
def Get_PurchaseOrder_Line_Details():
SDKConfig.PRINT_REQUEST_DATA = False
SDKConfig.PRINT_RAW_RESPONSE = False
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = exsited_sdk.purchase_order.line_uuid(id='PO-ID', uuid='UUID')
print(response)
return response
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function GetPurchaseOrderLineDetails()
{
$id = 'PO-ID';
$uuId = 'uuid';
try {
$response = $this->purchaseOrderService->readLineDetails($id, $uuId);
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
A response object containing the detailed information for the specified purchase order line, including item details, pricing, and any associated attributes.
PurchaseOrderDetailsDTO
{
"purchase_order": {
"line": {
"subtotal": "{SUBTOTAL}",
"total": "{TOTAL}",
"tax": "{TAX}",
"item_uuid": "{ITEM_UUID}",
"item_id": "{ITEM_ID}",
"item_name": "{ITEM_NAME}",
"item_quantity": "{ITEM_QUANTITY}",
"item_price_snapshot": {
"pricing_rule": {
"uuid": "{PRICING_RULE_UUID}",
"version": "{PRICING_RULE_VERSION}",
"price_type": "{PRICE_TYPE}",
"price": "{PRICE}",
"uom": "{UOM}",
"warehouse": "{WAREHOUSE}",
"pricing_version": "{PRICING_VERSION}",
"latest_used_pricing_version": "{LATEST_USED_PRICING_VERSION}"
}
},
"item_purchase_tax_configuration": {
"purchase_price_is_tax_inclusive": "{PURCHASE_PRICE_IS_TAX_INCLUSIVE}",
"tax_code": {
"uuid": "{TAX_CODE_UUID}",
"code": "{TAX_CODE}",
"rate": "{TAX_RATE}",
"link": "{TAX_LINK}"
}
},
"item_price_tax_exempt": "{ITEM_PRICE_TAX_EXEMPT}",
"item_price_tax": {
"uuid": "{ITEM_PRICE_TAX_UUID}",
"code": "{ITEM_PRICE_TAX_CODE}",
"rate": "{ITEM_PRICE_TAX_RATE}",
"link": "{ITEM_PRICE_TAX_LINK}"
},
"purchase_order_note": "{PURCHASE_ORDER_NOTE}",
"item_accounting_code": {
"cost_of_goods_sold": "{COST_OF_GOODS_SOLD}"
},
"uuid": "{LINE_UUID}",
"version": "{VERSION}"
}
}
}
Getting Purchase Order Line
Function: purchase_order_line()
Purpose
This function is designed to test the retrieval of detailed information about one or more lines within a purchase order. It allows developers or system integrators to ensure that the SDK or service layer correctly fetches the line-level data associated with a specific purchase order ID. This function is essential for verifying the integration and accurate data retrieval from the backend system for use cases such as validating line items, pricing details, quantities, tax configurations, or any related metadata required for processing or analysis. The function ensures smooth operational workflows by identifying potential discrepancies in purchase orders or their lines before they impact downstream processes like inventory updates, shipment handling, or financial reconciliation.
Parameters
Parameter |
Type |
Description |
---|---|---|
id |
String |
The unique identifier of the purchase order |
Use Case
Use this purchaseOrderLine()
function when you need to confirm that the integration for retrieving line-level details of a purchase order is functioning as expected. For example, during a system integration test, developers might use this to verify that line items' pricing, tax configurations, and quantities are accurately retrieved and match expected values in the backend database.
def purchase_order_line():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.purchase_order.po_line(id='PO-DQLP9B-0003')
print(response)
return response
# ResponseToObj().process(response=response["purchase_order"])
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testReadLines()
{
$id = 'PO-DQLP9B-0003';
try {
$response = $this->purchaseOrderService->readLines($id,'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
A response object containing the detailed information for the specified lines in the purchase order, including item details, pricing, quantities, tax configurations, and other associated metadata.
PurchaseOrderDetailsDTO(
purchaseOrder=PurchaseOrderDTO(
status=None,
id=None,
currency=None,
supplierInvoiceId=None,
issueDate=None,
dueDate=None,
expectedCompletionDate=None,
subtotal=None,
tax=None,
total=None,
priceTaxInclusive=None,
purchaseOrderNote=None,
accountId=None,
createdBy=None,
createdOn=None,
lastUpdatedBy=None,
lastUpdatedOn=None,
uuid=None,
version=None,
customAttributes=None,
customObjects=None,
lines=[
PurchaseOrderLineDTO(
subtotal='100.000000',
total='100.000000',
tax='0.000000',
itemUuid='',
itemId='',
itemName='banana',
itemQuantity='5.000000',
itemPriceSnapshot=PurchaseOrderItemPriceSnapshotDTO(
pricingRule=PurchaseOrderPricingRuleDTO(
uuid='',
version='',
priceType='',
price='',
uom='',
warehouse='',
pricingVersion='',
latestUsedPricingVersion=''
)
),
itemPurchaseTaxConfiguration=PurchaseOrderItemPurchaseTaxConfigurationDTO(
purchasePriceIsTaxInclusive='false',
taxCode=PurchaseOrderTaxCodeDTO(
uuid='58a36f3d-efaa-4ce7-bfc5-ce20c7330e6a',
code='No Tax',
rate='0.000000',
link='https://dev-api.exsited.com/api/v3/settings/taxes/58a36f3d-efaa-4ce7-bfc5-ce20c7330e6a'
)
),
itemPriceTaxExempt='false',
itemPriceTax=TaxDTO(
uuid='58a36f3d-efaa-4ce7-bfc5-ce20c7330e6a',
code='No Tax',
rate='0.000000',
link='https://dev-api.exsited.com/api/v3/settings/taxes/58a36f3d-efaa-4ce7-bfc5-ce20c7330e6a',
amount=None
),
purchaseOrderNote='',
itemAccountingCode=PurchaseOrderItemAccountingCodeDTO(
costOfGoodsSold=''
),
uuid='920c4851-6a33-4cf5-a76b-5bc97648f091',
version='1',
itemSerialOrBatchNumber=None
)
],
kpis=None
)
)
{
"purchase_order": {
"lines": [
{
"subtotal": "100.000000",
"total": "100.000000",
"tax": "0.000000",
"item_uuid": "",
"item_id": "",
"item_name": "banana",
"item_quantity": "5.000000",
"item_price_snapshot": {
"pricing_rule": {
"uuid": "",
"version": "",
"price_type": "",
"price": "",
"uom": "",
"warehouse": "",
"pricing_version": "",
"latest_used_pricing_version": ""
}
},
"item_purchase_tax_configuration": {
"purchase_price_is_tax_inclusive": "false",
"tax_code": {
"uuid": "58a36f3d-efaa-4ce7-bfc5-ce20c7330e6a",
"code": "No Tax",
"rate": "0.000000",
"link": "https:\/\/dev-api.exsited.com\/api\/v3\/settings\/taxes\/58a36f3d-efaa-4ce7-bfc5-ce20c7330e6a"
}
},
"item_price_tax_exempt": "false",
"item_price_tax": {
"uuid": "58a36f3d-efaa-4ce7-bfc5-ce20c7330e6a",
"code": "No Tax",
"rate": "0.000000",
"link": "https:\/\/dev-api.exsited.com\/api\/v3\/settings\/taxes\/58a36f3d-efaa-4ce7-bfc5-ce20c7330e6a"
},
"purchase_order_note": "",
"item_accounting_code": {
"cost_of_goods_sold": ""
},
"uuid": "920c4851-6a33-4cf5-a76b-5bc97648f091",
"version": "1"
}
]
},
"autobillCredential": {
"apiUrl": "https:\/\/dev-api.exsited.com\/api\/v3\/purchase-orders\/PO-DQLP9B-0003\/lines",
"appUrl": null,
"ClientId": "DTgOBjoFCTsCCDU3DAY5OWUCBwsKNgIJOgs6Ag0KDgcCCjg3CTkLBwYKBzo3Ag4FBwwCBQwKBjg=",
"ClientSecret": "NmE3L2MuMmQrL2YyYWJgMjErNDViYysyMjU3K2BiNTcrMWI3YDEvZF81NzEzKzcuMDUrYTY3M2E=",
"file_path": "C:\\Users\\saeedullah\\Desktop\\PROJECTS\\exsited\\php-sdk\\exsited-app-sdk-php\/token.json"
}
}
Creating Purchase Order Note
Function: create_purchase_order_note()
Purpose
This SDK method allows you to add a note (with or without file attachments) to a purchase order. Notes can contain text details such as comments, instructions, or approval remarks, and optionally include supporting documents like scanned purchase orders, supplier communication, or receipts. This provides a reliable way to capture and manage contextual information alongside financial records for better traceability and collaboration.
Parameters
Parameter | Type | Description |
---|---|---|
purchase_order_id |
string | Unique identifier of the purchase order to which the note will be added. |
datas |
string | The content of the note (text message, comment, or description). |
file_urls / filePaths |
array (Python) / string (PHP) | One or more file paths or URLs to be attached with the note. |
Use Case
This method is commonly used when businesses need to document additional context or approvals related to a purchase order. For example, a procurement officer might attach the supplier’s confirmation email and add a note stating that the order is approved for processing. Similarly, supporting files such as scanned receipts or supplier contracts can be uploaded with the note for future auditing. This ensures that critical decision-making information is recorded directly with the purchase order, improving accountability and compliance.
def create_purchase_order_note():
from exsited_sdk import ExsitedSDK, SDKConfig, FileTokenManager, CommonData
from exsited_sdk.exceptions import ABException
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "{{TOKEN_FILE_PATH}}"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
datas = "This is a test note for purchase order."
file_urls = [
"{{FILE_PATH}}"
]
response = exsited_sdk.notes.purchase_order_add_notes(
file_urls=file_urls,
datas=datas,
purchase_order_id="{{PURCHASE_ORDER_ID}}"
)
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function createPurchaseOrderNote()
{
$purchaseOrderId = '{{PURCHASE_ORDER_ID}}';
$filePaths = '{{FILE_PATH}}';
$note = 'from sdk purchase order notes';
try {
$response = $this->notesService->createPurchaseOrderNotes(
$filePaths,
$note,
$purchaseOrderId,
'v3'
);
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
On success, the method returns a purchase-order object containing a notes element with the UUID of the newly created note. This UUID acts as a unique reference for the added note and can be used to fetch, update, or manage the note later. If files are attached, they are linked with the note for retrieval in subsequent API calls. This ensures that both textual and file-based information are securely recorded with the purchase order, enabling complete audit trails and seamless collaboration.
PurchaseOrderNoteResponseDetailsDTO(
purchaseOrder=None
)
{
"purchase-order": {
"notes": {
"uuid": "{{NOTE_UUID}}"
}
}
}
Getting All Notes for a Purchase Order
Function: purchase_order_notes()
Purpose
This API retrieves all notes attached to a specific purchase order. Each note may contain textual content, metadata (such as who created or last updated it), versioning details, and optionally attached files. The endpoint also returns pagination information to handle scenarios where multiple notes are linked to the same purchase order. This is essential for purchase order lifecycle tracking, where comments, approvals, clarifications, and supporting documents need to be stored and retrieved for audit and operational purposes.
Parameters
Parameter | Type | Description |
---|---|---|
purchase_order_id |
string | Unique identifier of the purchase order whose notes are to be retrieved. |
Use Case
In real-world procurement workflows, purchase orders often go through multiple stakeholders, such as procurement officers, managers, and suppliers. Each stakeholder may add notes — for example, clarifications about quantities, approvals from management, or attached files like supplier quotations and compliance certificates. Instead of managing this information externally, organizations can use this endpoint to retrieve all related notes in one call, providing a complete history of communications and document attachments linked to the purchase order. This supports audit trails, reduces miscommunication, and ensures that all purchase-related documentation is centralized and easily accessible.
def purchase_order_notes():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.notes.purchase_order_note_details(
id="{{purchase_order_id}}"
)
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function purchaseOrderNotes()
{
$purchaseOrderId = '{{purchase_order_id}}';
try {
$response = $this->notesService->readPurchaseOrderAllNotes($purchaseOrderId, 'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
On success, the API returns a purchase_order object containing an array of notes. Each note object includes its unique identifier (uuid), versioning information, rich-text content (HTML-supported), any attached files (with their own UUID, name, and version), and audit metadata such as who created or last updated the note and when. Additionally, the response includes a pagination object that provides metadata about the number of records, limits, offsets, and pagination links. This structure ensures that even when multiple notes exist for a purchase order, applications can manage them efficiently with clear visibility of history and attachments.
PurchaseOrderDetailsDTO(
purchaseOrder=PurchaseOrderNoteDataDTO(
notes=[
NoteDataDTO(
uuid='<NOTE_UUID>',
version='<VERSION_NUMBER>',
content='<NOTE_CONTENT>',
files=[
FileDTO(
uuid='<FILE_UUID>',
name='<FILE_NAME>',
version='<FILE_VERSION>'
)
],
createdBy='<CREATED_BY>',
createdOn='<CREATED_ON_TIMESTAMP>',
lastUpdatedBy='<LAST_UPDATED_BY>',
lastUpdatedOn='<LAST_UPDATED_ON_TIMESTAMP>'
)
],
pagination=PaginationDTO(
records=<TOTAL_RECORDS>,
limit=<PAGE_LIMIT>,
offset=<PAGE_OFFSET>,
previousPage='<PREVIOUS_PAGE_URL>',
nextPage='<NEXT_PAGE_URL>'
)
)
)
{
"purchase_order": {
"notes": [
{
"uuid": "{{note_uuid}}",
"version": "{{note_version}}",
"content": "<p>{{note_content}}</p>",
"files": [
{
"uuid": "{{file_uuid}}",
"name": "{{file_name}}",
"version": "{{file_version}}"
}
],
"created_by": "{{created_by}}",
"created_on": "{{created_on}}",
"last_updated_by": "{{last_updated_by}}",
"last_updated_on": "{{last_updated_on}}",
"custom_attributes": []
}
],
"pagination": {
"records": {{records_count}},
"limit": {{limit}},
"offset": {{offset}},
"previous_page": "{{previous_page}}",
"next_page": "{{next_page}}"
}
}
}
Getting Purchase Order Note Details
Function: purchase_order_note_details()
Purpose
This API retrieves the details of a single note attached to a purchase order. The note object contains information such as its unique identifier(uuid), version, HTML-supported content, attached files, and audit metadata (who created/updated it and when). This is particularly useful when an application needs to display or process a specific note without fetching all notes for a purchase order.
Parameters
Parameter | Type | Description |
---|---|---|
purchase_order_id |
string | Unique identifier of the purchase order. |
NOTE_UUID |
string | Unique identifier of the note to be retrieved. |
Use Case
In procurement workflows, individual notes often contain important instructions, supplier clarifications, or internal approvals. While a purchase order may have multiple notes, sometimes a system needs to fetch details of a specific note — for example, showing the latest clarification added by a supplier or checking an attached file for compliance. This API provides direct access to that note’s full details, including attachments and metadata, without retrieving all purchase order notes.
def purchase_order_note_details():
SDKConfig.PRINT_REQUEST_DATA = False
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.notes.purchase_order_note_uuid_details(
id="{{purchase_order_id}}",
uuid="{{note_uuid}}"
)
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function purchaseOrderNoteDetails()
{
$purchaseOrderId = '{{purchase_order_id}}';
$noteUuid = '{{note_uuid}}';
try {
$response = $this->notesService->readPurchaseOrderNotesDetails($purchaseOrderId, $noteUuid, 'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
On success, the API returns a purchase_order object containing a single note. This note includes its UUID, version, content (HTML-supported), optional file attachments (each with its own UUID, name, and version), and audit fields such as created_by, created_on, last_updated_by, and last_updated_on. The custom_attributes field is provided for client-defined metadata. This makes it easy to track note ownership, review attached files, and maintain compliance/audit records for the purchase order.
PurchaseOrderNoteUuidDetailsDTO(
purchaseOrder=PurchaseOrderNoteUuidDataDTO(
note=NoteDataDTO(
uuid='{{note_uuid}}',
version='{{note_version}}',
content='<p>{{note_content}}</p>',
files=[
FileDTO(
uuid='{{file_uuid}}',
name='{{file_name}}',
version='{{file_version}}'
)
],
createdBy='{{created_by}}',
createdOn='{{created_on}}',
lastUpdatedBy='{{last_updated_by}}',
lastUpdatedOn='{{last_updated_on}}'
)
)
)
{
"purchase_order": {
"note": {
"uuid": "{{note_uuid}}",
"version": "{{note_version}}",
"content": "<p>{{note_content}}</p>",
"files": [
{
"uuid": "{{file_uuid}}",
"name": "{{file_name}}",
"version": "{{file_version}}"
}
],
"created_by": "{{created_by}}",
"created_on": "{{created_on}}",
"last_updated_by": "{{last_updated_by}}",
"last_updated_on": "{{last_updated_on}}",
"custom_attributes": []
}
}
}
Getting All Files of a Purchase Order Note
Function: purchase_order_note_files()
Purpose
This API retrieves all files attached to a specific note within a purchase order. Each file object includes metadata such as UUID, filename, and version. This is useful when notes contain supporting documents, images, or compliance-related attachments that need to be displayed, downloaded, or processed.
Parameters
Parameter | Type | Description |
---|---|---|
purchase_order_id |
string | Unique identifier of the purchase order. |
NOTE_UUID |
string | Unique identifier of the note whose files are being retrieved. |
Use Case
In many procurement processes, users attach important files (such as invoices, compliance certificates, delivery confirmations, or supplier communications) to notes within a purchase order. Instead of fetching all notes and filtering files manually, this API allows applications to retrieve just the files of a specific note. For example, if a supplier attaches a product quality certificate to a purchase order note, the system can fetch it directly using this endpoint.
def purchase_order_note_files():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.notes.purchase_order_note_uuid_files_details(
id="{{purchase_order_id}}",
uuid="{{note_uuid}}"
)
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function purchaseOrderNoteFiles()
{
$purchaseOrderId = '{{purchase_order_id}}';
$noteUuid = '{{note_uuid}}';
try {
$response = $this->notesService->readPurchaseOrderNoteAllFiles($purchaseOrderId, $noteUuid, 'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
On success, the API returns a purchase_order object containing a single note, which holds an array of files. Each file entry provides the UUID (for identification and retrieval), file name, and version (for version tracking). The custom_attributes array is available for client-defined metadata. This makes it simple to list and manage all attachments of a specific note without scanning all purchase order notes.
PurchaseOrderUuidFileDetailsDTO(
purchaseOrder=PurchaseOrderUuidFileDataDTO(
note=NoteFileDataDTO(
files=[
FileDTO(
uuid='{{file_uuid}}',
name='{{file_name}}',
version='{{file_version}}'
)
]
)
)
)
{
"purchase_order": {
"note": {
"files": [
{
"uuid": "{{file_uuid}}",
"name": "{{file_name}}",
"version": "{{file_version}}"
}
],
"custom_attributes": []
}
}
}
Getting a Specific File of a Purchase Order Note
Function: purchase_order_note_file_details()
Purpose
This API retrieves details of a single file attached to a specific note within a purchase order. It is useful for fetching metadata (UUID, name, version) of a particular file, typically when the user selects a file from a note for preview, download, or validation.
Parameters
Parameter | Type | Description |
---|---|---|
purchase_order_id |
string | Unique identifier of the purchase order. |
NOTE_UUID |
string | Unique identifier of the note containing the file. |
FILE_UUID |
string | Unique identifier of the file to be retrieved. |
Use Case
When users attach multiple files to a purchase order note, sometimes only a specific file needs to be accessed (example: downloading an invoice PDF, verifying a compliance certificate, or retrieving a product image). Instead of listing all files and filtering manually, this API directly fetches the details of the file by its UUID.
def purchase_order_note_file_details():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = False
token_file_path = "shared_token.json"
file_token_mgr = FileTokenManager(token_file_path)
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
request_token_dto=CommonData.get_request_token_dto(),
file_token_mgr=file_token_mgr
)
try:
response = exsited_sdk.notes.purchase_order_note_uuid_files_uuid_details(
id="{{purchase_order_id}}",
uuid="{{note_uuid}}",
file_uuid="{{file_uuid}}"
)
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function purchaseOrderNoteFileDetails()
{
$purchaseOrderId = '{{purchase_order_id}}';
$noteUuid = '{{note_uuid}}';
$fileUuid = '{{file_uuid}}';
try {
$response = $this->notesService->readPurchaseOrderNoteFileDetails($purchaseOrderId, $noteUuid, $fileUuid, 'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
On success, the API returns a purchase_order object containing a note, which includes the requested file. The file object provides its UUID (for identification), name (usually filename with extension), and version (for tracking different versions of the file). An empty custom_attributes array is included for extensibility if client-defined metadata is needed.
PurchaseOrderNoteUuidFileUuidDetailsDTO(
purchaseOrder=PurchaseOrderNoteUuidFileUuidDataDTO(
note=NoteFileUuidDataDTO(
file=FileDTO(
uuid='{{file_uuid}}',
name='{{file_name}}',
version='{{file_version}}'
)
)
)
)
{
"purchase_order": {
"note": {
"file": {
"uuid": "{{file_uuid}}",
"name": "{{file_name}}",
"version": "{{file_version}}"
},
"custom_attributes": []
}
}
}
Configuration
Before using any of these functions, ensure that your API credentials are properly configured.
- Python: The request token is retrieved from CommonData.get_request_token_dto().
- PHP: Configuration is managed via ConfigManager and $this->purchaseOrderService
Language-Specific Features
Feature | Python Implementation | PHP Implementation |
---|---|---|
SDK Initialization | ExsitedSDK().init_sdk() | $this->purchaseOrderService |
Exception Handling | ABException handles errors and raw response | try-catch block for exceptions |
Response Format | Prints response using print() | Outputs response using json_encode() |
Configuration | Managed through SDKConfig | Managed via ConfigManager |
Authentication Method | OAuth token via CommonData.get_request_token_dto() | API credentials via $this->purchaseOrderService |
Error Logging | Captures errors with ABException and prints raw response | Captures exceptions and prints error message |
Data Parsing | JSON response parsed natively in Python | JSON encoded and displayed using PHP |
Error Output | print(ab.get_errors()) and ab.raw_response | echo 'Error: ' . $e->getMessage() |