Show TOC

Object documentationTmxCustomer Interface

 

The interface is defined to manage a Customer table in the database. It includes the following methods:

Pa_customer Table

Name

COM Type

DB Type

Description

CustomerNumber

BSTR

A14

Uniquely identifies a customer.

CustomerReferenceNumber

Int

Integer

CustomerType

SHORT

Smallint

TitleID

SHORT

Smallint

LastName

BSTR

A40

FirstName

BSTR

A40

MiddleName

BSTR

A40

Gender

BSTR

A1

Address1

BSTR

A40

Address2

BSTR

A40

City

BSTR

A30

StateProvinceCode

BSTR

A2

ZipCode

BSTR

A15

Country

BSTR

A40

PhoneNumber1

BSTR

A20

PhoneNumber2

BSTR

A20

PriceLevel

SHORT

Smallint

AutoDiscount

SHORT

SHORT

DiscountPercent

VARIANT

Numeric(5,2)

FirstPurchaseDate

DT

Timestamp

LastPurchaseDate

DT

Timestamp

LastPurchaseAmount

VARIANT

Numeric(20,4)

PeriodNumberVisits

SHORT

Smallint

PeriodSales

VARIANT

Numeric(20,4)

PreviousPeriodNumberVisits

SHORT

Smallint

PreviousPeriodSales

VARIANT

Numeric(20,4)

ProPromptID

SHORT

Smallint

ChargeLimit

VARIANT

Numeric(20,4)

LastPayDate

DT

Timestamp

LastPayment

VARIANT

Numeric(20,4)

LockRegisterNumber

SHORT

Smallint

UpdateTime

DT

Timestamp

BirthDate

DT

Timestamp

ReferenceNumber2

BSTR

A20

ReferenceNumber3

BSTR

A20

CustomerStatus

SHORT

Smallint

Points

Int

Integer

PointsRedeemed

Int

Integer

LastPointsRedeemded

Int

Integer

LastRedeemedDate

DT

Timestamp

Method

HRESULT Initialize (BSTR bstrXmlCustInit, BSTR *bstrXmlCustInitResult)

This method is used to initialize a connection to the Xpress Server so that datagram requests can be sent to the Xpress Server to interact with the customer database.  After the method is called the return value has to be checked. If it is S_OK, the method successfully executed. If there is an error the resulting error code will be returned.  Refer to the problemDescription tag for information about the error in the resulting XML string (if provided)

Parameters

BSTR bstrXmlCustInit

String containing XML document, request.

BSTR *bstrXmlCustInitResult

String containing XML document of request status.

Return

S_OK

If connection to Xpress Server is successfully established.

TMXCUST_E_XPS_CONN

If connection is not established with Xpress Server.

TMXCUST_E_MULTI_INIT

If connection to Xpress Server is already established.

E_FAIL

If other error occurs during Initialization.

Example Request XML (bstrXmlCustInit)

Syntax Syntax

  1. <?xml version= "1.0" ?>
    <CUSTOMER_INIT_REQUEST>
     <serverName></serverName>
     <storeNumber></storeNumber>
     <registerNumber></registerNumber>
     <timeOut></timeOut>
    </CUSTOMER_INIT_REQUEST>
End of the code.
Example Response XML (*bstrXmlCustInitResult)

Syntax Syntax

  1. <CUSTOMER_INIT_RESPONSE>
     <problemDescription></problemDescription>
    </CUSTOMER_INIT_RESPONSE>
End of the code.
Method

HRESULT Inquiry (BSTR bstrXmlCustInq, BSTR *bstrXmlCustInqResult)

This method is used to retrieve a record from the Customer view table. These mandatory parameters are defined when calling the method. One of the following parameters must be defined to retrieve the customer information (they are defined in the schema):

  • customerNumber

  • customerReferenceNumber

  • One of firstName, lastName, phoneNumber1, or phoneNumber2

After the method is called, the return value has to be checked. If it is S_OK, the return string contains the data for the found record. If more than one record is found in the query, all of them can be parsed into the response string; it is up to the client how to use the data properly. For firstName, lastName, phoneNumber1 and phoneNumber2, the wild character '*' is used as part of the search criteria. For example, phoneNumber1 can be defined as '502*', this returns all records with the phone number as 502**** If there is an error the resulting error code will be returned.  Refer to the problemDescription tag for information about the error in the resulting XML string (if provided).

Parameters

BSTR bstrXmlCustInq

String containing the XML document request.

BSTR * bstrXmlCustInqResult

String containing the XML document of the request status.

Return

S_OK

If inquiry request was successful.

TMXCUST_E_MGRCODE_FILE

If inquiry manager code (10004) not defined.

TMXCUST_E_EMPNUM_NOT_FOUND

If employee invoking inquiry request was not found in the database.

TMXCUST_E_INVALID_AUTHLEVEL

If employee invoking inquiry request has insufficient authority.

TMXCUST_E_COMMUNICATION_ERROR

If communication error occurs during inquiry request.

TMXCUST_E_NOT_FOUND

If customer was not found in the database.

E_FAIL

If other error occurs during Initialization.

Example Request XML (bstrXmlCustInq)

Syntax Syntax

  1. <?xml version= "1.0" ?>
    <CUSTOMER_INQUIRY_REQUEST>
     <inquiryEmployeeNumber></inquiryEmployeeNumber>
     <inquiryEmployeeStoreNumber></inquiryEmployeeStoreNumber>
     <customerNumber></customerNumber>
     <customerReferenceNumber></customerReferenceNumber>
     <firstName></firstName>
     <lastName></lastName>
     <phoneNumber1></phoneNumber1>
    </CUSTOMER_INQUIRY_REQUEST>
    
End of the code.
Example Response XML (*bstrXmlCustInqResult)

Syntax Syntax

  1. <CUSTOMER_INQUIRY_RESPONSE>
     <Customer_Inquiry_Result_Header>
       <inquiryEmployeeNumber></inquiryEmployeeNumber>
       <inquiryEmployeeStoreNumber></inquiryEmployeeStoreNumber>
       <problemDescription></problemDescription>
     </Customer_Inquiry_Result_Header >
     <Customer_Inquiry_Request_Detail>
       <customerNumber></customerNumber>
       <firstName></firstName>
       <lastName></lastName>
       <phoneNumber1></phoneNumber1>
     </Customer_Inquiry_Request_Detail>
    </ CUSTOMER_INQUIRY_RESPONSE >
End of the code.
Method

HRESULT Update(BSTR bstrXmlCustUpdate, BSTR * bstrXmlCustUpdateResult)

This method is used to update a Customer. Clients can use the Inquiry method to retrieve the record first, change certain fields, and then call this method. The fields passed to the stored procedure must be checked to make sure that the value passed to the stored procedure is in the right data type format. After the method is called the return value must be checked. If it is S_OK, the method successfully executed. If there is an error the resulting error code will be returned and the record will not be updated. Refer to the problemDescription tag for information about the error in the resulting XML string (if provided).

Parameter

BSTR bstrXmlCustUpdate

String containing XML document, request.

BSTR bstrXmlCustUpdateResult

String containing XML document of request status.

Return

S_OK

If the update request was successful.

TMXCUST_E_MGRCODE_FILE

If the update manager code (10005) is not defined.

TMXCUST_E_EMPNUM_NOT_FOUND

If the employee invoking the update request was not found in the database.

TMXCUST_E_INVALID_AUTHLEVEL

If the employee invoking the update request has insufficient authority.

TMXCUST_E_COMMUNICATION_ERROR

If a communication error occurs during the update request.

TMXCUST_E_NOT_FOUND

If the customer was not found in the database.

E_FAIL

If other error occurs during Initialization.

The following customer fields are available to be set in the update request::

1

customerNumber

Mandatory (M) (required for update)

2

customerReferenceNumber

M

3

registerNumber

M

4

updateStamp

M

5

type

M

6

titleID

M

7

lastName

M

8

firstName

M

9

middleName

NULL if not setup

10

address1

NULL if not setup

11

address2

NULL if not setup

12

city

NULL if not setup

13

stateProvinceCode

NULL if not setup

14

zipCode

NULL if not setup

15

phoneNumber1

NULL if not setup

16

phoneNumber2

NULL if not setup

17

birthDate

NULL if not setup

18

priceLevel

1 if not setup

19

autoDiscount

NULL if not setup

20

discountPercent

NULL if not setup

21

periodNumberVisits

0 if not setup

22

previousPeriodSales

0.0 if not setup

23

previousPeriodNumberVisits

0 if not setup

24

firstPurchaseDate

NULL if not setup

25

lastPurchaseAmount

NULL if not setup

26

lastPurchaseDate

NULL if not setup

27

chargeLimit

NULL if not setup

28

lastPayment

0 if not setup

29

lastPaymentDate

NULL if not setup

30

referenceNumber2

NULL if not setup

31

referenceNumerb3

NULL if not setup

32

country

NULL if not setup

33

status

NULL if not setup

34

gender

NULL if not setup

35

points

NULL if not setup

36

pointsRedeemed

NULL if not setup

37

lastPointsRedeemed

NULL if not setup

38

lastRedeemedDate

NULL if not setup

39

periodSales

NULL if not setup

Example Request XML (bstrXmlCustUpdate)

Syntax Syntax

  1. <?xml version= "1.0" ?>
    <CUSTOMER_UPDATE_REQUEST>
     <Customer_Update_Request_Header>
       <inquiryEmployeeNumber></inquiryEmployeeNumber>
       <inquiryEmployeeStoreNumber></inquiryEmployeeStoreNumber>
     </Customer_Update_Request_Header>
     <Customer_Update_Request_Detail>
       <customerNumber></customerNumber>
       <firstName></firstName>
       <lastName></lastName>
       <phoneNumber1></phoneNumber1>
     </Customer_Update_Request_Detail>
    </CUSTOMER_UPDATE_REQUEST>
End of the code.
Example Response XML (*bstrXmlCustUpdateResult)

Syntax Syntax

  1. <CUSTOMER_UPDATE_RESPONSE>
     <Customer_Update_Response_Header>
       <inquiryEmployeeNumber></inquiryEmployeeNumber>
       <inquiryEmployeeStoreNumber></inquiryEmployeeStoreNumber>
       <problemDescription></problemDescription>
     </Customer_Update_Response_Header>
     <Customer_Update_Response_Detail>
       <customerNumber></customerNumber>
       <problemDescription></problemDescription>
     </Customer_Update_Response_Detail>
    </CUSTOMER_UPDATE_RESPONSE>
End of the code.
Method

HRESULT Delete(BSTR bstrXmlCustDelete, BSTR *bstrXmlCustDeleteResult)

This method is used to delete a customer from the database. After the method is called the return value must be checked. If it is S_OK, the method successfully executed.  If a specific customer is not specified all customers will be deleted. If there is an error the resulting error code will be returned. Refer to the problemDescription tag for information about the error in the resulting XML string (if provided).

Parameter

BSTR bstrXmlCustDelete

String containing the XML document of the request.

BSTR * bstrXmlCustDeleteResult

String containing the XML document of the request status.

Return

S_OK

If delete request was successful.

TMXCUST_E_MGRCODE_FILE

If delete manager code (10006) is not defined.

TMXCUST_E_EMPNUM_NOT_FOUND

If employee invoking delete request was not found in database.

TMXCUST_E_INVALID_AUTHLEVEL

If employee invoking delete request has insufficient authority.

TMXCUST_E_COMMUNICATION_ERROR

If a communication error occurs during a delete request.

TMXCUST_E_NOT_FOUND

If customer was not found in the database.

E_FAIL

If other error occurs during Initialization.

Example Request XML (bstrXmlCustDelete) – specific customer

Syntax Syntax

  1. <?xml version= "1.0" ?>
    <CUSTOMER_DELETE_REQUEST>
     <Customer_ Delete _Request_Header>
       <inquiryEmployeeNumber></inquiryEmployeeNumber>
       <inquiryEmployeeStoreNumber></inquiryEmployeeStoreNumber>
     </Customer_ Delete_Request_Header>
     <Customer_ Delete_Request_Detail>
       <customerNumber></customerNumber>
     </Customer_ Delete_Request_Detail>
    </CUSTOMER_DELETE_REQUEST>
End of the code.
Example Response XML (*bstrXmlCustDeleteResult) – specific customer

Syntax Syntax

  1. <CUSTOMER_DELETE_RESPONSE>
     <Customer_Delete_Response_Header>
       <inquiryEmployeeNumber></inquiryEmployeeNumber>
       <inquiryEmployeeStoreNumber></inquiryEmployeeStoreNumber>
       <problemDescription></problemDescription>
     </Customer_Delete_Response_Header>
     <Customer_Delete_Response_Detail>
       <customerNumber></customerNumber>
       <problemDescription></problemDescription>
     </Customer_Delete_Response_Detail>
    </CUSTOMER_DELETE_RESPONSE>
End of the code.
Example Request XML (bstrXmlCustDelete) – all customers

Syntax Syntax

  1. <?xml version= "1.0" ?>
    <CUSTOMER_DELETE_REQUEST>
     <Customer_ Delete_Request_Header>
       <inquiryEmployeeNumber></inquiryEmployeeNumber>
       <inquiryEmployeeStoreNumber></inquiryEmployeeStoreNumber>
     </Customer_ Delete_Request_Header>
    </CUSTOMER_DELETE_REQUEST>
End of the code.
Example Response XML (*bstrXmlCustDeleteResult) – all customers

Syntax Syntax

  1. <CUSTOMER_DELETE_RESPONSE>
     <Customer_Delete_Response_Header>
       <inquiryEmployeeNumber></inquiryEmployeeNumber>
       <inquiryEmployeeStoreNumber></inquiryEmployeeStoreNumber>
       <problemDescription></problemDescription>
     </Customer_Delete_Response_Header>
    </CUSTOMER_DELETE_RESPONSE>
End of the code.