Project

General

Profile

Actions

Programming Guide for Batch Program » History » Revision 2

« Previous | Revision 2/5 (diff) | Next »
chin-yeh, 09/29/2011 10:49 AM


Programming Guide for Batch Program

Refer to Programming Guide if integrating in other environment, e.g. web app

All of the APIs mentioned below will not invoke the DP web services at all. Instead it will insert record into interface table and then those records will be picked up by a specific batch program and send it to DP on daily basis.

The Javadoc of dp-client:

http://192.168.2.13:50000/dp_client_apidocs/

The binary or source files of dp-client:

SCM

Demo application of dp-client:

There is no demo application for these APIs but these API usage is very similiar with the one that mentioned in Programming Guide

Commit Sales

This method is used to deduct DP balance. And, this method will only persist the transaction details into database.

Method Signature:

public static int persistSalesCommit(java.sql.Connection dbConnection,
                                     java.lang.String transactionId,
                                     java.lang.String countryCode,
                                     java.lang.String memberId,
                                     java.util.Date trxDate,
                                     java.math.BigDecimal dpAmount,
                                     java.math.BigDecimal invoiceAmount)
                              throws java.sql.SQLException

Input Parameters

See persistSalesCommit

Output Parameters

The number of affected rows

Code Snippets

Connection dbConnection = DBConnectionFactory.createDbConnection("java:/DB2DS2");
TransactionResponse dpResponse = new TransactionResponse();
try {
    dpResponse = DPServicesUtils.persistSalesCommit(dbConnection,
                trxId, countryCode, shopperId,
                trxDate, dpAmount, invoiceAmount);
} catch (SQLException ex) {
    LOGGER.error("Error in persisting the event", ex);
} finally {        
    if (dbConnection != null) {
       dbConnection.close();
    }
}

Sales Return / Cancel Sales

This method is used to adjust the DP balance.

Method Signature:

public static int persistSalesReturn(java.sql.Connection connection,
                                     java.lang.String transactionId,
                                     java.lang.String countryCode,
                                     java.lang.String memberId,
                                     java.util.Date trxDate,
                                     java.math.BigDecimal dpAmount,
                                     java.math.BigDecimal invoiceAmount)
                              throws java.sql.SQLException

Input Parameters

See persistSalesReturn

Output Parameters

The number of affected rows

Code Snippets

Connection dbConnection = DBConnectionFactory.createDbConnection("java:/DB2DS2");

TransactionResponse dpResponse = new TransactionResponse();

try {
    dpResponse = DPServicesUtils.persistSalesReturn(dbConnection, trxId, countryCode, 
            shopperId,trxDate, dpAmount, invoiceAmount);    

} catch (SQLException ex) {
    LOGGER.error("Error in persisting the event", ex);
} finally {
    if (dbConnection != null) {
        dbConnection.close();
    }
}

VIP Upgrade to BO

This method upgrades the VIP to BO. One must utilize all of the remaining DP balance in the limited period of time. The validity period is determined by DP.

Method Signature:

public static int persistVipUpgrade(java.sql.Connection connection,
                                    java.lang.String trxId,
                                    java.lang.String countryCode,
                                    java.lang.String memberName,
                                    java.lang.String memberId,
                                    java.lang.String newMemberId,
                                    java.util.Date trxDate)
                             throws java.sql.SQLException

Input Parameters

See persistVipUpgrade

Output Parameters

The number of affected rows

Code Snippets

Connection dbConnection = DBConnectionFactory.createDbConnection("java:/DB2DS2");

TransactionResponse dpResponse = new TransactionResponse();

try {
    dpResponse = DPServicesUtils.persistVipUpgrade(dbConnection, trxId, countryCode,
            memberName, shopperId, newShopperId, trxDate);

} catch (SQLException ex) {
    LOGGER.error("Error in persisting the event", ex);
} finally {
    if (dbConnection != null) {
        dbConnection.close();
    }
}

Updated by chin-yeh almost 13 years ago · 2 revisions