VFN_Register()

This subprocedure can be used to register a device, creating a record in VFNDVC and registering the POS and device with Verifone’s Register service.

Subprocedure Prototype

D VFN_Register...
D                 PR              N   Extproc('VFN_Register')

Returns *OFF if an error occurs during processing, *ON otherwise.

D  pRequestDS                         LikeDS(VFN_RegisterReqDS_t) Const
 
D  pResponseDS                        LikeDS(VFN_RegisterRspDS_t)
 
D  pErrorDS                           LikeDS(VFN_ErrorDS_t)
D                                     Options(*Nopass)

Optional parameter that, if passed, will contain error data returned from the subprocedure.

Example Code


// Example Program: T_REGISTER // Description: // This is a test program to illustrate how to call the VFN_Register() // subprocedure. This subprocedure handles generating the required // public-private key pair, registering with the specified device, // and calculating the SHA-256 HMAC value for subsequent requests to // use as part of their counter calculations. This creates a record in // physical file VFNDVC, and the device ID can then be used with // other VFN subprocedures. Ctl-Opt DftActGrp(*No) ActGrp(*Caller) BndDir('PTTIBND'); /COPY QRPGLECPY,VFNCB // This is included for demo output purposes. Dcl-Pr WriteToJobLog Int(10) Extproc('Qp0zLprintf'); pString Pointer Value Options(*String); End-Pr; Dcl-C NewLine x'15'; // This will capture returned error information Dcl-Ds ErrorDS LikeDS(VFN_ErrorDS_t) Inz(*LikeDS); // This will be used to pass request information to the API call Dcl-Ds RegReqDS LikeDS(VFN_RegisterReqDS_t) Inz(*LikeDS); // This will store parsed response data from the API call Dcl-Ds RegRspDS LikeDS(VFN_RegisterRspDS_t) Inz(*LikeDS); reset ErrorDS; reset RegReqDS; reset RegRspDS; // VFN_GenerateEntryCode() is a convenience subprocedure that generates // a 4 character numeric code that is used to confirm the device // registration. However, you do not need to use it and could simply // assign a 4 character numeric string: RegReqDS.EntryCode = '1234'; //RegReqDS.EntryCode = VFN_GenerateEntryCode(); // Device ID can be anything, and will be used by all other APIs to // identify which device you are communicating with RegReqDS.DeviceID = 'test'; // The URL or IP address of the device. This should not include http:// RegReqDS.DeviceHost = '24.197.176.135'; // The default ports for Verifone devices are 5015 and 5016, but if you // configure them differently you can set those values here RegReqDS.PrimaryPort = 25015; RegReqDS.SecondaryPort = 25016; // Verifone makes different functions available based on device model. // It is important that the device model is set correctly during // registration to avoid calling functions that do not exist on your // device, or which may expect different fields. A complete list of // the models supported can be found in the copybook QRPGLECPY,VFNCB // or in the online product documentation. RegReqDS.Model = VFN_MODEL_MX915; // This is purely for recordkeeping purposes and is not used by the APIs RegReqDS.DeviceDescription = 'Test device'; // By default PTTI uses a timeout of 10 seconds for each of these next // fields, so you can ignore them unless you need to modify them to // accomodate your implementation/network/etc. RegReqDS.ReadTimeout = 10; RegReqDS.WriteTimeout = 10; RegReqDS.ConnectTimeout = 10; // if VFN_Register() returns *Off, it means that an error occurred // as part of the overall communication process, and the information // will be in ErrorDS - ErrorDS.Message is the main field to look at // for troubleshooting. if not VFN_Register( RegReqDS : RegRspDS : ErrorDS ); // handle error WriteToJobLog( 'Message ID: ' + ErrorDS.MessageId + NewLine ); WriteToJobLog( 'Message: ' + ErrorDS.Message + NewLine ); *INLR = *On; return; else; // Now you can check the response data structure for any status info // or data returned from the device: WriteToJobLog( 'Response Text: ' + RegRspDS.ResponseText + NewLine ); WriteToJobLog( 'Result: ' + RegRspDS.Result + NewLine ); WriteToJobLog( 'Response Code: ' + RegRspDS.ResultCode + NewLine ); WriteToJobLog( 'Termination Status: ' + RegRspDS.TerminationStatus + NewLine ); endif; *INLR = *On; return;

Data Structures

D VFN_RegisterReqDS_t...
D                 DS                  Qualified Template Inz
 
D  DeviceID                           Like(VFN_DeviceId_t)

Required

The ID to be assigned to the payment device. If this ID already exists in VFNDVC, the procedure will throw an error and abort.

D  RequestLog                         Like(VFN_Var1Kv_t)

Specifies the file name or path of the request log file. Will have no effect if logging is not enabled.

Example: "req_log.txt","/tmp/logs/request.txt"

D  ResponseLog                        Like(VFN_Var1Kv_t)

Specifies the file name or path of the response log file. Will have no effect if logging is not enabled.

Example: "rsp_log.txt","/tmp/logs/response.txt"

D  EntryCode                     4A

Required

The four-digit code to be verified on the payment device. Can be generated using VFN_GenerateEntryCode().

D  PrimaryPort                   5P 0 Inz(5015)

Default Value: 5015

D  SecondaryPort                 5P 0 Inz(5016)

Default Value: 5016

D  ConnectTimeout...
D                                3P 0 Inz(10)

default:10

D  WriteTimeout...
D                                3P 0 Inz(10)

default:10

D  ReadTimeout...
D                                3P 0 Inz(10)

default:10

D  DeviceHost                         Like(VFN_Var1Kv_t)

Required

The address of the payment device.

D  DeviceDescription...
D                                     Like(VFN_Var1Kv_t)

A description of the payment device to be registered. Can be used to assign recognizable names to devices.

D  ConnectTimeout...
D                                3P 0 Inz(-1)

Override the default value set in VFN_Register() or REGVFNDVC.

Default Value: -1

D  WriteTimeout...
D                                3P 0 Inz(-1)

Override the default value set in VFN_Register() or REGVFNDVC.

Default Value: -1

D  ReadTimeout...
D                                3P 0 Inz(-1)

Override the default value set in VFN_Register() or REGVFNDVC.

Default Value: -1

D VFN_RegisterRspDS_t...
D                 DS                  Qualified Template Inz
 
D  ResponseText                       Like(VFN_Var1Kv_t)

This field corresponds to the field RESPONSE_TEXT in your device's Verifone documentation.

D  Result                             Like(VFN_Var1Kv_t)

This field corresponds to the field RESULT in your device's Verifone documentation.

D  ResultCode                   10A   Varying

This field corresponds to the field RESULT_CODE in your device's Verifone documentation.

D  TerminationStatus...
D                                     Like(VFN_Var1Kv_t)

This field corresponds to the field TERMINATION_STATUS in your device's Verifone documentation.