The Jim Bob ACH Interface


The API documentation, which has been supplied to you in PDF form, includes the interface definition that the class JimBobAch implements. It also includes the definition for the related data classes. You can take the Jim Bob ACH code and for the time being copy it into your system. Enter this code into the directory structure ./com/jimbob/ach within your source directory. (You would probably be able to paste it directly from the PDF document.)

When you receive the actual API library from Jim Bob and company, ensure that it matches what you have before deleting your temporary copy.

[View full width]

// com.jimbob.ach.Ach package com.jimbob.ach; public interface Ach { public AchResponse issueDebit(AchCredentials credentials, AchTransactionData data); public AchResponse markTransactionAsNSF(AchCredentials credentials, AchTransactionData data, String traceCode); public AchResponse refundTransaction(AchCredentials credentials, AchTransactionData data, String traceCode); public AchResponse issueCredit(AchCredentials credentials, AchTransactionData data); public AchResponse voidSameDayTransaction(AchCredentials credentials, AchTransactionData data, String traceCode); public AchResponse queryTransactionStatus(AchCredentials credentials, AchTransactionData data, String traceCode); } // com.jimbob.ach.AchCredentials package com.jimbob.ach; public class AchCredentials { public String merchantId; public String userName; public String password; } // com.jimbob.ach.AchTransactionData package com.jimbob.ach; import java.math.BigDecimal; public class AchTransactionData { public String description; public BigDecimal amount; public String aba; public String account; public String accountType; } // com.jimbob.ach.AchResponse package com.jimbob.ach; import java.util.*; public class AchResponse { public Date timestamp; public String traceCode; public AchStatus status; public List<String> errorMessages; } // com.jimbob.ach.AchStatus package com.jimbob.ach; public enum AchStatus { SUCCESS, FAILURE; }

For now, you are interested only in the Ach interface method named issueDebit. You must send the issueDebit message to a JimBobAch object in order to withdraw money from the bank account. The message takes an Ach-Credentials object and an AchTransactionData object as parameters. Note the questionable practice of exposing the instance variables directly in these two classes. Unfortunately, when you deal with third-party vendor software, you get what you get.

The issueDebit method returns an AchResponse object upon completion. This response data indicates whether or not the debit succeeded by using an AchStatus enum value.



Agile Java. Crafting Code with Test-Driven Development
Agile Javaв„ў: Crafting Code with Test-Driven Development
ISBN: 0131482394
EAN: 2147483647
Year: 2003
Pages: 391
Authors: Jeff Langr

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net