Scenario: Get Open Orders and Invoices


MethodName: GetDocuments()


Inputs:

  • WebsiteID
    • Required, used to identify configuration
  • MagentoCustomerID
    • Required *, If CounterpointCustomerID not used
  • CPCustomerID
    • Required *, If MagentoCustomerID not used
  • OrderType
    • Required, O=Orders I=Invoices
  • StartDateOptional
    • DateFilter Default=MinDate
  • EndDateOptional
    • DateFilter Default=Runtime
  • Records
    • Optional, # of Records - Defaults 20
  • Page
    • Optional, Page – Defaults 1



Example of front end design for displaying open orders in the My Account section for a customer



Example of front end design for displaying Invoices in the My Account section for a customer



Logic:

Step 1: Return Documents List ordered by Ticket Date Descending

Step 2: Filter out all documents with Total less than 0

 

Use:

Order Example:

https://localhost:50937/c5coreapi/?APIToken=123456&action=GetDocuments&WebsiteID=www.mywebsite.com&CPCustomerID=7706141788&OrderType=O&Records=10&Page=1

 

Invoice Example:

https://localhost:50937/c5coreapi/?APIToken=123456&action=GetDocuments&WebsiteID=www.mywebsite.com&CPCustomerID=7706141788&OrderType=I&Records=10&Page=1


Invoice Example with DateFilters:

https://localhost:50937/c5coreapi/?APIToken=123456&action=GetDocuments&WebsiteID=www.mywebsite.com&CPCustomerID=7706141788&StartDate=01/01/2016&EndDate=01/20/2016&OrderType=I&Records=10&Page=1



Returns: 

{
  "Documents": []
}Returns: {
  "TotalRecords": 1253,
  "Documents": [{
    "CPDocGuid": "c988d022-c65c-4c8c-b8b4-6cb23cf010eb",
    "Type": "Order",
    "DocNumber": "1-2144899",
    "Status": "Open",
    "Date": "\/Date(1478754000000)\/",
    "ShipAddress": {
      "Name": "Artful Living",
      "Attention": null,
      "Address1": "3333 Buford Drive",
      "Address2": "#2030",
      "Address3": null,
      "City": "Buford",
      "State": "GA",
      "Zipcode": "30519",
      "Country": "US",
      "Phone": null
    },
    "OrderType": "Orders by E-Mail",
    "Total": 83.70
  },
  {
    "CPDocGuid": "e6464806-98bb-4292-967d-2f7c7272ca42",
    "Type": "Order",
    "DocNumber": "1-2143351",
    "Status": "Open",
    "Date": "\/Date(1476331200000)\/",
    "ShipAddress": {
      "Name": "Artful Living",
      "Attention": null,
      "Address1": "3333 Buford Drive",
      "Address2": "#2030",
      "Address3": null,
      "City": "Buford",
      "State": "GA",
      "Zipcode": "30519",
      "Country": "US",
      "Phone": null
    },
    "OrderType": "Orders by E-Mail",
    "Total": 50.00
  }]
}Returns: {
  "Error": "Error Message."
}


 

Scenario: Get Document Detail

MethodName: GetDocumentDetail()


Inputs:

  • WebsiteID
    • Required, used to identify configuration
  • CPDocGuid
    • Required, used to identify CP Transaction


Logic:

Step 1: Process Order Header Detail

Step 2: Process Order Line Item Detail

Step 3: Process Order Payment Detail

Step 4: Process Tracking Detail


Tracking information will be excluded if it doesn’t apply to the requested document.

 

Use:

https://localhost:50937/c5coreapi/?APIToken=123456&action=GetDocumentDetail&WebsiteID=www.mywebsite.com&CPDocGuid=c988d022-c65c-4c8c-b8b4-6cb23cf010eb

 

Returns:

{
  "OrderDetail": [{
    "CPDocGuid": "c988d022-c65c-4c8c-b8b4-6cb23cf010eb",
    "Type": "Order",
    "DocNumber": "1-2144899",
    "Status": "Open",
    "Date": "\/Date(1478754000000)\/",
    "CustomerNumber": "7706141788",
    "SalesRep": "CATHERINE SALES REP",
    "Caller": "Karen",
    "PONumber": "CALOWL 11.10.16",
    "ShippingMethod": "UPG",
    "OrderType": "Orders by E-Mail",
    "Terms": "N60",
    "OriginalDocNumber": "x-xxxxxx",
    "BillAddress": {
      "Name": "Artful Living",
      "Attention": "Karen \u0026 Mike Neal",
      "Address1": "3333 Buford Dr",
      "Address2": "The Mall of Georgia #2030",
      "Address3": null,
      "City": "Buford",
      "State": "GA",
      "Zipcode": "30519",
      "Country": "US",
      "Phone": "770-614-1788"
    },
    "ShipAddress": {
      "Name": "Artful Living",
      "Attention": null,
      "Address1": "3333 Buford Drive",
      "Address2": "#2030",
      "Address3": null,
      "City": "Buford",
      "State": "GA",
      "Zipcode": "30519",
      "Country": "US",
      "Phone": null
    },
    "Subtotal": 83.70,
    "Taxes": 0.00,
    "Shipping": 0,
    "Misc": 0.00,
    "Discount": 0.00,
    "Total": 83.70,
    "PaymentTotal": 83.70,
    "AmountDue": 0.00,
    "LineItems": [{
      "ItemNumber": "28368",
      "Description": "Goat Plaque",
      "Description2": "4.50\" x 6.75\"",
      "Sequence": 1,
      "Qty": 0.0000,
      "OrderQtyInvoiced": 0.0000,
      "OrderQtyShipped": 2.0000,
      "RetailPrice": 8.0000,
      "Price": 4.0000,
      "ExtendedPrice": 8.00,
      "Status": "Open",
      "ShipDate": "\/Date(1487135055984)\/"
    },
    {
      "ItemNumber": "26020",
      "Description": "Photo Block - To The Moon",
      "Description2": "4\" x 2.50\", Plus Wire",
      "Sequence": 2,
      "Qty": 0.0000,
      "OrderQtyInvoiced": 0.0000,
      "OrderQtyShipped": 8.0000,
      "RetailPrice": 3.5000,
      "Price": 3.1500,
      "ExtendedPrice": 25.20,
      "Status": "Open",
      "ShipDate": "\/Date(1487135055984)\/"
    },
    {
      "ItemNumber": "30993",
      "Description": "Box Sign - Lake Rules",
      "Description2": "15\" x 18\"",
      "Sequence": 3,
      "Qty": 6.0000,
      "OrderQtyInvoiced": 0.0000,
      "OrderQtyShipped": 0.0000,
      "RetailPrice": 21.5000,
      "Price": 10.7500,
      "ExtendedPrice": 64.50,
      "Status": "Open",
      "ShipDate": "\/Date(1487135055984)\/"
    }],
    "Payments": [{
      "Name": "Accounts Receivable",
      "Type": "A",
      "Amount": 0.00,
      "Reference": null
    }],
    "Tracking": [],
    "Comments": [{
      "Date": "\/Date(1488491786380)\/",
      "Comment": "This is a test comment"
    },
    {
      "Date": "\/Date(1488491783430)\/",
      "Comment": "This is a test comment"
    },
    {
      "Date": "\/Date(1488491675210)\/",
      "Comment": "This is a test comment"
    }]
  }]
}Returns: {
  "Error": "Error Message."
}