User Tools

Site Tools


webapi:examples:customers

How Customers work in System Five

Windward System Five supports a single address for a billing or shipping customer in our database. Each record will have a CustomerUnique number which is associated to invoices as either the Billing or Shipping customer. This is a 1 to many relationship in the database. One customer can have many billing or shipping invoices associated with them.

If you were to update an address using /update_Retail_Customer of the source Billing or Shipping customer. Re-printing a past order will have the address updated when printed at that new point in time. In our clients retail business, this is typically not a challenge as the order is shipped and dealt with well before a future address change takes place. With business to consumer website workflow, multiple orders with a different ship to locations could be imported in close succession and pose a problem.

If you require workflow to support different billing and shipping addresses. Then you would need to create customers with the same name with a different address and associate them to the sales orders being created. Best practice to avoid creating duplicate names and addresses would be to parse the customer lists to see if the customer already exists.

Sample Customer Pseudocode

  • Check if a customer exists by
    • parse customer lists for existing name/address/phone/email matches using Customers/Customers/0 listing OR
    • by email address using TServerMethodsWebAPI/Get_Customer_By_Email endpoint if duplicates are not a concern.
    • store the Customer Unique number
  • Else create a new customer using Customer/addCustomer

Sample Customer JSON

{
  "Customers": [
    {
      "Unique": 0,
      "Name": "string",
      "FirstName": "string",
      "LastName": "string",
      "Addr1": "string",
      "Addr2": "string",
      "City": "string",
      "Postal": "string",
      "State": "string",
      "Country": "string",
      "Phone1": "string",
      "Phone2": "string",
      "Phone3": "string",
      "APDiscount": 0,
      "APDiscountRule": 0,
      "APDiscountDays": 0,
      "Balances": {
        "C_BALANCE": 0,
        "C_DEPOSIT": 0,
        "C_SB_30": 0,
        "C_SB_60": 0,
        "C_SB_90": 0,
        "CN_BALANCE": 0,
        "CN_DEPOSIT": 0,
        "C_PO_BILLED": 0
      },
      "Duty": "string",
      "FedTax": "string",
      "AutoDiscount": "string",
      "DueDays": 0,
      "PriceSchedule": 0,
      "ContractDate": "string",
      "Salesman": 0,
      "CSType": "string",
      "Terms": "string",
      "Interest": 0,
      "TaxStatus": "string",
      "TaxNumber": "string",
      "BankInfo": "string",
      "ShipNo": 0,
      "CreditLimit": 0,
      "StandingPO": "string",
      "POExpiryDate": "string",
      "POMaximumValue": 0,
      "POBilledSoFar": 0,
      "GSTExempt": "string",
      "Department": 0,
      "TaxCode": "string",
      "Number": "string",
      "DisNv": 0,
      "DisStat": 0,
      "RetailType": "string",
      "Foreign": "string",
      "LastVisit": "string",
      "Email": "string",
      "WebComments": "string",
      "Password": "string",
      "EFTAccount": "string",
      "EFTBank": "string",
      "EFTName": "string",
      "TimeZone": 0,
      "ShippingAddress": "string",
      "Contacts": [
        {
          "ContactId": 0,
          "FirstName": "string",
          "LastName": "string",
          "City": "string",
          "Country": "string",
          "State": "string",
          "Postal": "string",
          "Phone1": "string",
          "Phone2": "string",
          "Email": "string",
          "Address1": "string",
          "Address2": "string"
        }
      ],
      "FreeFormGroup": [
        {
          "FreeFormData": "string",
          "FreeFormID": 0
        }
      ],
      "ShipName": "string",
      "ShipAddr1": "string",
      "ShipAddr2": "string",
      "ShipCity": "string",
      "ShipPostal": "string",
      "ShipState": "string",
      "ShipCountry": "string",
      "ShipPhone1": "string"
    }
  ],
  "ConnectionInfo": {
    "TerminalNumber": 0
  }
}

Customer Contacts

The /addCustomer method supports Contacts as part of the data payload. The Contact Object has to be filled in to generate. Populating the First Name and Last Name alone do not constitute a Contact record and will not create the a Contact. This is to allow for usage that doesn't want Contact records to be created just because the Name is provided as FirstName / LastName. Those fields are part of the Customer JSON to support the variations of First, Last / Last, First as the business name, not to auto-generate Contact records.

The Swagger Documentation provides the developer with the map of the Contact Object which when completed will create contacts.

      "Contacts": [
        {​
          "ContactId": 0,​
          "FirstName": "string",​
          "LastName": "string",​
          "City": "string",​
          "Country": "string",​
          "State": "string",​
          "Postal": "string",​
          "Phone1": "string",​
          "Phone2": "string",​
          "Email": "string",​
          "Address1": "string",​
          "Address2": "string"​
        }​

Continue on to Adding an Invoice or back to Swagger Samples

webapi/examples/customers.txt · Last modified: 2020/04/21 17:26 (4 years ago) by kevin