Duplicate Detect User Exit
com.ibm.icpcs.transactionserver.userexit.UserDuplicateDetectThis
interface has the following methods:
setPresentment (Presentment presentment);
modifyDupRecordForPayment (Item item, RecordData dupRecord);
modifyDupRecordForOutgoingItem(Item item, RecordData dupRecord)The setPresentment method is called by the Transaction Server to give the user access to the current batch (ICL) being processed by the modifyDupRecordForPayment method. The modifyDupRecordForPayment method is called by the Transaction Server to give the user the opportunity to modify the data being sent to the Duplicate Detect API. The modifyDupRecordForOutgoingItem method is called to modify the data of an outgoing batch (ICL). The first parameter is an item object that contains the data from the item and payment tables in the FTM database. This object gives the user access to all the MICR fields, along with additional fields. The second parameter is a RecordData object. This is the object that is passed to the Duplicate Detect API. The object contains an array of FieldData objects that contains the names and values of all the fields that are part of the duplicate checking algorithm. The Transaction Server populates this array with all the fields that are part of the Duplicate Detect reference implementation for payments.
The Transaction Server provides an abstract implementation of the UserDuplicateDetect interface called UserDuplicateDetectImpl. The simple implementation of the interface is provided to shield the user from any future changes to the interface. It implements the setPresentment method so you do not have to if you extend the implementation. You should extend this implementation class as it is shown in the sample Duplicate Detect user exit, SampleDuplicateDetectUserExit, provided in the samples folder.
FieldData objects and excludes transactions
less than two dollars from being duplicate checked. It also excludes
all transactions from being duplicate checked if the sort pattern
is zero.
package com.ibm.icpcs.transactionserver.samples.userexit;
//************************************************************************//
// //
//Name = SampleDupPaymentDuplicateDetectImpl //
// //
//Description = //
// //
//Status = Version 01 Release 01 Modification Level 00 //
// //
//Compiler = IBM Java Standard Edition (build 5.0) //
// //
//Change Activity: //
// //
// Feature/Defect Date Description //
// -------------- ---------- ------------------------------------------ //
// F8705 2007/08/28 part created. //
//************************************************************************//
import com.ibm.icpcs.transactionserver.database.objects.Item;
import com.ibm.icpcs.transactionserver.userexit.UserDuplicateDetectImpl;
import com.ibm.paydir.dupdetect.data.FieldData;
import com.ibm.paydir.dupdetect.data.RecordData;
public class SampleDuplicateDetectUserExit extends UserDuplicateDetectImpl {
/**
* Called by the Transaction Server
* to allow the user to modify the data being sent to the duplicate
* detect engine. This method is called for every item being duplicate
* checked.
* User can add/delete/modify the fields contained in the RecordData object
* for their specific implementation of duplicate detect.
* @param itemRec - current Item being processed
* @param dupRecord - duplicate detect RecordData object
* @return boolean - true = dup check the item, false = don't dup check
* this item.
*/
public boolean modifyDupRecordForPayment(Item item, RecordData dupRecord)
{
// possible filter out low dollar amounts on the client side
String sAmt = item.getMicrField(Item.MICR_FIELD1_IDX);
long amt;
if (sAmt != null && sAmt.length() > 0)
try {
amt = Long.parseLong(sAmt);
// the amount was less than 2 dollars
// don't bother with dup check
if (amt < 200)
return false;
} catch (NumberFormatException nfe) {
// Amount should always be numeric but just in case....
}
// Here you could possibly add your own field
// This example adds Micr field 8 to the fields to be dup detected.
dupRecord.addField(new FieldData("FIELD_8",
item.getMicrField (Item.MICR_FIELD8_IDX)));
// the presentment is also available for you to look at
// This example doesn't perform dup check on any items if the
// sort pattern is 0.
if (presentment.getSortPattern() == 0)
return false;
return true;
}
}