The Adyen.POS service and communicating variables using COM

The Adyen.POS service

Specific calls used will vary depending on the implementation language,

The single service executable registers under the name "Adyen.POS". The cash register creates an instance of the Adyen.POS service according to coding preference. For example: objADYPOS. We use this example name throughout this guide.

Communicate boolean variables using the COM

Communicating boolean variables across COM varies for different application languages and implementations. To prevent variations in implementations, in the C library COM extension for Windows booleans are handled via a simple {0,1} Integer mapping. False equates to 0 and True is passed as 1.

To implement this, we assume the cash register has a method, for example COMBoolean, which takes a single argument of type boolean and returns a 0/1. We use the method throughout this guide. 

Communicate ENUMs using the COM

The ENUMs as defined in the C library are not portable through the COM extension for Windows. Adyen provides helper methods to allow the cash register to retrieve the string representing the ENUM.

Example methods are: GetInitFlagsGetPEDresultStrGetLIBresultStr, and GetPSPresultStr.

Callback results are passed in the form of integers. The values can then be checked by the application for process control. The objADYPOS instance offers methods to interpret the provided values.

Code Example: Result checking

private void AdyenPOSClass_RegisterAppCB(AppInfo appObj, int pedResult, int pspResult, int libResult, string errorMessage)
    // Check if pspresult and library result is 0. If result is 0 then the register application is successful

    if (pspResult == 0 && libResult==0)
        Log.Debug("App registered");

    // Translate the error messages

        string pspResultCode = objPOS.GetPSPresultStr(pspResult);
        string libResultCode = objPOS.GetLIBresultStr(libResult);
            "RegisterApp callback ped_result: {0} lib_result: {1} PSP_result: {2} error_message: {3}",
            pedResult, libResultCode, pspResultCode, errorMessage));

The values returned by the ENUM in the C Library are string literals. The value 0 is used for successful results. All other values indicate an action has been duplicated unnecessarily, a longer wait is required, or a problem was encountered. When the application encounters a non-zero value, it is recommended to log the issue and have the application message the cash register staff so that they can take action if necessary. 

Obtain the available values (strings) by either looking at the C library header files or by running a simple loop on the helper methods. If you find an occurrence of an empty string, or a string with the value UNKNOWN, this indicates the end of the available entries in the underlying ENUM.