» Purchase Order Module SDK Documentation
» Purchase Order Module SDK Documentation

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      
            

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)      
                

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"
      }
    }
  ]
}

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)    
            

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}"
    }
  }
}

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)
       
            

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}"
    }
  }
}
            

Function : deletePurchaseOrder

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 Delete_PurchaseOrder():
    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.delete(id='PO_ID')
        print(response)
        return response
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A response object indicating success or failure of the purchase order deletion.

{'success': True, 'status_code': 204}

Function : readPurchaseOrderInformation

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 read_PurchaseOrder_Information():
    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.information(id='PO-ID')
        print(response)
        return response
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A response object containing the detailed information of the specified purchase order.

PurchaseOrderDetailsDTO(
    purchaseOrder=PurchaseOrderDTO(
        status='{STATUS}',
        id='{PURCHASE_ORDER_ID}',
        currency=PurchaseOrderCurrencyDTO(
            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='{ORDER_UUID}',
        version='{VERSION}',
        customAttributes=[],
        customObjects=[],
        lines=None,
        kpis=None
    )
)

Function: cancelPurchaseOrder

Purpose

 This cancelPurchaseOrder() function cancels a specific purchase order using its unique identifier.

Parameters

Parameter
Type
Description
id
String
The unique identifier of the purchase order
request_data
Object
Additional data required for cancellation (Python)

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 cancel_PurchaseOrder():
    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.cancel(id="PO-ID", request_data=request_data)
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A response confirming the cancellation of the specified purchase order, or an error message if the cancellation fails.


{'success': True, 'status_code': 204}

Function: reactivatePurchaseOrder

Purpose

This reactivatePurchaseOrder() function reactivates a previously canceled purchase order using its unique identifier.

Parameters

Parameter
Type
Description
id
String
The unique identifier of the purchase order
request_data
Object
Additional data required for reactivation (Python)

Use Case

This <b><i>reactivatePurchaseOrder()</i></b> is used to bring a canceled purchase order back into an active state, allowing further processing or transactions.

def reactivate_PurchaseOrder():
    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.reactivate(id="PO-ID", request_data=request_data)
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

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}

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)

Response

A response object containing the detailed information for the specified purchase order line, including item details, pricing, and any associated attributes.

PurchaseOrderDetailsDTO 

Function: purchaseOrderLine

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 = 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')
        print(response)
        return response
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

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=STATUS,
        id=PURCHASE_ORDER_ID,
        currency=CURRENCY,
        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=UUID,
        version=VERSION,
        customAttributes=CUSTOM_ATTRIBUTES,
        customObjects=CUSTOM_OBJECTS,
        lines=[
            PurchaseOrderLineDTO(
                subtotal=LINE_SUBTOTAL,
                total=LINE_TOTAL,
                tax=LINE_TAX,
                itemUuid=ITEM_UUID,
                itemId=ITEM_ID,
                itemName=ITEM_NAME,
                itemQuantity=ITEM_QUANTITY,
                itemPriceSnapshot=PurchaseOrderItemPriceSnapshotDTO(
                    pricingRule=PurchaseOrderPricingRuleDTO(
                        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=PurchaseOrderItemPurchaseTaxConfigurationDTO(
                    purchasePriceIsTaxInclusive=PURCHASE_PRICE_IS_TAX_INCLUSIVE,
                    taxCode=PurchaseOrderTaxCodeDTO(
                        uuid=TAX_CODE_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,
                    amount=TAX_AMOUNT
                ),
                purchaseOrderNote=LINE_PURCHASE_ORDER_NOTE,
                itemAccountingCode=PurchaseOrderItemAccountingCodeDTO(
                    costOfGoodsSold=COST_OF_GOODS_SOLD
                ),
                uuid=LINE_UUID,
                version=LINE_VERSION,
                itemSerialOrBatchNumber=ITEM_SERIAL_OR_BATCH_NUMBER
            )
        ],
        kpis=KPIS
    )
)

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()