diff --git a/README b/README
deleted file mode 100644
index afe89d0..0000000
--- a/README
+++ /dev/null
@@ -1,54 +0,0 @@
-Authorize.Net Android SDK
-=========================
-
-The Android SDK is meant to offer an easy approach to collecting payments
-on the Android mobile devices. It's an addition to the Authorize.Net Java
-SDK. The Android SDK provides a fast and easy way for Android developers
-to quickly integrate mobile payments without having to write the boiler plate
-code themselves that is necessary to communicate with the Authorize.Net gateway.
-
-The SDK is comprised of the following Authorize.Net APIs:
-
- * AIM - Advanced Integration Method
- * Transaction Details
- * CIM - Customer Information Manager
-
-Examples of implementation and integration will be published shortly. The examples do
-not cover the app building process, but offer the necessary pieces of
-information to help the developer add Authorize.Net payment gateway function-
-ality to their app.
-
-Every example will require that the necessary Authorize.Net SDK components
-exist in the project (either create a new project, or update a current project).
-
-Here are those steps:
-
-1. Add the Authorize.Net Android SDK library to your project in your
-environment workspace. If you would like to easily import the SDK project into Eclipse,
-run 'unzip eclipse_files.zip' from the command line in the anet_android_sdk
-directory. Make sure the files get unzipped directly into the root SDK
-directory.
-
-2. If your AndroidManifest.xml file doesn't already allow access to the
-Internet and your phone state, make sure to add the following snippetd in the
-manifest element.
-
-
-
-
-
-3. Add the according activity declarations to the AndroidManifest.xml within the
-application element of your app. Every activity declaration is NOT necessary,
-only the ones that are explicitly used in the app are required.
-
-4. The developer will need to create a layout that will be used to collect
-the account login id and password. These two pieces of information should be
-EditText objects. Additionally a cancel and validate/ok button will need to
-be placed in the layout as well. They don't have to be visible, but they must
-exist. The SDK takes the Android id's of these components and uses them when
-it's necessary to login to the Authorize.Net gateway. The logic is handled by
-the SDK, but the UI is flexible and must be implemented by the developer.
-
-
-
-
diff --git a/README.md b/README.md
old mode 100644
new mode 100755
index be4cdca..86528b3
--- a/README.md
+++ b/README.md
@@ -1,37 +1,97 @@
-**Authorize.Net Android SDK for Mobile Point of Sale Applications**
-=========================
-
-The Android SDK provides a fast and easy way for Android developers
-to quickly integrate card-present payments into their mobile Point-Of-Sale applications.
-
-To add the Android SDK to your project:
-
-
-- Add the Authorize.Net Android SDK library to your project in your
-environment workspace. If you would like to easily import the SDK project into Eclipse,
-run 'unzip eclipse_files.zip' from the command line in the anet_android_sdk
-directory. Make sure the files get unzipped directly into the root SDK
-directory.
-
-- If your AndroidManifest.xml file doesn't already allow access to the
-Internet and your phone state, make sure to add the following snippet in the
-manifest element.
-```xml
-
-
-
- ```
-
-- Add the according activity declarations to the AndroidManifest.xml within the
-application element of your app. Every activity declaration is NOT necessary,
-only the ones that are explicitly used in the app are required.
-
-- The developer will need to create a layout that will be used to collect
-the account login id and password. These two pieces of information should be
-EditText objects. Additionally a cancel and validate/ok button will need to
-be placed in the layout as well. They don't have to be visible, but they must
-exist. The SDK takes the Android id's of these components and uses them when
-it's necessary to login to the Authorize.Net gateway. The logic is handled by
-the SDK, but the UI is flexible and must be implemented by the developer.
-
+# Authorize.Net In-Person Android SDK
+
+The Android SDK is meant to offer an easy approach to collecting payments on the Android mobile devices. It's an addition to the Authorize.Net Java
+SDK. The Android SDK provides a fast and easy way for Android developers to quickly integrate mobile payments without having to write the boiler plate code themselves that is necessary to communicate with the Authorize.Net gateway.
+
+The Authorize.Net In-Person SDK also provides a Semi-Integrated Solution for EMV payment processing. The merchant's app invokes this SDK to complete an EMV transaction. The SDK handles the complex EMV workflow and securely submits the EMV transaction to Authorize.Net for processing. The merchant's application never touches any EMV data at any point.
+
+
+The SDK is comprised of the following Authorize.Net APIs:
+
+ * AIM - Advanced Integration Method
+ * Transaction Details
+ * CIM - Customer Information Manager
+
+Every application will require that the necessary Authorize.Net SDK components exist in the project (either create a new project, or update a current project).
+
+## Before you start the integration:
+
+1. If your AndroidManifest.xml file doesn't already allow access to the
+Internet and your phone state, make sure to add the following snippet in the manifest element.
+
+ ```xml
+
+
+
+ ```
+
+2. The developer will need to create a layout that will be used to collect account login id and password. These two pieces of information should be
+EditText objects. Additionally a cancel and validate/ok button will need to be placed in the layout as well. They don't have to be visible, but they must exist. The SDK takes the Android id's of these components and uses them when it's necessary to login to the Authorize.Net gateway. The logic is handled by the SDK, but the UI is flexible and must be implemented by the developer.
+
+
+
+# Integration Guide
+
+
+## Operational Workflow
+
+1. From POS application, select Pay By Card.
+
+2. Attached the card reader to the device if it is not already attached.
+
+3. Insert a card with an EMV chip and do not remove the card until the transaction is complete. Alternatively, swipe a non-EMV card.
+
+4. If only a single compatible payment app resides on the chip, the payment app is selected automatically. If prompted, select the payment app. For example, Visa credit or MasterCard debit.
+
+5. Confirm the amount.
+
+6. If at any time the user cancels the transaction, the transaction is cancelled.
+
+## Using the SDK to Create and Submit an EMV Transaction (using Android Studio)
+
+1. Import In-Person Android SDK framework to the merchant’s application. In Android Studio, create new module for emv-anet-sdk.aar by using File-New-New Module-Import jar/aar library.
+
+2. Update gradle build files
+
+ a) add the following line to the app folder build.gradle file:
+ compile project(':emv-anet-sdk')
+
+ b) add the following dependencies to the dependency section:
+ ```
+ compile 'com.android.support:cardview-v7:23.3.0'
+ compile 'com.android.support:appcompat-v7:23.4.0'
+ compile 'com.madgag.spongycastle:prov:1.53.0.0'
+ compile 'org.apache.httpcomponents:httpcore:4.4.1'
+ compile 'org.apache.httpcomponents:httpclient:4.5'
+ testCompile 'junit:junit:4.12'
+ testCompile 'org.hamcrest:hamcrest-library:1.3''
+ ```
+
+3. Create merchant object using password authentication:
+
+ a) create `PasswordAuthentication` object using login, password and deviceID
+
+ b) create `Merchant` object using `PasswordAuthentication` and specified environment
+
+ c) get session token using `SessionTokenAuthentication` and populate the field into `Merchant`
+
+4. Create EMV Transaction
+
+ a) create `EMVTranasction` using Merchant and transaction amount
+
+ b) create `EMVTransactionListener` to hold call back methods
+
+ c) start EMV transaction
+
+### Success
+
+On success, onEMVTransactionSuccessful method will be called, with the result populated in net.authorize.aim.emv.Result object
+
+### Errors
+
+In case of a transaction error, the onEMVTransactionError method will be called, with specified EMVErrorCode and result object.
+
+In case of other errors, the onEMVReadError method will be called, with only EMVErrorCode specified.
+
+Refer to EMVErrorCode class for detailed error code.
diff --git a/anet_java_sdk.properties b/anet_java_sdk.properties
deleted file mode 100644
index 5e3df89..0000000
--- a/anet_java_sdk.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Populate this file and put it into your home directory,
-# named as anet_java_sdk.properties
-#
-
-# API login/transaction key credentials
-api.login.id=API_LOGIN_ID
-transaction.key=TRANSACTION_KEY
-
-# Card Present transactions currently require different credentials.
-cp.api.login.id=API_LOGIN_ID
-cp.transaction.key=TRANSACTION_KEY
-md5.hash.key=MD5_HASH_KEY
-
-# DPM merchant host
-merchant.host=MERCHANT_HOST
-
-# Merchant accounts need have to have explicit support for unlinked credits.
-# Set this value to TRUE or FALSE if support exists.
-unlinked.credit.support=(TRUE|FALSE)
-
-# Mobile credential information
-username=USERNAME
-password=PASSWORD
-mobile.device.id=MOBILE_DEVICE_ID
-
-# Notification email address
-notification.email.address=NOTIFICATION_EMAIL_ADDRESS
diff --git a/anet_java_sdk.properties.example b/anet_java_sdk.properties.example
deleted file mode 100644
index 58e1e11..0000000
--- a/anet_java_sdk.properties.example
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Populate this file and put it into your home directory,
-# named as anet_java_sdk.properties
-#
-
-# API login/transaction key credentials
-api.login.id=API_LOGIN_ID11
-transaction.key=TRANSACTION_KEY11
-
-# Card Present transactions currently require different credentials.
-cp.api.login.id=API_LOGIN_ID11
-cp.transaction.key=TRANSACTION_KEY11
-md5.hash.key=MD5_HASH_KEY11
-
-# DPM merchant host
-merchant.host=MERCHANT_HOST11
-
-# Merchant accounts need have to have explicit support for unlinked credits.
-# Set this value to TRUE or FALSE if support exists.
-unlinked.credit.support=(TRUE|FALSE)
-
-# Mobile credential information
-username=USERNAME
-password=PASSWORD
-mobile.device.id=MOBILE_DEVICE_ID
-
-# Notification email address
-notification.email.address=NOTIFICATION_EMAIL_ADDRESS
-
diff --git a/build.properties.txt b/build.properties.txt
deleted file mode 100644
index 58e1e11..0000000
--- a/build.properties.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Populate this file and put it into your home directory,
-# named as anet_java_sdk.properties
-#
-
-# API login/transaction key credentials
-api.login.id=API_LOGIN_ID11
-transaction.key=TRANSACTION_KEY11
-
-# Card Present transactions currently require different credentials.
-cp.api.login.id=API_LOGIN_ID11
-cp.transaction.key=TRANSACTION_KEY11
-md5.hash.key=MD5_HASH_KEY11
-
-# DPM merchant host
-merchant.host=MERCHANT_HOST11
-
-# Merchant accounts need have to have explicit support for unlinked credits.
-# Set this value to TRUE or FALSE if support exists.
-unlinked.credit.support=(TRUE|FALSE)
-
-# Mobile credential information
-username=USERNAME
-password=PASSWORD
-mobile.device.id=MOBILE_DEVICE_ID
-
-# Notification email address
-notification.email.address=NOTIFICATION_EMAIL_ADDRESS
-
diff --git a/build.xml b/build.xml
deleted file mode 100644
index 2811af7..0000000
--- a/build.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Authorize.Net Java SDK]]>
-
-
-
-
diff --git a/docs/javadocs/allclasses-frame.html b/docs/javadocs/allclasses-frame.html
deleted file mode 100644
index 6a54bdd..0000000
--- a/docs/javadocs/allclasses-frame.html
+++ /dev/null
@@ -1,231 +0,0 @@
-
-
-
-
-This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
-Overview
-
-
-
-The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
-
-Package
-
-
-
-Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:
-
Interfaces (italic)
Classes
Enums
Exceptions
Errors
Annotation Types
-
-
-Class/Interface
-
-
-
-Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
-
Class inheritance diagram
Direct Subclasses
All Known Subinterfaces
All Known Implementing Classes
Class/interface declaration
Class/interface description
-
-
Nested Class Summary
Field Summary
Constructor Summary
Method Summary
-
-
Field Detail
Constructor Detail
Method Detail
-Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
-
-
-Annotation Type
-
-
-
-Each annotation type has its own separate page with the following sections:
-
Annotation Type declaration
Annotation Type description
Required Element Summary
Optional Element Summary
Element Detail
-
-
-
-Enum
-
-
-
-Each enum has its own separate page with the following sections:
-
Enum declaration
Enum description
Enum Constant Summary
Enum Constant Detail
-
-
-Use
-
-Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
-
-Tree (Class Hierarchy)
-
-There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
-
When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
-
-
-Deprecated API
-
-The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
-
-Index
-
-The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
-
-Prev/Next
-These links take you to the next or previous class, interface, package, or related page.
-Frames/No Frames
-These links show and hide the HTML frames. All pages are available with or without frames.
-
-
-Serialized Form
-Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
-
ACH notice of change (NOC) codes that may be received from the customer's
- bank in the event of a discrepancy in the bank information provided with the transaction.
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (AuthNetField c : AuthNetField.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
-Determines which environment to post transactions against.
- By placing the merchant's payment gateway account in Test Mode in the
- Merchant Interface. New payment gateway accounts are placed in Test Mode
- by default. For more information about Test Mode, see the Merchant
- Integration Guide at http://www.authorize.net/support/merchant/.
-
- When processing test transactions in Test Mode, the payment gateway will
- return a transaction ID of "0." This means you cannot test follow-on
- transactions, for example, credits, voids, etc., while in Test Mode.
-
- Note: Transactions posted against live merchant accounts using either of
- the above testing methods are not submitted to financial institutions for
- authorization and are not stored in the Merchant Interface.
-
createEnvironment(java.lang.String nvpBaseUrl,
- java.lang.String xmlBaseUrl)
-
-
- If a custom environment needs to be supported, this convenience create
- method can be used to pass in custom URLS for NVP and xml gateways.
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (Environment c : Environment.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
-Container to hold authentication credentials.
-
- The Merchant is also responsible for creating transactions and posting them
- to the gateway are performed through the Merchant.
-
Indicates if the transaction is enabled for partial authorization.
- Including this field in the transaction request overrides your account
- configuration.
-
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (ResponseCode c : ResponseCode.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
-ResponseField mappings used in processing and matching the returned data from
- the payment gateway.
-
- This enum is leveraged across all the integrations of
- AIM,SIM,DPM,ARB and CIM.
-
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (ResponseField c : ResponseField.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (ResponseReasonCode c : ResponseReasonCode.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (TransactionType c : TransactionType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
-
-
-
-
-
-getValue
-
-@Deprecated
-public java.lang.String getValue()
-
-
Deprecated.As of release 2.0.0, replaced by getNVPValue()
-
-
Return the value needed for SIM/DPM integrations.
-
-
-
-
Returns:
the value
-
-
-
-
-
-getNVPValue
-
-public java.lang.String getNVPValue()
-
-
Return the value needed for SIM/DPM integrations.
-
-
-
-
Returns:
the value
-
-
-
-
-
-getCIMValue
-
-public java.lang.String getCIMValue()
-
-
Return the value needed for CIM integrations.
-
-
-
-
Returns:
cim transaction type value.
-
-
-
-
-
-getXmlValue
-
-public java.lang.String getXmlValue()
-
-
Return the value needed for AIM (XML-based) integrations.
-
setTransHash(java.lang.String transHash)
-
-
- Set the payment gateway generated MD5 hash value that can be used to
- authenticate the transaction response.
-
-
-
- void
-
setTransId(java.lang.String transId)
-
-
- Set the transaction id.
-
-
-
-
-
-
Methods inherited from class net.authorize.xml.Result
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (DeviceType c : DeviceType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (MarketType c : MarketType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (TransactionType c : TransactionType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (MerchantAuthenticationType c : MerchantAuthenticationType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
SessionTokenAuthentication.createMerchantAuthentication(SessionTokenAuthentication sessionTokenAuth,
- java.lang.String secret)
-
-
- Creates a session token authenticator from an existing auth, but with an
- updated sessionToken.
SessionTokenAuthentication.createMerchantAuthentication(SessionTokenAuthentication sessionTokenAuth,
- java.lang.String secret)
-
-
- Creates a session token authenticator from an existing auth, but with an
- updated sessionToken.
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (SplitTenderStatus c : SplitTenderStatus.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (TransactionType c : TransactionType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (ValidationModeType c : ValidationModeType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Environment.createEnvironment(java.lang.String nvpBaseUrl,
- java.lang.String xmlBaseUrl)
-
-
- If a custom environment needs to be supported, this convenience create
- method can be used to pass in custom URLS for NVP and xml gateways.
Transaction.createTransaction(Merchant merchant,
- TransactionType transactionType,
- long fingerPrintSequence,
- java.math.BigDecimal amount)
-
-
- Create a Transaction for a given merchant.
Transaction.createTransaction(Transaction transaction,
- java.util.Hashtable<ResponseField,java.lang.String> responseMap)
-
-
- Create a transaction from a responseMap.
ResponseParser.parseResponseString(java.lang.String responseString,
- java.lang.String delimiter)
-
-
- Take a string and parses it into a Map keyed on ResponseFields.
Transaction.createTransaction(Merchant merchant,
- TransactionType transactionType,
- long fingerPrintSequence,
- java.math.BigDecimal amount)
-
-
- Create a Transaction for a given merchant.
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (CustomerType c : CustomerType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
-Merchants can opt to send a payment gateway generated email receipt to
- customers who provide an email address with their transaction.
-
- The email receipt includes a summary and results of the transaction.
-
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (PaymentMethod c : PaymentMethod.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (PermissionType c : PermissionType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (SubscriptionStatusType c : SubscriptionStatusType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (SubscriptionUnitType c : SubscriptionUnitType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Order.addOrderItem(OrderItem orderItem)
-
-
- Adds an OrderItem to the list of OrderItems - provided the list of items
- isn't already at the max of 30.
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (AVSCode c : AVSCode.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (CardType c : CardType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
setMaskedCreditCardNumber(java.lang.String maskedCreditCardNumber)
-
-
- Used in the response that comes back to offer access to the partial credit card number.
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (BankAccountType c : BankAccountType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (ECheckType c : ECheckType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
-ACH notice of change (NOC) codes that may be received from the customer's
- bank in the event of a discrepancy in the bank information provided with the transaction.
-
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (NOCCode c : NOCCode.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (ReturnCode c : ReturnCode.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
ACH notice of change (NOC) codes that may be received from the customer's
- bank in the event of a discrepancy in the bank information provided with the transaction.
ECheck
-
-
- Container used to hold ECheck related information.
-
-
-
ECheckType
-
-
- eCheck.Net transaction types supported by the Authorize.Net Payment Gateway
-
- ARC - Accounts Receivable Conversion
- BOC - Back Office Conversion
- CCD - Cash Concentration or Disbursement
- PPD - Prearranged Payment and Deposit Entry
- TEL - Telephone-Initiated Entry
- WEB - Internet-Initiated Entry
-
-
-
NOCCode
-
-
- ACH notice of change (NOC) codes that may be received from the customer's
- bank in the event of a discrepancy in the bank information provided with the transaction.
EmailReceipt
-
-
- Merchants can opt to send a payment gateway generated email receipt to
- customers who provide an email address with their transaction.
EmailReceipt
-
-
- Merchants can opt to send a payment gateway generated email receipt to
- customers who provide an email address with their transaction.
EmailReceipt
-
-
- Merchants can opt to send a payment gateway generated email receipt to
- customers who provide an email address with their transaction.
EmailReceipt
-
-
- Merchants can opt to send a payment gateway generated email receipt to
- customers who provide an email address with their transaction.
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (CAVVResponseType c : CAVVResponseType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (CardCodeResponseType c : CardCodeResponseType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (FDSFilterActionType c : FDSFilterActionType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (ReportingTransactionType c : ReportingTransactionType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (SettlementStateType c : SettlementStateType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (TransactionStatusType c : TransactionStatusType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
-When using the hosted payment form, settings can be configured to match the look of
- the merchantÕs website. The purpose of this class is just that - to
- store the hosted payment form settings.
-
-The hosted receipt page provides the customer with the status of their transaction and can include a
- link back to the merchantÕs website. It can be customized to reflect the look and feel of the
- merchantÕs website.
-
HostedPaymentFormSettings
-
-
- When using the hosted payment form, settings can be configured to match the look of
- the merchantÕs website.
-
-
-
HostedReceiptPageSettings
-
-
- The hosted receipt page provides the customer with the status of their transaction and can include a
- link back to the merchantÕs website.
HostedPaymentFormSettings
-
-
- When using the hosted payment form, settings can be configured to match the look of
- the merchantÕs website.
-
-
-
HostedReceiptPageSettings
-
-
- The hosted receipt page provides the customer with the status of their transaction and can include a
- link back to the merchantÕs website.
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (TransactionType c : TransactionType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (TransactionType c : TransactionType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Merchant
-
-
- Container to hold authentication credentials.
-
-
-
ResponseCode
-
-
- Response code indicates the overall status of the transaction
- with possible values of approved, declined, error, or held for review.
-
-
-
ResponseField
-
-
- ResponseField mappings used in processing and matching the returned data from
- the payment gateway.
-
-
-
ResponseReasonCode
-
-
- Response Reason Code is a numeric representation of a more specific reason for the transaction status.
Merchant
-
-
- Container to hold authentication credentials.
-
-
-
ResponseCode
-
-
- Response code indicates the overall status of the transaction
- with possible values of approved, declined, error, or held for review.
-
-
-
ResponseReasonCode
-
-
- Response Reason Code is a numeric representation of a more specific reason for the transaction status.
-
-
-
TransactionType
-
-
- The credit card transaction types supported by the payment gateway.
ResponseCode
-
-
- Response code indicates the overall status of the transaction
- with possible values of approved, declined, error, or held for review.
ResponseCode
-
-
- Response code indicates the overall status of the transaction
- with possible values of approved, declined, error, or held for review.
-
-
-
ResponseReasonCode
-
-
- Response Reason Code is a numeric representation of a more specific reason for the transaction status.
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (TransactionType c : TransactionType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
createFingerprint(java.lang.String loginID,
- java.lang.String transactionKey,
- long sequence,
- java.lang.String amount)
-
-
- Creates a fingerprint with raw data fields.
-The type of link back to the merchant's website.
-
- LINK creates a regular hyperlink.
- GET creates a button and returns transaction information in the receipt link URL.
- POST creates a button and returns transaction information as an HTML Form POST.
-
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (LinkMethod c : LinkMethod.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
createResult(java.lang.String apiLoginId,
- java.lang.String merchantMD5Key,
- java.util.Map<java.lang.String,java.lang.String[]> responseMap)
-
-
- Create a result for SIM based on the response map.
Transaction(Merchant merchant,
- TransactionType transactionType,
- java.math.BigDecimal amount)
-
-
- Constructor for creation a transaction with typed objects.
-
-
-
-
-
-
-
-
-
-Method Summary
-
-
-
- void
-
addFieldToRename(java.lang.String fieldToRename,
- java.lang.String replacementName)
-
-
- Add a field to rename.
-
-
-
- void
-
addFormInput(java.lang.String inputName,
- java.lang.String htmlInputData)
-
-
- Add an input name and replacement data to the list of fields that should
- not be auto populated in the createForm method.
-
-
-
- java.lang.String
-
createForm(java.lang.String formName,
- java.lang.String formId,
- Button button)
-
-
- Return an HTML form with all inputs.
-
-
-
-static java.lang.String
-
createRelayResponseRedirectUrl(java.lang.String relayResponseUrl,
- java.util.Map<java.lang.String,java.lang.String[]> requestParameterMap)
-
-
- Build a relay response url for the relay response redirect.
createTransaction(Merchant merchant,
- TransactionType transactionType,
- long fingerPrintSequence,
- java.math.BigDecimal amount)
-
-
- Create a Transaction for a given merchant.
setMerchantDefinedField(java.lang.String field,
- java.lang.String value)
-
-
- Set a merchant defined field.
-
-
-
- void
-
setOrder(Order order)
-
-
- Set the Order (and OrderItems) for the transaction request.
-
-
-
- void
-
setRecurringBilling(boolean recurringBillingStatus)
-
-
- Indicating marker used by merchant account providers to identify transactions which originate from merchant
- hosted recurring billing applications.
-
-
-
- void
-
setRelayResponseUrl(java.lang.String relayResponseUrl)
-
-
- SIM applications use relay response to redirect the user back to the merchant server.
setShowPaymentForm(boolean showForm)
-
-
- If true, will populate a field that indicates that the merchant would like to
- use the payment gateway hosted payment form to collect payment data.
-
-
-
- void
-
setSplitTenderId(java.lang.String splitTenderId)
-
-
- The payment gateway assigned slit tender ID of an original transaction.
-
-
-
-static void
-
setTransactionFieldDelimiter(java.lang.String transactionFieldDelimiter)
-
-
- Convenience method for overriding the transaction field delimited.
-
-
-
- void
-
setTransactionId(java.lang.String transactionId)
-
-
- The payment gateway assigned transaction ID of an original transaction.
-
-
-
- java.lang.String
-
toAuthNetPOSTString()
-
-
- Prepare the name/value pair mapping based on the Map(s) provided.
-
-
-
-
-
-
Methods inherited from class net.authorize.NVPTransaction
Convenience method for overriding the transaction field delimited.
-
- Character that will be used to separate fields in the transaction response.
- The system will use the character passed in this field or the value stored
- in the Merchant Interface if no value is passed.
-
Convenience method for overriding the encap char delimiter.
-
- Character that will be used to encapsulate the fields in the transaction response.
- The system will use the character passed in this field or the value stored in
- the Merchant Interface if no value is passed.
-
Indicating marker used by merchant account providers to identify transactions which originate from merchant
- hosted recurring billing applications. This value is not affiliated with Automated Recurring Billing.
-
Get the field names that should not be auto populated
- in the createForm method. The developer can then offer
- these as customized input fields in the form.
-
Add an input name and replacement data to the list of fields that should
- not be auto populated in the createForm method. If the optionsMap is
- empty, then no input element will be created in the form for the
- specified inputName.
-
- Example:
-
- If "notes" was passed in as the inputName, the htmlInputData provided
- could look like
-
- "
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (ButtonType c : ButtonType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
Fingerprint.createFingerprint(java.lang.String loginID,
- java.lang.String transactionKey,
- long sequence,
- java.lang.String amount)
-
-
- Creates a fingerprint with raw data fields.
Result.createResult(java.lang.String apiLoginId,
- java.lang.String merchantMD5Key,
- java.util.Map<java.lang.String,java.lang.String[]> responseMap)
-
-
- Create a result for SIM based on the response map.
Transaction.createTransaction(Merchant merchant,
- TransactionType transactionType,
- long fingerPrintSequence,
- java.math.BigDecimal amount)
-
-
- Create a Transaction for a given merchant.
Transaction.createTransaction(Transaction transaction,
- java.util.Hashtable<ResponseField,java.lang.String> responseMap)
-
-
- Create a transaction from a responseMap.
Transaction.createTransaction(Transaction transaction,
- java.util.Hashtable<ResponseField,java.lang.String> responseMap)
-
-
- Create a transaction from a responseMap.
getElementText(org.w3c.dom.Element parent_el,
- java.lang.String element_name)
-
-
- Helper for getting element text from a parent.
-
-
-
-static java.lang.String
-
getElementText(org.w3c.dom.Element parent_el,
- java.lang.String element_name,
- boolean checkDeepMatchList)
-
-
- Helper for getting element text from a parent.
parseResponseString(java.lang.String responseString,
- java.lang.String delimiter)
-
-
- Take a string and parses it into a Map keyed on ResponseFields.
addCharEntity(int i,
- java.lang.StringBuilder sb)
-
-
- Convert integer to char entity
-
-
-
-static boolean
-
isEmpty(java.lang.String str)
-
-
- Return true if the string is null or "".
-
-
-
-static boolean
-
isNotEmpty(java.lang.String str)
-
-
- Return true if the string is not null and not == "".
-
-
-
-static boolean
-
isTrue(java.lang.String str)
-
-
- Returns true if the string is 1 or "true"
-
-
-
-static java.lang.String
-
sanitizeString(java.lang.String str)
-
-
- Sanitize strings for output
-
-
-
-static java.lang.String
-
subString(java.lang.String str,
- int maxLength)
-
-
- Returns a sub string of the string "str" that has a length that's less
- than the maxLength, but not larger than it's current length.
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (MessageType c : MessageType.values())
- System.out.println(c);
-
-
-
-
-
Returns:
an array containing the constants of this enum type, in
-the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
-
Parameters:
name - the name of the enum constant to be returned.
-
Returns:
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant
-with the specified name
-
java.lang.NullPointerException - if the argument is null
createResult(ITransaction requestTransaction,
- java.lang.String response)
-
-
- Create a Result from the request and response data.
-
-
-
-protected static java.lang.String
-
getElementText(org.w3c.dom.Element parent_el,
- java.lang.String element_name)
-
-
- Local wrapper for getting element text from a parent.
-
-
-
-protected static java.lang.String
-
getElementText(org.w3c.dom.Element parent_el,
- java.lang.String element_name,
- boolean checkDeepMatchList)
-
-
- Local wrapper for getting element text from a parent.
Return the sesssionToken that was passed back. This token supersedes the one that was previously
- used in the request. While the two tokens could be the same, it's not guaranteed for the longevity of the
- running application.
-
-
-
-
-
-
-
-
diff --git a/docs/javadocs/stylesheet.css b/docs/javadocs/stylesheet.css
deleted file mode 100644
index 6ea9e51..0000000
--- a/docs/javadocs/stylesheet.css
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Javadoc style sheet */
-
-/* Define colors, fonts and other style attributes here to override the defaults */
-
-/* Page background color */
-body { background-color: #FFFFFF; color:#000000 }
-
-/* Headings */
-h1 { font-size: 145% }
-
-/* Table colors */
-.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */
-.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */
-.TableRowColor { background: #FFFFFF; color:#000000 } /* White */
-
-/* Font used in left-hand frame lists */
-.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
-.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
-.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
-
-/* Navigation bar fonts and colors */
-.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */
-.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */
-.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;}
-.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;}
-
-.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}
-.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}
-
diff --git a/emv-anet-sdk.aar b/emv-anet-sdk.aar
new file mode 100755
index 0000000..b91d3e2
Binary files /dev/null and b/emv-anet-sdk.aar differ
diff --git a/lib/commons-logging-1.1.1.jar b/lib/commons-logging-1.1.1.jar
deleted file mode 100644
index 8758a96..0000000
Binary files a/lib/commons-logging-1.1.1.jar and /dev/null differ
diff --git a/lib/httpclient-4.0.1.jar b/lib/httpclient-4.0.1.jar
deleted file mode 100644
index e9c961f..0000000
Binary files a/lib/httpclient-4.0.1.jar and /dev/null differ
diff --git a/lib/httpcore-4.0.1.jar b/lib/httpcore-4.0.1.jar
deleted file mode 100644
index 4638daa..0000000
Binary files a/lib/httpcore-4.0.1.jar and /dev/null differ
diff --git a/lib/junit-4.8.2.jar b/lib/junit-4.8.2.jar
deleted file mode 100644
index 5b4bb84..0000000
Binary files a/lib/junit-4.8.2.jar and /dev/null differ
diff --git a/lib/log4j-1.2.16.jar b/lib/log4j-1.2.16.jar
deleted file mode 100644
index 3f9d847..0000000
Binary files a/lib/log4j-1.2.16.jar and /dev/null differ
diff --git a/license.md b/license.md
deleted file mode 100644
index 54f1dd3..0000000
--- a/license.md
+++ /dev/null
@@ -1,42 +0,0 @@
-SDK LICENSE AGREEMENT
-This Software Development Kit (“SDKâ€) License Agreement (“Agreementâ€) is between you (both the individual downloading the SDK and any legal entity on behalf of which such individual is acting) (“You†or “Yourâ€) and Authorize.Net LLC (“Authorize.Net’).
-
-IT IS IMPORTANT THAT YOU READ CAREFULLY AND UNDERSTAND THIS AGREEMENT. BY CLICKING THE “I ACCEPT†BUTTON OR AN EQUIVALENT INDICATOR OR BY DOWNLOADING, INSTALLING OR USING THE SDK OR THE DOCUMENTATION, YOU AGREE TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE TO BE BOUND BY THIS AGREEMENT, YOU WILL NOT BE PERMITTED TO (AND YOU WILL HAVE NO RIGHT TO) DOWNLOAD, INSTALL OR USE THE SDK OR THE DOCUMENTATION.
-1. DEFINITIONS
-1.1 “Application(s)†means software programs that You develop to operate with the Gateway using components of the Software.
-1.2 “Documentation†means the materials made available to You in connection with the Software by or on behalf of Authorize.Net pursuant to this Agreement.
-1.3 “Gateway†means any electronic payment platform maintained and operated by Authorize.Net and any of its affiliates.
-1.4 “Software†means all of the software included in the software development kit made available to You by or on behalf of Authorize.Net pursuant to this Agreement, including but not limited to sample source code, code snippets, software tools, code libraries, sample applications, Documentation and any upgrades, modified versions, updates, and/or additions thereto, if any, made available to You by or on behalf of Authorize.Net pursuant to this Agreement.
-2. GRANT OF LICENSE; RESTRICTIONS
-2.1 Limited License. Subject to and conditioned upon Your compliance with the terms of this Agreement, Authorize.Net hereby grants to You a limited, revocable, non-exclusive, non-transferable, royalty-free license during the term of this Agreement to: (a) in any country worldwide, use, reproduce, modify, and create derivative works of the components of the Software solely for the purpose of developing, testing and manufacturing Applications; (b) distribute, sell or otherwise provide Your Applications that include components of the Software to Your end users in all countries worldwide; and (c) use the Documentation in connection with the foregoing activities. The license to distribute Applications that include components of the Software as set forth in subsection (b) above includes the right to grant sublicenses to Your end users to use such components of the Software as incorporated into such Applications, subject to the limitations and restrictions set forth in this Agreement.
-2.2 Restrictions. You shall not (and shall have no right to): (a) make or distribute copies of the Software or the Documentation, in whole or in part, except as expressly permitted pursuant to Section 2.1; (b) alter or remove any copyright, trademark, trade name or other proprietary notices, legends, symbols or labels appearing on or in the Software or Documentation; (c) sublicense (or purport to sublicense) the Software or the Documentation, in whole or in part, to any third party except as expressly permitted pursuant to Section 2.1; (d) engage in any activity with the Software, including the development or distribution of an Application, that interferes with, disrupts, damages, or accesses in an unauthorized manner the Gateway or platform, servers, or systems of Authorize.Net, any of its affiliates, or any third party; (e) make any statements that Your Application is “certified†or otherwise endorsed, or that its performance is guaranteed, by Authorize.Net or any of its affiliates; or (f) otherwise use or exploit the Software or the Documentation for any purpose other than to develop and distribute Applications as expressly permitted by this Agreement.
-2.3 Ownership. You shall retain ownership of Your Applications developed in accordance with this Agreement, subject to Authorize.Net’s ownership of the Software and Documentation (including Authorize.Net’s ownership of any portion of the Software or Documentation incorporated in Your Applications). You acknowledge and agree that all right, title and interest in and to the Software and Documentation shall, at all times, be and remain the exclusive property of Authorize.Net and that You do not have or acquire any rights, express or implied, in the Software or Documentation except those rights expressly granted under this Agreement.
-2.4 No Support. Authorize.Net has no obligation to provide support, maintenance, upgrades, modifications or new releases of the Software.
-2.5 Open Source Software. You hereby acknowledge that the Software may contain software that is distributed under “open source†license terms (“Open Source Softwareâ€). You shall review the Documentation in order to determine which portions of the Software are Open Source Software and are licensed under such Open Source Software license terms. To the extent any such license requires that Authorize.Net provide You any rights with respect to such Open Source Software that are inconsistent with the limited rights granted to You in this Agreement, then such rights in the applicable Open Source Software license shall take precedence over the rights and restrictions granted in this Agreement, but solely with respect to such Open Source Software. You acknowledge that the Open Source Software license is solely between You and the applicable licensor of the Open Source Software and that Your use, reproduction and distribution of Open Source Software shall be in compliance with applicable Open Source Software license. You understand and agree that Authorize.Net is not liable for any loss or damage that You may experience as a result of Your use of Open Source Software and that You will look solely to the licensor of the Open Source Software in the event of any such loss or damage.
-2.6 License to Authorize.Net. In the event You choose to submit any suggestions, feedback or other information or materials related to the Software or Documentation or Your use thereof (collectively, “Feedbackâ€) to Authorize.Net, You hereby grant to Authorize.Net a worldwide, non-exclusive, royalty-free, transferable, sublicensable, perpetual and irrevocable license to use and otherwise exploit such Feedback in connection with the Software, Documentation, and other products and services.
-2.7 Use.
-(a) You represent, warrant and agree to use the Software and write Applications only for purposes permitted by (i) this Agreement; (ii) applicable law and regulation, including, without limitation, the Payment Card Industry Data Security Standard (PCI DSS); and (iii) generally accepted practices or guidelines in the relevant jurisdictions. You represent, warrant and agree that if You use the Software to develop Applications for general public end users, that You will protect the privacy and legal rights of those users. If the Application receives or stores personal or sensitive information provided by end users, it must do so securely and in compliance with all applicable laws and regulations, including card association regulations. If the Application receives Authorize.Net account information, the Application may only use that information to access the end user's Authorize.Net account. You represent, warrant and agree that You are solely responsible for (and that neither Authorize.Net nor its affiliates have any responsibility to You or to any third party for): (i) any data, content, or resources that You obtain, transmit or display through the Application; and (ii) any breach of Your obligations under this Agreement, any applicable third party license, or any applicable law or regulation, and for the consequences of any such breach.
-3. WARRANTY DISCLAIMER; LIMITATION OF LIABILITY
-3.1 Disclaimer. THE SOFTWARE AND THE DOCUMENTATION ARE PROVIDED ON AN “AS IS†AND “AS AVAILABLE†BASIS WITH NO WARRANTY. YOU AGREE THAT YOUR USE OF THE SOFTWARE AND THE DOCUMENTATION IS AT YOUR SOLE RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE. TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, AUTHORIZE.NET AND ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE AND THE DOCUMENTATION, INCLUDING ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, SATISFACTORY QUALITY, ACCURACY, TITLE AND NON-INFRINGEMENT, AND ANY WARRANTIES THAT MAY ARISE OUT OF COURSE OF PERFORMANCE, COURSE OF DEALING OR USAGE OF TRADE. NEITHER AUTHORIZE.NET NOR ITS AFFILIATES WARRANT THAT THE FUNCTIONS OR INFORMATION CONTAINED IN THE SOFTWARE OR THE DOCUMENTATION WILL MEET ANY REQUIREMENTS OR NEEDS YOU MAY HAVE, OR THAT THE SOFTWARE OR DOCUMENTATION WILL OPERATE ERROR FREE, OR THAT THE SOFTWARE OR DOCUMENTATION IS COMPATIBLE WITH ANY PARTICULAR OPERATING SYSTEM.
-3.2 Limitation of Liability. IN NO EVENT SHALL AUTHORIZE.NET AND ITS AFFILIATES BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR PUNITIVE DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, BUSINESS, SAVINGS, DATA, USE OR COST OF SUBSTITUTE PROCUREMENT, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT, EVEN IF AUTHORIZE.NET HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR IF SUCH DAMAGES ARE FORESEEABLE. IN NO EVENT SHALL THE ENTIRE LIABILITY OF AUTHORIZE.NET AND AFFILIATES ARISING FROM OR RELATING TO THIS AGREEMENT OR THE SUBJECT MATTER HEREOF EXCEED ONE HUNDRED U.S. DOLLARS ($100). THE PARTIES ACKNOWLEDGE THAT THE LIMITATIONS OF LIABILITY IN THIS SECTION 3.2 AND IN THE OTHER PROVISIONS OF THIS AGREEMENT AND THE ALLOCATION OF RISK HEREIN ARE AN ESSENTIAL ELEMENT OF THE BARGAIN BETWEEN THE PARTIES, WITHOUT WHICH AUTHORIZE.NET WOULD NOT HAVE ENTERED INTO THIS AGREEMENT.
-4. INDEMNIFICATION. You shall indemnify, hold harmless and, at Authorize.Net’s request, defend Authorize.Net and its affiliates and their officers, directors, employees, and agents from and against any claim, suit or proceeding, and any associated liabilities, costs, damages and expenses, including reasonable attorneys’ fees, that arise out of relate to: (i) Your Applications or the use or distribution thereof and Your use or distribution of the Software or the Documentation (or any portion thereof including Open Source Software), including, but not limited to, any allegation that any such Application or any such use or distribution infringes, misappropriates or otherwise violates any intellectual property (including, without limitation, copyright, patent, and trademark), privacy, publicity or other rights of any third party, or has caused the death or injury of any person or damage to any property; (ii) Your alleged or actual breach of this Agreement; (iii) the alleged or actual breach of this Agreement by any party to whom you have provided Your Applications, the Software or the Documentation or (iii) Your alleged or actual violation of or non-compliance with any applicable laws, legislation, policies, rules, regulations or governmental requirements (including, without limitation, any laws, legislation, policies, rules, regulations or governmental requirements related to privacy and data collection).
-5. TERMINATION. This Agreement and the licenses granted to you herein are effective until terminated. Authorize.Net may terminate this Agreement and the licenses granted to You at any time. Upon termination of this Agreement, You shall cease all use of the Software and the Documentation, return to Authorize.Net or destroy all copies of the Software and Documentation and related materials in Your possession, and so certify to Authorize.Net. Except for the license to You granted herein, the terms of this Agreement shall survive termination.
-6. CONFIDENTIAL INFORMATION
-a. You hereby agree (i) to hold Authorize.Net’s Confidential Information in strict confidence and to take reasonable precautions to protect such Confidential Information (including, without limitation, all precautions You employ with respect to Your own confidential materials), (ii) not to divulge any such Confidential Information to any third person; (iii) not to make any use whatsoever at any time of such Confidential Information except as strictly licensed hereunder, (iv) not to remove or export from the United States or re-export any such Confidential Information or any direct product thereof, except in compliance with, and with all licenses and approvals required under applicable U.S. and foreign export laws and regulations, including, without limitation, those of the U.S. Department of Commerce.
-b. “Confidential Information†shall mean any data or information, oral or written, treated as confidential that relates to Authorize.Net’s past, present, or future research, development or business activities, including without limitation any unannounced products and services, any information relating to services, developments, inventions, processes, plans, financial information, customer data, revenue, transaction volume, forecasts, projections, application programming interfaces, Software and Documentation.
-7. General Terms
-7.1 Law. This Agreement and all matters arising out of or relating to this Agreement shall be governed by the internal laws of the State of California without giving effect to any choice of law rule. This Agreement shall not be governed by the United Nations Convention on Contracts for the International Sales of Goods, the application of which is expressly excluded. In the event of any controversy, claim or dispute between the parties arising out of or relating to this Agreement, such controversy, claim or dispute shall be resolved in the state or federal courts in Santa Clara County, California, and the parties hereby irrevocably consent to the jurisdiction and venue of such courts.
-7.2 Logo License. Authorize.Net hereby grants to You the right to use, reproduce, publish, perform and display Authorize.Net logo solely in accordance with the current Authorize.Net brand guidelines.
-7.3 Severability and Waiver. If any provision of this Agreement is held to be illegal, invalid or otherwise unenforceable, such provision shall be enforced to the extent possible consistent with the stated intention of the parties, or, if incapable of such enforcement, shall be deemed to be severed and deleted from this Agreement, while the remainder of this Agreement shall continue in full force and effect. The waiver by either party of any default or breach of this Agreement shall not constitute a waiver of any other or subsequent default or breach.
-7.4 No Assignment. You may not assign, sell, transfer, delegate or otherwise dispose of, whether voluntarily or involuntarily, by operation of law or otherwise, this Agreement or any rights or obligations under this Agreement without the prior written consent of Authorize.Net, which may be withheld in Authorize.Net’s sole discretion. Any purported assignment, transfer or delegation by You shall be null and void. Subject to the foregoing, this Agreement shall be binding upon and shall inure to the benefit of the parties and their respective successors and assigns.
-7.5 Government Rights. If You (or any person or entity to whom you provide the Software or Documentation) are an agency or instrumentality of the United States Government, the Software and Documentation are “commercial computer software†and “commercial computer software documentation,†and pursuant to FAR 12.212 or DFARS 227.7202, and their successors, as applicable, use, reproduction and disclosure of the Software and Documentation are governed by the terms of this Agreement.
-7.6 Export Administration. You shall comply fully with all relevant export laws and regulations of the United States, including, without limitation, the U.S. Export Administration Regulations (collectively “Export Controlsâ€). Without limiting the generality of the foregoing, You shall not, and You shall require Your representatives not to, export, direct or transfer the Software or the Documentation, or any direct product thereof, to any destination, person or entity restricted or prohibited by the Export Controls.
-7.7 Privacy. In order to continually innovate and improve the Software, Licensee understands and agrees that Authorize.Net may collect certain usage statistics including but not limited to a unique identifier, associated IP address, version number of software, and information on which tools and/or services in the Software are being used and how they are being used.
-7.8 Headings. The headings to the Sections and Subsections of this Agreement are included merely for convenience of reference and shall not affect the meaning of the language included therein.
-7.9 Entire Agreement; Amendments. This Agreement constitutes the entire agreement between the parties and supersedes all prior or contemporaneous agreements or representations, written or oral, concerning the subject matter of this Agreement. Authorize.Net may make changes to this Agreement, Software or Documentation in its sole discretion. When these changes are made, Authorize.Net will make a new version of the Agreement, Software or Documentation available on the website where the Software is available. This Agreement may not be modified or amended by You except in a writing signed by a duly authorized representative of each party. You acknowledge and agree that
-Authorize.Net has not made any representations, warranties or agreements of any kind, except as expressly set forth herein.
-
-
-BY CLICKING “I ACCEPT,†“I AGREE†OR AN EQUIVALENT INDICATOR OR BY DOWNLOADING, INSTALLING OR USING THE SOFTWARE OR THE DOCUMENTATION, YOU ACKNOWLEDGE AND AGREE THAT (1) YOU HAVE READ AND REVIEWED THIS AGREEMENT IN ITS ENTIRETY, (2) YOU AGREE TO BE BOUND BY THIS AGREEMENT, (3) YOU HAVE THE POWER, AUTHORITY AND LEGAL RIGHT TO ENTER INTO THIS AGREEMENT ON BEHALF OF YOU AND, (4) THIS AGREEMENT CONSTITUTES BINDING AND ENFORCEABLE OBLIGATIONS OF YOU.
-
-v. July 9, 2014
diff --git a/resources/logging.properties b/resources/logging.properties
deleted file mode 100644
index 17bbfc8..0000000
--- a/resources/logging.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Specify the handlers to create in the root logger
-# (all loggers are children of the root logger)
-# The following creates two handlers
-handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
-
-# Set the default logging level for the root logger
-.level = SEVERE
-
-# Set the default logging level for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.level = ALL
-
-# Set the default logging level for new FileHandler instances
-java.util.logging.FileHandler.level = ALL
-
-# Set the default formatter for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-
-# Set the default logging level for the logger named xxx.yyyyy
-net.authorize.util.HttpClient.level = ALL
\ No newline at end of file
diff --git a/sampleapp/.gitignore b/sampleapp/.gitignore
old mode 100644
new mode 100755
index 9c4de58..39fb081
--- a/sampleapp/.gitignore
+++ b/sampleapp/.gitignore
@@ -1,3 +1,4 @@
+*.iml
.gradle
/local.properties
/.idea/workspace.xml
@@ -5,3 +6,4 @@
.DS_Store
/build
/captures
+.externalNativeBuild
diff --git a/sampleapp/.idea/.name b/sampleapp/.idea/.name
deleted file mode 100644
index 750d488..0000000
--- a/sampleapp/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-SampleApplication
\ No newline at end of file
diff --git a/sampleapp/.idea/compiler.xml b/sampleapp/.idea/compiler.xml
old mode 100644
new mode 100755
index 9a8b7e5..96cc43e
--- a/sampleapp/.idea/compiler.xml
+++ b/sampleapp/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
diff --git a/sampleapp/.idea/copyright/profiles_settings.xml b/sampleapp/.idea/copyright/profiles_settings.xml
old mode 100644
new mode 100755
diff --git a/sampleapp/.idea/gradle.xml b/sampleapp/.idea/gradle.xml
old mode 100644
new mode 100755
index 1bbc21d..753c04e
--- a/sampleapp/.idea/gradle.xml
+++ b/sampleapp/.idea/gradle.xml
@@ -5,13 +5,14 @@
-
+
+
+
+
+
\ No newline at end of file
diff --git a/sampleapp/.idea/modules.xml b/sampleapp/.idea/modules.xml
old mode 100644
new mode 100755
index 5c457f3..8e5daf6
--- a/sampleapp/.idea/modules.xml
+++ b/sampleapp/.idea/modules.xml
@@ -2,8 +2,9 @@
-
+
+
\ No newline at end of file
diff --git a/sampleapp/.idea/runConfigurations.xml b/sampleapp/.idea/runConfigurations.xml
new file mode 100755
index 0000000..7f68460
--- /dev/null
+++ b/sampleapp/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sampleapp/.idea/vcs.xml b/sampleapp/.idea/vcs.xml
deleted file mode 100644
index 6564d52..0000000
--- a/sampleapp/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sampleapp/SampleApplication.iml b/sampleapp/SampleApplication.iml
deleted file mode 100644
index c3ab757..0000000
--- a/sampleapp/SampleApplication.iml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sampleapp/app/.gitignore b/sampleapp/app/.gitignore
old mode 100644
new mode 100755
diff --git a/sampleapp/app/app.iml b/sampleapp/app/app.iml
deleted file mode 100644
index 82433d5..0000000
--- a/sampleapp/app/app.iml
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sampleapp/app/build.gradle b/sampleapp/app/build.gradle
old mode 100644
new mode 100755
index 6a03fe6..92208e1
--- a/sampleapp/app/build.gradle
+++ b/sampleapp/app/build.gradle
@@ -1,17 +1,15 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 22
- buildToolsVersion "22.0.1"
-
+ compileSdkVersion 24
+ buildToolsVersion "25.0.0"
defaultConfig {
- applicationId "net.authorize.sampleapplication"
- minSdkVersion 15
- targetSdkVersion 22
+ applicationId "authorize.net.inperson_sdk_android"
+ minSdkVersion 21
+ targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
-
}
buildTypes {
release {
@@ -22,14 +20,19 @@ android {
}
dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- compile 'com.android.support:appcompat-v7:22.2.0'
- compile 'com.android.support:design:22.2.0'
- compile 'com.android.support:recyclerview-v7:22.0.0'
- compile 'com.android.support:cardview-v7:22.0.+'
- compile files('libs/anet-java-sdk-android-2.0.5.jar')
- androidTestCompile 'junit:junit:4.12'
- androidTestCompile('com.android.support.test:testing-support-lib:0.1') {
- exclude group: 'junit' // junit:junit-dep conflicts with junit:unit
- }
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ compile 'com.android.support:appcompat-v7:24.2.1'
+ testCompile 'junit:junit:4.12'
+ compile project(':emv-anet-sdk')
+ compile 'com.android.support:cardview-v7:23.3.0'
+ compile 'com.android.support:appcompat-v7:23.4.0'
+ compile 'com.madgag.spongycastle:prov:1.53.0.0'
+ compile 'org.apache.httpcomponents:httpcore:4.4.1'
+ compile 'org.apache.httpcomponents:httpclient:4.5'
+ testCompile 'junit:junit:4.12'
+ testCompile 'org.hamcrest:hamcrest-library:1.3'
+
}
diff --git a/sampleapp/app/libs/anet-java-sdk-android-2.0.5.jar b/sampleapp/app/libs/anet-java-sdk-android-2.0.5.jar
deleted file mode 100644
index 56fa9c9..0000000
Binary files a/sampleapp/app/libs/anet-java-sdk-android-2.0.5.jar and /dev/null differ
diff --git a/sampleapp/app/proguard-rules.pro b/sampleapp/app/proguard-rules.pro
old mode 100644
new mode 100755
index 0ecc4bb..2b76f44
--- a/sampleapp/app/proguard-rules.pro
+++ b/sampleapp/app/proguard-rules.pro
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
-# in C:\Users\hpreslie\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
+# in C:\Users\yingh\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
diff --git a/sampleapp/app/src/androidTest/java/authorize/net/inperson_sdk_android/ExampleInstrumentedTest.java b/sampleapp/app/src/androidTest/java/authorize/net/inperson_sdk_android/ExampleInstrumentedTest.java
new file mode 100755
index 0000000..6b2b4df
--- /dev/null
+++ b/sampleapp/app/src/androidTest/java/authorize/net/inperson_sdk_android/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package authorize.net.inperson_sdk_android;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumentation test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() throws Exception {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("authorize.net.inperson_sdk_android", appContext.getPackageName());
+ }
+}
diff --git a/sampleapp/app/src/androidTest/java/net/authorize/sampleapplication/ApplicationTest.java b/sampleapp/app/src/androidTest/java/net/authorize/sampleapplication/ApplicationTest.java
deleted file mode 100644
index 19873a1..0000000
--- a/sampleapp/app/src/androidTest/java/net/authorize/sampleapplication/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package net.authorize.sampleapplication;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * Testing Fundamentals
- */
-public class ApplicationTest extends ApplicationTestCase {
- public ApplicationTest() {
- super(Application.class);
- }
-}
\ No newline at end of file
diff --git a/sampleapp/app/src/androidTest/java/net/authorize/sampleapplication/LoginActivityTest.java b/sampleapp/app/src/androidTest/java/net/authorize/sampleapplication/LoginActivityTest.java
deleted file mode 100644
index fb3563a..0000000
--- a/sampleapp/app/src/androidTest/java/net/authorize/sampleapplication/LoginActivityTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package net.authorize.sampleapplication;
-
-import android.app.Activity;
-import android.app.Instrumentation;
-import android.content.Intent;
-import android.content.res.ColorStateList;
-import android.graphics.Color;
-import android.graphics.ColorFilter;
-import android.graphics.drawable.ColorDrawable;
-import android.graphics.drawable.Drawable;
-import android.media.Image;
-import android.support.design.widget.CoordinatorLayout;
-import android.test.ActivityInstrumentationTestCase2;
-import android.test.TouchUtils;
-import android.test.ViewAsserts;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-
-import net.authorize.sampleapplication.services.AnetIntentService;
-
-/**
- * Created by hpreslie on 7/22/2015.
- */
-public class LoginActivityTest extends ActivityInstrumentationTestCase2 {
-
- private LoginActivity mLoginAcitivty;
- private Instrumentation mInstrumentation;
- private EditText mLoginIdEditText;
- private EditText mPasswordEditText;
- private Button mLoginButton;
- private TextView loginIdErrorMessageTextView;
- private TextView passwordErrorMessageTextView;
- private ImageView loginIdIcon;
- private ImageView passwordIcon;
- private ProgressBar loginProgressBar;
-
- public LoginActivityTest() {
- super(LoginActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- setActivityInitialTouchMode(true);
- mLoginAcitivty = getActivity();
- mInstrumentation = getInstrumentation();
- mLoginButton = (Button) getActivity().findViewById(R.id.login_button);
- mLoginIdEditText = (EditText) getActivity().findViewById(R.id.loginId);
- mPasswordEditText = (EditText) getActivity().findViewById(R.id.password);
- loginIdErrorMessageTextView = (TextView) getActivity().findViewById(R.id.loginId_error_message);
- passwordErrorMessageTextView = (TextView) getActivity().findViewById(R.id.password_error_message);
- loginIdIcon = ((ImageView) getActivity().findViewById(R.id.loginId_icon));
- passwordIcon = ((ImageView) getActivity().findViewById(R.id.password_icon));
- loginProgressBar = (ProgressBar) getActivity().findViewById(R.id.login_progress_bar);
- }
-
- public void testPreconditions() {
- assertNotNull("mLoginAcitivty is null", mLoginAcitivty);
- assertNotNull("mLoginButton is null", mLoginButton);
- assertNotNull("mLoginIdEditText is null", mLoginIdEditText);
- assertNotNull("mPasswordEditText is null", mPasswordEditText);
- }
-
- public void testErrorMessages() throws Throwable{
- runTestOnUiThread(new Runnable() {
- @Override
- public void run() {
- mLoginIdEditText.setText("");
- mPasswordEditText.setText("");
- }
- });
- assertEquals(loginIdErrorMessageTextView.getVisibility(), View.VISIBLE);
- assertEquals(passwordErrorMessageTextView.getVisibility(), View.VISIBLE);
- assertEquals(loginIdErrorMessageTextView.getCurrentTextColor(), mLoginAcitivty.getResources().getColor(R.color.ErrorMessageColor));
- assertEquals(passwordErrorMessageTextView.getCurrentTextColor(), mLoginAcitivty.getResources().getColor(R.color.ErrorMessageColor));
- assertEquals(mLoginButton.isEnabled(), false);
- assertEquals(loginProgressBar.getVisibility(), View.INVISIBLE);
- }
-
- public void testNormalView() throws Throwable{
- runTestOnUiThread(new Runnable() {
- @Override
- public void run() {
- mLoginIdEditText.setText("login");
- mPasswordEditText.setText("password");
- }
- });
- assertEquals(loginIdErrorMessageTextView.getVisibility(), View.GONE);
- assertEquals(passwordErrorMessageTextView.getVisibility(), View.GONE);
- assertEquals(mLoginButton.isEnabled(), true);
- assertEquals(loginProgressBar.getVisibility(), View.INVISIBLE);
- }
-
-
- public void testLoginButtonLaunchedNavigationActivity() throws Throwable {
- Instrumentation.ActivityMonitor mNavigationActivityMonitor =
- mInstrumentation.addMonitor(NavigationActivity.class.getName(),
- null, false);
-
- TouchUtils.clickView(this, mLoginButton);
- assertFalse(mLoginIdEditText.getText().length() == 0);
- assertFalse(mPasswordEditText.getText().length() == 0);
- assertEquals(loginIdErrorMessageTextView.getVisibility(), View.GONE);
- assertEquals(passwordErrorMessageTextView.getVisibility(), View.GONE);
-
- // Wait for the Activity to Load
- NavigationActivity receiverActivity = (NavigationActivity)
- mNavigationActivityMonitor.waitForActivityWithTimeout(100);
-
- // Check the Activity has exists
- assertNotNull("NavigationActivity is null", receiverActivity);
-
- // Check the Activity has loaded
- assertEquals("Monitor for mNavigationActivityMonitor has not been called",
- 1, mNavigationActivityMonitor.getHits());
-
- // Remove the Activity Monitor
- getInstrumentation().removeMonitor(mNavigationActivityMonitor);
- }
-}
\ No newline at end of file
diff --git a/sampleapp/app/src/androidTest/java/net/authorize/sampleapplication/TransactionResultTest.java b/sampleapp/app/src/androidTest/java/net/authorize/sampleapplication/TransactionResultTest.java
deleted file mode 100644
index 6160a3a..0000000
--- a/sampleapp/app/src/androidTest/java/net/authorize/sampleapplication/TransactionResultTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package net.authorize.sampleapplication;
-
-import android.app.Instrumentation;
-import android.test.ActivityInstrumentationTestCase2;
-import android.test.TouchUtils;
-import android.widget.Button;
-
-
-/**
- * Created by hpreslie on 7/23/2015.
- */
-public class TransactionResultTest extends ActivityInstrumentationTestCase2 {
-
- private TransactionResultActivity mTransactionResultActivity;
- private Instrumentation mInstrumentation;
- private Button mHistoryButton;
- private Button mTransactionButton;
-
- public TransactionResultTest() {
- super(TransactionResultActivity.class);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- setActivityInitialTouchMode(true);
- mTransactionResultActivity = getActivity();
- mInstrumentation = getInstrumentation();
- mHistoryButton = (Button) getActivity().findViewById(R.id.history_page_button);
- mTransactionButton = (Button) getActivity().findViewById(R.id.make_new_transaction_button);
- }
-
- public void testPreconditions() {
- assertNotNull("mTransactionResultActivity is null", mTransactionResultActivity);
- assertNotNull("mHistoryButton is null", mHistoryButton);
- assertNotNull("mTransactionButton is null", mTransactionButton);
- }
-
- public void testHistoryActivityWasLaunchedWithIntent() {
- Instrumentation.ActivityMonitor mNavigationActivityMonitor =
- mInstrumentation.addMonitor(NavigationActivity.class.getName(),
- null, false);
-
- TouchUtils.clickView(this, mHistoryButton);
-
- // Wait for the Activity to Load
- NavigationActivity receiverActivity = (NavigationActivity)
- mNavigationActivityMonitor.waitForActivityWithTimeout(100);
-
- // Check the Activity has exists
- assertNotNull("NavigationActivity is null", receiverActivity);
-
- // Check the Activity has loaded
- assertEquals("Monitor for mNavigationActivityMonitor has not been called",
- 1, mNavigationActivityMonitor.getHits());
-
- // Remove the Activity Monitor
- getInstrumentation().removeMonitor(mNavigationActivityMonitor);
-
- }
-
-
- public void testTransactionActivityWasLaunchedWithIntent() {
- Instrumentation.ActivityMonitor mNavigationActivityMonitor =
- mInstrumentation.addMonitor(NavigationActivity.class.getName(),
- null, false);
-
- TouchUtils.clickView(this, mTransactionButton);
-
- // Wait for the Activity to Load
- NavigationActivity receiverActivity = (NavigationActivity)
- mNavigationActivityMonitor.waitForActivityWithTimeout(100);
-
- // Check the Activity has exists
- assertNotNull("NavigationActivity is null", receiverActivity);
-
- // Check the Activity has loaded
- assertEquals("Monitor for mNavigationActivityMonitor has not been called",
- 1, mNavigationActivityMonitor.getHits());
-
- // Remove the Activity Monitor
- getInstrumentation().removeMonitor(mNavigationActivityMonitor);
- }
-}
\ No newline at end of file
diff --git a/sampleapp/app/src/main/AndroidManifest.xml b/sampleapp/app/src/main/AndroidManifest.xml
old mode 100644
new mode 100755
index 1b7fa9a..4cc0a9c
--- a/sampleapp/app/src/main/AndroidManifest.xml
+++ b/sampleapp/app/src/main/AndroidManifest.xml
@@ -1,38 +1,28 @@
-
-
-
-
-
+ package="authorize.net.inperson_sdk_android">
+
+
+
+
+ android:supportsRtl="true"
+ android:theme="@style/AppTheme">
+ android:name=".MainActivity"
+ android:label="@string/app_name" >
+
+
+
+
+
-
-
-
-
-
-
+
diff --git a/sampleapp/app/src/main/java/authorize/net/inperson_sdk_android/AppManager.java b/sampleapp/app/src/main/java/authorize/net/inperson_sdk_android/AppManager.java
new file mode 100755
index 0000000..a814aa3
--- /dev/null
+++ b/sampleapp/app/src/main/java/authorize/net/inperson_sdk_android/AppManager.java
@@ -0,0 +1,13 @@
+package authorize.net.inperson_sdk_android;
+
+import net.authorize.Merchant;
+
+/**
+ * Created by vkinagi on 11/3/2015.jjj
+ */
+public class AppManager {
+
+ public static Merchant merchant;
+
+
+}
diff --git a/sampleapp/app/src/main/java/authorize/net/inperson_sdk_android/LoginActivity.java b/sampleapp/app/src/main/java/authorize/net/inperson_sdk_android/LoginActivity.java
new file mode 100755
index 0000000..b22caba
--- /dev/null
+++ b/sampleapp/app/src/main/java/authorize/net/inperson_sdk_android/LoginActivity.java
@@ -0,0 +1,147 @@
+package authorize.net.inperson_sdk_android;
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.support.v4.app.FragmentActivity;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import net.authorize.Environment;
+import net.authorize.Merchant;
+import net.authorize.TransactionType;
+import net.authorize.aim.cardpresent.DeviceType;
+import net.authorize.aim.cardpresent.MarketType;
+import net.authorize.aim.emv.EMVTransaction;
+import net.authorize.aim.emv.EMVTransactionManager;
+import net.authorize.auth.PasswordAuthentication;
+import net.authorize.auth.SessionTokenAuthentication;
+import net.authorize.data.Order;
+import net.authorize.data.OrderItem;
+import net.authorize.data.creditcard.CreditCard;
+import net.authorize.data.creditcard.CreditCardPresenceType;
+import net.authorize.data.mobile.MobileDevice;
+
+import java.math.BigDecimal;
+
+/**
+ * Created by vkinagi on 11/3/2015.
+ */
+public class LoginActivity extends FragmentActivity {
+Button b;
+EditText login;
+EditText pwd;
+ Context context;
+
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.login);
+ b= (Button)findViewById(R.id.buttonLoginLoginIn);
+ b.setOnClickListener(mListner);
+
+ login = (EditText)findViewById(R.id.editTextLoginLoginID);
+ pwd = (EditText)findViewById(R.id.editTextLoginPassword);
+
+
+// login.setText("javasdk1");
+// pwd.setText("Authnet103");
+
+// login.setText("FdcRetailOwner1");
+// pwd.setText("Authnet101");
+
+
+ login.setText("MobileCNP1");
+ pwd.setText("Authnet105");
+ context = this;
+ }
+
+
+ Handler handler = new Handler(){
+
+@Override
+public void handleMessage(Message inputMessage) {
+
+ if(inputMessage.what==0){
+ Intent i = new Intent(context,MainActivity.class);
+ startActivity(i);
+ finish();
+ pd.dismiss();
+ }
+ else{
+ pd.dismiss();
+ Toast.makeText(context.getApplicationContext(),"Login Error",Toast.LENGTH_SHORT).show();
+ }
+
+}
+
+ };
+
+ ProgressDialog pd;
+ View.OnClickListener mListner = new View.OnClickListener(){
+
+ public void onClick(View view){
+ Thread t = new Thread(){
+
+ @Override
+ public void run(){
+
+// handler.sendEmptyMessage(0);
+ net.authorize.mobile.Result result;
+ String deviceID = "Test EMV Android";
+ PasswordAuthentication passAuth = PasswordAuthentication
+ .createMerchantAuthentication(login.getText().toString(), pwd.getText().toString(), deviceID);
+
+ AppManager.merchant = Merchant.createMerchant(Environment.SANDBOX, passAuth);
+
+ net.authorize.mobile.Transaction transaction = AppManager.merchant
+ .createMobileTransaction(net.authorize.mobile.TransactionType.MOBILE_DEVICE_LOGIN);
+ MobileDevice mobileDevice = MobileDevice.createMobileDevice(deviceID,
+ "Device description", "425-555-0000", "Android");
+ transaction.setMobileDevice(mobileDevice);
+ result = (net.authorize.mobile.Result) AppManager.merchant
+ .postTransaction(transaction);
+
+ if(result.isOk()){
+
+ try {
+ SessionTokenAuthentication sessionTokenAuthentication = SessionTokenAuthentication
+ .createMerchantAuthentication(AppManager.merchant
+ .getMerchantAuthentication().getName(), result
+ .getSessionToken(), "Test EMV Android");
+ if ((result.getSessionToken() != null)
+ && (sessionTokenAuthentication != null)) {
+ AppManager.merchant
+ .setMerchantAuthentication(sessionTokenAuthentication);
+
+ handler.sendEmptyMessage(0);
+ }
+ } catch (Exception ex) {
+
+ }
+ }
+ else{
+ handler.sendEmptyMessage(1);
+ Log.e("EMVResponse",result.getXmlResponse());
+// Toast.makeText(context, result.getXmlResponse(),Toast.LENGTH_SHORT).show();
+ }
+
+ }
+ };
+ t.start();
+ pd = new ProgressDialog(context);
+ pd.setCancelable(false);
+ pd.setTitle("Logging in..");
+ pd.setProgressStyle(android.R.style.Widget_ProgressBar_Small);
+ pd.show();
+
+ }
+ };
+
+
+}
diff --git a/sampleapp/app/src/main/java/authorize/net/inperson_sdk_android/MainActivity.java b/sampleapp/app/src/main/java/authorize/net/inperson_sdk_android/MainActivity.java
new file mode 100755
index 0000000..27f1388
--- /dev/null
+++ b/sampleapp/app/src/main/java/authorize/net/inperson_sdk_android/MainActivity.java
@@ -0,0 +1,464 @@
+package authorize.net.inperson_sdk_android;
+
+import android.Manifest;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.FragmentManager;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.media.AudioManager;
+import android.os.Handler;
+import android.os.Message;
+import android.support.v4.app.ActivityCompat;
+import android.support.v7.app.ActionBarActivity;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ProgressBar;
+import android.widget.RelativeLayout;
+import android.widget.Spinner;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import net.authorize.ResponseReasonCode;
+import net.authorize.aim.emv.EMVActivity;
+import net.authorize.aim.emv.EMVErrorCode;
+import net.authorize.aim.emv.EMVTransaction;
+import net.authorize.aim.emv.EMVTransactionManager;
+import net.authorize.aim.emv.EMVTransactionType;
+import net.authorize.data.Order;
+import net.authorize.data.OrderItem;
+import net.authorize.mobile.Result;
+import net.authorize.mobile.TransactionType;
+import net.authorize.util.StringUtils;
+import net.authorize.xml.MessageType;
+
+import org.w3c.dom.Text;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class MainActivity extends ActionBarActivity {
+ List list;
+ Button b;
+ EditText amount;
+ String spinnerAmountStr = "1";
+ RelativeLayout cvrLayout;
+ private Dialog dialog;
+
+ Handler myHandler = new Handler(){
+
+ @Override
+ public void handleMessage(Message msg) {
+
+ pr.dismiss();
+ finish();
+ Intent i =new Intent(context,LoginActivity.class);
+ startActivity(i);
+ }
+
+ };
+
+
+ Context context;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+
+ super.onCreate(savedInstanceState);
+ context = this;
+ FragmentManager fmanager = this.getFragmentManager();
+
+ if(fmanager.findFragmentByTag("background")==null){
+
+
+ }
+ setContentView(R.layout.activity_main);
+ b = (Button) findViewById(R.id.button);
+
+ b.setOnClickListener(mListner);
+ amount = (EditText) findViewById(R.id.editTextAmount);
+ context = this;
+
+ checkRuntimePermissions();
+ }
+ private boolean addPermission(List permissionsList, String permission) {
+ if (ActivityCompat.checkSelfPermission(this, permission)
+ != PackageManager.PERMISSION_GRANTED) {
+ permissionsList.add(permission);
+ // Check for Rationale Option
+ if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permission))
+ return false;
+ }
+ return true;
+ }
+ boolean haveAllPermissions = false;
+ private void checkRuntimePermissions() {
+ List permissionsNeeded = new ArrayList<>();
+
+ final List permissionsList = new ArrayList<>();
+
+ if (!addPermission(permissionsList, Manifest.permission.RECORD_AUDIO))
+ permissionsNeeded.add("'Record Audio' to make the card-swipers work correctly");
+ if (!addPermission(permissionsList, Manifest.permission.WRITE_EXTERNAL_STORAGE))
+ permissionsNeeded.add("and 'Read/Write External Storage' to store/retrieve information.");
+ if (!addPermission(permissionsList, Manifest.permission.READ_EXTERNAL_STORAGE))
+ permissionsNeeded.add("");
+
+ if (!permissionsList.isEmpty()) {
+ haveAllPermissions = false;
+// if (!permissionsNeeded.isEmpty()) {
+// // Need Rationale
+// String message = "Please allow access to " + permissionsNeeded.get(0);
+// for (int i = 1; i < permissionsNeeded.size(); i++)
+// if(!permissionsNeeded.get(i).isEmpty())
+// message = message + ", " + permissionsNeeded.get(i);
+// showRationale("Permissions Request", permissionsList, message, ALLOW, CANCEL);
+// return;
+// }
+ ActivityCompat.requestPermissions(this,
+ permissionsList.toArray(new String[permissionsList.size()]),
+ 1);
+ return;
+ }
+ else {
+// haveAllPermissions = true;
+ //rf.initializeDevice(); // already have permissions so initialize
+ }
+ }
+
+
+
+ EMVTransactionManager.EMVTransactionListener iemvTransaction = new EMVTransactionManager.EMVTransactionListener() {
+ @Override
+ public void onEMVTransactionSuccessful(net.authorize.aim.emv.Result result) {
+ if (result != null) {
+
+
+ dialog = new Dialog(MainActivity.this);
+ dialog.setContentView(R.layout.receipt);
+ TextView status = (TextView) dialog.findViewById(R.id.textViewStatus);
+ status.setText("Transaction Successful");
+ TextView amount = (TextView) dialog.findViewById(R.id.textViewResAmount);
+
+ amount.setText("$" + spinnerAmountStr + " USD");
+ TextView tid = (TextView) dialog.findViewById(R.id.textViewResTransId);
+ tid.setText(result.getTransId());
+ TextView aid = (TextView) dialog.findViewById(R.id.textViewResApplicationId);
+ HashMap map = result.getEmvTlvMap();
+ //4f is EMV code for application ID
+ if(map.get("4f")!=null){
+ aid.setText( map.get("4f"));
+ }
+ else
+ aid.setVisibility(View.INVISIBLE);
+
+
+
+ TextView mode = (TextView) dialog.findViewById(R.id.textViewResMode);
+ if (result.getIsIssuerResponse())
+ mode.setText("ISSUER");
+ else
+ mode.setText("CARD");
+
+
+
+ TextView tvr = (TextView) dialog.findViewById(R.id.textViewResTVR);
+ if (map.containsKey("95")) ;
+ tvr.setText(map.get("95"));
+
+ TextView iad = (TextView) dialog.findViewById(R.id.textViewResIAD);
+ if (map.containsKey("9f10")) ;
+ iad.setText(map.get("9f10"));
+
+ TextView tsi = (TextView) dialog.findViewById(R.id.textViewResTSI);
+ if (map.containsKey("9b")) ;
+ tsi.setText(map.get("9b"));
+
+ TextView arc = (TextView) dialog.findViewById(R.id.textViewResARC);
+ if (map.containsKey("8a")) ;
+ arc.setText(map.get("8b"));
+
+
+// cvrLayout = (RelativeLayout) dialog.findViewById(R.id.cvrLayout);
+
+// if(result.isShowSignature())
+// cvrLayout.setVisibility(View.VISIBLE);
+// else
+// cvrLayout.setVisibility(View.INVISIBLE);
+
+ dialog.show();
+ } else;
+// Toast.makeText(getApplicationContext(), "Fallback swipe transactions will be supported in next release", Toast.LENGTH_LONG).show();
+
+// Button button = (Button)dialog.findViewById(R.id.button);
+//
+// button.setOnClickListener(new View.OnClickListener(){
+//
+// @Override
+// public void onClick(View view){
+//
+// }
+//
+// });
+
+ }
+
+ View.OnClickListener listener =new View.OnClickListener(){
+
+ @Override
+ public void onClick(View view){
+
+ }
+
+ };
+
+ @Override
+ public void onEMVReadError(EMVErrorCode emvError) {
+ if (emvError == EMVErrorCode.VOLUME_WARNING_NOT_ACCEPTED) {
+ AudioManager audioManager = (AudioManager) getSystemService(context.AUDIO_SERVICE);
+ audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC),0);
+ } else {
+ AlertDialog.Builder adb = new AlertDialog.Builder(context);
+ adb.setTitle("EMV Status");
+ adb.setNeutralButton("OK", null);
+ adb.setCancelable(true);
+ if (emvError != null) {
+ adb.setMessage(emvError.getErrorString());
+
+ } else
+ adb.setMessage("EMV Error");
+ adb.create().show();
+ }
+ }
+
+ @Override
+ public void onEMVTransactionError(net.authorize.aim.emv.Result result, EMVErrorCode emvError) {
+
+
+ // do a time out error first
+
+ if (result != null) {
+
+ ArrayList message1 = null;
+
+ message1 = result.getMessages();
+ if (message1 != null
+ && message1.size() > 0
+ && message1.get(0) != null
+ && message1.get(0).compareTo(MessageType.E00007) == 0) {
+ Toast.makeText(context.getApplicationContext(), "Session time out: Please log in again", Toast.LENGTH_SHORT).show();
+ Intent i = new Intent(context, LoginActivity.class);
+ i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(i);
+ finish();
+ return;
+
+ }
+ }
+
+
+ if (result != null && result.getEmvTlvMap() != null) {
+
+ HashMap emvMap = result.getEmvTlvMap();
+ dialog = new Dialog(MainActivity.this);
+ dialog.setContentView(R.layout.receipt);
+ TextView amount = (TextView) dialog.findViewById(R.id.textViewResAmount);
+ amount.setText("$"+spinnerAmountStr + " USD");
+ TextView tid = (TextView) dialog.findViewById(R.id.textViewResTransId);
+ if (result.getTransId() != null)
+ tid.setText(result.getTransId());
+
+ TextView mode = (TextView) dialog.findViewById(R.id.textViewResMode);
+ if (result.getIsIssuerResponse())
+ mode.setText("ISSUER");
+ else
+ mode.setText("CARD");
+
+ TextView aid = (TextView) dialog.findViewById(R.id.textViewResApplicationId);
+//
+ if(emvMap.get("4f")!=null){
+ aid.setText("ApplicationId: " + emvMap.get("4f"));
+ }
+ else
+ aid.setVisibility(View.INVISIBLE);
+
+ TextView tvr = (TextView) dialog.findViewById(R.id.textViewResTVR);
+ if (emvMap.containsKey("95")) ;
+ tvr.setText(emvMap.get("95"));
+
+ TextView iad = (TextView) dialog.findViewById(R.id.textViewResIAD);
+ if (emvMap.containsKey("9f10")) ;
+ iad.setText(emvMap.get("9f10"));
+
+ TextView tsi = (TextView) dialog.findViewById(R.id.textViewResTSI);
+ if (emvMap.containsKey("9b")) ;
+ tsi.setText(emvMap.get("9b"));
+
+ TextView arc = (TextView) dialog.findViewById(R.id.textViewResARC);
+ if (emvMap.containsKey("8a")) ;
+ arc.setText(emvMap.get("8b"));
+
+ TextView errorMsg = (TextView) dialog.findViewById(R.id.textViewStatus);
+
+
+ //
+ ArrayList responseError = result
+ .getTransactionResponseErrors();
+ if (responseError != null
+ && responseError.size() > 0
+ && !StringUtils.isEmpty(responseError
+ .get(0).getReasonText()))
+ errorMsg.setText(responseError.get(0)
+ .getReasonText());
+
+ else
+ errorMsg.setText("Transaction Unsuccessful");
+
+ //
+
+ TextView merchantText = (TextView) dialog.findViewById(R.id.textViewResMerchant);
+ merchantText.setVisibility(View.GONE);
+ dialog.show();
+
+
+ } else {
+
+ ///else
+
+ AlertDialog.Builder adb = new AlertDialog.Builder(context);
+ ArrayList message = null;
+ if (result != null) {
+ message = result.getMessages();
+ }
+
+ if (result == null) {
+ if (emvError == EMVErrorCode.TRANSACTION_DECLINED)
+ adb.setMessage(String.valueOf(emvError.getError()) + "Transaction Decline");
+ } else if (message != null
+ && message.size() > 0
+ && message.get(0) != null
+ && message.get(0).compareTo(MessageType.E00007) == 0) {
+ Toast.makeText(context.getApplicationContext(), "Session time out: Please log in again", Toast.LENGTH_SHORT).show();
+ Intent i = new Intent(context, LoginActivity.class);
+ i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(i);
+ finish();
+
+
+ } else {
+ ArrayList responseError = result
+ .getTransactionResponseErrors();
+ if (responseError != null
+ && responseError.size() > 0
+ && !StringUtils.isEmpty(responseError
+ .get(0).getReasonText()))
+ adb.setMessage(responseError.get(0)
+ .getReasonText());
+
+ else
+ adb.setMessage("Transaction Unsuccessful");
+ }
+
+ adb.setTitle("EMV Status");
+ adb.setNeutralButton("OK", null);
+ adb.setCancelable(true);
+ adb.create().show();
+
+ }
+
+
+ }
+
+
+
+ };
+
+ View.OnClickListener mListner = new View.OnClickListener() {
+
+ public void onClick(View view) {
+
+ if(AppManager.merchant==null){
+ Intent i = new Intent(context, LoginActivity.class);
+ i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(i);
+ finish();
+ return;
+ }
+
+ String value = amount.getText().toString();
+ if (StringUtils.isEmpty(value))
+ value = "0.0";
+ spinnerAmountStr = value;
+ Order order = Order.createOrder();
+ OrderItem oi = OrderItem.createOrderItem();
+ oi.setItemId("1");
+ oi.setItemName("name");
+
+ oi.setItemQuantity("1");
+ oi.setItemTaxable(false);
+ oi.setItemDescription("desc");
+ oi.setItemDescription("Goods");
+
+ order.addOrderItem(oi);
+ BigDecimal transAmount = new BigDecimal(value);
+ oi.setItemPrice(transAmount);
+ order.setTotalAmount(transAmount);
+ EMVTransaction emvTransaction = EMVTransactionManager.createEMVTransaction(AppManager.merchant, transAmount);
+ emvTransaction.setEmvTransactionType(EMVTransactionType.GOODS);
+ emvTransaction.setOrder(order);
+ emvTransaction.setSolutionID("SOLUTION ID");
+ EMVTransactionManager.startEMVTransaction(emvTransaction, iemvTransaction, context);
+
+ }
+ };
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu){
+
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.menu_main, menu);
+ return true;
+ }
+
+ ProgressDialog pr;
+
+// @Override
+// public boolean onOptionsItemSelected(MenuItem item) {
+// // Handle item selection
+// switch (item.getItemId()) {
+// case R.id.logout:
+// pr = new ProgressDialog(context);
+// pr.setIndeterminate(true);
+// pr.setMessage("Logging out...");
+// pr.show();
+// Thread t = new Thread(){
+// @Override
+// public void run(){
+//
+// net.authorize.mobile.Transaction logoutTrans = AppManager.merchant.createMobileTransaction(TransactionType.LOGOUT);
+//
+// Result r = (Result)AppManager.merchant.postTransaction(logoutTrans);
+// myHandler.sendEmptyMessage(1);
+// }
+// };
+// t.start();
+// return true;
+// }
+//
+// return false;
+// }
+
+}
\ No newline at end of file
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/AnetBaseActivity.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/AnetBaseActivity.java
deleted file mode 100644
index 4615060..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/AnetBaseActivity.java
+++ /dev/null
@@ -1,209 +0,0 @@
-package net.authorize.sampleapplication;
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.support.design.widget.CoordinatorLayout;
-import android.support.design.widget.Snackbar;
-import android.support.v7.app.ActionBarActivity;
-import android.os.Bundle;
-import android.support.v7.app.AlertDialog;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.EditText;
-
-import net.authorize.sampleapplication.models.AnetSingleton;
-
-/**
- * Base activity that all activities inherit from.
- * Contains functions applicable to all/some activities in the application
- */
-public abstract class AnetBaseActivity extends ActionBarActivity {
- private ProgressDialog progressDialog;
- private AlertDialog alertDialog;
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- }
-
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.menu_anet_base, menu);
- return true;
- }
-
-
- @Override
- protected void onResume() {
- super.onResume();
- // checks if the merchant is null every time the application resumes
- // so that the session will never be expired inside the application
- if (!(this instanceof LoginActivity) && AnetSingleton.merchant == null) {
- displaySessionExpiredDialog();
- }
- }
-
-
- /**
- * Sets an OnTouchListener to each element present in the UI that is not an instance
- * of EditText so that the user can click on any part of the activity to hide the keyboard
- * @param view view in the UI
- */
- public void setupClickableUI(View view) {
- if(!(view instanceof EditText)) {
- view.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- hideSoftKeyboard(AnetBaseActivity.this);
- return false;
- }
- });
- }
- if (view instanceof ViewGroup) {
- for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
- View innerView = ((ViewGroup) view).getChildAt(i);
- setupClickableUI(innerView);
- }
- }
- }
-
- /**
- * Hides the typing keyboard.
- * @param activity current activity
- */
- public static void hideSoftKeyboard(Activity activity) {
- InputMethodManager inputMethodManager = (InputMethodManager)
- activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
- if (activity.getCurrentFocus() != null)
- inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
- }
-
-
- /**
- * Displays a snackbar
- * @param coordinatorLayout layout that holds the snackbar
- * @param transactionType string that determines the action of the snackbar for the fragments
- * @param snackBarTextId string ID of the text to be displayed in the snackbar
- * @param actionId string ID of the text to be displayed in the action text of the snackbar
- */
- public void displaySnackbar(CoordinatorLayout coordinatorLayout, final String transactionType,
- int snackBarTextId, int actionId) {
- final Activity activity = this;
- Snackbar
- .make(coordinatorLayout, snackBarTextId, Snackbar.LENGTH_LONG)
- .setAction(actionId, new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (activity instanceof LoginActivity) {
- ((LoginActivity) activity).attemptLogin();
- } else if (activity instanceof NavigationActivity) {
- ((NavigationActivity) activity).retryAction(transactionType);
- }
- }
- })
- .show();
- }
-
-
- /**
- * Displays a one choice dialog
- * @param title title of the dialog
- * @param message message of the dialog
- */
- public void displayOkDialog (String title, String message) {
- AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
- alertDialogBuilder
- .setTitle(title)
- .setMessage(message)
- .setCancelable(false)
- .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- dialog.dismiss();
- }
- });
- alertDialog = alertDialogBuilder.create();
- alertDialog.show();
- }
-
-
- /**
- * Displays a dialog to the user to either close the application or login again
- * when the session has expired
- */
- public void displaySessionExpiredDialog () {
- AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
- alertDialogBuilder
- .setTitle(getResources().getString(R.string.dialog_title_session_expired))
- .setMessage(getResources().getString(R.string.dialog_message_session_expired))
- .setCancelable(false)
- .setPositiveButton(getResources().getString(R.string.dialog_session_expired_yes_choice),
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- dialog.dismiss();
- launchLogin();
- }
- })
- .setNegativeButton(getResources().getString(R.string.dialog_session_expired_no_choice),
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- dialog.dismiss();
- System.exit(0);
- }
- });
- alertDialog = alertDialogBuilder.create();
- alertDialog.show();
- }
-
-
- /**
- * Starts the login activity
- */
- private void launchLogin() {
- Intent intent = new Intent(this, LoginActivity.class);
- startActivity(intent);
- finish();
- }
-
-
- /**
- * Displays a progress dialog
- * @param title title of the dialog
- * @param message message of the dialog
- */
- public void showIndeterminateProgressDialog(String title, String message) {
- progressDialog = new ProgressDialog(this);
- progressDialog = ProgressDialog.show(this, title, message, true);
- progressDialog.setCancelable(false);
- }
-
-
- /**
- * Dismisses the progress dialog
- */
- public void dismissIndeterminateProgressDialog() {
- progressDialog.dismiss();
- }
-
-
- /**
- * Determines whether the network is available
- * @return whether the network is available
- */
- public boolean isNetworkAvailable() {
- ConnectivityManager connectivityManager
- = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
- return activeNetworkInfo != null && activeNetworkInfo.isConnected();
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/LoginActivity.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/LoginActivity.java
deleted file mode 100644
index 75ae980..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/LoginActivity.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package net.authorize.sampleapplication;
-
-import android.app.FragmentManager;
-import android.content.Intent;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
-import android.support.design.widget.CoordinatorLayout;
-
-import android.os.Bundle;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.KeyEvent;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-
-import net.authorize.mobile.Result;
-import net.authorize.sampleapplication.fragments.LoginActivityRetainedFragment;
-import net.authorize.sampleapplication.services.AnetIntentService;
-
-/**
- * Allows the user to login into Authorize.Net sandbox account using valid
- * login and password credentials
- */
-public class LoginActivity extends AnetBaseActivity implements
- LoginActivityRetainedFragment.OnFragmentInteractionListener{
-
- public static final String LOGIN_ID_TAG = "LOGIN_ID";
- public static final String PASSWORD_TAG = "PASSWORD";
- private static final String AUTHENTICATE_USER_FRAGMENT = "authenticate_user_fragment";
- private EditText loginIdEditText;
- private EditText passwordEditText;
- private TextView loginIdErrorMessageTextView;
- private TextView passwordErrorMessageTextView;
- private Drawable loginIdIcon;
- private Drawable passwordIcon;
- private ProgressBar loginProgressBar;
- private Button loginButton;
- private CoordinatorLayout coordinatorLayout;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_login);
- setupClickableUI(findViewById(R.id.login_page));
- setupViews();
- setupErrorMessages();
- }
-
- /**
- * Sets variables with their views in the layout XML
- */
- private void setupViews() {
- loginIdEditText = (EditText) findViewById(R.id.loginId);
- passwordEditText = (EditText) findViewById(R.id.password);
- loginIdErrorMessageTextView = (TextView) findViewById(R.id.loginId_error_message);
- passwordErrorMessageTextView = (TextView) findViewById(R.id.password_error_message);
- loginIdIcon = ((ImageView) findViewById(R.id.loginId_icon)).getDrawable();
- passwordIcon = ((ImageView) findViewById(R.id.password_icon)).getDrawable();
- coordinatorLayout = (CoordinatorLayout) findViewById(R.id.snackbarPosition);
- passwordEditText.setOnKeyListener(new View.OnKeyListener() {
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- return attemptLoginOnEnter(keyCode);
- }
- });
- loginButton = (Button) findViewById(R.id.login_button);
- loginButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- attemptLogin();
- }
- });
- }
-
-
- /**
- * Allows the user to login when an enter is clicked on the keyboard
- * @param keyCode the code for the physical key that was pressed
- * @return
- */
- public boolean attemptLoginOnEnter(int keyCode) {
- if (keyCode == KeyEvent.KEYCODE_ENTER) {
- hideSoftKeyboard(this);
- attemptLogin();
- return true;
- } else {
- return false;
- }
- }
-
-
- /**
- * Sends the credentials (username and password) from the edit texts
- * to a retained fragment for backend authentication.
- */
- public void attemptLogin() {
- String loginId = loginIdEditText.getText().toString();
- String password = passwordEditText.getText().toString();
- boolean credentialsVerified = verifyCredentials(loginId, password);
- if (!isNetworkAvailable()) {
- displaySnackbar(coordinatorLayout, "", R.string.snackbar_text_no_network_connection, R.string.snackbar_action_retry);
- } else if (!credentialsVerified) {
- displayOkDialog(getResources().getString(R.string.dialog_title_login_error), getResources().getString(R.string.dialog_message_login_error));
- } else {
- FragmentManager fragmentManager = getFragmentManager();
- LoginActivityRetainedFragment retainedFragment = (LoginActivityRetainedFragment) fragmentManager.
- findFragmentByTag(AUTHENTICATE_USER_FRAGMENT);
- if (retainedFragment == null) {
- retainedFragment = new LoginActivityRetainedFragment();
- Bundle credentials = new Bundle();
- credentials.putString(LOGIN_ID_TAG, loginId);
- credentials.putString(PASSWORD_TAG, password);
- retainedFragment.setArguments(credentials);
- fragmentManager.beginTransaction().add(retainedFragment,
- AUTHENTICATE_USER_FRAGMENT).commit();
- } else {
- retainedFragment.startServiceAuthenticateUser(loginId, password);
- }
- loginProgressBar = (ProgressBar) findViewById(R.id.login_progress_bar);
- loginProgressBar.setVisibility(View.VISIBLE);
- }
- }
-
-
- /**
- * Checks if either login field is empty
- * @param loginId text entered in the login edit text
- * @param password text entered in the password edit text
- * @return
- */
- private boolean verifyCredentials(String loginId, String password) {
- if (loginId == null || loginId.trim().length() == 0)
- return false;
- if (password == null || password.trim().length() == 0)
- return false;
- return true;
- }
-
-
- /**
- * Sets up custom error messages for the login fields.
- */
- private void setupErrorMessages() {
- loginIdEditText.addTextChangedListener(new LoginTextWatcher
- (loginIdErrorMessageTextView, loginIdIcon, loginButton));
- passwordEditText.addTextChangedListener(new LoginTextWatcher
- (passwordErrorMessageTextView, passwordIcon, loginButton));
- }
-
-
- /**
- * Callback method that receives the results of the user authentication
- * from the intent service
- * @param resultData the result of the authentication
- */
- public void onReceiveAuthenticateUserResult(Bundle resultData) {
- Result loginResult = (Result) resultData.getSerializable
- (AnetIntentService.AUTHENTICATE_USER_STATUS);
- loginProgressBar.setVisibility(View.INVISIBLE);
- if (loginResult.isResponseOk()) {
- Intent intent = new Intent(this, NavigationActivity.class);
- startActivity(intent);
- finish();
- } else if (loginResult.getMessages().size() != 0){
- displayOkDialog(getResources().getString(R.string.dialog_title_login_error),
- getResources().getString(R.string.dialog_message_login_error));
- } else {
- displayOkDialog(getResources().getString(R.string.dialog_title_login_error),
- getResources().getString(R.string.dialog_message_unknown_error));
- }
- }
-
-
-
- /**
- * Class used to display custom error messages when the
- * login fields are empty
- */
- private class LoginTextWatcher implements TextWatcher {
- private TextView textView;
- private Drawable icon;
- private Button loginButton;
-
- public LoginTextWatcher(TextView textView, Drawable icon, Button loginButton) {
- this.textView = textView;
- this.icon = icon;
- this.loginButton = loginButton;
- }
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {}
- @Override
- public void afterTextChanged(Editable s) {
- if (s.length() == 0) {
- textView.setVisibility(View.VISIBLE);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
- icon.setTint(getResources().getColor(R.color.ErrorMessageColor));
- loginButton.setEnabled(false);
- } else { // restores layout
- textView.setVisibility(View.GONE);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
- icon.setTint(getResources().getColor(R.color.ThemeColor));
- loginButton.setEnabled(true);
- }
- }
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/NavigationActivity.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/NavigationActivity.java
deleted file mode 100644
index 766140d..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/NavigationActivity.java
+++ /dev/null
@@ -1,511 +0,0 @@
-package net.authorize.sampleapplication;
-
-import android.content.Intent;
-import android.os.Build;
-import android.support.design.widget.CoordinatorLayout;
-import android.support.design.widget.NavigationView;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.view.GravityCompat;
-import android.support.v4.widget.DrawerLayout;
-import android.support.v7.app.ActionBarDrawerToggle;
-import android.support.v7.widget.Toolbar;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.Spinner;
-
-import net.authorize.aim.Result;
-import net.authorize.data.reporting.TransactionDetails;
-import net.authorize.sampleapplication.fragments.HistoryFragment;
-import net.authorize.sampleapplication.fragments.HistoryRetainedFragment;
-import net.authorize.sampleapplication.fragments.LogoutRetainedFragment;
-import net.authorize.sampleapplication.fragments.TransactionFragment;
-import net.authorize.sampleapplication.fragments.TransactionRetainedFragment;
-import net.authorize.sampleapplication.services.AnetIntentService;
-
-import java.util.ArrayList;
-
-
-/**
- * Allows the user to navigate between two fragments: (1) charging a credit card (manually or with
- * swipe data) or (2) getting unsettled/settled transactions and voiding/refunding a transaction
- */
-public class NavigationActivity extends AnetBaseActivity implements
- LogoutRetainedFragment.OnFragmentInteractionListener,
- TransactionRetainedFragment.OnFragmentInteractionListener,
- HistoryRetainedFragment.OnHistoryTransactionListener {
-
- public static final String TRANSACTION_FRAGMENT_TAG = "TRANSACTION_FRAGMENT";
- public static final String HISTORY_FRAGMENT_TAG = "HISTORY_FRAGMENT";
- public static final String LOGOUT_FRAGMENT_TAG = "LOGOUT_FRAGMENT";
- public static final String TRANSACTION_SETTLED = "Settled Transactions";
- public static final String TRANSACTION_UNSETTLED = "Unsettled Transactions";
- public static final String FRAGMENT_TYPE = "FRAGMENT_TYPE";
- private DrawerLayout drawerLayout;
- private NavigationView navigationView;
- private Toolbar toolbar;
- private CoordinatorLayout coordinatorLayout;
- private Spinner transactionHistorySpinner;
- private String fragmentFromIntent;
-
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_navigation);
- setupViews();
- commitFragment();
- setupToolbar();
- setupNavigationDrawer();
- }
-
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch(item.getItemId()) {
- case R.id.action_logout:
- performLogout();
- return true;
- case android.R.id.home:
- drawerLayout.openDrawer(GravityCompat.START);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.menu_navigation, menu);
- if (getCurrentFragmentTag() == null) {
- return false;
- }
- switch (getCurrentFragmentTag()) {
- case TRANSACTION_FRAGMENT_TAG:
- transactionHistorySpinner.setVisibility(View.GONE);
- break;
- case HISTORY_FRAGMENT_TAG:
- transactionHistorySpinner.setVisibility(View.VISIBLE);
- break;
- }
- return true;
- }
-
-
- /**
- * Sets variables with their views in the layout XML
- */
- private void setupViews() {
- toolbar = (Toolbar) findViewById(R.id.toolbar);
- drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
- navigationView = (NavigationView) findViewById(R.id.navigation_view);
- coordinatorLayout = (CoordinatorLayout) findViewById(R.id.snackbarPosition);
- transactionHistorySpinner = (Spinner) findViewById(R.id.history_spinner);
- setupSpinner();
- }
-
-
- /**
- * Sets up spinner in toolbar with a custom layout, adapter, and listener.
- */
- private void setupSpinner() {
- String[] transactionTypes = new String[]{TRANSACTION_UNSETTLED, TRANSACTION_SETTLED};
- ArrayAdapter transactionSpinnerAdapter = new ArrayAdapter<>(this,
- R.layout.history_spinner_item, transactionTypes);
- transactionSpinnerAdapter.setDropDownViewResource(R.layout.history_spinner_item_dropdown);
- transactionHistorySpinner.setAdapter(transactionSpinnerAdapter);
- transactionHistorySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView> parent, View view, int position, long id) {
- HistoryFragment historyFragment = (HistoryFragment) getSupportFragmentManager().
- findFragmentByTag(HISTORY_FRAGMENT_TAG);
- String transactionListType = parent.getItemAtPosition(position).toString();
- if (historyFragment == null)
- return;
- historyFragment.getListOfTransactions(transactionListType, false);
- }
-
- @Override
- public void onNothingSelected(AdapterView> parent) {
- }
- });
- }
-
-
- /**
- * Commits a specified fragment to the frame layout based on intent extras (used in
- * TransactionResultActivity) or commits the default
- */
- private void commitFragment() {
- fragmentFromIntent = null;
- Bundle extras = null;
- if (getIntent() != null)
- extras = getIntent().getExtras();
- if (extras != null)
- fragmentFromIntent = extras.getString(FRAGMENT_TYPE);
- if (fragmentFromIntent != null) {
- switch (fragmentFromIntent) {
- case TRANSACTION_FRAGMENT_TAG:
- setToolbarShadow(false);
- Fragment transactionFragment = TransactionFragment.newInstance();
- getSupportFragmentManager().beginTransaction().replace
- (R.id.content, transactionFragment, fragmentFromIntent).commit();
- break;
- case HISTORY_FRAGMENT_TAG:
- setToolbarShadow(true);
- Fragment historyFragment = HistoryFragment.newInstance();
- getSupportFragmentManager().beginTransaction().replace
- (R.id.content, historyFragment, fragmentFromIntent).commit();
- break;
- }
- } else { // default fragment to commit if no fragment is specified
- setToolbarShadow(false);
- Fragment transactionFragment = TransactionFragment.newInstance();
- getSupportFragmentManager().beginTransaction().replace
- (R.id.content, transactionFragment, TRANSACTION_FRAGMENT_TAG).commit();
- }
- }
-
-
- /**
- * Sets a shadow to the toolbar
- * @param shadow whether a shadow should be added to the toolbar
- */
- public void setToolbarShadow(boolean shadow) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- if (shadow)
- toolbar.setElevation(15);
- else
- toolbar.setElevation(0);
- }
- }
-
-
- /**
- * Sets up the toolbar for the activity
- */
- private void setupToolbar() {
- if (toolbar != null ) {
- setSupportActionBar(toolbar);
- if (getSupportActionBar() != null){
- getSupportActionBar().setTitle("");
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- }
- }
- }
-
- /**
- * @return coordinatorLayout for the activity
- */
- public CoordinatorLayout getCoordinatorLayout() {
- return coordinatorLayout;
- }
-
-
- /**
- * Refreshes or retries the transaction
- * @param transactionType type of transaction (used to distinguish between swipe or manual entry transaction)
- */
- public void retryAction(final String transactionType) {
- switch (getCurrentFragmentTag()) {
- case TRANSACTION_FRAGMENT_TAG:
- TransactionFragment transactionFragment = (TransactionFragment)
- getSupportFragmentManager().findFragmentByTag(TRANSACTION_FRAGMENT_TAG);
- if (transactionType.equals(AnetIntentService.ACTION_MAKE_TRANSACTION))
- transactionFragment.makeTransaction();
- else if (transactionType.equals(AnetIntentService.ACTION_PERFORM_SWIPE))
- transactionFragment.performSwipe();
- break;
- case HISTORY_FRAGMENT_TAG:
- HistoryFragment historyFragment = (HistoryFragment) getSupportFragmentManager().
- findFragmentByTag(HISTORY_FRAGMENT_TAG);
- historyFragment.getListOfTransactions(getSpinnerTransactionType(), false);
- break;
- }
- }
-
-
- /**
- * Sets up the navigation drawer
- */
- public void setupNavigationDrawer() {
- ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(this, drawerLayout,
- toolbar, R.string.open_drawer_action, R.string.closer_drawer_action);
- drawerLayout.setDrawerListener(drawerToggle);
- drawerToggle.syncState();
- if (toolbar != null) {
- toolbar.setNavigationOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- drawerLayout.openDrawer(GravityCompat.START);
- }
- });
- }
- navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
- @Override
- public boolean onNavigationItemSelected(MenuItem menuItem) {
- updateFragmentOnSelection(menuItem);
- return true;
- }
- });
- updateCheckedSelection(fragmentFromIntent);
- }
-
-
- /**
- * Commits a fragment based on the item selected in the navigation drawer and then closes
- * the drawer
- * @param menuItem item in the navigation drawer
- */
- private void updateFragmentOnSelection(MenuItem menuItem) {
- FragmentManager fragmentManager = getSupportFragmentManager();
- Fragment fragment = null;
- String tag = "";
- menuItem.setChecked(true);
- switch (menuItem.getItemId()) {
- case R.id.drawer_transaction:
- setToolbarShadow(false);
- tag = TRANSACTION_FRAGMENT_TAG;
- fragment = fragmentManager.findFragmentByTag(tag);
- if (fragment == null)
- fragment = TransactionFragment.newInstance();
- break;
- case R.id.drawer_history:
- setToolbarShadow(true);
- tag = HISTORY_FRAGMENT_TAG;
- fragment = fragmentManager.findFragmentByTag(tag);
- if (fragment == null)
- fragment = HistoryFragment.newInstance();
- break;
- }
- drawerLayout.closeDrawer(GravityCompat.START);
- getSupportFragmentManager().beginTransaction().replace(R.id.content, fragment, tag).commit();
- }
-
-
- /**
- * Updates the highlighted item (item checked) in the navigation drawer to the
- * fragment currently being displayed (necessary if sent from another activity)
- * @param fragmentFromIntent fragment committed from intent
- */
- private void updateCheckedSelection(String fragmentFromIntent) {
- MenuItem transactionItem = navigationView.getMenu().findItem(R.id.drawer_transaction);
- MenuItem historyItem = navigationView.getMenu().findItem(R.id.drawer_history);
- if (fragmentFromIntent == null) {
- transactionItem.setChecked(true);
- } else switch (fragmentFromIntent) {
- case TRANSACTION_FRAGMENT_TAG:
- historyItem.setChecked(false);
- transactionItem.setChecked(true);
- break;
- case HISTORY_FRAGMENT_TAG:
- transactionItem.setChecked(false);
- historyItem.setChecked(true);
- break;
- }
- }
-
-
- /**
- * Begins a logout transaction
- */
- private void performLogout() {
- FragmentManager fragmentManager = getSupportFragmentManager();
- LogoutRetainedFragment logoutFragment = (LogoutRetainedFragment) fragmentManager.
- findFragmentByTag(LOGOUT_FRAGMENT_TAG);
- if (logoutFragment == null) {
- logoutFragment = new LogoutRetainedFragment();
- fragmentManager.beginTransaction().add(logoutFragment, LOGOUT_FRAGMENT_TAG).commit();
- } else {
- logoutFragment.startServiceLogout();
- }
- }
-
-
- /**
- * Gets the tag of the current fragment displayed
- * @return the tag of the current fragment
- */
- public String getCurrentFragmentTag() {
- TransactionFragment transactionFragment = (TransactionFragment) getSupportFragmentManager().
- findFragmentByTag(TRANSACTION_FRAGMENT_TAG);
- HistoryFragment historyFragment = (HistoryFragment) getSupportFragmentManager().
- findFragmentByTag(HISTORY_FRAGMENT_TAG);
- if (transactionFragment != null && transactionFragment.isVisible())
- return TRANSACTION_FRAGMENT_TAG;
- if (historyFragment != null && historyFragment.isVisible())
- return HISTORY_FRAGMENT_TAG;
- return null;
- }
-
-
- /**
- * Gets a string value of the current transaction type (unsettled or settled) displayed
- * @return string of the transaction type displayed in the spinner
- */
- public String getSpinnerTransactionType() {
- return transactionHistorySpinner.getSelectedItem().toString();
- }
-
-
- /**
- * Launches the login activity and finished the current activity when logoout result is received
- * @param resultData the result of the logout transaction
- */
- @Override
- public void onReceiveLogoutResult(Bundle resultData) {
- net.authorize.mobile.Result result = (net.authorize.mobile.Result)
- resultData.getSerializable(AnetIntentService.LOGOUT_STATUS);
- if (result.isResponseOk()) {
- Intent intent = new Intent(this, LoginActivity.class);
- startActivity(intent);
- finish();
- } else {
- displayOkDialog(getResources().getString(R.string.dialog_title_unknown_error),
- getResources().getString(R.string.dialog_message_unknown_error));
- }
- }
-
-
- /**
- * Updates the UI based on the status of the manual/swipe transaction result
- * @param resultData the result of a manual or swipe transaction
- */
- @Override
- public void onReceiveTransactionResult(Bundle resultData) {
- Result transactionResult = (Result) resultData.getSerializable(AnetIntentService.TRANSACTION_STATUS);
- dismissIndeterminateProgressDialog();
- String fragmentTag = getCurrentFragmentTag();
- if (fragmentTag == null)
- return;
- switch(fragmentTag) {
- case TRANSACTION_FRAGMENT_TAG:
- if (transactionResult != null && !transactionResult.isApproved()) {
- String title = getResources().getString(R.string.dialog_title_transaction_unsuccessful);
- if (transactionResult.getTransactionResponseErrors().size() != 0) {
- String errorMessage = transactionResult.getTransactionResponseErrors().get(0).getReasonText();
- displayOkDialog(title, errorMessage);
- } else {
- displayOkDialog(getResources().getString(R.string.dialog_title_unknown_error), getResources().getString(R.string.dialog_message_check_unsettled_transactions));
- }
- } else {
- Intent intent = new Intent(this, TransactionResultActivity.class);
- intent.putExtra(TransactionResultActivity.TRANSACTION_RESULT, transactionResult);
- startActivity(intent);
- finish();
- }
- break;
- case HISTORY_FRAGMENT_TAG:
- //display the results of the transaction in the history fragment
- if (transactionResult.isApproved()) {
- displaySnackbar(coordinatorLayout, HistoryFragment.HISTORY_FRAGMENT_TRANSACTION_TYPE_TAG,
- R.string.snackbar_text_successful_transaction, R.string.snackbar_action_refresh);
- } else {
- displaySnackbar(coordinatorLayout, HistoryFragment.HISTORY_FRAGMENT_TRANSACTION_TYPE_TAG,
- R.string.dialog_title_transaction_unsuccessful, R.string.snackbar_action_refresh);
- }
- break;
- }
- }
-
-
- /**
- * Updates the UI depending on the result of the void/refund transaction
- * @param resultData the result of a void or refund transaction
- * @param transactionType type of transaction (refund or void)
- */
- @Override
- public void onReceiveHistoryVoidRefundResult(Bundle resultData, String transactionType) {
- net.authorize.aim.Result voidRefundResult = null;
- String actionTag = null;
- int snackbarSuccessfulMessage = 0, unsuccessfulMessasgeTitle = 0, snackbarUnsuccessfulMessage = 0;
- switch (transactionType) {
- case AnetIntentService.ACTION_REFUND:
- voidRefundResult = (net.authorize.aim.Result) resultData.getSerializable(AnetIntentService.REFUND_STATUS);
- actionTag = AnetIntentService.ACTION_REFUND;
- snackbarSuccessfulMessage = R.string.snackbar_text_successful_refund;
- unsuccessfulMessasgeTitle = R.string.dialog_title_transaction_not_refunded;
- snackbarUnsuccessfulMessage = R.string.snackbar_text_unsuccessful_refund;
- break;
- case AnetIntentService.ACTION_VOID:
- voidRefundResult = (net.authorize.aim.Result) resultData.getSerializable(AnetIntentService.VOID_STATUS);
- actionTag = AnetIntentService.ACTION_VOID;
- snackbarSuccessfulMessage = R.string.snackbar_text_successful_void;
- unsuccessfulMessasgeTitle = R.string.dialog_title_transaction_not_voided;
- snackbarUnsuccessfulMessage = R.string.snackbar_text_unsuccessful_void;
- break;
- }
- if (voidRefundResult != null && voidRefundResult.isResponseOk()) {
- displaySnackbar(coordinatorLayout, actionTag, snackbarSuccessfulMessage, R.string.snackbar_action_refresh);
- } else if (voidRefundResult != null && voidRefundResult.getTransactionResponseErrors().size() != 0){
-
- String errorMessage = voidRefundResult.getTransactionResponseErrors().get(0).getReasonText();
- displayOkDialog(getResources().getString(unsuccessfulMessasgeTitle), errorMessage);
- } else {
- displaySnackbar(coordinatorLayout, HistoryFragment.HISTORY_FRAGMENT_TRANSACTION_TYPE_TAG,
- snackbarUnsuccessfulMessage, R.string.snackbar_action_refresh);
- }
- }
-
-
- /**
- * Updates the UI based on the result of getting unsettled/settled transaction
- * @param resultData result of getting unsettled/settled transactions
- * @param transactionType type of transaction (unsettled/settled)
- */
- @Override
- @SuppressWarnings("unchecked") // transactionList always an arrayList of transaction details
- public void onReceiveHistoryTransactionsListResult(Bundle resultData, String transactionType) {
- HistoryFragment fragment = (HistoryFragment) getSupportFragmentManager().
- findFragmentByTag(HISTORY_FRAGMENT_TAG);
- if (fragment == null)
- return;
- fragment.updateViewOnTransactionResult();
- net.authorize.reporting.Result historyResult = null;
- ArrayList transactionList = new ArrayList<>();
- switch (transactionType) {
- case AnetIntentService.ACTION_GET_SETTLED_TRANSACTIONS:
- historyResult = (net.authorize.reporting.Result) resultData.getSerializable
- (AnetIntentService.SETTLED_TRANSACTION_LIST_STATUS);
- transactionList = (ArrayList) resultData.
- getSerializable(AnetIntentService.EXTRA_SETTLED_TRANSACTION_LIST);
- break;
- case AnetIntentService.ACTION_GET_UNSETTLED_TRANSACTIONS:
- historyResult = (net.authorize.reporting.Result) resultData.getSerializable
- (AnetIntentService.UNSETTLED_TRANSACTION_LIST_STATUS);
- transactionList = historyResult.getReportingDetails().getTransactionDetailList();
- break;
- }
- if (transactionList.size() == 0) { // no transaction to display
- fragment.displayTransactionsRecyclerView(View.INVISIBLE);
- fragment.updateTransactionList(transactionList);
- fragment.displayNoHistoryTransactions(View.VISIBLE);
- } else if (historyResult != null && historyResult.isResponseOk()) {
- fragment.displayTransactionsRecyclerView(View.VISIBLE);
- fragment.updateTransactionList(transactionList);
- fragment.displayNoHistoryTransactions(View.INVISIBLE);
- } else {
- fragment.displayNoHistoryTransactions(View.INVISIBLE);
- fragment.displayTransactionsRecyclerView(View.INVISIBLE);
- displaySnackbar(coordinatorLayout, HistoryFragment.HISTORY_FRAGMENT_TRANSACTION_TYPE_TAG,
- R.string.snackbar_text_failed_load_transactions, R.string.snackbar_action_retry);
- }
- }
-
-
- /**
- * This method will return the user to the login activity as the session has expired.
- * @param resultCode session expired result code
- */
- @Override
- public void onReceiveErrorResult(int resultCode) {
- if (resultCode == AnetIntentService.SESSION_EXPIRED_CODE) {
- displaySessionExpiredDialog();
- }
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/TransactionResultActivity.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/TransactionResultActivity.java
deleted file mode 100644
index 4d20367..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/TransactionResultActivity.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package net.authorize.sampleapplication;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v7.widget.CardView;
-import android.view.View;
-import android.widget.Button;
-import android.widget.TextView;
-
-import java.util.Calendar;
-
-/**
- * Displays a receipt for the transaction and allows users to navigate
- * back to the transaction fragment or view their transaction in a history fragment.
- */
-public class TransactionResultActivity extends AnetBaseActivity {
-
- public static final String TRANSACTION_RESULT = "TRANSACTION_RESULT";
- private TextView transactionIdTextView;
- private TextView transactionTotalAmountTextView;
- private CardView transactionSuccessfulCard;
- private TextView transactionCardTypeTextView;
- private TextView transactionCardNumberTextView;
- private TextView transactionDateTextView;
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_transaction_result);
- setupViews();
- displayResults();
- }
-
-
- @Override
- public void onBackPressed() {
- returnToTransaction(NavigationActivity.TRANSACTION_FRAGMENT_TAG);
- super.onBackPressed();
- }
-
-
- /**
- * Sets variables with their views in the layout XML
- */
- public void setupViews() {
- transactionIdTextView = (TextView) findViewById(R.id.transaction_id);
- transactionTotalAmountTextView = (TextView) findViewById(R.id.transaction_amount);
- transactionSuccessfulCard = (CardView) findViewById(R.id.transaction_successful_card);
- transactionCardNumberTextView = (TextView) findViewById(R.id.transaction_card_number);
- transactionCardTypeTextView = (TextView) findViewById(R.id.transaction_card_type);
- transactionDateTextView = (TextView) findViewById(R.id.transaction_date);
- Button makeNewTransactionButton = (Button) findViewById(R.id.make_new_transaction_button);
- Button paymentHistoryButton = (Button) findViewById(R.id.history_page_button);
- paymentHistoryButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- returnToTransaction(NavigationActivity.HISTORY_FRAGMENT_TAG);
- }
- });
- makeNewTransactionButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- returnToTransaction(NavigationActivity.TRANSACTION_FRAGMENT_TAG);
- }
- });
- }
-
-
- /**
- * Starts the Navigation Activity with the fragment specified by fragmentType
- * @param fragmentType fragment to commit
- */
- public void returnToTransaction(String fragmentType) {
- Intent intent = new Intent(getBaseContext(), NavigationActivity.class);
- intent.putExtra(NavigationActivity.FRAGMENT_TYPE, fragmentType);
- startActivity(intent);
- finish();
- }
-
-
- /**
- * Sets the amount, card number, card type, transaction ID, and transaction date of the
- * transaction to the text views to display the receipt
- */
- public void displayResults() {
- net.authorize.aim.Result transactionResult = null;
- if (getIntent() != null && getIntent().getExtras() != null)
- transactionResult = (net.authorize.aim.Result) getIntent().getExtras().
- getSerializable(TRANSACTION_RESULT);
- if (transactionResult != null && transactionResult.isOk()) {
- String transactionAmount = transactionResult.getRequestTransaction().getOrder().
- getTotalAmount().toString();
- transactionTotalAmountTextView.setText("$" + transactionAmount);
- transactionCardNumberTextView.setText(transactionResult.getAccountNumber());
- transactionCardTypeTextView.setText(transactionResult.getAccountType().name());
- transactionIdTextView.setText(transactionResult.getTransId());
- Calendar calendar = Calendar.getInstance();
- transactionDateTextView.setText(calendar.get(Calendar.MONTH) + "/" +
- calendar.get(Calendar.DATE) + "/" + calendar.get(Calendar.YEAR));
- transactionSuccessfulCard.setVisibility(View.VISIBLE);
- }
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/adapters/TransactionHistoryAdapter.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/adapters/TransactionHistoryAdapter.java
deleted file mode 100644
index 61be95b..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/adapters/TransactionHistoryAdapter.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package net.authorize.sampleapplication.adapters;
-
-import android.support.v7.widget.RecyclerView;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.TextView;
-
-import net.authorize.data.reporting.TransactionDetails;
-import net.authorize.data.reporting.TransactionStatusType;
-import net.authorize.sampleapplication.NavigationActivity;
-import net.authorize.sampleapplication.R;
-import net.authorize.sampleapplication.fragments.HistoryFragment;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-
-/**
- * Adapter used to populate the recycler view of unsettled/settled transactions in the history fragment.
- */
-public class TransactionHistoryAdapter extends RecyclerView.Adapter {
-
- private ArrayList transactions = null;
- private String currentTransactionType;
- private HistoryFragment fragment;
- private static final String DATE_FORMAT = "EEE, MMM d hh:mm a";
-
- public static class ViewHolder extends RecyclerView.ViewHolder {
- public TextView transactionID;
- public TextView transactionAmount;
- public TextView transactionDate;
- public Button refundVoidButton;
- public TextView refundedTextView;
-
- public ViewHolder(View view) {
- super(view);
- transactionID = (TextView) view.findViewById(R.id.history_transaction_id);
- transactionAmount = (TextView) view.findViewById(R.id.history_amount);
- transactionDate = (TextView) view.findViewById(R.id.history_transaction_date);
- refundVoidButton = (Button) view.findViewById(R.id.refund_void_button);
- refundedTextView = (TextView) view.findViewById(R.id.refund_void_image);
- }
- }
-
- public TransactionHistoryAdapter(ArrayList transactions, String transactionType, HistoryFragment fragment) {
- this.transactions = transactions;
- this.currentTransactionType = transactionType;
- this.fragment = fragment;
- }
-
- public void setHistoryTransactionList(ArrayList newTransactions, String transactionType) {
- currentTransactionType = transactionType;
- transactions.clear();
- transactions.addAll(newTransactions);
- this.notifyDataSetChanged();
- }
-
-
- @Override
- public TransactionHistoryAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
- View view = LayoutInflater.from(viewGroup.getContext()).
- inflate(R.layout.transaction_history_item, viewGroup, false);
- return new ViewHolder(view);
- }
-
-
- @Override
- public void onBindViewHolder(ViewHolder viewHolder, int i) {
- final TransactionDetails transaction = transactions.get(i);
- viewHolder.transactionID.setText(transaction.getTransId());
- viewHolder.transactionAmount.setText("$" + transaction.getSettleAmount().toString());
- Date date = transaction.getSubmitTimeLocal();
- DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
- viewHolder.transactionDate.setText(dateFormat.format(date));
- String type = transaction.getTransactionStatus().value();
- if (currentTransactionType.equals(NavigationActivity.TRANSACTION_SETTLED)) {
- viewHolder.refundVoidButton.setText(fragment.getResources().getString(R.string.refund_button_text));
- if (type.equals((TransactionStatusType.REFUND_SETTLED_SUCCESSFULLY).value())) {
- viewHolder.refundVoidButton.setVisibility(View.INVISIBLE);
- viewHolder.refundedTextView.setText(fragment.getResources().getString(R.string.refunded_text));
- viewHolder.transactionAmount.setText("($" + transaction.getSettleAmount().toString() + ")");
- viewHolder.refundedTextView.setVisibility(View.VISIBLE);
- } else if (type.equals((TransactionStatusType.VOIDED).value())) {
- viewHolder.refundVoidButton.setVisibility(View.INVISIBLE);
- viewHolder.refundedTextView.setText(fragment.getResources().getString(R.string.voided_text));
- viewHolder.refundedTextView.setVisibility(View.VISIBLE);
- } else {
- viewHolder.refundVoidButton.setVisibility(View.VISIBLE);
- viewHolder.refundedTextView.setVisibility(View.INVISIBLE);
- }
- } else if (currentTransactionType.equals(NavigationActivity.TRANSACTION_UNSETTLED)) {
- viewHolder.refundVoidButton.setText(fragment.getResources().getString(R.string.void_button_text));
- if (type.equals((TransactionStatusType.VOIDED).value())) {
- viewHolder.refundVoidButton.setVisibility(View.INVISIBLE);
- viewHolder.refundedTextView.setText(fragment.getResources().getString(R.string.voided_text));
- viewHolder.refundedTextView.setVisibility(View.VISIBLE);
- }else {
- viewHolder.refundVoidButton.setVisibility(View.VISIBLE);
- viewHolder.refundedTextView.setVisibility(View.INVISIBLE);
- }
- }
- viewHolder.refundVoidButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- String transactionId = transaction.getTransId();
- String transactionAmount = transaction.getSettleAmount().toString();
- String cardNumber = null;
- if (transaction.getPayment() != null) // unable to get payment information from sdk
- cardNumber = transaction.getPayment().getCreditCard().getCreditCardNumber();
- else if (transaction.getAccountNumber() != null)
- // gets masked credit card for the transaction
- cardNumber = transaction.getAccountNumber();
- if (currentTransactionType.equals(NavigationActivity.TRANSACTION_SETTLED))
- fragment.refundTransaction(transactionId, transactionAmount, cardNumber);
- if (currentTransactionType.equals(NavigationActivity.TRANSACTION_UNSETTLED))
- fragment.voidTransaction(transactionId, transactionAmount);
- }
- });
- }
-
- @Override
- public int getItemCount() {
- return transactions.size();
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/HistoryFragment.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/HistoryFragment.java
deleted file mode 100644
index f9d41fb..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/HistoryFragment.java
+++ /dev/null
@@ -1,201 +0,0 @@
-package net.authorize.sampleapplication.fragments;
-
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-
-import net.authorize.data.reporting.TransactionDetails;
-import net.authorize.sampleapplication.NavigationActivity;
-import net.authorize.sampleapplication.services.AnetIntentService;
-import net.authorize.sampleapplication.R;
-import net.authorize.sampleapplication.adapters.TransactionHistoryAdapter;
-
-import java.util.ArrayList;
-
-/**
- * Displays unsettled or settled transactions to the user.
- */
-public class HistoryFragment extends Fragment {
-
- private static final String HISTORY_RETAINED_FRAGMENT = "HISTORY_RETAINED_FRAGMENT";
- public static final String HISTORY_FRAGMENT_TRANSACTION_TYPE_TAG = "TRANSACTION_SERVICE";
- public static final String TRANSACTION_ID_TAG = "TRANSACTION_ID";
- public static final String TRANSACTION_AMOUNT_TAG = "TRANSACTION_AMOUNT";
- public static final String TRANSACTION_CARD_NUMBER_TAG = "TRANSACTION_CARD_NUMBER";
- private TransactionHistoryAdapter transactionAdapter;
- private SwipeRefreshLayout swipeRefreshLayout;
- private String currentTransactionListType;
- private ProgressBar progressBar;
- private RecyclerView transactionListRecyclerView;
- private ImageView noTransactionsIcon;
- private TextView noTransactionsTextView;
-
- public static HistoryFragment newInstance() {
- return new HistoryFragment();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- }
-
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.fragment_history, container, false);
- setupViews(view);
- currentTransactionListType = ((NavigationActivity) getActivity()).getSpinnerTransactionType();
- getListOfTransactions(currentTransactionListType, false);
- return view;
- }
-
- /**
- * Sets variables with their views in the layout XML
- * @param view fragment view
- */
- public void setupViews(View view) {
- setHasOptionsMenu(true); // calls options menu in base activity again to set spinner
- ArrayList listOfTransactions = new ArrayList<>();
- swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.history_swipe_refresh_layout);
- swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
- @Override
- public void onRefresh() {
- getListOfTransactions(currentTransactionListType, true);
- }
- });
- progressBar = (ProgressBar) view.findViewById(R.id.history_progress_bar);
- noTransactionsIcon = (ImageView) view.findViewById(R.id.no_transactions_icon);
- noTransactionsTextView = (TextView) view.findViewById(R.id.no_transactions_textView);
- transactionListRecyclerView = (RecyclerView) view.findViewById(R.id.transactions_recycler_view);
- transactionListRecyclerView.setHasFixedSize(true);
- RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
- transactionListRecyclerView.setLayoutManager(mLayoutManager);
- transactionAdapter = new TransactionHistoryAdapter(listOfTransactions, currentTransactionListType, this);
- transactionListRecyclerView.setAdapter(transactionAdapter);
- }
-
-
- /**
- * Puts the necessary extras for refunding a transaction into a bundle that will be
- * sent to the retained fragment for further processing
- * @param transactionListType type of transaction (unsettled/settled)
- * @param isSwipe whether the swipe refresh layout was used
- */
- public void getListOfTransactions(String transactionListType, boolean isSwipe) {
- displayNoHistoryTransactions(View.INVISIBLE);
- if (isSwipe)
- progressBar.setVisibility(View.INVISIBLE);
- else
- progressBar.setVisibility(View.VISIBLE);
- currentTransactionListType = transactionListType;
- swipeRefreshLayout.setVisibility(View.INVISIBLE);
- if (transactionListType.equals(NavigationActivity.TRANSACTION_UNSETTLED))
- sendToRetainedFragment(AnetIntentService.ACTION_GET_UNSETTLED_TRANSACTIONS, null);
- else if (transactionListType.equals(NavigationActivity.TRANSACTION_SETTLED))
- sendToRetainedFragment(AnetIntentService.ACTION_GET_SETTLED_TRANSACTIONS, null);
-
- }
-
- /**
- * Puts the necessary extras for voiding a transaction into a bundle that will be
- * sent to the retained fragment for further processing
- * @param transactionId ID of the transaction
- * @param transactionAmount amount of the transaction
- */
- public void voidTransaction(String transactionId, String transactionAmount) {
- Bundle extras = new Bundle();
- extras.putString(TRANSACTION_ID_TAG, transactionId);
- extras.putString(TRANSACTION_AMOUNT_TAG, transactionAmount);
- sendToRetainedFragment(AnetIntentService.ACTION_VOID, extras);
- }
-
-
- /**
- * Puts the necessary extras for refunding a transaction into a bundle that will be
- * sent to the retained fragment for further processing
- * @param transactionId ID of the transaction
- * @param transactionAmount amount of the transaction
- * @param cardNumber card number associated with the transaction
- */
- public void refundTransaction(String transactionId, String transactionAmount, String cardNumber) {
- Bundle extras = new Bundle();
- extras.putString(TRANSACTION_ID_TAG, transactionId);
- extras.putString(TRANSACTION_AMOUNT_TAG, transactionAmount);
- extras.putString(TRANSACTION_CARD_NUMBER_TAG, cardNumber);
- sendToRetainedFragment(AnetIntentService.ACTION_REFUND, extras);
- }
-
-
- /**
- * Sends the transaction request to the retained fragment to start the service
- * @param action type of transaction (getting unsettled/settled, voiding/refunding)
- * @param extras extra strings needed to perform the transaction
- */
- public void sendToRetainedFragment(String action, Bundle extras) {
- NavigationActivity navigationActivity = (NavigationActivity) getActivity();
- if (!navigationActivity.isNetworkAvailable()) {
- navigationActivity.displaySnackbar(navigationActivity.getCoordinatorLayout(),
- "", R.string.snackbar_text_no_network_connection, R.string.snackbar_action_retry);
- }
- FragmentManager fragmentManager = getFragmentManager();
- HistoryRetainedFragment historyRetainedFragment = (HistoryRetainedFragment) fragmentManager.
- findFragmentByTag(HISTORY_RETAINED_FRAGMENT);
- if (historyRetainedFragment == null) {
- historyRetainedFragment = new HistoryRetainedFragment();
- Bundle transactionType = new Bundle();
- transactionType.putString(HISTORY_FRAGMENT_TRANSACTION_TYPE_TAG, action);
- historyRetainedFragment.setArguments(transactionType);
- fragmentManager.beginTransaction().add(historyRetainedFragment, HISTORY_RETAINED_FRAGMENT).commit();
- } else {
- historyRetainedFragment.startServiceGetTransactions(action, extras);
- }
- }
-
-
- /**
- * Updates the UI after the transaction result has been received
- */
- public void updateViewOnTransactionResult() {
- progressBar.setVisibility(View.GONE);
- swipeRefreshLayout.setVisibility(View.VISIBLE);
- swipeRefreshLayout.setRefreshing(false);
- }
-
-
- /**
- * Sets the visibility of the ImageView and TextView to be displayed when there are no transactions
- * @param viewType the visibility of the ImageView and TextView
- */
- public void displayNoHistoryTransactions(int viewType) {
- noTransactionsIcon.setVisibility(viewType);
- noTransactionsTextView.setVisibility(viewType);
- }
-
-
- /**
- * Sets the visibility of the transaction list recycler view
- * @param viewType the visibility of the recycler view
- */
- public void displayTransactionsRecyclerView(int viewType) {
- transactionListRecyclerView.setVisibility(viewType);
- }
-
-
- /**
- * Sends the transaction list to the adapter to update the recycler view with the new list of transactions
- * @param transactionList list of unsettled/settled transactions to be populated in the recycler view
- */
- public void updateTransactionList(ArrayList transactionList) {
- transactionAdapter.setHistoryTransactionList(transactionList, currentTransactionListType);
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/HistoryRetainedFragment.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/HistoryRetainedFragment.java
deleted file mode 100644
index e3b5864..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/HistoryRetainedFragment.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package net.authorize.sampleapplication.fragments;
-
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v4.app.Fragment;
-
-import net.authorize.sampleapplication.services.AnetIntentService;
-import net.authorize.sampleapplication.receivers.AnetResultReceiver;
-
-/**
- * Starts the AnetIntentService with the specified intent action to (1) get settled transactions,
- * (2) get unsettled transactions, (3) refund a transaction, or (4) void a transaction and listens
- * to the results of the transaction (from the result receiver) to send back via a callback to the activity.
- */
-public class HistoryRetainedFragment extends Fragment implements AnetResultReceiver.ReceiverCallback {
-
- private AnetResultReceiver resultReceiver;
- private OnHistoryTransactionListener mListener;
-
-
- public interface OnHistoryTransactionListener {
- void onReceiveHistoryTransactionsListResult(Bundle resultData, String transactionType);
- void onReceiveHistoryVoidRefundResult(Bundle resultData, String transactionType);
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- try {
- mListener = (OnHistoryTransactionListener) activity;
- } catch (ClassCastException e) {
- throw new ClassCastException(activity.toString()
- + " must implement OnFragmentInteractionListener");
- }
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setRetainInstance(true);
- resultReceiver = new AnetResultReceiver(new Handler());
- resultReceiver.setReceiverCallback(this);
- Bundle transactionTypeBundle = getArguments();
- if (transactionTypeBundle!= null) {
- String transactionService = transactionTypeBundle.getString
- (HistoryFragment.HISTORY_FRAGMENT_TRANSACTION_TYPE_TAG);
- startServiceGetTransactions(transactionService, transactionTypeBundle);
- }
- }
-
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- if (resultReceiver != null)
- resultReceiver.clearReceiverCallback();
- }
-
- /**
- * Starts the intent service with an action specified by the transactionService and any extras
- * @param transactionService type of transaction as specified in the intent service (UNSETTLED / SETTLED)
- * @param extras extra information needed to make the specified transaction
- * @return whether the service was successfully started
- */
- public boolean startServiceGetTransactions(String transactionService, Bundle extras) {
- try {
- Intent intent = new Intent(getActivity(), AnetIntentService.class);
- intent.setAction(transactionService);
- if (extras != null) {
- intent.putExtra(HistoryFragment.TRANSACTION_CARD_NUMBER_TAG, extras.
- getString(HistoryFragment.TRANSACTION_CARD_NUMBER_TAG));
- intent.putExtra(HistoryFragment.TRANSACTION_ID_TAG, extras.
- getString(HistoryFragment.TRANSACTION_ID_TAG));
- intent.putExtra(HistoryFragment.TRANSACTION_AMOUNT_TAG, extras.
- getString(HistoryFragment.TRANSACTION_AMOUNT_TAG));
- }
- intent.putExtra(AnetResultReceiver.RESULT_RECEIVER_TAG, resultReceiver);
- getActivity().startService(intent);
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
-
- /**
- * Uses a callback to propagate the result of the service request back to the calling activity
- * @param resultCode result code for the transaction defined in and delivered by the service
- * @param resultData the result of the transaction and the full array list of transactions
- */
- public void onReceiveResult(int resultCode, Bundle resultData) {
- switch (resultCode) {
- case AnetIntentService.UNSETTLED_TRANSACTIONS_CODE:
- mListener.onReceiveHistoryTransactionsListResult(resultData,
- AnetIntentService.ACTION_GET_UNSETTLED_TRANSACTIONS);
- break;
- case AnetIntentService.SETTLED_TRANSACTIONS_CODE:
- mListener.onReceiveHistoryTransactionsListResult(resultData,
- AnetIntentService.ACTION_GET_SETTLED_TRANSACTIONS);
- break;
- case AnetIntentService.REFUND_RESULT_CODE:
- mListener.onReceiveHistoryVoidRefundResult(resultData,
- AnetIntentService.ACTION_REFUND);
- break;
- case AnetIntentService.VOID_RESULT_CODE:
- mListener.onReceiveHistoryVoidRefundResult(resultData,
- AnetIntentService.ACTION_VOID);
- break;
- }
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/LoginActivityRetainedFragment.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/LoginActivityRetainedFragment.java
deleted file mode 100644
index c5f677a..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/LoginActivityRetainedFragment.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package net.authorize.sampleapplication.fragments;
-
-import android.app.Activity;
-import android.app.Fragment;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-
-import net.authorize.sampleapplication.services.AnetIntentService;
-import net.authorize.sampleapplication.receivers.AnetResultReceiver;
-import net.authorize.sampleapplication.LoginActivity;
-
-/**
- * Starts the AnetIntentService to authenticate a user and listens to the results of the
- * authentication transaction (from the result receiver) to send back via a callback to the activity.
- */
-public class LoginActivityRetainedFragment extends Fragment
- implements AnetResultReceiver.ReceiverCallback {
-
- private AnetResultReceiver resultReceiver;
- private OnFragmentInteractionListener mListener;
-
- public interface OnFragmentInteractionListener {
- void onReceiveAuthenticateUserResult(Bundle resultData);
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- try {
- mListener = (OnFragmentInteractionListener) activity;
- } catch (ClassCastException e) {
- throw new ClassCastException(activity.toString()
- + " must implement OnFragmentInteractionListener");
- }
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setRetainInstance(true);
- resultReceiver = new AnetResultReceiver(new Handler());
- resultReceiver.setReceiverCallback(this);
- Bundle credentials = getArguments();
- if (credentials!= null) {
- String loginId = credentials.getString(LoginActivity.LOGIN_ID_TAG);
- String password = credentials.getString(LoginActivity.PASSWORD_TAG);
- startServiceAuthenticateUser(loginId, password);
- }
- }
-
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- if (resultReceiver != null)
- resultReceiver.clearReceiverCallback();
- }
-
- /**
- * Starts the service to authenticate a user
- * Pre: loginId and password are not empty
- * @param loginId username for the account entered in the EditText
- * @param password password for the account entered in the EditText
- * @return whether the service was successfully started
- */
- public boolean startServiceAuthenticateUser(String loginId, String password) {
- try {
- Intent intent = new Intent(getActivity(), AnetIntentService.class);
- intent.setAction(AnetIntentService.ACTION_AUTHENTICATE_USER);
- intent.putExtra(LoginActivity.LOGIN_ID_TAG, loginId);
- intent.putExtra(LoginActivity.PASSWORD_TAG, password);
- intent.putExtra(AnetResultReceiver.RESULT_RECEIVER_TAG, resultReceiver);
- getActivity().startService(intent);
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
- /**
- * Uses a callback to propagate the result of the service request back to the activity
- * @param resultCode result code for the transaction defined in and delivered by the service
- * @param resultData the result of the transaction and the full array list of transactions
- */
- public void onReceiveResult(int resultCode, Bundle resultData) {
- if (resultCode == AnetIntentService.AUTHENTICATE_USER_RESULT_CODE)
- mListener.onReceiveAuthenticateUserResult(resultData);
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/LogoutRetainedFragment.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/LogoutRetainedFragment.java
deleted file mode 100644
index 9316c81..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/LogoutRetainedFragment.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package net.authorize.sampleapplication.fragments;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-
-import net.authorize.sampleapplication.services.AnetIntentService;
-import net.authorize.sampleapplication.receivers.AnetResultReceiver;
-
-/**
- * Starts the AnetIntentService to log a user out and listens to the results of the
- * logout transaction (from the result receiver) to send back via a callback to the activity.
- */
-public class LogoutRetainedFragment extends android.support.v4.app.Fragment implements
- AnetResultReceiver.ReceiverCallback {
-
- private AnetResultReceiver resultReceiver;
- private OnFragmentInteractionListener mListener;
-
- public interface OnFragmentInteractionListener {
- void onReceiveLogoutResult(Bundle resultData);
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- try {
- mListener = (OnFragmentInteractionListener) activity;
- } catch (ClassCastException e) {
- throw new ClassCastException(activity.toString()
- + " must implement OnFragmentInteractionListener");
- }
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setRetainInstance(true);
-
- resultReceiver = new AnetResultReceiver(new Handler());
- resultReceiver.setReceiverCallback(this);
-
- startServiceLogout();
- }
-
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- if (resultReceiver != null)
- resultReceiver.clearReceiverCallback();
- }
-
-
- /**
- * Starts the service to log a user out
- * @return whether the service was successfully started
- */
- public boolean startServiceLogout() {
- try {
- Intent intent = new Intent(getActivity(), AnetIntentService.class);
- intent.setAction(AnetIntentService.ACTION_LOGOUT);
- intent.putExtra(AnetResultReceiver.RESULT_RECEIVER_TAG, resultReceiver);
- getActivity().startService(intent);
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
- /**
- * Uses a callback to propagate the result of the service request back to the calling activity
- * @param resultCode result code for the transaction defined in and delivered by the service
- * @param resultData the result of the logout transaction
- */
- public void onReceiveResult(int resultCode, Bundle resultData) {
- if (resultCode == AnetIntentService.LOGOUT_RESULT_CODE)
- mListener.onReceiveLogoutResult(resultData);
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/TransactionFragment.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/TransactionFragment.java
deleted file mode 100644
index 29654fa..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/TransactionFragment.java
+++ /dev/null
@@ -1,447 +0,0 @@
-package net.authorize.sampleapplication.fragments;
-
-import android.app.Activity;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.v4.app.FragmentManager;
-import android.text.TextUtils;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import net.authorize.sampleapplication.NavigationActivity;
-import net.authorize.sampleapplication.services.AnetIntentService;
-import net.authorize.sampleapplication.models.CreditCardObject;
-import net.authorize.sampleapplication.views.FormattingTextWatcher;
-import net.authorize.sampleapplication.R;
-import net.authorize.util.Luhn;
-
-import java.util.Calendar;
-
-/**
- * Allows the user to make a transaction using manually entered information or swipe data.
- */
-public class TransactionFragment extends android.support.v4.app.Fragment
- implements FormattingTextWatcher.UpdateUICallBack {
-
- private static final String TRANSACTION_RETAINED_FRAGMENT = "transaction_retained_fragment";
- public static final String ZIPCODE_TAG = "ZIPCODE";
- public static final String AMOUNT_TAG = "TOTAL_AMOUNT";
- public static final String CREDIT_CARD_TAG ="CREDIT_CARD_TAG";
- public static final int CARD_NUMBER_FIELD_LENGTH = 19;
- public static final int CARD_NUMBER_LENGTH = 16;
- public static final int CVV_NUMBER_LENGTH = 3;
- public static final int EXP_DATE_FIELD_LENGTH = 5;
- public static final int EXP_DATE_LENGTH = 4;
- public static final int ZIPCODE_LENGTH = 5;
- private EditText cardNumberEditText;
- private EditText cardExpDateEditText;
- private EditText cardCVVEditText;
- private EditText cardZipCodeEditText;
- private EditText totalAmountEditText;
- private TextView cardNumberMessageTextView;
- private TextView cardExpDateMessageTextView;
- private TextView cardCVVMessageTextView;
- private TextView cardZipcodeMessageTextView;
- private Drawable cardNumberIcon;
- private Drawable expDateIcon;
- private Drawable cvvIcon;
- private Drawable zipcodeIcon;
- private TransactionRetainedFragment transactionFragment;
-
- public static TransactionFragment newInstance() {
- return new TransactionFragment();
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.fragment_make_transaction, container, false);
- ((NavigationActivity) getActivity()).setupClickableUI(view.findViewById(R.id.transaction_fragment));
- setupViews(view);
- setupCustomViewMessages();
- return view;
- }
-
-
- /**
- * Sets variables with their views in the layout XML
- * @param view fragment view
- */
- private void setupViews(View view) {
- cardNumberEditText = (EditText) view.findViewById(R.id.editText_CardNumber);
- cardExpDateEditText = (EditText) view.findViewById(R.id.editText_CardExpDate);
- cardCVVEditText = (EditText) view.findViewById(R.id.editText_CardCVV);
- cardZipCodeEditText = (EditText) view.findViewById(R.id.editText_CardZipCode);
- totalAmountEditText = (EditText) view.findViewById(R.id.editText_amount);
-
- cardNumberMessageTextView = (TextView) view.findViewById(R.id.card_error_message);
- cardExpDateMessageTextView = (TextView) view.findViewById(R.id.exp_date_error_message);
- cardCVVMessageTextView = (TextView) view.findViewById(R.id.cvv_error_message);
- cardZipcodeMessageTextView = (TextView) view.findViewById(R.id.zipcode_error_message);
-
- cardNumberIcon = ((ImageView) view.findViewById(R.id.credit_card_icon)).getDrawable();
- expDateIcon = ((ImageView) view.findViewById(R.id.exp_date_icon)).getDrawable();
- cvvIcon = ((ImageView) view.findViewById(R.id.security_card_icon)).getDrawable();
- zipcodeIcon = ((ImageView) view.findViewById(R.id.zipcode_icon)).getDrawable();
-
- Button makeTransactionButton = (Button) view.findViewById(R.id.transaction_button);
- makeTransactionButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- makeTransaction();
- }
- });
- Button swipeButton = (Button) view.findViewById(R.id.swipe_button);
- swipeButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- performSwipe();
- }
- });
- }
-
-
- /**
- * Puts the necessary extras for making a transaction with manual entries into a bundle that will be
- * sent to the retained fragment for further processing
- */
- public void makeTransaction() {
- String cardNumber = cardNumberEditText.getText().toString().replace(" ", "");
- String cardExpirationDate = cardExpDateEditText.getText().toString().replace("/", "");
- String cardCVV = cardCVVEditText.getText().toString();
- String cardZipcode = cardZipCodeEditText.getText().toString();
- String cardExpMonth, cardExpYear;
- String totalAmount = totalAmountEditText.getText().toString();
- NavigationActivity navigationActivity = (NavigationActivity) getActivity();
- if (!navigationActivity.isNetworkAvailable()) {
- navigationActivity.displaySnackbar(navigationActivity.getCoordinatorLayout(), AnetIntentService.ACTION_MAKE_TRANSACTION,
- R.string.snackbar_text_no_network_connection, R.string.snackbar_action_retry);
- } else if (totalAmountEditText.getText().length() == 0) {
- navigationActivity.displayOkDialog("Error", getResources().
- getString(R.string.dialog_message_invalid_amount));
- } else if (!isValidField(cardNumber, cardCVV, cardZipcode, cardExpirationDate, totalAmount)) {
- String title = getResources().getString(R.string.dialog_title_error);
- String message = getResources().getString(R.string.dialog_message_invalid_field);
- navigationActivity.displayOkDialog(title, message);
- } else {
- cardExpMonth = cardExpirationDate.substring(0, 2);
- cardExpYear = cardExpirationDate.substring(2, 4);
- CreditCardObject creditCardObject = new CreditCardObject(cardNumber, cardCVV,
- cardExpMonth, cardExpYear);
- FragmentManager fragmentManager = getFragmentManager();
- transactionFragment = (TransactionRetainedFragment) fragmentManager.
- findFragmentByTag(TRANSACTION_RETAINED_FRAGMENT);
- if (transactionFragment == null) {
- transactionFragment = new TransactionRetainedFragment();
- Bundle creditCardBundle = new Bundle();
- creditCardBundle.putParcelable(CREDIT_CARD_TAG, creditCardObject);
- creditCardBundle.putString(ZIPCODE_TAG, cardZipcode);
- creditCardBundle.putString(AMOUNT_TAG, totalAmount);
- creditCardBundle.putString(AnetIntentService.ACTION_TRANSACTION_TYPE_TAG,
- AnetIntentService.ACTION_MAKE_TRANSACTION);
- transactionFragment.setArguments(creditCardBundle);
- fragmentManager.beginTransaction().add(transactionFragment,
- TRANSACTION_RETAINED_FRAGMENT).commit();
- } else {
- transactionFragment.startServiceTransaction(creditCardObject, cardZipcode, totalAmount);
- }
- navigationActivity.showIndeterminateProgressDialog(getResources().getString
- (R.string.progress_dialog_title_please_wait), getResources().getString(R.string.progress_dialog_message_processing_transaction));
- }
- }
-
-
- /**
- * Puts the necessary extras for making a transaction using swipe data into a bundle that will be
- * sent to the retained fragment for further processing
- */
- public void performSwipe() {
- NavigationActivity navigationActivity = (NavigationActivity) getActivity();
- if (totalAmountEditText.getText().length() == 0) {
- navigationActivity.displayOkDialog(getResources().getString(R.string.dialog_title_error), getResources().getString(R.string.dialog_message_invalid_amount));
- } else {
- String totalAmount = totalAmountEditText.getText().toString();
- if (!navigationActivity.isNetworkAvailable()) {
- navigationActivity.displaySnackbar(navigationActivity.getCoordinatorLayout(), AnetIntentService.ACTION_PERFORM_SWIPE,
- R.string.snackbar_text_no_network_connection, R.string.snackbar_action_retry);
- } else {
- FragmentManager fragmentManager = getFragmentManager();
- transactionFragment = (TransactionRetainedFragment) fragmentManager.
- findFragmentByTag(TRANSACTION_RETAINED_FRAGMENT);
- if (transactionFragment == null) {
- transactionFragment = new TransactionRetainedFragment();
- Bundle cardInformationBundle = new Bundle();
- cardInformationBundle.putString(AnetIntentService.ACTION_TRANSACTION_TYPE_TAG,
- AnetIntentService.ACTION_PERFORM_SWIPE);
- cardInformationBundle.putString(AMOUNT_TAG, totalAmount);
- transactionFragment.setArguments(cardInformationBundle);
- fragmentManager.beginTransaction().add(transactionFragment,
- TRANSACTION_RETAINED_FRAGMENT).commit();
- } else {
- transactionFragment.startServicePerformSwipe(totalAmount);
- }
- navigationActivity.showIndeterminateProgressDialog(getResources().getString(R.string.progress_dialog_title_please_wait), getResources().getString(R.string.progress_dialog_message_processing_swipe));
- }
- }
- }
-
-
- /**
- * Determines whether all of the information entered in the Edit Texts are valid entries
- * @param cardNumber card number entered in Edit Text
- * @param cardCVV card security number entered in Edit Text
- * @param cardZipCode zipcode entered in Edit Text
- * @param cardExpDate card expiration date entered in Edit Text
- * @param totalAmount amount entered in Edit Text
- * @return whether all fields entered are valid
- */
- private boolean isValidField(String cardNumber, String cardCVV, String cardZipCode,
- String cardExpDate, String totalAmount) {
- if (cardNumber.isEmpty() || cardCVV.isEmpty() || cardExpDate.isEmpty()
- || cardZipCode.isEmpty() || totalAmount.isEmpty()) {
- return false;
- } else if (cardNumber.length() != CARD_NUMBER_LENGTH || cardCVV.length() != CVV_NUMBER_LENGTH
- || cardZipCode.length() != ZIPCODE_LENGTH || cardExpDate.length() != EXP_DATE_LENGTH) {
- return false;
- } else if (!(TextUtils.isDigitsOnly(cardNumber)) || !(TextUtils.isDigitsOnly(cardCVV))
- || !(TextUtils.isDigitsOnly(cardZipCode)) || !(TextUtils.isDigitsOnly(cardExpDate))) {
- return false;
- } else if (!Luhn.isCardValid(cardNumber)) {
- return false;
- } else if (!isValidMonth(cardExpDate.substring(0,2)) &&
- !isValidExpDate(cardExpDate.substring(0, 2), cardExpDate.substring(2, 4))) {
- return false;
- }
- return true;
- }
-
-
- /**
- * Determines whether the expiration month and year entered in Edit Texts
- * are valid entries
- * @param expMonth expiration Month entered in Edit Text
- * @param expYear expiration Year entered in Edit Text
- * @return whether the expiration month and year are valid
- */
- public static boolean isValidExpDate(String expMonth, String expYear) {
- int currentYear = Integer.parseInt(String.valueOf(
- Calendar.getInstance().get(Calendar.YEAR)).substring(2));
- int currentMonth = Integer.parseInt(String.valueOf(Calendar
- .getInstance().get(Calendar.MONTH))) + 1;
- try {
- if (Integer.parseInt(expYear) < currentYear) {
- return false;
- } else if (Integer.parseInt(expYear) == currentYear) {
- if (Integer.parseInt(expMonth) < currentMonth)
- return false;
- }
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
-
- /**
- * Determines whether the card expiration month entered is between 1 and 12 inclusive
- * @param expMonth expiration month entered
- * @return whether the expiration month is valid
- */
- private boolean isValidMonth(String expMonth) {
- try {
- if (((Integer.parseInt(expMonth) == 0 || Integer.parseInt(expMonth) > 12)))
- return false;
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
-
- /**
- * Sets text watchers and on focus change listeners to edit texts to display custom error messages
- */
- private void setupCustomViewMessages() {
- int cardNumberHint = R.string.card_number_hint;
- int cvvHint = R.string.cvv_hint;
- int expDateHint = R.string.exp_date_hint;
- int zipcodeHint = R.string.zipcode_hint;
- int cardLengthErrorMessage = R.string.card_length_error_message;
- int cvvLengthErrorMessage = R.string.cvv_length_error_message;
- int expDateFormatErrorMessage = R.string.exp_date_format_error_message;
- int zipcodeLengthErrorMessage = R.string.zipcode_length_error_message;
-
- FormattingTextWatcher cardNumberTextWatcher = new FormattingTextWatcher(FormattingTextWatcher.FieldType.CARD_NUMBER);
- cardNumberTextWatcher.setFormattingTextWatcher(this);
- FormattingTextWatcher cardExpDateTextWatcher = new FormattingTextWatcher(FormattingTextWatcher.FieldType.EXP_DATE);
- cardExpDateTextWatcher.setFormattingTextWatcher(this);
- FormattingTextWatcher cardCVVTextWatcher = new FormattingTextWatcher(FormattingTextWatcher.FieldType.CVV_NUMBER);
- cardCVVTextWatcher.setFormattingTextWatcher(this);
- FormattingTextWatcher zipcodeTextWatcher = new FormattingTextWatcher(FormattingTextWatcher.FieldType.ZIPCODE);
- zipcodeTextWatcher.setFormattingTextWatcher(this);
- FormattingTextWatcher amountTextWatcher = new FormattingTextWatcher(FormattingTextWatcher.FieldType.TOTAL_AMOUNT);
- amountTextWatcher.setFormattingTextWatcher(this);
-
- cardNumberEditText.addTextChangedListener(cardNumberTextWatcher);
- cardExpDateEditText.addTextChangedListener(cardExpDateTextWatcher);
- cardCVVEditText.addTextChangedListener(cardCVVTextWatcher);
- cardZipCodeEditText.addTextChangedListener(zipcodeTextWatcher);
- totalAmountEditText.addTextChangedListener(amountTextWatcher);
-
- cardNumberEditText.setOnFocusChangeListener(new FieldFocusListener(
- cardNumberMessageTextView,
- cardNumberIcon,
- CARD_NUMBER_FIELD_LENGTH,
- cardNumberHint,
- cardLengthErrorMessage));
- cardExpDateEditText.setOnFocusChangeListener(new FieldFocusListener(
- cardExpDateMessageTextView,
- expDateIcon,
- EXP_DATE_FIELD_LENGTH,
- expDateHint,
- expDateFormatErrorMessage));
- cardCVVEditText.setOnFocusChangeListener(new FieldFocusListener(
- cardCVVMessageTextView,
- cvvIcon,
- CVV_NUMBER_LENGTH,
- cvvHint,
- cvvLengthErrorMessage));
- cardZipCodeEditText.setOnFocusChangeListener(new FieldFocusListener(
- cardZipcodeMessageTextView,
- zipcodeIcon,
- ZIPCODE_LENGTH,
- zipcodeHint,
- zipcodeLengthErrorMessage));
- }
-
-
- /**
- * Callback method from FormattingTextWatcher class that updates the transaction information
- * fields on user input
- * @param fieldType type of field in transaction fragment
- * @param messageId response message to be displayed below edit text
- * @param messageColorId color of response message displayed below edit text
- * @param iconColorId color of icon next to edit text field
- */
- @Override
- public void updateMessages(FormattingTextWatcher.FieldType fieldType, int messageId,
- int messageColorId, int iconColorId) {
- TextView textView = null;
- Drawable icon = null;
- switch(fieldType) {
- case CARD_NUMBER:
- textView = cardNumberMessageTextView;
- icon = cardNumberIcon;
- break;
- case EXP_DATE:
- textView = cardExpDateMessageTextView;
- icon = expDateIcon;
- break;
- case CVV_NUMBER:
- textView = cardCVVMessageTextView;
- icon = cvvIcon;
- break;
- case ZIPCODE:
- textView = cardZipcodeMessageTextView;
- icon = zipcodeIcon;
- break;
- }
- if (textView != null && icon != null) {
- textView.setText(getResources().getString(messageId));
- textView.setTextColor(getResources().getColor(messageColorId));
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
- icon.setTint(getResources().getColor(iconColorId));
- }
- }
-
-
- /**
- * Callback method from FormattingTextWatcher that updates the edit text with formatted
- * entries.
- * @param fieldType type of field entry
- * @param text the text to be set to the edit text
- * @param textWatcher the text watcher object to be removed and readded
- */
- @Override
- public void updateText(FormattingTextWatcher.FieldType fieldType, String text,
- FormattingTextWatcher textWatcher) {
- EditText editText = null;
- switch (fieldType) {
- case CARD_NUMBER:
- editText = cardNumberEditText;
- break;
- case CVV_NUMBER:
- editText = cardCVVEditText;
- break;
- case EXP_DATE:
- editText = cardExpDateEditText;
- break;
- case ZIPCODE:
- editText = cardZipCodeEditText;
- break;
- case TOTAL_AMOUNT:
- editText = totalAmountEditText;
- break;
- }
- if (editText != null) {
- editText.removeTextChangedListener(textWatcher);
- editText.setText(text);
- editText.addTextChangedListener(textWatcher);
- editText.setSelection(editText.getText().length());
- }
- }
-
-
- /**
- * This class displays custom error messages for a credit card field.
- */
- public class FieldFocusListener implements View.OnFocusChangeListener {
- private TextView textView;
- private Drawable icon;
- private int length;
- private int hintId;
- private int errorMessageId;
-
- public FieldFocusListener(TextView textView, Drawable icon,
- int length, int hintId, int errorMessageId) {
- this.textView = textView;
- this.icon = icon;
- this.length = length;
- this.hintId = hintId;
- this.errorMessageId = errorMessageId;
- }
-
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- EditText editText = (EditText) v;
- if (!hasFocus) {
- if (v.getId() != R.id.editText_amount && editText.getText().length() != length) {
- updateMessage(errorMessageId, R.color.ErrorMessageColor,
- R.color.ErrorMessageColor);
- } else if (v.getId() != R.id.editText_CardNumber &&
- v.getId() != R.id.editText_CardExpDate && v.getId() != R.id.editText_amount){
- updateMessage(hintId, R.color.HintColor, R.color.ThemeColor);
- } else if (v.getId() == R.id.editText_amount) {
- updateMessage(hintId, R.color.White, R.color.White);
- }
- }
- }
-
- public void updateMessage(int textId, int textColorId, int tintColorId ) {
- textView.setText(getResources().getString(textId));
- textView.setTextColor(getResources().getColor(textColorId));
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
- icon.setTint(getResources().getColor(tintColorId));
- }
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/TransactionRetainedFragment.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/TransactionRetainedFragment.java
deleted file mode 100644
index 6ef79cf..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/fragments/TransactionRetainedFragment.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package net.authorize.sampleapplication.fragments;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-
-import net.authorize.sampleapplication.services.AnetIntentService;
-import net.authorize.sampleapplication.receivers.AnetResultReceiver;
-import net.authorize.sampleapplication.models.CreditCardObject;
-
-/**
- * Starts the AnetIntentService to either make a transaction using manually entered information
- * or using swipe information and listens to the results of the transaction
- * (from the result receiver) to send back via a callback to the activity.
- */
-public class TransactionRetainedFragment extends android.support.v4.app.Fragment
- implements AnetResultReceiver.ReceiverCallback {
-
- private static AnetResultReceiver resultReceiver;
- private OnFragmentInteractionListener mListener;
-
- public interface OnFragmentInteractionListener {
- void onReceiveTransactionResult(Bundle resultData);
- void onReceiveErrorResult(int resultCode);
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- try {
- mListener = (OnFragmentInteractionListener) activity;
- } catch (ClassCastException e) {
- throw new ClassCastException(activity.toString()
- + " must implement OnFragmentInteractionListener");
- }
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setRetainInstance(true);
-
- resultReceiver = new AnetResultReceiver(new Handler());
- resultReceiver.setReceiverCallback(this);
-
- Bundle cardInformationBundle = getArguments();
- if (cardInformationBundle != null) {
- if (cardInformationBundle.getString(AnetIntentService.ACTION_TRANSACTION_TYPE_TAG).
- equals(AnetIntentService.ACTION_MAKE_TRANSACTION)) {
- CreditCardObject creditCardObject = cardInformationBundle.getParcelable
- (TransactionFragment.CREDIT_CARD_TAG);
- String zipcode = cardInformationBundle.getString(TransactionFragment.ZIPCODE_TAG);
- String totalAmount = cardInformationBundle.getString(TransactionFragment.AMOUNT_TAG);
- startServiceTransaction(creditCardObject, zipcode, totalAmount);
- } else if (cardInformationBundle.getString(AnetIntentService.ACTION_TRANSACTION_TYPE_TAG).
- equals(AnetIntentService.ACTION_PERFORM_SWIPE)) {
- String totalAmount = cardInformationBundle.getString(TransactionFragment.AMOUNT_TAG);
- startServicePerformSwipe(totalAmount);
- }
- }
- }
-
- @Override
- public void onResume() {
- resultReceiver.setReceiverCallback(this);
- super.onResume();
- }
-
-
- /**
- * Starts the service to make a transaction with manually entered information
- * Pre: creditCardObject, zipcode and totalAmount are not empty
- * @param creditCardObject parcelable object that contains validated manually entered card information
- * from EditTexts
- * @param zipcode billing zipcode for the transaction
- * @param totalAmount total amount for the transaction
- * @return whether the service was successfully started
- */
- public boolean startServiceTransaction(CreditCardObject creditCardObject, String zipcode,
- String totalAmount) {
- try {
- Intent intent = new Intent(getActivity(), AnetIntentService.class);
- intent.setAction(AnetIntentService.ACTION_MAKE_TRANSACTION);
- intent.putExtra(TransactionFragment.CREDIT_CARD_TAG, creditCardObject);
- intent.putExtra(TransactionFragment.ZIPCODE_TAG, zipcode);
- intent.putExtra(TransactionFragment.AMOUNT_TAG, totalAmount);
- intent.putExtra(AnetResultReceiver.RESULT_RECEIVER_TAG, resultReceiver);
- getActivity().startService(intent);
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
- /**
- * Starts the service to make a transaction using swipe information
- * Pre: totalAmount is not empty
- * @param totalAmount total amount for the transaction
- * @return whether the service was successfully started
- */
- public boolean startServicePerformSwipe(String totalAmount) {
- try {
- Intent intent = new Intent(getActivity(), AnetIntentService.class);
- intent.setAction(AnetIntentService.ACTION_PERFORM_SWIPE);
- intent.putExtra(TransactionFragment.AMOUNT_TAG, totalAmount);
- intent.putExtra(AnetResultReceiver.RESULT_RECEIVER_TAG, resultReceiver);
- getActivity().startService(intent);
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
- /**
- * Uses a callback to propagate the result of the service request back to the calling activity
- * @param resultCode result code for the transaction defined in and delivered by the service
- * @param resultData the result of the transaction
- */
- public void onReceiveResult(int resultCode, Bundle resultData) {
- if (resultCode == AnetIntentService.TRANSACTION_RESULT_CODE)
- mListener.onReceiveTransactionResult(resultData);
- if (resultCode == AnetIntentService.SESSION_EXPIRED_CODE)
- mListener.onReceiveErrorResult(resultCode);
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/models/AnetSingleton.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/models/AnetSingleton.java
deleted file mode 100644
index 5947511..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/models/AnetSingleton.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package net.authorize.sampleapplication.models;
-
-import net.authorize.Merchant;
-
-/**
- * Singleton class used to hold variables that are common to the entire application.
- */
-public class AnetSingleton {
- private static AnetSingleton instance;
- public static Merchant merchant;
-
- public static AnetSingleton getInstance()
- {
- if (instance == null)
- return new AnetSingleton();
- else
- return instance;
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/models/CreditCardObject.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/models/CreditCardObject.java
deleted file mode 100644
index b80295c..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/models/CreditCardObject.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package net.authorize.sampleapplication.models;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * Parcelable object that stores credit card information that was manually entered.
- */
-public class CreditCardObject implements Parcelable {
- private String cardNumber;
- private String securityCode;
- private String expMonth;
- private String expYear;
-
- public CreditCardObject(String cardNumber, String securityCode, String expMonth, String expYear) {
- this.cardNumber = cardNumber;
- this.securityCode = securityCode;
- this.expMonth = expMonth;
- this.expYear = expYear;
- }
-
- public CreditCardObject(Parcel pc){
- cardNumber = pc.readString();
- securityCode = pc.readString();
- expMonth = pc.readString();
- expYear = pc.readString();
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(cardNumber);
- dest.writeString(securityCode);
- dest.writeString(expMonth);
- dest.writeString(expYear);
- }
-
- public static final Parcelable.Creator CREATOR
- = new Parcelable.Creator() {
-
- @Override
- public CreditCardObject createFromParcel(Parcel in) {
- return new CreditCardObject(in);
- }
-
- @Override
- public CreditCardObject[] newArray(int size) {
- return new CreditCardObject[size];
- }
- };
-
- public String getExpYear() {
- return expYear;
- }
-
- public String getExpMonth() {
- return expMonth;
- }
-
- public String getCardNumber() {
- return cardNumber;
- }
-
- public String getSecurityCode() {
- return securityCode;
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/receivers/AnetResultReceiver.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/receivers/AnetResultReceiver.java
deleted file mode 100644
index 85297c9..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/receivers/AnetResultReceiver.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package net.authorize.sampleapplication.receivers;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.ResultReceiver;
-import android.util.Log;
-
-/**
- * Receives all results from the intent service
- */
-public class AnetResultReceiver extends ResultReceiver {
-
- public static final String RESULT_RECEIVER_TAG = "RESULT_RECEIVER_TAG";
-
- private ReceiverCallback receiverCallback;
-
- public interface ReceiverCallback {
- void onReceiveResult(int resultCode, Bundle resultData);
- }
-
- public AnetResultReceiver(Handler handler) {
- super(handler);
- }
-
- @Override
- protected void onReceiveResult(int resultCode, Bundle resultData) {
- if (receiverCallback != null) {
- receiverCallback.onReceiveResult(resultCode, resultData);
- }
- }
-
- public void setReceiverCallback(ReceiverCallback receiver) {
- receiverCallback = receiver;
- }
-
- public void clearReceiverCallback() {
- receiverCallback = null;
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/services/AnetIntentService.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/services/AnetIntentService.java
deleted file mode 100644
index b96a6b1..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/services/AnetIntentService.java
+++ /dev/null
@@ -1,509 +0,0 @@
-package net.authorize.sampleapplication.services;
-
-import android.app.IntentService;
-import android.content.Intent;
-import android.content.Context;
-import android.os.Bundle;
-import android.os.ResultReceiver;
-import android.telephony.TelephonyManager;
-
-import net.authorize.Environment;
-import net.authorize.Merchant;
-import net.authorize.aim.cardpresent.MarketType;
-import net.authorize.auth.PasswordAuthentication;
-import net.authorize.auth.SessionTokenAuthentication;
-import net.authorize.data.Address;
-import net.authorize.data.Customer;
-import net.authorize.data.Order;
-import net.authorize.data.OrderItem;
-import net.authorize.data.ShippingCharges;
-import net.authorize.data.creditcard.CreditCard;
-import net.authorize.data.creditcard.CreditCardPresenceType;
-import net.authorize.data.mobile.MobileDevice;
-import net.authorize.data.reporting.BatchDetails;
-import net.authorize.data.reporting.ReportingDetails;
-import net.authorize.data.reporting.TransactionDetails;
-import net.authorize.data.swiperdata.SwiperEncryptionAlgorithmType;
-import net.authorize.mobile.Transaction;
-import net.authorize.mobile.TransactionType;
-import net.authorize.mobile.Result;
-import net.authorize.sampleapplication.models.AnetSingleton;
-import net.authorize.sampleapplication.fragments.HistoryFragment;
-import net.authorize.sampleapplication.receivers.AnetResultReceiver;
-import net.authorize.sampleapplication.models.CreditCardObject;
-import net.authorize.sampleapplication.fragments.TransactionFragment;
-import net.authorize.sampleapplication.LoginActivity;
-
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-
-/**
- * Performs all API calls / transaction requests on a background thread asynchronously.
- */
-public class AnetIntentService extends IntentService {
-
- public static final String ACTION_TRANSACTION_TYPE_TAG = "TRANSACTION_TYPE_TAG";
- public static final String ACTION_AUTHENTICATE_USER = "net.authorize.sampleapplication.action.AUTHENTICATE_USER";
- public static final String ACTION_MAKE_TRANSACTION = "net.authorize.sampleapplication.action.MAKE_TRANSACTION";
- public static final String ACTION_PERFORM_SWIPE = "net.authorize.sampleapplication.action.PERFORM_SWIPE";
- public static final String ACTION_LOGOUT = "net.authorize.sampleapplication.action.LOGOUT";
- public static final String ACTION_GET_UNSETTLED_TRANSACTIONS = "net.authorize.sampleapplication.action.GET_UNSETTLED_TRANSACTIONS";
- public static final String ACTION_GET_SETTLED_TRANSACTIONS = "net.authorize.sampleapplication.action.GET_SETTLED_TRANSACTIONS";
- public static final String ACTION_REFUND = "net.authorize.sampleapplication.action.REFUND";
- public static final String ACTION_VOID = "net.authorize.sampleapplication.action.VOID";
- public static final String AUTHENTICATE_USER_STATUS = "AUTHENTICATE_USER_STATUS";
- public static final String TRANSACTION_STATUS = "TRANSACTION_STATUS";
- public static final String UNSETTLED_TRANSACTION_LIST_STATUS = "UNSETTLED_TRANSACTION_LIST_STATUS";
- public static final String SETTLED_TRANSACTION_LIST_STATUS = "SETTLED_TRANSACTION_LIST_STATUS";
- public static final String REFUND_STATUS = "REFUND_STATUS";
- public static final String VOID_STATUS = "VOID_STATUS";
- public static final String ERROR_STATUS = "ERROR_STATUS";
- public static final String LOGOUT_STATUS = "LOGOUT_STATUS";
- public static final String EXTRA_SETTLED_TRANSACTION_LIST = "SETTLED_TRANSACTION_LIST";
- public static final int AUTHENTICATE_USER_RESULT_CODE = 100;
- public static final int TRANSACTION_RESULT_CODE = 200;
- public static final int LOGOUT_RESULT_CODE = 300;
- public static final int UNSETTLED_TRANSACTIONS_CODE = 400;
- public static final int SETTLED_TRANSACTIONS_CODE = 500;
- public static final int REFUND_RESULT_CODE = 600;
- public static final int VOID_RESULT_CODE = 700;
- public static final int SESSION_EXPIRED_CODE = 800;
- public static final int EXCEPTION_ERROR_CODE = 900;
-
- // In order to refund a transaction, the expiration date of the card used to make the
- // transaction is required. This is not provided when the list of settled transactions
- // is obtained. Therefore, if you want to refund a transaction in the application
- // you have to set the expiration date manually.
- private static final String EXP_DATE_REQUIRED_FOR_REFUND = "2020-12";
-
- public AnetIntentService() {
- super("AnetIntentService");
- }
-
- @Override
- protected void onHandleIntent(Intent intent) {
- if (intent == null)
- return;
- final String action = intent.getAction();
- if (action == null)
- return;
- final ResultReceiver receiver = intent.getParcelableExtra(AnetResultReceiver.RESULT_RECEIVER_TAG);
- if (receiver == null)
- return;
- if (ACTION_AUTHENTICATE_USER.equals(action)) {
- authenticateUser(receiver, intent);
- } else if (AnetSingleton.merchant == null) { // session has expired
- receiver.send(SESSION_EXPIRED_CODE, null);
- } else switch (action) {
- case ACTION_MAKE_TRANSACTION:
- makeTransaction(receiver, intent);
- break;
- case ACTION_PERFORM_SWIPE:
- makeTransaction(receiver, intent);
- break;
- case ACTION_LOGOUT:
- logout(receiver);
- break;
- case ACTION_GET_UNSETTLED_TRANSACTIONS:
- getUnsettledTransactions(receiver);
- break;
- case ACTION_GET_SETTLED_TRANSACTIONS:
- getSettledTransactions(receiver);
- break;
- case ACTION_REFUND:
- refundTransaction(receiver, intent);
- break;
- case ACTION_VOID:
- voidTransaction(receiver, intent);
- break;
- }
- }
-
- /**
- * Validates a username and password and updates the user's session token.
- * @param receiver receiver that listens to the result of the transaction
- * @param intent intent with required extras for the authentication
- */
- private void authenticateUser(ResultReceiver receiver, Intent intent) {
- Bundle resultData = new Bundle();
- try {
- final String loginId = intent.getStringExtra(LoginActivity.LOGIN_ID_TAG);
- final String password = intent.getStringExtra(LoginActivity.PASSWORD_TAG);
- String deviceId = getDeviceId();
- String deviceDescription = "";
- String deviceTelephoneNumber = "";
- // Create a mobile device with a valid device ID
- MobileDevice mobileDevice = MobileDevice.createMobileDevice
- (deviceId, deviceDescription, deviceTelephoneNumber);
-
- // Create a merchant authentication a merchant with a valid device ID,
- // sandbox username and password
- PasswordAuthentication authentication = PasswordAuthentication.
- createMerchantAuthentication(loginId, password, deviceId);
-
- // Create a merchant specifying environment type and with the merchant authentication
- AnetSingleton.merchant = Merchant.createMerchant(Environment.SANDBOX, authentication);
- AnetSingleton.merchant.setDuplicateTxnWindowSeconds(30);
-
- // Create a mobile transaction and specify the type of transaction
- Transaction transaction = AnetSingleton.merchant.createMobileTransaction
- (TransactionType.MOBILE_DEVICE_LOGIN);
-
- // Set the mobile device created to the transaction and post the transaction
- transaction.setMobileDevice(mobileDevice);
- Result loginResult = (Result) AnetSingleton.merchant.postTransaction(transaction);
-
- if (loginResult.isOk())
- updateSessionToken(loginResult, deviceId);
- resultData.putSerializable(AUTHENTICATE_USER_STATUS, loginResult);
- receiver.send(AUTHENTICATE_USER_RESULT_CODE, resultData);
- } catch (Exception e) {
- resultData.putSerializable(ERROR_STATUS, e);
- receiver.send(EXCEPTION_ERROR_CODE, resultData);
- }
- }
-
-
- /**
- * Gets the device ID of the phone you are using. If your device is offline,
- * set the return string to your device ID. Make sure your device is enabled within
- * the sandbox account. (Go to settings -> mobile device management and enable your device).
- * @return device ID of the phone
- */
- private String getDeviceId() {
- TelephonyManager telephonyManager = (TelephonyManager)
- getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
- if (telephonyManager != null) {
- return telephonyManager.getDeviceId();
- }
- return ""; // for offline devices, set your device ID
- }
-
-
- /**
- * Creates a user's session token using the loginResult's session token and device ID,
- * and sets the merchant authentication in order for the user to perform transactions.
- * @param loginResult result from authenticating a user
- * @param deviceId ID of your current device
- */
- private void updateSessionToken(net.authorize.xml.Result loginResult, String deviceId) {
- AnetSingleton.merchant.setMerchantAuthentication(SessionTokenAuthentication.createMerchantAuthentication
- (AnetSingleton.merchant.getMerchantAuthentication().getName(), loginResult.getSessionToken(), deviceId));
- }
-
-
- /**
- * Performs a transaction using either manually inputted credit card information
- * or credit card information from a test encrypted blob
- * @param receiver receiver that listens to the result of the transaction
- * @param intent intent with required extras for the transaction
- */
- private void makeTransaction(ResultReceiver receiver, Intent intent) {
- Bundle resultData = new Bundle();
- try {
- // set the market type for the merchant
- AnetSingleton.merchant.setMarketType(MarketType.RETAIL);
- final CreditCardObject creditCardObject = intent.getParcelableExtra
- (TransactionFragment.CREDIT_CARD_TAG);
- final String zipcode = intent.getStringExtra(TransactionFragment.ZIPCODE_TAG);
- final String totalAmountString = intent.getStringExtra(TransactionFragment.AMOUNT_TAG);
- final BigDecimal totalAmount = new BigDecimal(totalAmountString);
-
- // Create credit card, order, shipping, and customer information for the transaction
- CreditCard creditCard = null;
- if (intent.getAction().equals(ACTION_PERFORM_SWIPE))
- creditCard = creditCardFromSwipe();
- else if (intent.getAction().equals(ACTION_MAKE_TRANSACTION))
- creditCard = createCreditCard(creditCardObject);
- Order testOrder = createOrder(totalAmount);
- ShippingCharges shippingCharges = createShippingCharges();
- Customer customer = createCustomer(zipcode);
-
- // Create an AIM transaction specifying the type of transaction and the amount
- net.authorize.aim.Transaction transaction = AnetSingleton.merchant.createAIMTransaction
- (net.authorize.TransactionType.AUTH_CAPTURE, testOrder.getTotalAmount());
-
- // Set the credit card, order, shipping, and customer information to the transaction
- // and post the transaction
- transaction.setCreditCard(creditCard);
- transaction.setShippingCharges(shippingCharges);
- transaction.setOrder(testOrder);
- transaction.setCustomer(customer);
- net.authorize.aim.Result transactionResult = (net.authorize.aim.Result)
- AnetSingleton.merchant.postTransaction(transaction);
- resultData.putSerializable(TRANSACTION_STATUS, transactionResult);
- receiver.send(TRANSACTION_RESULT_CODE, resultData);
- } catch (Exception e) {
- resultData.putSerializable(ERROR_STATUS, e);
- receiver.send(EXCEPTION_ERROR_CODE, resultData);
- }
- }
-
-
- /**
- * Creates and sets custom shipping charges for the transaction.
- * Send in and update any information needed to create the order.
- * @return shipping charges for the transaction
- */
- public ShippingCharges createShippingCharges() {
- ShippingCharges shippingCharges = ShippingCharges.createShippingCharges();
- shippingCharges.setTaxAmount(new BigDecimal(5.0));
- shippingCharges.setTaxItemName("Sales Tax");
- shippingCharges.setFreightAmount(new BigDecimal(6.0));
- shippingCharges.setFreightItemName("Shipping and Handling");
- return shippingCharges;
- }
-
-
- /**
- * Creates and sets credit card information for the transaction
- * @return credit card for the transaction
- */
- public CreditCard createCreditCard(CreditCardObject creditCardObject) {
- CreditCard creditCard = net.authorize.data.creditcard.CreditCard.createCreditCard();
- creditCard.setCreditCardNumber(creditCardObject.getCardNumber());
- creditCard.setCardCode(creditCardObject.getSecurityCode());
- creditCard.setExpirationMonth(creditCardObject.getExpMonth());
- creditCard.setExpirationYear(creditCardObject.getExpYear());
- creditCard.setAnetDuplicatemaskedCardNumber(creditCardObject.getCardNumber().substring(12, 16));
- return creditCard;
- }
-
- /**
- * Creates a custom order for the transaction. Send in and
- * update any information needed to create the order.
- * @return order for the transaction
- */
- public Order createOrder(BigDecimal totalAmount) {
- Order testOrder = Order.createOrder();
- testOrder.setTotalAmount(totalAmount);
- OrderItem testItem = OrderItem.createOrderItem();
- testItem.setItemId("testItemID");
- testItem.setItemName("testItemName");
- testItem.setItemDescription("testItemDescription");
- testItem.setItemQuantity(new BigDecimal(1));
- testItem.setItemTaxable(false);
- testOrder.addOrderItem(testItem);
- testOrder.setPurchaseOrderNumber("9999");
- return testOrder;
- }
-
-
- /**
- * Creates and sets a unique customer for the transaction. Send in
- * and update any information as needed to create the customer.
- * @return customer for the transaction
- */
- public Customer createCustomer(String zipcode) {
- Customer testCustomer = Customer.createCustomer();
- Address billingAddress = Address.createAddress();
- billingAddress.setZipPostalCode(zipcode);
- billingAddress.setFirstName("John");
- billingAddress.setLastName("Doe");
- billingAddress.setAddress("Main Street");
- billingAddress.setCity("Bellevue");
- billingAddress.setCountry("USA");
- billingAddress.setState("WA");
- testCustomer.setBillTo(billingAddress);
- return testCustomer;
- }
-
-
- /**
- * Sets data from an id tech encrypted blob to a credit card
- * @return creditCard received from test encrypted blob
- */
- private CreditCard creditCardFromSwipe() {
- String encryptedBlob = "02f700801f4725008383252a343736312a2a2a2a2a2a2a2a" +
- "303031305e56495341204143515549524552205445535420434152442032325" +
- "e313531322a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a3f2a3b34373631" +
- "2a2a2a2a2a2a2a2a303031303d313531322a2a2a2a2a2a2a2a2a2a2a2a2a3f2a" +
- "10966bcf447a17ad5c139c016b376c09bb4437cbc91d7cc2b3239a7eb76a7636" +
- "ca68ea1eabca7299503a46cac3d8176d2c0b9439d95d4d0b45c874599a5b8c7" +
- "abc04c1dcd47bb0476f4fe3d4caed018bf055d96c70314acec5773358decc8d50" +
- "e1d8e0999e7fc233a927555d6b5440165431323438303238313862994901000000" +
- "e0073d826003"; // encrypted data blob from card swipe
- String encryptionType = SwiperEncryptionAlgorithmType.TDES.getFieldName();
- CreditCard creditCard = CreditCard.createCreditCard();
- creditCard.setCardPresenseType(CreditCardPresenceType.CARD_PRESENT_ENCRYPTED);
- creditCard.getSwipperData().setEncryptedData(encryptedBlob);
- creditCard.getSwipperData().setDeviceInfo("4649443D4944544543482E556E694D61672E416E64726F69642E53646B7631"); // id tech hex device info
- creditCard.getSwipperData().setEncryptionAlgorithm(SwiperEncryptionAlgorithmType.getEnum(encryptionType));
- return creditCard;
- }
-
-
- /**
- * Gets unsettled transactions from sandbox account
- * @param receiver receiver that listens to the result of the transaction
- */
- private void getUnsettledTransactions(ResultReceiver receiver) {
- Bundle resultData = new Bundle();
- try {
- // Create reporting transaction and specify transaction type
- net.authorize.reporting.Transaction transaction = AnetSingleton.merchant.createReportingTransaction
- (net.authorize.reporting.TransactionType.GET_UNSETTLED_TRANSACTION_LIST);
-
- // Create and set reporting details
- transaction.setReportingDetails(ReportingDetails.createReportingDetails());
-
- // Post the transaction
- net.authorize.reporting.Result transactionResult = (net.authorize.reporting.Result)
- AnetSingleton.merchant.postTransaction(transaction);
- resultData.putSerializable(UNSETTLED_TRANSACTION_LIST_STATUS, transactionResult);
- receiver.send(UNSETTLED_TRANSACTIONS_CODE, resultData);
- } catch (Exception e) {
- resultData.putSerializable(ERROR_STATUS, e);
- receiver.send(EXCEPTION_ERROR_CODE, resultData);
- }
- }
-
-
- /**
- * Gets the list of settled transactions between a range set by reporting details.
- * Make sure transaction details API is enabled on your account
- * (Account -> Transaction Details API -> enable)
- * @param receiver receiver that listens to the result of the transaction
- */
- private void getSettledTransactions(ResultReceiver receiver) {
- Bundle resultData = new Bundle();
- try {
- // Create reporting transaction and specify transaction type (GET_SETTLED_BATCH_LIST)
- net.authorize.reporting.Transaction batchListTransaction =
- AnetSingleton.merchant.createReportingTransaction
- (net.authorize.reporting.TransactionType.GET_SETTLED_BATCH_LIST);
- // set reporting details (default or custom)
- batchListTransaction.setReportingDetails(getReportingDetails());
- // post transaction to get batch list
- net.authorize.reporting.Result batchListResult = (net.authorize.reporting.Result)
- AnetSingleton.merchant.postTransaction(batchListTransaction);
- // get batch details list
- ArrayList batchList = batchListResult.getReportingDetails().getBatchDetailsList();
- net.authorize.reporting.Result transactionListResult = null;
- ArrayList settledList = new ArrayList<>();
- // for every batch in batch details list, get transaction list
- for (int i = batchList.size() - 1; i >= 0; i--) { // in order to display most recent first
- // create a reporting transaction and specify transaction type as GET_TRANSACTION_LIST
- net.authorize.reporting.Transaction transactionListTransaction = AnetSingleton.merchant.
- createReportingTransaction(net.authorize.reporting.TransactionType.GET_TRANSACTION_LIST);
- // Create and set reporting details to transaction
- transactionListTransaction.setReportingDetails(ReportingDetails.createReportingDetails());
- // set Batch ID from batch transaction list to transaction
- transactionListTransaction.getReportingDetails().setBatchId(batchList.get(i).getBatchId());
- // post transaction
- transactionListResult = (net.authorize.reporting.Result)
- AnetSingleton.merchant.postTransaction(transactionListTransaction);
- settledList.addAll(transactionListResult.getReportingDetails().getTransactionDetailList());
- }
- resultData.putSerializable(SETTLED_TRANSACTION_LIST_STATUS, transactionListResult);
- resultData.putSerializable(EXTRA_SETTLED_TRANSACTION_LIST, settledList);
- receiver.send(SETTLED_TRANSACTIONS_CODE, resultData);
- } catch (Exception e) {
- resultData.putSerializable(ERROR_STATUS, e);
- receiver.send(EXCEPTION_ERROR_CODE, resultData);
- }
- }
-
-
- /**
- * Sets a range for obtaining the list of settled transactions.
- * @return custom reporting details for the transaction
- */
- private ReportingDetails getReportingDetails() {
- ReportingDetails reportingDetails = ReportingDetails.createReportingDetails();
- Date currentDate = Calendar.getInstance().getTime(); // get current date
-
- Calendar calendar = Calendar.getInstance();
- calendar.add(Calendar.DATE, -2); // 2 days before
- Date firstDate = calendar.getTime();
-
- // date format required by SDK
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
-
- // set reporting details to get batch between firstDate and currentDate
- reportingDetails.setBatchFirstSettlementDate(dateFormat.format(firstDate));
- reportingDetails.setBatchLastSettlementDate(dateFormat.format(currentDate));
- return reportingDetails;
- }
-
-
- /**
- * Refunds a transaction
- * @param receiver receiver that listens to the result of the transaction
- * @param intent intent with required extras for refunding a transaction
- */
- private void refundTransaction(ResultReceiver receiver, Intent intent) {
- Bundle resultData = new Bundle();
- try {
- String cardNumber = intent.getExtras().getString(HistoryFragment.TRANSACTION_CARD_NUMBER_TAG);
- String transactionId = intent.getExtras().getString(HistoryFragment.TRANSACTION_ID_TAG);
- String transactionAmountString = intent.getExtras().getString
- (HistoryFragment.TRANSACTION_AMOUNT_TAG);
- BigDecimal transactionAmount = new BigDecimal(transactionAmountString);
- net.authorize.aim.Transaction refundTransaction = AnetSingleton.merchant.createAIMTransaction
- (net.authorize.TransactionType.CREDIT, transactionAmount);
- refundTransaction.setRefTransId(transactionId);
- CreditCard creditCard = CreditCard.createCreditCard();
- if (cardNumber != null)
- creditCard.setMaskedCreditCardNumber(cardNumber);
- // bug in sdk (exp date required for refund/ not provided in transaction)
- creditCard.setExpirationDate(EXP_DATE_REQUIRED_FOR_REFUND);
- refundTransaction.setCreditCard(creditCard);
- net.authorize.aim.Result refundResult = (net.authorize.aim.Result)
- AnetSingleton.merchant.postTransaction(refundTransaction);
- resultData.putSerializable(REFUND_STATUS, refundResult);
- receiver.send(REFUND_RESULT_CODE, resultData);
- } catch (Exception e){
- resultData.putSerializable(ERROR_STATUS, e);
- receiver.send(EXCEPTION_ERROR_CODE, resultData);
- }
- }
-
-
- /**
- * Voids a transaction
- * @param receiver receiver that listens to the result of the transaction
- * @param intent intent with required extras for voiding a transaction
- */
- private void voidTransaction(ResultReceiver receiver, Intent intent) {
- Bundle resultData = new Bundle();
- try {
- String transactionId = intent.getExtras().getString(HistoryFragment.TRANSACTION_ID_TAG);
- String transactionAmountString = intent.getExtras().getString
- (HistoryFragment.TRANSACTION_AMOUNT_TAG);
- BigDecimal transactionAmount = new BigDecimal(transactionAmountString);
- net.authorize.aim.Transaction voidTransaction = AnetSingleton.merchant.createAIMTransaction
- (net.authorize.TransactionType.VOID, transactionAmount);
- voidTransaction.setRefTransId(transactionId);
- net.authorize.aim.Result voidResult = (net.authorize.aim.Result) AnetSingleton.merchant
- .postTransaction(voidTransaction);
- resultData.putSerializable(VOID_STATUS, voidResult);
- receiver.send(VOID_RESULT_CODE, resultData);
- } catch (Exception e) {
- resultData.putSerializable(ERROR_STATUS, e);
- receiver.send(EXCEPTION_ERROR_CODE, resultData);
- }
- }
-
-
- /**
- * Logs a user out
- * @param receiver receiver for listening to the result of the transaction
- */
- private void logout(ResultReceiver receiver) {
- Bundle resultData = new Bundle();
- try {
- net.authorize.mobile.Transaction logoutTransaction = AnetSingleton.merchant.createMobileTransaction
- (net.authorize.mobile.TransactionType.LOGOUT);
- Result result = (net.authorize.mobile.Result) AnetSingleton.merchant.postTransaction(logoutTransaction);
- resultData.putSerializable(LOGOUT_STATUS, result);
- receiver.send(LOGOUT_RESULT_CODE, resultData);
- } catch (Exception e) {
- resultData.putSerializable(ERROR_STATUS, e);
- receiver.send(EXCEPTION_ERROR_CODE, resultData);
- }
- }
-}
diff --git a/sampleapp/app/src/main/java/net/authorize/sampleapplication/views/FormattingTextWatcher.java b/sampleapp/app/src/main/java/net/authorize/sampleapplication/views/FormattingTextWatcher.java
deleted file mode 100644
index 7f4cd1f..0000000
--- a/sampleapp/app/src/main/java/net/authorize/sampleapplication/views/FormattingTextWatcher.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package net.authorize.sampleapplication.views;
-
-import android.text.Editable;
-import android.text.TextWatcher;
-
-import net.authorize.sampleapplication.R;
-import net.authorize.sampleapplication.fragments.TransactionFragment;
-import net.authorize.util.Luhn;
-
-/**
- * Displays custom hint messages, message colors, and icon colors based on the validity of
- * the text entered in the edit text
- */
-public class FormattingTextWatcher implements TextWatcher {
-
- private FieldType fieldType;
- private UpdateUICallBack updateUICallBack;
-
- public enum FieldType {CARD_NUMBER, CVV_NUMBER, EXP_DATE, ZIPCODE, TOTAL_AMOUNT};
-
- public interface UpdateUICallBack {
- void updateMessages(FieldType fieldType, int messageId, int messageColorId, int iconColorId);
- void updateText(FieldType fieldType, String text, FormattingTextWatcher textWatcher);
- }
-
- public void setFormattingTextWatcher(UpdateUICallBack updateUICallBack) {
- this.updateUICallBack = updateUICallBack;
- }
-
- public FormattingTextWatcher(FieldType fieldType) {
- this.fieldType = fieldType;
- }
-
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {}
- @Override
- public void afterTextChanged(Editable s) {
- String editText = s.toString();
- int messageId = 0;
- switch (fieldType) {
- case CARD_NUMBER:
- String cardNumberText = s.toString().replaceAll(" ", "");
- String formatted = formatCreditCard(cardNumberText);
- updateUICallBack.updateText(FieldType.CARD_NUMBER, formatted, this);
- if (editText.length() == TransactionFragment.CARD_NUMBER_FIELD_LENGTH)
- displayCardMessageValidation(s);
- else
- messageId = R.string.card_number_hint;
- break;
- case EXP_DATE:
- String expDateText = s.toString().replaceAll("/", "");
- String formattedExpDate = formatExpDate(expDateText);
- updateUICallBack.updateText(FieldType.EXP_DATE, formattedExpDate, this);
- if (s.length() == TransactionFragment.EXP_DATE_FIELD_LENGTH)
- displayExpDateValidation(s);
- else
- messageId = R.string.exp_date_hint;
- break;
- case CVV_NUMBER:
- messageId = R.string.cvv_hint;
- break;
- case ZIPCODE:
- messageId = R.string.zipcode_hint;
- break;
- case TOTAL_AMOUNT:
- roundAmount(s.toString());
- break;
- }
- if (s.length() != 0 && messageId != 0) {
- restoreField(fieldType, messageId);
- }
- }
-
- /**
- * Limits the user to only entering two digits after the decimal in the amount edit text
- * @param s current text inside the amount edit text
- */
- public void roundAmount(String s) {
- String amountString = s;
- if (amountString.contains(".") && amountString.length() > 1 &&
- amountString.charAt(amountString.length() - 1) != '.') {
- String digitsBeforeDecimal = amountString.split("\\.")[0];
- String digitsAfterDecimal = amountString.split("\\.")[1];
- if (digitsAfterDecimal.length() > 2) {
- digitsAfterDecimal = digitsAfterDecimal.substring(0, 2);
- if (digitsBeforeDecimal.length() == 0) {
- amountString = "." + digitsAfterDecimal;
- } else {
- amountString = digitsBeforeDecimal + "." + digitsAfterDecimal;
- }
- updateUICallBack.updateText(FieldType.TOTAL_AMOUNT, amountString, this);
- }
- }
- }
-
- /**
- * Displays a custom hint message with a custom color below the expiration date exit text
- * based off the validity of the expiration date
- * @param editText expiration date edit text
- */
- public void displayExpDateValidation(Editable editText) {
- String cardExpDateText = editText.toString().replace("/", "");
- String expMonth = cardExpDateText.substring(0, 2);
- String expYear = cardExpDateText.substring(2, 4);
- if (!TransactionFragment.isValidExpDate(expMonth, expYear)) {
- updateUICallBack.updateMessages(
- FieldType.EXP_DATE,
- R.string.invalid_expDate_message,
- R.color.ErrorMessageColor,
- R.color.ErrorMessageColor);
- } else {
- updateUICallBack.updateMessages(
- FieldType.EXP_DATE,
- R.string.exp_date_hint,
- R.color.HintColor,
- R.color.ThemeColor);
- }
- }
-
- /**
- * Displays a custom hint message with a custom color below the card number edit text
- * based off the validity of the card number
- * @param editText card number edit text
- */
- public void displayCardMessageValidation(Editable editText) {
- if (Luhn.isCardValid(editText.toString())) {
- updateUICallBack.updateMessages(
- FieldType.CARD_NUMBER,
- R.string.valid_card_message,
- R.color.Correct,
- R.color.ThemeColor);
- } else {
- updateUICallBack.updateMessages(
- FieldType.CARD_NUMBER,
- R.string.invalid_card_error_message,
- R.color.ErrorMessageColor,
- R.color.ErrorMessageColor);
- }
- }
-
- /**
- * Formats the input of the expiration date EditText after every character entered
- * @param expDateText the current expiration date text inside the expiration date EditText
- * @return formatted expiration date text (MM/YY) to be set inside the EditText
- */
- public String formatExpDate(String expDateText) {
- String formattedExpDate = "";
- for (int i = 0; i < expDateText.length(); i++) {
- formattedExpDate = formattedExpDate + expDateText.charAt(i);
- if ((i + 1) % 2 == 0 && i != expDateText.length() - 1) {
- formattedExpDate = formattedExpDate + "/";
- }
- }
- return formattedExpDate;
- }
-
- /**
- * Restores the original layout (hint messages and colors) of the field
- * @param fieldType the type of field (current EditText)
- * @param messageId the custom hint message to be displayed beneath the EditText
- */
- public void restoreField(FieldType fieldType, int messageId) {
- updateUICallBack.updateMessages(
- fieldType,
- messageId,
- R.color.HintColor,
- R.color.ThemeColor);
- }
-
- /**
- * Formats the input of the card number EditText after every character entered
- * @param cardNumberText the current card number text inside the card number EditText
- * @return formatted card number text to be set inside the EditText
- */
- public String formatCreditCard(String cardNumberText) {
- String formatted = "";
- for (int i = 0; i < cardNumberText.length(); i++) {
- formatted = formatted + cardNumberText.charAt(i);
- if ((i + 1) % 4 == 0 && i != cardNumberText.length() - 1) {
- formatted = formatted + " ";
- }
- }
- return formatted;
- }
-
-}
diff --git a/sampleapp/app/src/main/res/color/navigation_item.xml b/sampleapp/app/src/main/res/color/navigation_item.xml
deleted file mode 100644
index 5a1d50e..0000000
--- a/sampleapp/app/src/main/res/color/navigation_item.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_account_box_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_account_box_black_24dp.png
deleted file mode 100644
index 47db072..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_account_box_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_account_circle_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_account_circle_black_24dp.png
deleted file mode 100644
index ba5a509..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_account_circle_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_attach_money_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_attach_money_black_24dp.png
deleted file mode 100644
index ad0f76c..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_attach_money_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_desktop_mac_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_desktop_mac_black_24dp.png
deleted file mode 100644
index b5d41aa..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_desktop_mac_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_done_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_done_black_24dp.png
deleted file mode 100644
index d4c0607..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_done_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_error_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_error_black_24dp.png
deleted file mode 100644
index 5799a7d..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_error_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_event_note_black_18dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_event_note_black_18dp.png
deleted file mode 100644
index 93277e4..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_event_note_black_18dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_history_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_history_black_24dp.png
deleted file mode 100644
index b74e289..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_history_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_lock_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_lock_black_24dp.png
deleted file mode 100644
index de50295..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_lock_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_my_location_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_my_location_black_24dp.png
deleted file mode 100644
index 85e3872..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_my_location_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_payment_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_payment_black_24dp.png
deleted file mode 100644
index e2225e8..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_payment_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_person_outline_black_18dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_person_outline_black_18dp.png
deleted file mode 100644
index 96fcb38..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_person_outline_black_18dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_person_outline_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_person_outline_black_24dp.png
deleted file mode 100644
index 871f8be..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_person_outline_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_person_outline_black_48dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_person_outline_black_48dp.png
deleted file mode 100644
index d54de22..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_person_outline_black_48dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_place_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_place_black_24dp.png
deleted file mode 100644
index df1f340..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_place_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_search_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_search_black_24dp.png
deleted file mode 100644
index c593e7a..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_search_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_search_white_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_search_white_24dp.png
deleted file mode 100644
index bbfbc96..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_search_white_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_store_mall_directory_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_store_mall_directory_black_24dp.png
deleted file mode 100644
index a45c025..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_store_mall_directory_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-hdpi/ic_tablet_mac_black_24dp.png b/sampleapp/app/src/main/res/drawable-hdpi/ic_tablet_mac_black_24dp.png
deleted file mode 100644
index 263b0a7..0000000
Binary files a/sampleapp/app/src/main/res/drawable-hdpi/ic_tablet_mac_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_account_box_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_account_box_black_24dp.png
deleted file mode 100644
index 2a5617b..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_account_box_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_account_circle_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_account_circle_black_24dp.png
deleted file mode 100644
index 0c1202d..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_account_circle_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_attach_money_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_attach_money_black_24dp.png
deleted file mode 100644
index 2ae5e6d..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_attach_money_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_desktop_mac_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_desktop_mac_black_24dp.png
deleted file mode 100644
index c03f394..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_desktop_mac_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_done_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_done_black_24dp.png
deleted file mode 100644
index 5e5e7cf..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_done_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_error_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_error_black_24dp.png
deleted file mode 100644
index 221a25d..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_error_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_event_note_black_18dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_event_note_black_18dp.png
deleted file mode 100644
index 3a777f1..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_event_note_black_18dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_history_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_history_black_24dp.png
deleted file mode 100644
index e77a077..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_history_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_lock_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_lock_black_24dp.png
deleted file mode 100644
index 3a4a158..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_lock_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_my_location_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_my_location_black_24dp.png
deleted file mode 100644
index 5684aa7..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_my_location_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_payment_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_payment_black_24dp.png
deleted file mode 100644
index 09e63c2..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_payment_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_person_outline_black_18dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_person_outline_black_18dp.png
deleted file mode 100644
index 6dd594e..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_person_outline_black_18dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_person_outline_black_48dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_person_outline_black_48dp.png
deleted file mode 100644
index 7a95c11..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_person_outline_black_48dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_place_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_place_black_24dp.png
deleted file mode 100644
index 92a0738..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_place_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_search_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_search_black_24dp.png
deleted file mode 100644
index 6b16343..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_search_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_search_white_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_search_white_24dp.png
deleted file mode 100644
index faefc59..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_search_white_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_store_mall_directory_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_store_mall_directory_black_24dp.png
deleted file mode 100644
index f41052a..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_store_mall_directory_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-mdpi/ic_tablet_mac_black_24dp.png b/sampleapp/app/src/main/res/drawable-mdpi/ic_tablet_mac_black_24dp.png
deleted file mode 100644
index 8a323e4..0000000
Binary files a/sampleapp/app/src/main/res/drawable-mdpi/ic_tablet_mac_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_account_box_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_account_box_black_24dp.png
deleted file mode 100644
index c5cd86f..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_account_box_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_account_circle_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_account_circle_black_24dp.png
deleted file mode 100644
index f26b201..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_account_circle_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_attach_money_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_attach_money_black_24dp.png
deleted file mode 100644
index c94dc6a..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_attach_money_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_desktop_mac_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_desktop_mac_black_24dp.png
deleted file mode 100644
index 962dd00..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_desktop_mac_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_done_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_done_black_24dp.png
deleted file mode 100644
index 64a4944..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_done_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_error_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_error_black_24dp.png
deleted file mode 100644
index fb719fc..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_error_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_event_note_black_18dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_event_note_black_18dp.png
deleted file mode 100644
index 3d068f1..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_event_note_black_18dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_history_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_history_black_24dp.png
deleted file mode 100644
index 8e44d94..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_history_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_lock_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_lock_black_24dp.png
deleted file mode 100644
index 2a16694..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_lock_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_my_location_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_my_location_black_24dp.png
deleted file mode 100644
index 7faa345..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_my_location_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_payment_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_payment_black_24dp.png
deleted file mode 100644
index 33b1cb3..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_payment_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_person_outline_black_18dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_person_outline_black_18dp.png
deleted file mode 100644
index 871f8be..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_person_outline_black_18dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_person_outline_black_48dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_person_outline_black_48dp.png
deleted file mode 100644
index 46ce7ef..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_person_outline_black_48dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_place_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_place_black_24dp.png
deleted file mode 100644
index b2696b6..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_place_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_search_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_search_black_24dp.png
deleted file mode 100644
index 6381902..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_search_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_search_white_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_search_white_24dp.png
deleted file mode 100644
index bfc3e39..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_search_white_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_store_mall_directory_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_store_mall_directory_black_24dp.png
deleted file mode 100644
index 392ac52..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_store_mall_directory_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xhdpi/ic_tablet_mac_black_24dp.png b/sampleapp/app/src/main/res/drawable-xhdpi/ic_tablet_mac_black_24dp.png
deleted file mode 100644
index fdfd93b..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xhdpi/ic_tablet_mac_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_account_box_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_account_box_black_24dp.png
deleted file mode 100644
index 114d176..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_account_box_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_account_circle_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_account_circle_black_24dp.png
deleted file mode 100644
index 3cc0a63..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_account_circle_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_attach_money_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_attach_money_black_24dp.png
deleted file mode 100644
index a9478a6..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_attach_money_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_desktop_mac_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_desktop_mac_black_24dp.png
deleted file mode 100644
index 7f59f89..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_desktop_mac_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_done_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_done_black_24dp.png
deleted file mode 100644
index c9c0174..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_done_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_error_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_error_black_24dp.png
deleted file mode 100644
index 9329ca2..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_error_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_event_note_black_18dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_event_note_black_18dp.png
deleted file mode 100644
index 17a70f9..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_event_note_black_18dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_lock_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_lock_black_24dp.png
deleted file mode 100644
index a7caa2d..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_lock_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_my_location_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_my_location_black_24dp.png
deleted file mode 100644
index d3a1ab0..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_my_location_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_payment_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_payment_black_24dp.png
deleted file mode 100644
index 8b0836b..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_payment_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_person_outline_black_18dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_person_outline_black_18dp.png
deleted file mode 100644
index 474dee9..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_person_outline_black_18dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_person_outline_black_48dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_person_outline_black_48dp.png
deleted file mode 100644
index 6b9ac06..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_person_outline_black_48dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_place_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_place_black_24dp.png
deleted file mode 100644
index 5a21dfa..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_place_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_search_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_search_black_24dp.png
deleted file mode 100644
index 3ae490e..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_search_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_search_white_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_search_white_24dp.png
deleted file mode 100644
index abbb989..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_search_white_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_store_mall_directory_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_store_mall_directory_black_24dp.png
deleted file mode 100644
index b0b71df..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_store_mall_directory_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_tablet_mac_black_24dp.png b/sampleapp/app/src/main/res/drawable-xxhdpi/ic_tablet_mac_black_24dp.png
deleted file mode 100644
index 70859ba..0000000
Binary files a/sampleapp/app/src/main/res/drawable-xxhdpi/ic_tablet_mac_black_24dp.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable/authorize_background.png b/sampleapp/app/src/main/res/drawable/authorize_background.png
deleted file mode 100644
index 242b85a..0000000
Binary files a/sampleapp/app/src/main/res/drawable/authorize_background.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable/authorize_net_logo.png b/sampleapp/app/src/main/res/drawable/authorize_net_logo.png
deleted file mode 100644
index acdd22a..0000000
Binary files a/sampleapp/app/src/main/res/drawable/authorize_net_logo.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable/drawer_header.png b/sampleapp/app/src/main/res/drawable/drawer_header.png
deleted file mode 100644
index 3a204ea..0000000
Binary files a/sampleapp/app/src/main/res/drawable/drawer_header.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable/history_item_refund_background.xml b/sampleapp/app/src/main/res/drawable/history_item_refund_background.xml
deleted file mode 100644
index a6a7584..0000000
--- a/sampleapp/app/src/main/res/drawable/history_item_refund_background.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sampleapp/app/src/main/res/drawable/key.png b/sampleapp/app/src/main/res/drawable/key.png
deleted file mode 100644
index 88cabc3..0000000
Binary files a/sampleapp/app/src/main/res/drawable/key.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/drawable/listview.png b/sampleapp/app/src/main/res/drawable/listview.png
deleted file mode 100644
index a4f3870..0000000
Binary files a/sampleapp/app/src/main/res/drawable/listview.png and /dev/null differ
diff --git a/sampleapp/app/src/main/res/layout/activity_login.xml b/sampleapp/app/src/main/res/layout/activity_login.xml
deleted file mode 100644
index 8da0e3e..0000000
--- a/sampleapp/app/src/main/res/layout/activity_login.xml
+++ /dev/null
@@ -1,155 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sampleapp/app/src/main/res/layout/activity_main.xml b/sampleapp/app/src/main/res/layout/activity_main.xml
new file mode 100755
index 0000000..b613fb4
--- /dev/null
+++ b/sampleapp/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/sampleapp/app/src/main/res/layout/activity_navigation.xml b/sampleapp/app/src/main/res/layout/activity_navigation.xml
deleted file mode 100644
index a8418f8..0000000
--- a/sampleapp/app/src/main/res/layout/activity_navigation.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sampleapp/app/src/main/res/layout/activity_transaction_result.xml b/sampleapp/app/src/main/res/layout/activity_transaction_result.xml
deleted file mode 100644
index 1034e34..0000000
--- a/sampleapp/app/src/main/res/layout/activity_transaction_result.xml
+++ /dev/null
@@ -1,225 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sampleapp/app/src/main/res/layout/drawer_header.xml b/sampleapp/app/src/main/res/layout/drawer_header.xml
deleted file mode 100644
index 1e48b07..0000000
--- a/sampleapp/app/src/main/res/layout/drawer_header.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/sampleapp/app/src/main/res/layout/emvresult.xml b/sampleapp/app/src/main/res/layout/emvresult.xml
new file mode 100755
index 0000000..c3e69d5
--- /dev/null
+++ b/sampleapp/app/src/main/res/layout/emvresult.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sampleapp/app/src/main/res/layout/fragment_history.xml b/sampleapp/app/src/main/res/layout/fragment_history.xml
deleted file mode 100644
index eff7bcc..0000000
--- a/sampleapp/app/src/main/res/layout/fragment_history.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sampleapp/app/src/main/res/layout/fragment_make_transaction.xml b/sampleapp/app/src/main/res/layout/fragment_make_transaction.xml
deleted file mode 100644
index e1918fe..0000000
--- a/sampleapp/app/src/main/res/layout/fragment_make_transaction.xml
+++ /dev/null
@@ -1,239 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sampleapp/app/src/main/res/layout/history_spinner_item.xml b/sampleapp/app/src/main/res/layout/history_spinner_item.xml
deleted file mode 100644
index 9fb6995..0000000
--- a/sampleapp/app/src/main/res/layout/history_spinner_item.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
diff --git a/sampleapp/app/src/main/res/layout/history_spinner_item_dropdown.xml b/sampleapp/app/src/main/res/layout/history_spinner_item_dropdown.xml
deleted file mode 100644
index 0c1284c..0000000
--- a/sampleapp/app/src/main/res/layout/history_spinner_item_dropdown.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
\ No newline at end of file
diff --git a/sampleapp/app/src/main/res/layout/login.xml b/sampleapp/app/src/main/res/layout/login.xml
new file mode 100755
index 0000000..25a7e9a
--- /dev/null
+++ b/sampleapp/app/src/main/res/layout/login.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sampleapp/app/src/main/res/layout/receipt.xml b/sampleapp/app/src/main/res/layout/receipt.xml
new file mode 100755
index 0000000..2a8eabf
--- /dev/null
+++ b/sampleapp/app/src/main/res/layout/receipt.xml
@@ -0,0 +1,255 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sampleapp/app/src/main/res/layout/transaction_history_item.xml b/sampleapp/app/src/main/res/layout/transaction_history_item.xml
deleted file mode 100644
index 5f16191..0000000
--- a/sampleapp/app/src/main/res/layout/transaction_history_item.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sampleapp/app/src/main/res/menu/drawer.xml b/sampleapp/app/src/main/res/menu/drawer.xml
deleted file mode 100644
index d2d67cf..0000000
--- a/sampleapp/app/src/main/res/menu/drawer.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
\ No newline at end of file
diff --git a/sampleapp/app/src/main/res/menu/menu_anet_base.xml b/sampleapp/app/src/main/res/menu/menu_anet_base.xml
deleted file mode 100644
index e9fbd74..0000000
--- a/sampleapp/app/src/main/res/menu/menu_anet_base.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/sampleapp/app/src/main/res/menu/menu_login.xml b/sampleapp/app/src/main/res/menu/menu_main.xml
old mode 100644
new mode 100755
similarity index 71%
rename from sampleapp/app/src/main/res/menu/menu_login.xml
rename to sampleapp/app/src/main/res/menu/menu_main.xml
index be6015c..b1cb908
--- a/sampleapp/app/src/main/res/menu/menu_login.xml
+++ b/sampleapp/app/src/main/res/menu/menu_main.xml
@@ -1,6 +1,6 @@
diff --git a/sampleapp/app/src/main/res/menu/menu_make_transaction.xml b/sampleapp/app/src/main/res/menu/menu_make_transaction.xml
deleted file mode 100644
index ba65b37..0000000
--- a/sampleapp/app/src/main/res/menu/menu_make_transaction.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/sampleapp/app/src/main/res/menu/menu_navigation.xml b/sampleapp/app/src/main/res/menu/menu_navigation.xml
deleted file mode 100644
index 8cf3aad..0000000
--- a/sampleapp/app/src/main/res/menu/menu_navigation.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
diff --git a/sampleapp/app/src/main/res/menu/menu_transaction_result.xml b/sampleapp/app/src/main/res/menu/menu_transaction_result.xml
deleted file mode 100644
index 22856a1..0000000
--- a/sampleapp/app/src/main/res/menu/menu_transaction_result.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/sampleapp/app/src/main/res/mipmap-hdpi/ic_launcher.png b/sampleapp/app/src/main/res/mipmap-hdpi/ic_launcher.png
old mode 100644
new mode 100755
diff --git a/sampleapp/app/src/main/res/mipmap-mdpi/ic_launcher.png b/sampleapp/app/src/main/res/mipmap-mdpi/ic_launcher.png
old mode 100644
new mode 100755
diff --git a/sampleapp/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/sampleapp/app/src/main/res/mipmap-xhdpi/ic_launcher.png
old mode 100644
new mode 100755
diff --git a/sampleapp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sampleapp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
old mode 100644
new mode 100755
diff --git a/sampleapp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sampleapp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100755
index 0000000..aee44e1
Binary files /dev/null and b/sampleapp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/sampleapp/app/src/main/res/values-w820dp/dimens.xml b/sampleapp/app/src/main/res/values-w820dp/dimens.xml
old mode 100644
new mode 100755
diff --git a/sampleapp/app/src/main/res/values/colors.xml b/sampleapp/app/src/main/res/values/colors.xml
old mode 100644
new mode 100755
index 16b352e..3ab3e9c
--- a/sampleapp/app/src/main/res/values/colors.xml
+++ b/sampleapp/app/src/main/res/values/colors.xml
@@ -1,164 +1,6 @@
-
- #ff4f90bc
- #ff2f5571
- #fffdad37
- #fffa0a76
- #00000000
- #FFDD2C00
- @color/hint_foreground_material_light
- @color/LightGrey
- @color/MediumSeaGreen
- #ffe7e7e7
- #ffb4b4b4
-
-
- #6be7fe
- #d1b6f1
- #8a140e
- #33b5e5
-
-
- #FFFFFF
- #FFFFF0
- #FFFFE0
- #FFFF00
- #FFFAFA
- #FFFAF0
- #FFFACD
- #FFF8DC
- #FFF5EE
- #FFF0F5
- #FFEFD5
- #FFEBCD
- #FFE4E1
- #FFE4C4
- #FFE4B5
- #FFDEAD
- #FFDAB9
- #FFD700
- #FFC0CB
- #FFB6C1
- #FFA500
- #FFA07A
- #FF8C00
- #FF7F50
- #FF69B4
- #FF6347
- #FF4500
- #FF1493
- #FF00FF
- #FF00FF
- #FF0000
- #FDF5E6
- #FAFAD2
- #FAF0E6
- #FAEBD7
- #FA8072
- #F8F8FF
- #F5FFFA
- #F5F5F5
- #F5F5DC
- #F5DEB3
- #F4A460
- #F0FFFF
- #F0FFF0
- #F0F8FF
- #F0E68C
- #F08080
- #EEE8AA
- #EE82EE
- #E9967A
- #E6E6FA
- #E0FFFF
- #DEB887
- #DDA0DD
- #DCDCDC
- #DC143C
- #DB7093
- #DAA520
- #DA70D6
- #D8BFD8
- #D3D3D3
- #D2B48C
- #D2691E
- #CD853F
- #CD5C5C
- #C71585
- #C0C0C0
- #BDB76B
- #BC8F8F
- #BA55D3
- #B8860B
- #B22222
- #B0E0E6
- #B0C4DE
- #AFEEEE
- #ADFF2F
- #ADD8E6
- #A9A9A9
- #A52A2A
- #A0522D
- #9ACD32
- #9932CC
- #98FB98
- #9400D3
- #9370DB
- #90EE90
- #8FBC8F
- #8B4513
- #8B008B
- #8B0000
- #8A2BE2
- #87CEFA
- #87CEEB
- #808080
- #808000
- #800080
- #800000
- #7FFFD4
- #7FFF00
- #7CFC00
- #7B68EE
- #778899
- #708090
- #6B8E23
- #6A5ACD
- #696969
- #66CDAA
- #6495ED
- #5F9EA0
- #556B2F
- #4B0082
- #48D1CC
- #483D8B
- #4682B4
- #4169E1
- #40E0D0
- #3CB371
- #32CD32
- #2F4F4F
- #2E8B57
- #228B22
- #20B2AA
- #1E90FF
- #191970
- #00FFFF
- #00FFFF
- #00FF7F
- #00FF00
- #00FA9A
- #00CED1
- #00BFFF
- #008B8B
- #008080
- #008000
- #006400
- #0000FF
- #0000CD
- #00008B
- #000080
- #000000
-
-
\ No newline at end of file
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/sampleapp/app/src/main/res/values/dimens.xml b/sampleapp/app/src/main/res/values/dimens.xml
old mode 100644
new mode 100755
index df27903..47c8224
--- a/sampleapp/app/src/main/res/values/dimens.xml
+++ b/sampleapp/app/src/main/res/values/dimens.xml
@@ -1,14 +1,5 @@
- 10dp
- 10dp
- 8dp
- 17sp
- 17sp
- 20sp
- 7dp
- 5dp
- 5dp
- 10dp
- 15dp
+ 16dp
+ 16dp
diff --git a/sampleapp/app/src/main/res/values/strings.xml b/sampleapp/app/src/main/res/values/strings.xml
old mode 100644
new mode 100755
index 7ad94e4..62dade8
--- a/sampleapp/app/src/main/res/values/strings.xml
+++ b/sampleapp/app/src/main/res/values/strings.xml
@@ -1,119 +1,18 @@
- Authorize.Net
- Accept Payments. Anywhere
+ EMVTest
-
- MakeTransactionActivity
- TransactionResultActivity
- BaseActivity
- NavigationActivity
- AnetBase
-
-
- Logout
+ Hello world!Settings
-
-
-
- Username
- Password
-
- Login
-
-
- Transaction
- History
- Open
- Close
-
-
-
- 16-digit number
- 3-digit number
- MM/YY
- 5-digit number
-
- This field is required.
- Enter a 16-digit number.
- Invalid card number.
- Valid card number.
- Enter a 3-digit number.
- MM/YY
- Enter a 6-digit number.
- Expired Card.
-
- Confirm and Pay
- Swipe Card
-
- Card Number
- Security Code
- Expiration Date
- Zipcode
- Total Amount
-
-
- Transaction ID:
- Amount
- Date
- Recycler View Line
- REFUND
- VOID
- Voided
- Refunded
-
-
- Transaction successfully refunded
- Transaction successfully voided
- Unable to void transaction
- Unable to refund transaction
- Transaction was successful
- No network connection
- Unable to load transactions
- REFRESH
- RETRY
-
-
- Login Error
- The username or password you have entered is incorrect. Please check your entries and try again.
- Refund Unsuccessful
- Void Unsuccessful
- Transaction Unsuccessful
- Error
- Unknown Error
- Please check your unsettled transactions.
- One or more of the fields you have entered is incorrect. Please check your entries and try again.
- The amount field is empty. Please enter a valid amount for the transaction.
- An unknown error has occurred.
- Please wait . . .
- Processing Transaction . . .
- Processing Swipe . . .
- Session Expired
- Your session has expired. Please login again.
- Login
- Close
-
-
- Transaction ID
- TOTAL
- ORDER SUMMARY
- Date
- Payment History
- New Transaction
- Card Number
- Card Type
- Payment Information
- Enter Information Manually
- No Transactions to Display
-
-
- Login Icon
- Password Icon
- Mobile Device Icon
- Desktop Icon
- Store Icon
- Credit Card Icon
- Calendar Icon
- Location Icon
- Total Amount Icon
- Navigation Drawer Header Image
+
+ $1
+ $2
+ $3
+ $4
+ $5
+ $6
+ $7
+ $8
+ $9
+ $10
+
diff --git a/sampleapp/app/src/main/res/values/styles.xml b/sampleapp/app/src/main/res/values/styles.xml
old mode 100644
new mode 100755
index 8a6d561..766ab99
--- a/sampleapp/app/src/main/res/values/styles.xml
+++ b/sampleapp/app/src/main/res/values/styles.xml
@@ -1,105 +1,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sampleapp/app/src/test/java/authorize/net/inperson_sdk_android/ExampleUnitTest.java b/sampleapp/app/src/test/java/authorize/net/inperson_sdk_android/ExampleUnitTest.java
new file mode 100755
index 0000000..21e7188
--- /dev/null
+++ b/sampleapp/app/src/test/java/authorize/net/inperson_sdk_android/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package authorize.net.inperson_sdk_android;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/sampleapp/build.gradle b/sampleapp/build.gradle
old mode 100644
new mode 100755
index 9405f3f..c20bca1
--- a/sampleapp/build.gradle
+++ b/sampleapp/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.2.3'
+ classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -17,3 +17,7 @@ allprojects {
jcenter()
}
}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/sampleapp/emv-anet-sdk/build.gradle b/sampleapp/emv-anet-sdk/build.gradle
new file mode 100755
index 0000000..09160aa
--- /dev/null
+++ b/sampleapp/emv-anet-sdk/build.gradle
@@ -0,0 +1,2 @@
+configurations.maybeCreate("default")
+artifacts.add("default", file('emv-anet-sdk.aar'))
\ No newline at end of file
diff --git a/sampleapp/emv-anet-sdk/emv-anet-sdk.aar b/sampleapp/emv-anet-sdk/emv-anet-sdk.aar
new file mode 100755
index 0000000..b91d3e2
Binary files /dev/null and b/sampleapp/emv-anet-sdk/emv-anet-sdk.aar differ
diff --git a/sampleapp/gradle.properties b/sampleapp/gradle.properties
old mode 100644
new mode 100755
index 1d3591c..aac7c9b
--- a/sampleapp/gradle.properties
+++ b/sampleapp/gradle.properties
@@ -9,10 +9,9 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
\ No newline at end of file
+# org.gradle.parallel=true
diff --git a/sampleapp/gradle/wrapper/gradle-wrapper.jar b/sampleapp/gradle/wrapper/gradle-wrapper.jar
old mode 100644
new mode 100755
index 8c0fb64..13372ae
Binary files a/sampleapp/gradle/wrapper/gradle-wrapper.jar and b/sampleapp/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/sampleapp/gradle/wrapper/gradle-wrapper.properties b/sampleapp/gradle/wrapper/gradle-wrapper.properties
old mode 100644
new mode 100755
index 0c71e76..04e285f
--- a/sampleapp/gradle/wrapper/gradle-wrapper.properties
+++ b/sampleapp/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
diff --git a/sampleapp/gradlew b/sampleapp/gradlew
old mode 100644
new mode 100755
index 91a7e26..9d82f78
--- a/sampleapp/gradlew
+++ b/sampleapp/gradlew
@@ -42,11 +42,6 @@ case "`uname`" in
;;
esac
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
+cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
+cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -114,6 +109,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
diff --git a/sampleapp/gradlew.bat b/sampleapp/gradlew.bat
old mode 100644
new mode 100755
diff --git a/sampleapp/settings.gradle b/sampleapp/settings.gradle
old mode 100644
new mode 100755
index e7b4def..b711fef
--- a/sampleapp/settings.gradle
+++ b/sampleapp/settings.gradle
@@ -1 +1 @@
-include ':app'
+include ':app', ':emv-anet-sdk'
diff --git a/src/net/authorize/AuthNetField.java b/src/net/authorize/AuthNetField.java
deleted file mode 100644
index 1733664..0000000
--- a/src/net/authorize/AuthNetField.java
+++ /dev/null
@@ -1,362 +0,0 @@
-package net.authorize;
-
-
-/**
- * Enumeration to handle all the x_ field names and xml element names
- */
-public enum AuthNetField {
- ELEMENT__ACCOUNT_NUMBER("AccountNumber"),
- ELEMENT__ACCOUNT_TYPE("AccountType"),
- ELEMENT__AUTH_CODE("AuthCode"),
- ELEMENT__AVS_RESPONSE("AVSResponse"),
- ELEMENT__AVS_RESULT_CODE("AVSResultCode"),
- ELEMENT__CAVV_RESPONSE("CAVVResponse"),
- ELEMENT__CODE("Code"),
- ELEMENT__CVV_RESULT_CODE("CVVResultCode"),
- ELEMENT__DESCRIPTION("Description"),
- ELEMENT__ERROR("Error"),
- ELEMENT__ERROR_CODE("ErrorCode"),
- ELEMENT__ERROR_TEXT("ErrorText"),
- ELEMENT__FDS_FILTER("FDSFilter"),
- ELEMENT__FDS_FILTER_ACTION("FDSFilterAction"),
- ELEMENT__FDS_FILTERS("FDSFilters"),
- ELEMENT__MESSAGE("Message"),
- ELEMENT__REF_TRANS_ID("RefTransID"),
- ELEMENT__RESPONSE_CODE("ResponseCode"),
- ELEMENT__TEST_MODE("TestMode"),
- ELEMENT__TRANS_HASH("TransHash"),
- ELEMENT__TRANS_ID("TransID"),
- ELEMENT__USER_REF("UserRef"),
- ELEMENT_ACCOUNT_NUMBER("accountNumber"),
- ELEMENT_ACCOUNT_TYPE("accountType"),
- ELEMENT_ACTION("action"),
- ELEMENT_ADDRESS("address"),
- ELEMENT_AMOUNT("amount"),
- ELEMENT_APPROVAL_CODE("approvalCode"),
- ELEMENT_APPROVED_AMOUNT("approvedAmount"),
- ELEMENT_AUTH_AMOUNT("authAmount"),
- ELEMENT_AUTH_CODE("authCode"),
- ELEMENT_AVS_RESULT_CODE("avsResultCode"),
- ELEMENT_BALANCE_ON_CARD("balanceOnCard"),
- ELEMENT_BANK_ACCOUNT("bankAccount"),
- ELEMENT_BANK_ACCOUNT_NUMBER_MASKED("bankAccountNumberMasked"),
- ELEMENT_BANK_NAME("bankName"),
- ELEMENT_BANK_ROUTING_NUMBER_MASKED("bankRoutingNumberMasked"),
- ELEMENT_BATCH("batch"),
- ELEMENT_BATCH_ID("batchId"),
- ELEMENT_BATCH_LIST("batchList"),
- ELEMENT_BILL_TO("billTo"),
- ELEMENT_CARD_CODE("cardCode"),
- ELEMENT_CARD_CODE_RESPONSE("cardCodeResponse"),
- ELEMENT_CARD_NUMBER("cardNumber"),
- ELEMENT_CAVV_RESULT_CODE("cavvResultCode"),
- ELEMENT_CHARGE_AMOUNT("chargeAmount"),
- ELEMENT_CHARGE_CHARGEBACK_AMOUNT("chargeChargeBackAmount"),
- ELEMENT_CHARGE_CHARGEBACK_COUNT("chargeChargeBackCount"),
- ELEMENT_CHARGE_COUNT("chargeCount"),
- ELEMENT_CHARGE_RETURNED_ITEMS_AMOUNT("chargeReturnedItemsAmount"),
- ELEMENT_CHARGE_RETURNED_ITEMS_COUNT("chargeReturnedItemsCount"),
- ELEMENT_CHARGEBACK_AMOUNT("chargebackAmount"),
- ELEMENT_CHARGEBACK_COUNT("chargebackCount"),
- ELEMENT_CITY("city"),
- ELEMENT_CODE("code"),
- ELEMENT_COMPANY("company"),
- ELEMENT_CORRECTION_NOTICE_COUNT("correctionNoticeCount"),
- ELEMENT_COUNTRY("country"),
- ELEMENT_CREATE_TRANSACTION_REQUEST("createTransactionRequest"),
- ELEMENT_CREDIT_CARD("creditCard"),
- ELEMENT_CREDIT_CARD_EXPIRY("expirationDate"),
- ELEMENT_CREDIT_CARD_NUMBER("cardNumber"),
- ELEMENT_CREDIT_CARD_NUMBER_MASKED("creditCardNumberMasked"),
- ELEMENT_CUSTOMER("customer"),
- ELEMENT_CUSTOMER_ADDRESS_ID("customerAddressId"),
- ELEMENT_CUSTOMER_EMAIL("customerEmail"),
- ELEMENT_CUSTOMER_IP("customerIP"),
- ELEMENT_CUSTOMER_PAYMENT_PROFILE_ID("customerPaymentProfileId"),
- ELEMENT_CUSTOMER_PAYMENT_PROFILE_ID_LIST("customerPaymentProfileIdList"),
- ELEMENT_CUSTOMER_PROFILE_ID("customerProfileId"),
- ELEMENT_CUSTOMER_SHIPPING_ADDRESS_ID("customerShippingAddressId"),
- ELEMENT_CUSTOMER_SHIPPING_ADDRESS_ID_LIST("customerShippingAddressIdList"),
- ELEMENT_CUSTOMER_TYPE("customerType"),
- ELEMENT_CVV_RESULT_CODE("cvvResultCode"),
- ELEMENT_DATA_CAPITAL("Data"),
- ELEMENT_PIN_CAPITAL("PIN"),
- ELEMENT_DECLINE_COUNT("declineCount"),
- ELEMENT_DESCRIPTION("description"),
- ELEMENT_DESCRIPTION_CAPITAL("Description"),
- ELEMENT_DEVICE_INFO("DeviceInfo"),
- ELEMENT_DEVICE_TYPE("deviceType"),
- ELEMENT_DIRECT_RESPONSE("directResponse"),
- ELEMENT_DRIVER_LICENSE("driversLicense"),
- ELEMENT_DUKPT("DUKPT"),
- ELEMENT_DUTY("duty"),
- ELEMENT_ECHECK_TYPE("echeckType"),
- ELEMENT_EMAIL("email"),
- ELEMENT_ENCODING("Encoding"),
- ELEMENT_ENCRYPTION_ALGORITHM("EncryptionAlgorithm"),
- ELEMENT_ERROR("error"),
- ELEMENT_ENCRYPTED_TRACK_DATA("encryptedTrackData"),
- ELEMENT_ERROR_CODE("errorCode"),
- ELEMENT_ERROR_COUNT("errorCount"),
- ELEMENT_ERROR_TEXT("errorText"),
- ELEMENT_ERRORS("errors"),
- ELEMENT_EXPIRATION_DATE("expirationDate"),
- ELEMENT_EXTRA_OPTIONS("extraOptions"),
- ELEMENT_FAX_NUMBER("faxNumber"),
- ELEMENT_FIRST_NAME("firstName"),
- ELEMENT_FIRST_SETTLEMENT_DATE("firstSettlementDate"),
- ELEMENT_FOOTER_EMAIL_RECEIPT("footerEmailReceipt"),
- ELEMENT_FORM_OF_PAYMENT("FormOfPayment"),
- ELEMENT_HEADER_EMAIL_RECEIPT("headerEmailReceipt"),
- ELEMENT_ID("id"),
- ELEMENT_IDS("ids"),
- ELEMENT_INCLUDE_STATISTICS("includeStatistics"),
- ELEMENT_INTERVAL("interval"),
- ELEMENT_INVOICE_NUMBER("invoiceNumber"),
- ELEMENT_ITEM_ID("itemId"),
- ELEMENT_LAST_NAME("lastName"),
- ELEMENT_LAST_SETTLEMENT_DATE("lastSettlementDate"),
- ELEMENT_LENGTH("length"),
- ELEMENT_LINE_ITEM("lineItem"),
- ELEMENT_LINE_ITEMS("lineItems"),
- ELEMENT_MARKET_TYPE("marketType"),
- ELEMENT_MERCHANT_ADDRESS("merchantAddress"),
- ELEMENT_MERCHANT_AUTHENTICATION("merchantAuthentication"),
- ELEMENT_MERCHANT_CITY("merchantCity"),
- ELEMENT_MERCHANT_CONTACT("merchantContact"),
- ELEMENT_MERCHANT_CUSTOMER_ID("merchantCustomerId"),
- ELEMENT_MERCHANT_EMAIL("merchantEmail"),
- ELEMENT_MERCHANT_NAME("merchantName"),
- ELEMENT_MERCHANT_PHONE("merchantPhone"),
- ELEMENT_MERCHANT_STATE("merchantState"),
- ELEMENT_MERCHANT_ZIP("merchantZip"),
- ELEMENT_MERCHANT_ACCOUNT("merchantAccount"),
- ELEMENT_MESSAGE("message"),
- ELEMENT_MESSAGES("messages"),
- ELEMENT_MOBILE_DEVICE("mobileDevice"),
- ELEMENT_MOBILE_DEVICE_ID("mobileDeviceId"),
- ELEMENT_MODE("Mode"),
- ELEMENT_NAME("name"),
- ELEMENT_NAME_ALLOW_PARTIAL_AUTH("allowPartialAuth"),
- ELEMENT_NAME_DUPLICATE_WINDOW("duplicateWindow"),
- ELEMENT_NAME_EMAIL_CUSTOMER("emailCustomer"),
- ELEMENT_NAME_ON_ACCOUNT("nameOnAccount"),
- ELEMENT_NAME_RECURRING_BILLING("recurringBilling"),
- ELEMENT_NAME_TEST_REQUEST("testRequest"),
- ELEMENT_OPERATION("Operation"),
- ELEMENT_ORDER("order"),
- ELEMENT_PASSWORD("password"),
- ELEMENT_PAYMENT("payment"),
- ELEMENT_PAYMENT_METHOD("paymentMethod"),
- ELEMENT_PAYMENT_PROFILE("paymentProfile"),
- ELEMENT_PAYMENT_PROFILES("paymentProfiles"),
- ELEMENT_PAYMENT_SCHEDULE("paymentSchedule"),
- ELEMENT_PERMISSION("permission"),
- ELEMENT_PERMISSION_NAME("permissionName"),
- ELEMENT_PHONE_NUMBER("phoneNumber"),
- ELEMENT_DEVICE_PLATFORM("devicePlatform"),
- ELEMENT_PO_NUMBER("poNumber"),
- ELEMENT_PREPAID_BALANCE_REMAINING("prepaidBalanceRemaining"),
- ELEMENT_PREPAID_CARD("prePaidCard"),
- ELEMENT_PROFILE("profile"),
- ELEMENT_PROFILE_TRANS_AUTH_ONLY("profileTransAuthOnly"),
- ELEMENT_PURCHASE_ORDER_NUMBER("purchaseOrderNumber"),
- ELEMENT_QUANTITY("quantity"),
- ELEMENT_RECURRING_BILLING("recurringBilling"),
- ELEMENT_REF_TRANS_HASH("refTransHash"),
- ELEMENT_REF_TRANS_ID("refTransId"),
- ELEMENT_REF_TRANS_IDD("refTransID"),
- ELEMENT_REFID("refId"),
- ELEMENT_REFUND_AMOUNT("refundAmount"),
- ELEMENT_REFUND_CHARGEBACK_AMOUNT("refundChargeBackAmount"),
- ELEMENT_REFUND_CHARGEBACK_COUNT("refundChargeBackCount"),
- ELEMENT_REFUND_COUNT("refundCount"),
- ELEMENT_REFUND_RETURNED_ITEMS_AMOUNT("refundReturnedItemsAmount"),
- ELEMENT_REFUND_RETURNED_ITEMS_COUNT("refundReturnedItemsCount"),
- ELEMENT_REQUESTED_AMOUNT("requestedAmount"),
- ELEMENT_RESPONSE_CODE("responseCode"),
- ELEMENT_RESPONSE_REASON_CODE("responseReasonCode"),
- ELEMENT_RESPONSE_REASON_DESCRIPTION("responseReasonDescription"),
- ELEMENT_RESPONSE_TO_CUSTOMER("responseToCustomer"),
- ELEMENT_RESULT_CODE("resultCode"),
- ELEMENT_RETAIL("retail"),
- ELEMENT_RETURNED_ITEM_AMOUNT("returnedItemAmount"),
- ELEMENT_RETURNED_ITEM_COUNT("returnedItemCount"),
- ELEMENT_ROUTING_NUMBER("routingNumber"),
- ELEMENT_SCHEME("Scheme"),
- ELEMENT_SESSION_TOKEN("sessionToken"),
- ELEMENT_SETTING("setting"),
- ELEMENT_SETTING_NAME("settingName"),
- ELEMENT_SETTING_VALUE("settingValue"),
- ELEMENT_SETTLE_AMOUNT("settleAmount"),
- ELEMENT_SETTLEMENT_STATE("settlementState"),
- ELEMENT_SETTLEMENT_TIME_LOCAL("settlementTimeLocal"),
- ELEMENT_SETTLEMENT_TIME_UTC("settlementTimeUTC"),
- ELEMENT_SHIP_TO("shipTo"),
- ELEMENT_SHIP_TO_LIST("shipToList"),
- ELEMENT_SHIPPING("shipping"),
- ELEMENT_SPLIT_TENDER_ID("splitTenderId"),
- ELEMENT_SPLIT_TENDER_PAYMENT("splitTenderPayment"),
- ELEMENT_SPLIT_TENDER_PAYMENTS("splitTenderPayments"),
- ELEMENT_SPLIT_TENDER_STATUS("splitTenderStatus"),
- ELEMENT_START_DATE("startDate"),
- ELEMENT_STATE("state"),
- ELEMENT_STATISTIC("statistic"),
- ELEMENT_STATISTICS("statistics"),
- ELEMENT_SUBMIT_TIME_LOCAL("submitTimeLocal"),
- ELEMENT_SUBMIT_TIME_UTC("submitTimeUTC"),
- ELEMENT_SUBSCRIPTION("subscription"),
- ELEMENT_SUBSCRIPTION_ID("subscriptionId"),
- ELEMENT_SUBSCRIPTION_STATUS("Status"),
- ELEMENT_SWIPER_DATA("swiperData"),
- ELEMENT_ENCRYPTED_DATA("EncryptedData"),
- ELEMENT_TAX("tax"),
- ELEMENT_TAX_EXEMPT("taxExempt"),
- ELEMENT_TAX_ID("taxId"),
- ELEMENT_TAXABLE("taxable"),
- ELEMENT_TEST_REQUEST("testRequest"),
- ELEMENT_TEXT("text"),
- ELEMENT_TOTAL_OCCURRENCES("totalOccurrences"),
- ELEMENT_TRACK_DATA("trackData"),
- ELEMENT_TRACK1("track1"),
- ELEMENT_TRACK2("track2"),
- ELEMENT_TRANS_HASH("transHash"),
- ELEMENT_TRANS_ID("transId"),
- ELEMENT_TRANSACTION("transaction"),
- ELEMENT_TRANSACTION_ID("transactionId"),
- ELEMENT_TRANSACTION_KEY("transactionKey"),
- ELEMENT_TRANSACTION_REQUEST("transactionRequest"),
- ELEMENT_TRANSACTION_RESPONSE("transactionResponse"),
- ELEMENT_TRANSACTION_SETTINGS("transactionSettings"),
- ELEMENT_TRANSACTION_STATUS("transactionStatus"),
- ELEMENT_TRANSACTION_TYPE("transactionType"),
- ELEMENT_TRANSACTIONS("transactions"),
- ELEMENT_TRIAL_AMOUNT("trialAmount"),
- ELEMENT_TRIAL_OCCURRENCES("trialOccurrences"),
- ELEMENT_TYPE("type"),
- ELEMENT_UNIT("unit"),
- ELEMENT_UNIT_PRICE("unitPrice"),
- ELEMENT_USER_FIELD("userField"),
- ELEMENT_USER_FIELDS("userFields"),
- ELEMENT_USER_PERMISSIONS("userPermissions"),
- ELEMENT_VALIDATION_DIRECT_RESPONSE("validationDirectResponse"),
- ELEMENT_VALIDATION_DIRECT_RESPONSE_LIST("validationDirectResponseList"),
- ELEMENT_VALIDATION_MODE("validationMode"),
- ELEMENT_VALUE("value"),
- ELEMENT_VALUE_CAPITAL("Value"),
- ELEMENT_VOID_COUNT("voidCount"),
- ELEMENT_ZIP("zip"),
- X_ACCOUNT_NUMBER("x_account_number"),
- X_ADDRESS("x_address"),
- X_ALLOW_PARTIAL_AUTH("x_allow_partial_Auth"),
- X_AMOUNT("x_amount"),
- X_AUTH_CODE("x_auth_code"),
- X_AUTHENTICATION_INDICATOR("x_authentication_indicator"),
- X_AVS_CODE("x_avs_code"),
- X_BACKGROUND_URL("x_background_url"),
- X_BANK_ABA_CODE("x_bank_aba_code"),
- X_BANK_ACCT_NAME("x_bank_acct_name"),
- X_BANK_ACCT_NUM("x_bank_acct_num"),
- X_BANK_ACCT_TYPE("x_bank_acct_type"),
- X_BANK_CHECK_NUMBER("x_bank_check_number"),
- X_BANK_NAME("x_bank_name"),
- X_CARD_CODE("x_card_code"),
- X_CARD_NUM("x_card_num"),
- X_CARD_TYPE("x_card_type"),
- X_CARDHOLDER_AUTHENTICATION_VALUE("x_cardholder_authentication_value"),
- X_CAVV_RESPONSE("x_cavv_response"),
- X_CITY("x_city"),
- X_COLOR_BACKGROUND("x_color_background"),
- X_COLOR_LINK("x_color_link"),
- X_COLOR_TEXT("x_color_text"),
- X_COMPANY("x_company"),
- X_COUNTRY("x_country"),
- X_CPVERSION("x_cpversion"),
- X_CURRENCY_CODE("x_currency_code"),
- X_CUST_ID("x_cust_id"),
- X_CUSTOMER_IP("x_customer_ip"),
- X_CVV2_RESP_CODE("x_cvv2_resp_code"),
- X_DELIM_CHAR_FIELD("x_delim_char"),
- X_DELIM_DATA("x_delim_data"),
- X_DELIM_DATA_FIELD("x_delim_data"),
- X_DESCRIPTION("x_description"),
- X_DEVICE_TYPE("x_device_type"),
- X_DUPLICATE_WINDOW("x_duplicate_window"),
- X_DUTY("x_duty"),
- X_ECHECK_TYPE("x_echeck_type"),
- X_EMAIL("x_email"),
- X_EMAIL_CUSTOMER("x_email_customer"),
- X_ENCAP_CHAR("x_encap_char"),
- X_EXP_DATE("x_exp_date"),
- X_FAX("x_fax"),
- X_FIRST_NAME("x_first_name"),
- X_FOOTER_EMAIL_RECEIPT("x_footer_email_receipt"),
- X_FOOTER_HTML_PAYMENT_FORM("x_footer_html_payment_form"),
- X_FP_HASH("x_fp_hash"),
- X_FP_SEQUENCE("x_fp_sequence"),
- X_FP_TIMESTAMP("x_fp_timestamp"),
- X_FREIGHT("x_freight"),
- X_HEADER_EMAIL_RECEIPT("x_header_email_receipt"),
- X_HEADER_HTML_PAYMENT_FORM("x_header_html_payment_form"),
- X_INVOICE_NUM("x_invoice_num"),
- X_LAST_NAME("x_last_name"),
- X_LINE_ITEM("x_line_item"),
- X_LOGIN("x_login"),
- X_LOGO_URL("x_logo_url"),
- X_MARKET_TYPE("x_market_type"),
- X_MD5_HASH("x_MD5_Hash"),
- X_MERCHANT_EMAIL("x_merchant_email"),
- X_METHOD("x_method"),
- X_PHONE("x_phone"),
- X_PO_NUM("x_po_num"),
- X_PREPAID_BALANCE_ON_CARD("x_prepaid_balance_on_card"),
- X_PREPAID_REQUESTED_AMOUNT("x_prepaid_requested_amount"),
- X_RECEIPT_LINK_METHOD("x_receipt_link_method"),
- X_RECEIPT_LINK_TEXT("x_receipt_link_text"),
- X_RECEIPT_LINK_URL("x_receipt_link_url"),
- X_RECURRING_BILLING("x_recurring_billing"),
- X_RELAY_RESPONSE("x_relay_response"),
- X_RELAY_URL("x_relay_url"),
- X_RENAME("x_rename"),
- X_RESPONSE_CODE("x_response_code"),
- X_RESPONSE_FORMAT("x_response_format"),
- X_RESPONSE_REASON_CODE("x_response_reason_code"),
- X_RESPONSE_REASON_TEXT("x_response_reason_text"),
- X_SHIP_TO_ADDRESS("x_ship_to_address"),
- X_SHIP_TO_CITY("x_ship_to_city"),
- X_SHIP_TO_COMPANY("x_ship_to_company"),
- X_SHIP_TO_COUNTRY("x_ship_to_country"),
- X_SHIP_TO_FIRST_NAME("x_ship_to_first_name"),
- X_SHIP_TO_LAST_NAME("x_ship_to_last_name"),
- X_SHIP_TO_STATE("x_ship_to_state"),
- X_SHIP_TO_ZIP("x_ship_to_zip"),
- X_SHOW_FORM("x_show_form"),
- X_SPLIT_TENDER_ID("x_split_tender_id"),
- X_STATE("x_state"),
- X_TAX("x_tax"),
- X_TAX_EXEMPT("x_tax_exempt"),
- X_TEST_REQUEST("x_test_request"),
- X_TRACK1("x_track1"),
- X_TRACK2("x_track2"),
- X_TRAN_KEY("x_tran_key"),
- X_TRANS_ID("x_trans_id"),
- X_TYPE("x_type"),
- X_USER_REF("x_user_ref"),
- X_VERSION_FIELD("x_version"),
- X_ZIP("x_zip");
-
- final private String fieldName;
-
- private AuthNetField(String fieldName) {
- this.fieldName = fieldName;
- }
-
- /**
- * @return the fieldName
- */
- public String getFieldName() {
- return fieldName;
- }
-
-
-}
diff --git a/src/net/authorize/Environment.java b/src/net/authorize/Environment.java
deleted file mode 100644
index 4c230fb..0000000
--- a/src/net/authorize/Environment.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package net.authorize;
-
-
-/**
- * Determines which environment to post transactions against.
- * By placing the merchant's payment gateway account in Test Mode in the
- * Merchant Interface. New payment gateway accounts are placed in Test Mode
- * by default. For more information about Test Mode, see the Merchant
- * Integration Guide at http://www.authorize.net/support/merchant/.
- *
- * When processing test transactions in Test Mode, the payment gateway will
- * return a transaction ID of "0." This means you cannot test follow-on
- * transactions, for example, credits, voids, etc., while in Test Mode.
- *
- * Note: Transactions posted against live merchant accounts using either of
- * the above testing methods are not submitted to financial institutions for
- * authorization and are not stored in the Merchant Interface.
- */
-public enum Environment {
- SANDBOX("https://test.authorize.net","https://apitest.authorize.net"),
- SANDBOX_TESTMODE("https://test.authorize.net","https://apitest.authorize.net"),
- PRODUCTION("https://secure.authorize.net","https://api.authorize.net"),
- PRODUCTION_TESTMODE("https://secure.authorize.net","https://api.authorize.net"),
- CUSTOM(null,null)
- ;
-
- private String nvpBaseUrl;
- private String xmlBaseUrl;
-
- /**
- * Environment constructor.
- *
- * @param nvpBaseUrl
- * @param xmlBaseUrl
- */
- private Environment(String nvpBaseUrl, String xmlBaseUrl) {
- this.nvpBaseUrl = nvpBaseUrl;
- this.xmlBaseUrl = xmlBaseUrl;
- }
-
- /**
- * @return the baseUrl
- *
- * @deprecated As of release 2.0.0, replaced by {@link #getNVPBaseUrl()}
- */
- @Deprecated
- public String getBaseUrl() {
- return nvpBaseUrl;
- }
-
- /**
- * Return the name-value-pair base url.
- *
- * @return the nvpBaseUrl
- */
- public String getNVPBaseUrl() {
- return nvpBaseUrl;
- }
-
- /**
- * Return the XML base url.
- *
- * @return the xmlBaseUrl
- */
- public String getXmlBaseUrl() {
- return xmlBaseUrl;
- }
-
- /**
- * If a custom environment needs to be supported, this convenience create
- * method can be used to pass in custom URLS for NVP and xml gateways.
- *
- * @param nvpBaseUrl
- * @param xmlBaseUrl
- *
- * @return Environment object
- */
- public static Environment createEnvironment(String nvpBaseUrl, String xmlBaseUrl) {
- Environment environment = Environment.CUSTOM;
- environment.nvpBaseUrl = nvpBaseUrl;
- environment.xmlBaseUrl = xmlBaseUrl;
-
- return environment;
- }
-}
diff --git a/src/net/authorize/ITransaction.java b/src/net/authorize/ITransaction.java
deleted file mode 100644
index 74b83f4..0000000
--- a/src/net/authorize/ITransaction.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package net.authorize;
-
-import java.math.BigDecimal;
-
-import net.authorize.data.Customer;
-import net.authorize.data.EmailReceipt;
-import net.authorize.data.Order;
-import net.authorize.data.ShippingAddress;
-import net.authorize.data.ShippingCharges;
-import net.authorize.data.creditcard.CreditCard;
-import net.authorize.data.echeck.BankAccount;
-
-/**
- * Interface for Transactions.
- *
- */
-public interface ITransaction {
-
- public static final String VERSION = "3.1";
- public static final String TRUE = "TRUE";
- public static final String FALSE = "FALSE";
- public static final String ZERO_STRING = "0.00";
- public static final BigDecimal ZERO_AMOUNT = new BigDecimal(0.00);
- public static final String EMPTY_STRING = "";
- public static final int CURRENCY_DECIMAL_PLACES = 2;
- public static final int QUANTITY_DECIMAL_PLACES = 4;
-
- /**
- * @return the creditCard
- */
- public abstract CreditCard getCreditCard();
-
- /**
- * @param creditCard the creditCard to set
- */
- public abstract void setCreditCard(CreditCard creditCard);
-
- /**
- * @return the bankAccount
- */
- public abstract BankAccount getBankAccount();
-
- /**
- * @param bankAccount the bank account information to set
- */
- public abstract void setBankAccount(BankAccount bankAccount);
-
- /**
- * @return the customer
- */
- public abstract Customer getCustomer();
-
- /**
- * @param customer the customer to set
- */
- public abstract void setCustomer(Customer customer);
-
- /**
- * @return the emailReceipt
- */
- public abstract EmailReceipt getEmailReceipt();
-
- /**
- * @param emailReceipt the emailReceipt to set
- */
- public abstract void setEmailReceipt(EmailReceipt emailReceipt);
-
- /**
- * @return the order
- */
- public abstract Order getOrder();
-
- /**
- * @param order the order to set
- */
- public abstract void setOrder(Order order);
-
- /**
- * @return the shippingAddress
- */
- public abstract ShippingAddress getShippingAddress();
-
- /**
- * @param shippingAddress the shippingAddress to set
- */
- public abstract void setShippingAddress(ShippingAddress shippingAddress);
-
- /**
- * @return the shippingCharges
- */
- public abstract ShippingCharges getShippingCharges();
-
- /**
- * @param shippingCharges the shippingCharges to set
- */
- public abstract void setShippingCharges(ShippingCharges shippingCharges);
-
- /**
- * @return the md5Value
- */
- public abstract String getMD5Value();
-
- /**
- * @return the transactionType
- */
- public abstract Enum> getTransactionType();
-
- /**
- * @return String to be POSTed to the AuthNet gateway.
- */
- public abstract String toAuthNetPOSTString();
-
- /**
- *
- * @return the merchant container
- */
- public abstract Merchant getMerchant();
-}
\ No newline at end of file
diff --git a/src/net/authorize/Merchant.java b/src/net/authorize/Merchant.java
deleted file mode 100644
index f4cb45d..0000000
--- a/src/net/authorize/Merchant.java
+++ /dev/null
@@ -1,424 +0,0 @@
-package net.authorize;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.Map;
-
-import net.authorize.aim.cardpresent.DeviceType;
-import net.authorize.aim.cardpresent.MarketType;
-import net.authorize.auth.IMerchantAuthentication;
-import net.authorize.data.arb.Subscription;
-import net.authorize.util.HttpClient;
-
-/**
- * Container to hold authentication credentials.
- *
- * The Merchant is also responsible for creating transactions and posting them
- * to the gateway are performed through the Merchant.
- *
- */
-public class Merchant implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- public static final int MAX_LOGIN_LENGTH = 20;
- public static final int MAX_TRANSACTION_KEY_LENGTH = 16;
-
- private Environment environment = Environment.SANDBOX;
-
- private boolean allowPartialAuth = false;
- private int duplicateTxnWindowSeconds = -1;
- private boolean emailCustomer = false;
- private String merchantEmail = null;
- private boolean recurringBilling = false;
-
- private MarketType marketType = null;
- private DeviceType deviceType = null;
- private String userRef = null;
- private String md5Value = null;
- private IMerchantAuthentication merchantAuthenticator;
-
- private Merchant() {
- }
-
- public static Merchant createMerchant(Environment environment,
- IMerchantAuthentication merchantAuthenticator) {
- Merchant merchant = new Merchant();
- merchant.environment = environment;
- merchant.merchantAuthenticator = merchantAuthenticator;
-
- return merchant;
- }
-
- public static Merchant createMerchant(Environment environment,
- IMerchantAuthentication merchantAuthenticator, String md5Value) {
-
- Merchant merchant = Merchant.createMerchant(environment,
- merchantAuthenticator);
- merchant.md5Value = md5Value;
-
- return merchant;
- }
-
- /**
- * Get the merchant authenticator.
- *
- * @return IMerchantAuthentication
- */
- public IMerchantAuthentication getMerchantAuthentication() {
- return this.merchantAuthenticator;
- }
-
- /**
- * Set the merchant authenticator.
- *
- * @param merchantAuthenticator
- */
- public void setMerchantAuthentication(
- IMerchantAuthentication merchantAuthenticator) {
- this.merchantAuthenticator = merchantAuthenticator;
- }
-
- /**
- * Return true if the merchant has been enabled, via the SDK, to allow
- * partial AUTH transactions.
- *
- * @return the allowPartialAuth
- */
- public boolean isAllowPartialAuth() {
- return allowPartialAuth;
- }
-
- /**
- * Indicates if the transaction is enabled for partial authorization.
- * Including this field in the transaction request overrides your account
- * configuration.
- *
- * @param allowPartialAuth
- * the allowPartialAuth to set
- */
- public void setAllowPartialAuth(boolean allowPartialAuth) {
- this.allowPartialAuth = allowPartialAuth;
- }
-
- /**
- * Get the Environment that transactions will be posted against.
- *
- * @return the environment
- */
- public Environment getEnvironment() {
- return environment;
- }
-
- /**
- * Set the environment that transactions will be posted against.
- *
- * @param environment
- * the environment to set
- */
- public void setEnvironment(Environment environment) {
- this.environment = environment;
- }
-
- /**
- * Return true if the environment is a sandbox type environment.
- *
- * @return true if in the sandbox environment
- */
- public boolean isSandboxEnvironment() {
- return (environment != null && (Environment.SANDBOX
- .equals(this.environment) || Environment.SANDBOX_TESTMODE
- .equals(this.environment)));
- }
-
- /**
- * @return the marketType
- */
- public MarketType getMarketType() {
- return marketType;
- }
-
- /**
- * @param marketType
- * the marketType to set
- */
- public void setMarketType(MarketType marketType) {
- this.marketType = marketType;
- }
-
- /**
- * @return the deviceType
- */
- public DeviceType getDeviceType() {
- return deviceType;
- }
-
- /**
- * @param deviceType
- * the deviceType to set
- */
- public void setDeviceType(DeviceType deviceType) {
- this.deviceType = deviceType;
- }
-
- /**
- * @return the MD5Value
- */
- public String getMD5Value() {
- return md5Value;
- }
-
- /**
- * @param MD5Value
- * the MD5Value to set
- */
- public void setMD5Value(String MD5Value) {
- this.md5Value = MD5Value;
- }
-
- /**
- * Get the UserRef value.
- *
- * @return the userRef
- */
- public String getUserRef() {
- return userRef;
- }
-
- /**
- * Set the userRef for Card Present transactions.
- *
- * @param userRef
- * the userRef to set
- */
- public void setUserRef(String userRef) {
- this.userRef = userRef;
- }
-
- /**
- * @return the duplicateTxnWindowSeconds
- */
- public int getDuplicateTxnWindowSeconds() {
- return duplicateTxnWindowSeconds;
- }
-
- /**
- * @param duplicateTxnWindowSeconds
- * the duplicateTxnWindowSeconds to set
- */
- public void setDuplicateTxnWindowSeconds(int duplicateTxnWindowSeconds) {
- this.duplicateTxnWindowSeconds = duplicateTxnWindowSeconds;
- }
-
- /**
- * @return the emailCustomer
- */
- public boolean isEmailCustomer() {
- return emailCustomer;
- }
-
- /**
- * @param emailCustomer
- * the emailCustomer to set
- */
- public void setEmailCustomer(boolean emailCustomer) {
- this.emailCustomer = emailCustomer;
- }
-
- /**
- * @return the merchantEmail
- */
- public String getMerchantEmail() {
- return merchantEmail;
- }
-
- /**
- * @param merchantEmail
- * the merchantEmail to set
- */
- public void setMerchantEmail(String merchantEmail) {
- this.merchantEmail = merchantEmail;
- }
-
- /**
- * @return the recurringBilling
- */
- public boolean isRecurringBilling() {
- return recurringBilling;
- }
-
- /**
- * @param recurringBilling
- * the recurringBilling to set
- */
- public void setRecurringBilling(boolean recurringBilling) {
- this.recurringBilling = recurringBilling;
- }
-
- /**
- * Creates a new AIM Transaction (includes Card Present)
- *
- * @param transactionType
- * @param amount
- *
- * @return A newly created Transaction
- */
- public net.authorize.aim.Transaction createAIMTransaction(
- TransactionType transactionType, BigDecimal amount) {
- return net.authorize.aim.Transaction.createTransaction(this,
- transactionType, amount);
- }
-
- /**
- * Creates a new SIM Transaction.
- *
- * @param transactionType
- * @param fingerPrintSequence
- * @param amount
- *
- * @return A newly created Transaction
- */
- public net.authorize.sim.Transaction createSIMTransaction(
- TransactionType transactionType, long fingerPrintSequence,
- BigDecimal amount) {
-
- return net.authorize.sim.Transaction.createTransaction(this,
- transactionType, fingerPrintSequence, amount);
- }
-
- /**
- * Creates a new ARB Transaction.
- *
- * @param transactionType
- * @param subscription
- *
- * @return A newly created Transaction
- */
- public net.authorize.arb.Transaction createARBTransaction(
- net.authorize.arb.TransactionType transactionType,
- Subscription subscription) {
-
- return net.authorize.arb.Transaction.createTransaction(this,
- transactionType, subscription);
- }
-
- /**
- * Creates a new CIM Transaction.
- *
- * @param transactionType
- *
- * @return A newly created Transaction
- */
- public net.authorize.cim.Transaction createCIMTransaction(
- net.authorize.cim.TransactionType transactionType) {
-
- return net.authorize.cim.Transaction.createTransaction(this,
- transactionType);
- }
-
- /**
- * Creates a new Reporting Transaction.
- *
- * @param transactionType
- *
- * @return A newly created Transaction
- */
- public net.authorize.reporting.Transaction createReportingTransaction(
- net.authorize.reporting.TransactionType transactionType) {
-
- return net.authorize.reporting.Transaction.createTransaction(this,
- transactionType);
- }
-
- /**
- * Creates a new Mobile Transaction.
- *
- * @param transactionType
- *
- * @return A newly created Transaction
- */
- public net.authorize.mobile.Transaction createMobileTransaction(
- net.authorize.mobile.TransactionType transactionType) {
-
- return net.authorize.mobile.Transaction.createTransaction(this,
- transactionType);
- }
-
- /**
- * Creates a new notification Transaction.
- *
- * @param transactionType
- *
- * @return A newly created Transaction
- */
- public net.authorize.notification.Transaction createNotificationTransaction(
- net.authorize.notification.TransactionType transactionType) {
-
- return net.authorize.notification.Transaction.createTransaction(this,
- transactionType);
- }
-
- /**
- * Post a Transaction request to the payment gateway.
- *
- * @param transaction
- *
- * @return A Result is returned with each post.
- *
- */
- public Result postTransaction(ITransaction transaction) {
-
- Result result = null;
-
- // aim
- if (transaction instanceof net.authorize.aim.Transaction) {
- String response = HttpClient.executeXML(this.environment,
- transaction);
- result = net.authorize.aim.Result.createResult(transaction,
- response);
- }
- // mobile
- else if (transaction instanceof net.authorize.mobile.Transaction) {
- String response = HttpClient.executeXML(this.environment,
- transaction);
- result = net.authorize.mobile.Result.createResult(transaction,
- response);
- }
- // cim
- else if (transaction instanceof net.authorize.cim.Transaction) {
- String response = HttpClient.executeXML(this.environment,
- transaction);
- result = net.authorize.cim.Result.createResult(transaction,
- response);
- }
- // reporting
- else if (transaction instanceof net.authorize.reporting.Transaction) {
- String response = HttpClient.executeXML(this.environment,
- transaction);
- result = net.authorize.reporting.Result.createResult(transaction,
- response);
- }
- // arb
- else if (transaction instanceof net.authorize.arb.Transaction) {
- String response = HttpClient.executeXML(this.environment,
- transaction);
- result = net.authorize.arb.Result.createResult(transaction,
- response);
- }
- // notification
- else if (transaction instanceof net.authorize.notification.Transaction) {
- String response = HttpClient.executeXML(this.environment,
- transaction);
- result = net.authorize.notification.Result.createResult(
- transaction, response);
- }
- // sim
- else if (transaction instanceof net.authorize.sim.Transaction) {
- Map responseMap = HttpClient.execute(
- this.environment, transaction);
- result = net.authorize.sim.Result.createResult(responseMap);
- }
- return result;
- }
-
-}
diff --git a/src/net/authorize/NVPTransaction.java b/src/net/authorize/NVPTransaction.java
deleted file mode 100644
index 5d59dfd..0000000
--- a/src/net/authorize/NVPTransaction.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package net.authorize;
-
-import java.io.Serializable;
-
-import net.authorize.data.Address;
-import net.authorize.data.Customer;
-import net.authorize.data.EmailReceipt;
-import net.authorize.data.Order;
-import net.authorize.data.ShippingAddress;
-import net.authorize.data.ShippingCharges;
-import net.authorize.data.creditcard.CreditCard;
-import net.authorize.data.echeck.BankAccount;
-import net.authorize.data.echeck.ECheck;
-
-public abstract class NVPTransaction implements Serializable, ITransaction {
-
- private static final long serialVersionUID = 2L;
-
- protected ECheck eCheck;
- protected CreditCard creditCard;
- protected Customer customer;
- protected EmailReceipt emailReceipt;
- protected Environment environment;
- protected String md5Value = null;
- protected Merchant merchant;
- protected Order order;
- protected Address billToAddress;
- protected ShippingAddress shippingAddress;
- protected ShippingCharges shippingCharges;
- protected TransactionType transactionType;
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#getCreditCard()
- */
- public CreditCard getCreditCard() {
- return this.creditCard;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#getCustomer()
- */
- public Customer getCustomer() {
- return this.customer;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#getECheck()
- */
- public ECheck getECheck() {
- return this.eCheck;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#getEmailReceipt()
- */
- public EmailReceipt getEmailReceipt() {
- return this.emailReceipt;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#getEnvironment()
- */
- public Environment getEnvironment() {
- return this.environment;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#getMD5Value()
- */
- public String getMD5Value() {
- return this.md5Value;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#getOrder()
- */
- public Order getOrder() {
- return this.order;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#getShippingAddress()
- */
- public ShippingAddress getShippingAddress() {
- return this.shippingAddress;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#getShippingCharges()
- */
- public ShippingCharges getShippingCharges() {
- return this.shippingCharges;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#getTransactionType()
- */
- public Enum> getTransactionType() {
- return this.transactionType;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#setCreditCard(net.authorize.data.creditcard.CreditCard)
- */
- public void setCreditCard(CreditCard creditCard) {
- this.creditCard = creditCard;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#setCustomer(net.authorize.data.Customer)
- */
- public void setCustomer(Customer customer) {
- this.customer = customer;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#setECheck(net.authorize.data.echeck.ECheck)
- */
- public void setECheck(ECheck eCheck) {
- this.eCheck = eCheck;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#setEmailReceipt(net.authorize.data.EmailReceipt)
- */
- public void setEmailReceipt(EmailReceipt emailReceipt) {
- this.emailReceipt = emailReceipt;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#setOrder(net.authorize.data.Order)
- */
- public void setOrder(Order order) {
- this.order = order;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#setShippingAddress(net.authorize.data.ShippingAddress)
- */
- public void setShippingAddress(ShippingAddress shippingAddress) {
- this.shippingAddress = shippingAddress;
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#setShippingCharges(net.authorize.data.ShippingCharges)
- */
- public void setShippingCharges(ShippingCharges shippingCharges) {
- this.shippingCharges = shippingCharges;
- }
-
- /**
- * Returns the bank account/eCheck account information.
- *
- * @return BankAccount
- */
- public BankAccount getBankAccount() {
- return (BankAccount)this.getECheck();
- }
-
- /**
- * Set the bank account / eCheck information.
- *
- * @param bankAccount bankAccount / eCheck information.
- */
- public void setBankAccount(BankAccount bankAccount) {
- this.eCheck = (ECheck)bankAccount;
- }
-
- /**
- * Return the Merchant container.
- *
- * @return Merchant
- */
- public Merchant getMerchant() {
- return this.merchant;
- }
-
-
-}
diff --git a/src/net/authorize/ResponseCode.java b/src/net/authorize/ResponseCode.java
deleted file mode 100644
index b7d7765..0000000
--- a/src/net/authorize/ResponseCode.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package net.authorize;
-
-import net.authorize.util.StringUtils;
-
-/**
- * Response code indicates the overall status of the transaction
- * with possible values of approved, declined, error, or held for review.
- *
- */
-public enum ResponseCode {
- APPROVED(1, "This transaction has been approved."),
- DECLINED(2, "This transaction has been declined."),
- ERROR(3, "There has been an error processing this transaction."),
- REVIEW(4, "This transaction is being held for review."),
- UNKNOWN(0, "Unknown.");
-
- private final int code;
- private final String description;
-
- private ResponseCode(int code, String description) {
- this.code = code;
- this.description = description;
- }
-
- /**
- * Lookup a ResponseCode by it's response code.
- * @param code
- *
- * @return Returns a ResponseCode if a code match is found.
- */
- public static ResponseCode findByResponseCode(int code) {
- for(ResponseCode responseCode : values()) {
- if(responseCode.code == code) {
- return responseCode;
- }
- }
-
- return ResponseCode.UNKNOWN;
- }
-
- /**
- * Lookup a ResponseCode by it's response code.
- * @param code
- *
- * @return Returns a ResponseCode if a code match is found.
- */
- public static ResponseCode findByResponseCode(String code) {
- if(StringUtils.isNotEmpty(code)) {
- return findByResponseCode(Integer.parseInt(code));
- }
-
- return ResponseCode.UNKNOWN;
- }
-
- /**
- * @return the code
- */
- public int getCode() {
- return code;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
-}
diff --git a/src/net/authorize/ResponseField.java b/src/net/authorize/ResponseField.java
deleted file mode 100644
index eaa974b..0000000
--- a/src/net/authorize/ResponseField.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package net.authorize;
-
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * ResponseField mappings used in processing and matching the returned data from
- * the payment gateway.
- *
- * This enum is leveraged across all the integrations of
- * AIM,SIM,DPM,ARB and CIM.
- *
- */
-public enum ResponseField {
- RESPONSE_CODE(AuthNetField.X_RESPONSE_CODE.getFieldName()),
- RESPONSE_SUBCODE(null),
- RESPONSE_REASON_CODE(AuthNetField.X_RESPONSE_REASON_CODE.getFieldName()),
- RESPONSE_REASON_TEXT(AuthNetField.X_RESPONSE_REASON_TEXT.getFieldName()),
- AUTHORIZATION_CODE(AuthNetField.X_AUTH_CODE.getFieldName()),
- AVS_CODE(AuthNetField.X_AVS_CODE.getFieldName()),
- TRANSACTION_ID(AuthNetField.X_TRANS_ID.getFieldName()),
- INVOICE_NUMBER(AuthNetField.X_INVOICE_NUM.getFieldName()),
- DESCRIPTION(AuthNetField.X_DESCRIPTION.getFieldName()),
- AMOUNT(AuthNetField.X_AMOUNT.getFieldName()),
- METHOD(AuthNetField.X_METHOD.getFieldName()),
- TRANSACTION_TYPE(AuthNetField.X_TYPE.getFieldName()),
- CUSTOMER_ID(AuthNetField.X_CUST_ID.getFieldName()),
- FIRST_NAME(AuthNetField.X_FIRST_NAME.getFieldName()),
- LAST_NAME(AuthNetField.X_LAST_NAME.getFieldName()),
- COMPANY(AuthNetField.X_COMPANY.getFieldName()),
- ADDRESS(AuthNetField.X_ADDRESS.getFieldName()),
- CITY(AuthNetField.X_CITY.getFieldName()),
- STATE(AuthNetField.X_STATE.getFieldName()),
- ZIP_CODE(AuthNetField.X_ZIP.getFieldName()),
- COUNTRY(AuthNetField.X_COUNTRY.getFieldName()),
- PHONE(AuthNetField.X_PHONE.getFieldName()),
- FAX(AuthNetField.X_FAX.getFieldName()),
- EMAIL_ADDRESS(AuthNetField.X_EMAIL.getFieldName()),
- SHIP_TO_FIRST_NAME(AuthNetField.X_SHIP_TO_FIRST_NAME.getFieldName()),
- SHIP_TO_LAST_NAME(AuthNetField.X_SHIP_TO_LAST_NAME.getFieldName()),
- SHIP_TO_COMPANY(AuthNetField.X_SHIP_TO_COMPANY.getFieldName()),
- SHIP_TO_ADDRESS(AuthNetField.X_SHIP_TO_ADDRESS.getFieldName()),
- SHIP_TO_CITY(AuthNetField.X_SHIP_TO_CITY.getFieldName()),
- SHIP_TO_STATE(AuthNetField.X_SHIP_TO_STATE.getFieldName()),
- SHIP_TO_ZIP_CODE(AuthNetField.X_SHIP_TO_ZIP.getFieldName()),
- SHIP_TO_COUNTRY(AuthNetField.X_SHIP_TO_COUNTRY.getFieldName()),
- TAX(AuthNetField.X_TAX.getFieldName()),
- DUTY(AuthNetField.X_DUTY.getFieldName()),
- FREIGHT(AuthNetField.X_FREIGHT.getFieldName()),
- TAX_EXEMPT(AuthNetField.X_TAX_EXEMPT.getFieldName()),
- PURCHASE_ORDER_NUMBER(AuthNetField.X_PO_NUM.getFieldName()),
- MD5_HASH(AuthNetField.X_MD5_HASH.getFieldName()),
- CARD_CODE_RESPONSE(AuthNetField.X_CVV2_RESP_CODE.getFieldName()),
- CARDHOLDER_AUTHENTICATION_VERIFICATION_RESPONSE(AuthNetField.X_CAVV_RESPONSE.getFieldName()),
- RESERVED_1(null),
- RESERVED_2(null),
- RESERVED_3(null),
- RESERVED_4(null),
- RESERVED_5(null),
- RESERVED_6(null),
- RESERVED_7(null),
- RESERVED_8(null),
- RESERVED_9(null),
- RESERVED_10(null),
- ACCOUNT_NUMBER(AuthNetField.X_ACCOUNT_NUMBER.getFieldName()),
- CARD_TYPE(AuthNetField.X_CARD_TYPE.getFieldName()),
- SPLIT_TENDER_ID(AuthNetField.X_SPLIT_TENDER_ID.getFieldName()),
- PREPAID_REQUESTED_AMOUNT(AuthNetField.X_PREPAID_REQUESTED_AMOUNT.getFieldName()),
- PREPAID_BALANCE_ON_CARD(AuthNetField.X_PREPAID_BALANCE_ON_CARD.getFieldName()),
- RESERVED_11(null),
- RESERVED_12(null),
- RESERVED_13(null),
- RESERVED_14(null),
- RESERVED_15(null),
- RESERVED_16(null),
- RESERVED_17(null),
- RESERVED_18(null),
- RESERVED_19(null),
- RESERVED_20(null),
- RESERVED_21(null),
- RESERVED_22(null),
- RESERVED_23(null);
-
- private static final int MERCHANT_DEFINED_START_INDEX = 69;
-
- private int responseOrder;
- final private String fieldName;
- private static final Map lookup =
- new HashMap();
-
- static {
- for (ResponseField s : EnumSet.allOf(ResponseField.class))
- lookup.put(s.responseOrder, s);
- }
-
- private ResponseField(String fieldName) {
- if(fieldName == null) {
- this.fieldName = "x_" + this.name();
- } else {
- this.fieldName = fieldName;
- }
- this.responseOrder = this.ordinal()+1;
- }
-
- /**
- * Get the true response order.
- *
- * @return Integer of the response order.
- */
- public int getResponsOrder() { return this.responseOrder; }
-
- /**
- * Get the ResponseField identified by the order specified.
- *
- * @param order
- * @return the ResponseField keyed off the order
- */
- public static ResponseField get(int order) {
- if(order < MERCHANT_DEFINED_START_INDEX) {
- return ResponseField.lookup.get(order);
- } else {
- return null;
- }
- }
-
-
- /**
- * Lookup a ResponseField by it's field name.
- *
- * @param fieldName
- *
- * @return Returns a ResponseField if the fieldName match is found.
- */
- public static ResponseField findByFieldName(String fieldName) {
- for(ResponseField responseField : values()) {
- if(responseField.fieldName.equals(fieldName)) {
- return responseField;
- }
- }
-
- return null;
- }
-
- /**
- * @return the responseOrder
- */
- public int getResponseOrder() {
- return responseOrder;
- }
-
- /**
- * @return the fieldName
- */
- public String getFieldName() {
- return fieldName;
- }
-
-
-}
diff --git a/src/net/authorize/ResponseReasonCode.java b/src/net/authorize/ResponseReasonCode.java
deleted file mode 100644
index 6b12e12..0000000
--- a/src/net/authorize/ResponseReasonCode.java
+++ /dev/null
@@ -1,288 +0,0 @@
-package net.authorize;
-
-import net.authorize.util.StringUtils;
-
-
-/**
- * Response Reason Code is a numeric representation of a more specific reason for the transaction status.
- *
- */
-public enum ResponseReasonCode {
-
- RRC_1_1(ResponseCode.APPROVED, 1,"This transaction has been approved.", ""),
- RRC_2_2(ResponseCode.DECLINED, 2,"This transaction has been declined.", ""),
- RRC_2_3(ResponseCode.DECLINED, 3,"This transaction has been declined.", ""),
- RRC_2_4(ResponseCode.DECLINED, 4,"This transaction has been declined.", "The code returned from the processor indicating that the card used needs to be picked up."),
- RRC_3_5(ResponseCode.ERROR, 5,"A valid amount is required.", "The value submitted in the amount field did not pass validation for a number."),
- RRC_3_6(ResponseCode.ERROR, 6,"The credit card number is invalid.",""),
- RRC_3_7(ResponseCode.ERROR, 7,"The credit card expiration date is invalid.","The format of the date submitted was incorrect."),
- RRC_3_8(ResponseCode.ERROR, 8,"The credit card has expired.",""),
- RRC_3_9(ResponseCode.ERROR, 9,"The ABA code is invalid.","The value submitted in the x_bank_aba_code field did not pass validation or was not for a valid financial institution."),
- RRC_3_10(ResponseCode.ERROR, 10,"The account number is invalid.","The value submitted in the x_bank_acct_num field did not pass validation."),
- RRC_3_11(ResponseCode.ERROR, 11,"A duplicate transaction has been submitted.","A transaction with identical amount and credit card information was submitted two minutes prior."),
- RRC_3_12(ResponseCode.ERROR, 12 , "An authorization code is required but not present.", "A transaction that required x_auth_code to be present was submitted without a value."),
- RRC_3_13(ResponseCode.ERROR, 13, "The merchant API Login ID is invalid or the account is inactive.", ""),
- RRC_3_14(ResponseCode.ERROR, 14, "The Referrer or Relay Response URL is invalid.", "The Relay Response or Referrer URL does not match the merchant'ges configured value"),
- RRC_3_15(ResponseCode.ERROR, 15, "The transaction ID is invalid.", "The transaction ID value is non-numeric or was not present for a transaction that requires it."),
- RRC_3_16(ResponseCode.ERROR, 16, "The transaction was not found.", "The transaction ID sent in was properly formatted but the gateway had no record of the transaction."),
- RRC_3_17(ResponseCode.ERROR, 17, "The merchant does not accept this type of credit card.", "The merchant was not configured to accept the credit card submitted in the transaction."),
- RRC_3_18(ResponseCode.ERROR, 18, "ACH transactions are not accepted by this merchant.", "The merchant does not accept electronic checks."),
- RRC_3_19(ResponseCode.ERROR, 19, "An error occurred during processing. Please try again in 5 minutes.",""),
- RRC_3_20(ResponseCode.ERROR, 20, "An error occurred during processing. Please try again in 5 minutes.",""),
- RRC_3_21(ResponseCode.ERROR, 21, "An error occurred during processing. Please try again in 5 minutes.",""),
- RRC_3_22(ResponseCode.ERROR, 22, "An error occurred during processing. Please try again in 5 minutes.",""),
- RRC_3_23(ResponseCode.ERROR, 23, "An error occurred during processing. Please try again in 5 minutes.",""),
- RRC_3_24(ResponseCode.ERROR, 24, "The Nova Bank Number or Terminal ID is incorrect. Call Merchant Service Provider.",""),
- RRC_3_25(ResponseCode.ERROR, 25, "An error occurred during processing. Please try again in 5 minutes.",""),
- RRC_3_26(ResponseCode.ERROR, 26, "An error occurred during processing. Please try again in 5 minutes.",""),
- RRC_2_27(ResponseCode.DECLINED, 27, "The transaction resulted in an AVS mismatch. The address provided does not match billing address of cardholder.",""),
- RRC_2_28(ResponseCode.DECLINED, 28, "The merchant does not accept this type of credit card.", "The Merchant ID at the processor was not configured to accept this card type."),
- RRC_2_29(ResponseCode.DECLINED, 29, "The Paymentech identification numbers are incorrect. Call Merchant Service Provider.",""),
- RRC_2_30(ResponseCode.DECLINED, 30, "The configuration with the processor is invalid. Call Merchant Service Provider.",""),
- RRC_2_31(ResponseCode.DECLINED, 31, "The FDC Merchant ID or Terminal ID is incorrect. Call Merchant Service Provider.", "The merchant was incorrectly set up at the processor."),
- RRC_3_32(ResponseCode.ERROR, 32, "This reason code is reserved or not applicable to this API.",""),
- RRC_3_33(ResponseCode.ERROR, 33, "FIELD cannot be left blank.", "The word FIELD will be replaced by an actual field name. This error indicates that a field the merchant specified as required was not filled in. Please see the Form Fields section of the Merchant Integration Guide for details."),
- RRC_2_34(ResponseCode.DECLINED, 34, "The VITAL identification numbers are incorrect. Call Merchant Service Provider.", "The merchant was incorrectly set up at the processor."),
- RRC_2_35(ResponseCode.DECLINED, 35, "An error occurred during processing. Call Merchant Service Provider.", "The merchant was incorrectly set up at the processor."),
- RRC_3_36(ResponseCode.ERROR, 36, "The authorization was approved, but settlement failed.",""),
- RRC_2_37(ResponseCode.DECLINED, 37, "The credit card number is invalid.",""),
- RRC_2_38(ResponseCode.DECLINED, 38, "The Global Payment System identification numbers are incorrect. Call Merchant Service Provider.", "The merchant was incorrectly set up at the processor."),
- RRC_3_40(ResponseCode.ERROR, 40, "This transaction must be encrypted.",""),
- RRC_2_41(ResponseCode.DECLINED, 41, "This transaction has been declined.", "Only merchants set up for the FraudScreen.Net service would receive this decline. This code will be returned if a given transaction'ges fraud score is higher than the threshold set by the merchant."),
- RRC_3_43(ResponseCode.ERROR, 43, "The merchant was incorrectly set up at the processor. Call your Merchant Service Provider.", "The merchant was incorrectly set up at the processor."),
- RRC_2_44(ResponseCode.DECLINED, 44, "This transaction has been declined.", "The card code submitted with the transaction did not match the card code on file at the card issuing bank and the transaction was declined."),
- RRC_2_45(ResponseCode.DECLINED, 45, "This transaction has been declined.", "This error would be returned if the transaction received a code from the processor that matched the rejection criteria set by the merchant for both the AVS and Card Code filters."),
- RRC_3_46(ResponseCode.ERROR, 46, "Your session has expired or does not exist. You must log in to continue working.", ""),
- RRC_3_47(ResponseCode.ERROR, 47, "The amount requested for settlement may not be greater than the original amount authorized.", "This occurs if the merchant tries to capture funds greater than the amount of the original authorization-only transaction."),
- RRC_3_48(ResponseCode.ERROR, 48, "This processor does not accept partial reversals.", "The merchant attempted to settle for less than the originally authorized amount."),
- RRC_3_49(ResponseCode.ERROR, 49, "A transaction amount greater than [amount] will not be accepted.", "The transaction amount submitted was greater than the maximum amount allowed."),
- RRC_3_50(ResponseCode.ERROR, 50, "This transaction is awaiting settlement and cannot be refunded.", "Credits or refunds can only be performed against settled transactions. The transaction against which the credit/refund was submitted has not been settled, so a credit cannot be issued."),
- RRC_3_51(ResponseCode.ERROR, 51, "The sum of all credits against this transaction is greater than the original transaction amount.",""),
- RRC_3_52(ResponseCode.ERROR, 52, "The transaction was authorized, but the client could not be notified; the transaction will not be settled.",""),
- RRC_3_53(ResponseCode.ERROR, 53, "The transaction type was invalid for ACH transactions.", "If x_method ECHECK, x_type cannot be set to CAPTURE_ONLY."),
- RRC_3_54(ResponseCode.ERROR, 54, "The referenced transaction does not meet the criteria for issuing a credit.",""),
- RRC_3_55(ResponseCode.ERROR, 55, "The sum of credits against the referenced transaction would exceed the original debit amount.", "The transaction is rejected if the sum of this credit and prior credits exceeds the original debit amount"),
- RRC_3_56(ResponseCode.ERROR, 56, "This merchant accepts ACH transactions only; no credit card transactions are accepted.", "The merchant processes eCheck.Net transactions only and does not accept credit cards."),
- RRC_3_57(ResponseCode.ERROR, 57, "An error occurred in processing. Please try again in 5 minutes.",""),
- RRC_3_58(ResponseCode.ERROR, 58, "An error occurred in processing. Please try again in 5 minutes.",""),
- RRC_3_59(ResponseCode.ERROR, 59, "An error occurred in processing. Please try again in 5 minutes.",""),
- RRC_3_60(ResponseCode.ERROR, 60, "An error occurred in processing. Please try again in 5 minutes.",""),
- RRC_3_61(ResponseCode.ERROR, 61, "An error occurred in processing. Please try again in 5 minutes.",""),
- RRC_3_62(ResponseCode.ERROR, 62, "An error occurred in processing. Please try again in 5 minutes.",""),
- RRC_3_63(ResponseCode.ERROR, 63, "An error occurred in processing. Please try again in 5 minutes.",""),
- RRC_2_65(ResponseCode.DECLINED, 65, "This transaction has been declined.", "The transaction was declined because the merchant configured their account through the Merchant Interface to reject transactions with certain values for a Card Code mismatch."),
- RRC_3_66(ResponseCode.ERROR, 66, "This transaction cannot be accepted for processing.", "The transaction did not meet gateway security guidelines."),
- RRC_3_68(ResponseCode.ERROR, 68, "The version parameter is invalid.", "The value submitted in x_version was invalid."),
- RRC_3_69(ResponseCode.ERROR, 69, "The transaction type is invalid.", "The value submitted in x_type was invalid."),
- RRC_3_70(ResponseCode.ERROR, 70, "The transaction method is invalid.", "The value submitted in x_method was invalid."),
- RRC_3_71(ResponseCode.ERROR, 71, "The bank account type is invalid.", "The value submitted in x_bank_acct_type was invalid."),
- RRC_3_72(ResponseCode.ERROR, 72, "The authorization code is invalid.", "The value submitted in x_auth_code was more than six characters in length."),
- RRC_3_73(ResponseCode.ERROR, 73, "The driver'ges license date of birth is invalid.", "The format of the value submitted in x_drivers_license_dob was invalid."),
- RRC_3_74(ResponseCode.ERROR, 74, "The duty amount is invalid.", "The value submitted in x_duty failed format validation."),
- RRC_3_75(ResponseCode.ERROR, 75, "The freight amount is invalid.", "The value submitted in x_freight failed format validation."),
- RRC_3_76(ResponseCode.ERROR, 76, "The tax amount is invalid.", "The value submitted in x_tax failed format validation."),
- RRC_3_77(ResponseCode.ERROR, 77, "The SSN or tax ID is invalid.", "The value submitted in x_customer_tax_id failed validation."),
- RRC_3_78(ResponseCode.ERROR, 78, "The Card CodeCVV2/CVC2/CID) is invalid.", "The value submitted in x_card_code failed format validation."),
- RRC_3_79(ResponseCode.ERROR, 79, "The driver'ges license number is invalid.", "The value submitted in x_drivers_license_num failed format validation."),
- RRC_3_80(ResponseCode.ERROR, 80, "The driver'ges license state is invalid.", "The value submitted in x_drivers_license_state failed format validation."),
- RRC_3_81(ResponseCode.ERROR, 81, "The requested form type is invalid.", "The merchant requested an integration method not compatible with the AIM API."),
- RRC_3_82(ResponseCode.ERROR, 82, "Scripts are only supported in version 2.5.", "The system no longer supports version 2.5; requests cannot be posted to scripts."),
- RRC_3_83(ResponseCode.ERROR, 83, "The requested script is either invalid or no longer supported.", "The system no longer supports version 2.5; requests cannot be posted to scripts."),
- RRC_3_84(ResponseCode.ERROR, 84, "This reason code is reserved or not applicable to this API.",""),
- RRC_3_85(ResponseCode.ERROR, 85, "This reason code is reserved or not applicable to this API.",""),
- RRC_3_86(ResponseCode.ERROR, 86, "This reason code is reserved or not applicable to this API.",""),
- RRC_3_87(ResponseCode.ERROR, 87, "This reason code is reserved or not applicable to this API.",""),
- RRC_3_88(ResponseCode.ERROR, 88, "This reason code is reserved or not applicable to this API.",""),
- RRC_3_89(ResponseCode.ERROR, 89, "This reason code is reserved or not applicable to this API.",""),
- RRC_3_90(ResponseCode.ERROR, 90, "This reason code is reserved or not applicable to this API.",""),
- RRC_3_91(ResponseCode.ERROR, 91, "Version 2.5 is no longer supported.",""),
- RRC_3_92(ResponseCode.ERROR, 92, "The gateway no longer supports the requested method of integration.",""),
- RRC_3_97(ResponseCode.ERROR, 97, "This transaction cannot be accepted.", "Applicable only to SIM API. Fingerprints are only valid for a short period of time. If the fingerprint is more than one hour old or more than 15 minutes into the future, it will be rejected. This code indicates that the transaction fingerprint has expired."),
- RRC_3_98(ResponseCode.ERROR, 98, "This transaction cannot be accepted.", "Applicable only to SIM API. The transaction fingerprint has already been used."),
- RRC_3_99(ResponseCode.ERROR, 99, "This transaction cannot be accepted.", "Applicable only to SIM API. The server-generated fingerprint does not match the merchant-specified fingerprint in the x_fp_hash field."),
- RRC_3_100(ResponseCode.ERROR, 100, "The eCheck.Net type is invalid.", "Applicable only to eCheck.Net. The value specified in the x_echeck_type field is invalid."),
- RRC_3_101(ResponseCode.ERROR, 101, "The given name on the account and/or the account type does not match the actual account.", "Applicable only to eCheck.Net. The specified name on the account and/or the account type do not match the NOC record for this account."),
- RRC_3_102(ResponseCode.ERROR, 102, "This request cannot be accepted.", "A password or Transaction Key was submitted with this WebLink request. This is a high security risk."),
- RRC_3_103(ResponseCode.ERROR, 103, "This transaction cannot be accepted.", "A valid fingerprint, Transaction Key, or password is required for this transaction."),
- RRC_3_104(ResponseCode.ERROR, 104, "This transaction is currently under review.", "Applicable only to eCheck.Net. The value submitted for country failed validation."),
- RRC_3_105(ResponseCode.ERROR, 105, "This transaction is currently under review.", "Applicable only to eCheck.Net. The values submitted for city and country failed validation."),
- RRC_3_106(ResponseCode.ERROR, 106, "This transaction is currently under review.", "Applicable only to eCheck.Net. The value submitted for company failed validation."),
- RRC_3_107(ResponseCode.ERROR, 107, "This transaction is currently under review.", "Applicable only to eCheck.Net. The value submitted for bank account name failed validation."),
- RRC_3_108(ResponseCode.ERROR, 108, "This transaction is currently under review.", "Applicable only to eCheck.Net. The values submitted for first name and last name failed validation."),
- RRC_3_109(ResponseCode.ERROR, 109, "This transaction is currently under review.", "Applicable only to eCheck.Net. The values submitted for first name and last name failed validation."),
- RRC_3_110(ResponseCode.ERROR, 110, "This transaction is currently under review.", "Applicable only to eCheck.Net. The value submitted for bank account name does not contain valid characters."),
- RRC_3_116(ResponseCode.ERROR, 116, "The authentication indicator is invalid.", "This error is only applicable to Verified by Visa and MasterCard SecureCode transactions. The ECI value for a Visa transaction; or the UCAF indicator for a MasterCard transaction submitted in the x_authentication_indicator field is invalid."),
- RRC_3_117(ResponseCode.ERROR, 117, "The cardholder authentication value is invalid.", "This error is only applicable to Verified by Visa and MasterCard SecureCode transactions. The CAVV for a Visa transaction; or the AVV/UCAF for a MasterCard transaction is invalid."),
- RRC_3_118(ResponseCode.ERROR, 118, "The combination of authentication indicator and cardholder authentication value is invalid.", "This error is only applicable to Verified by Visa and MasterCard SecureCode transactions. The combination of authentication indicator and cardholder authentication value for a Visa or MasterCard transaction is invalid. For more information, see the Cardholder Authentication section of this document."),
- RRC_3_119(ResponseCode.ERROR, 119, "Transactions having cardholder authentication values cannot be marked as recurring.", "This error is only applicable to Verified by Visa and MasterCard SecureCode transactions. Transactions submitted with a value in x_authentication_indicator and x_recurring_billing=YES will be rejected."),
- RRC_3_120(ResponseCode.ERROR, 120, "An error occurred during processing. Please try again.", "The system-generated void for the original timed-out transaction failed.The original transaction timed out while waiting for a response from the authorizer.)"),
- RRC_3_121(ResponseCode.ERROR, 121, "An error occurred during processing. Please try again.", "The system-generated void for the original errored transaction failed.The original transaction experienced a database error."),
- RRC_3_122(ResponseCode.ERROR, 122, "An error occurred during processing. Please try again.", "The system-generated void for the original errored transaction failed.The original transaction experienced a processing error."),
- RRC_3_123(ResponseCode.ERROR, 123, "This account has not been given the permission",""),
- RRC_2_127(ResponseCode.DECLINED, 127, "The transaction resulted in an AVS mismatch. The address provided does not match billing address of cardholder.", "The system-generated void for the original AVS-rejected transaction failed."),
- RRC_3_128(ResponseCode.ERROR, 128, "This transaction cannot be processed.", "The customer'ges financial institution does not currently allow transactions for this account."),
- RRC_3_130(ResponseCode.ERROR, 130, "This payment gateway account has been closed.", "IFT: The payment gateway account status is Blacklisted."),
- RRC_3_131(ResponseCode.ERROR, 131, "This transaction cannot be accepted at this time.", "IFT: The payment gateway account status is Suspended-STA."),
- RRC_3_132(ResponseCode.ERROR, 132, "This transaction cannot be accepted at this time.", "IFT: The payment gateway account status is Suspended-Blacklist."),
- RRC_2_141(ResponseCode.DECLINED, 141, "This transaction has been declined.", "The system-generated void for the original FraudScreen-rejected transaction failed."),
- RRC_2_145(ResponseCode.DECLINED, 145, "This transaction has been declined.", "The system-generated void for the original card code-rejected and AVS-rejected transaction failed."),
- RRC_3_152(ResponseCode.ERROR, 152, "The transaction was authorized, but the client could not be notified; the transaction will not be settled.", "The system-generated void for the original transaction failed. The response for the original transaction could not be communicated to the client."),
- RRC_2_165(ResponseCode.DECLINED, 165, "This transaction has been declined.", "The system-generated void for the original card code-rejected transaction failed."),
- RRC_3_170(ResponseCode.ERROR, 170, "An error occurred during processing. Please contact the merchant.", "Concord EFS Provisioning at the processor has not been completed."),
- RRC_2_171(ResponseCode.DECLINED, 171, "An error occurred during processing. Please contact the merchant.", "Concord EFS This request is invalid."),
- RRC_2_172(ResponseCode.DECLINED, 172, "An error occurred during processing. Please contact the merchant.", "Concord EFS The store ID is invalid."),
- RRC_3_173(ResponseCode.ERROR, 173, "An error occurred during processing. Please contact the merchant.", "Concord EFS The store key is invalid."),
- RRC_2_174(ResponseCode.DECLINED, 174, "The transaction type is invalid. Please contact the merchant.", "Concord EFS This transaction type is not accepted by the processor."),
- RRC_3_175(ResponseCode.ERROR, 175, "The processor does not allow voiding of credits.", "Concord EFS This transaction is not allowed. The Concord EFS processing platform does not support voiding credit transactions. Please debit the credit card instead of voiding the credit."),
- RRC_3_180(ResponseCode.ERROR, 180, "An error occurred during processing. Please try again.", "The processor response format is invalid."),
- RRC_3_181(ResponseCode.ERROR, 181, "An error occurred during processing. Please try again.", "The system-generated void for the original invalid transaction failed.The original transaction included an invalid processor response format.)"),
- RRC_3_185(ResponseCode.ERROR, 185, "This reason code is reserved or not applicable to this API.", ""),
- RRC_4_193(ResponseCode.REVIEW, 193, "The transaction is currently under review.", "The transaction was placed under review by the risk management system."),
- RRC_2_200(ResponseCode.DECLINED, 200, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The credit card number is invalid."),
- RRC_2_201(ResponseCode.DECLINED, 201, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The expiration date is invalid."),
- RRC_2_202(ResponseCode.DECLINED, 202, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The transaction type is invalid."),
- RRC_2_203(ResponseCode.DECLINED, 203, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The value submitted in the amount field is invalid."),
- RRC_2_204(ResponseCode.DECLINED, 204, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The department code is invalid."),
- RRC_2_205(ResponseCode.DECLINED, 205, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The value submitted in the merchant number field is invalid."),
- RRC_2_206(ResponseCode.DECLINED, 206, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The merchant is not on file."),
- RRC_2_207(ResponseCode.DECLINED, 207, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The merchant account is closed."),
- RRC_2_208(ResponseCode.DECLINED, 208, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The merchant is not on file."),
- RRC_2_209(ResponseCode.DECLINED, 209, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. Communication with the processor could not be established."),
- RRC_2_210(ResponseCode.DECLINED, 210, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The merchant type is incorrect."),
- RRC_2_211(ResponseCode.DECLINED, 211, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The cardholder is not on file."),
- RRC_2_212(ResponseCode.DECLINED, 212, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The bank configuration is not on file"),
- RRC_2_213(ResponseCode.DECLINED, 213, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The merchant assessment code is incorrect."),
- RRC_2_214(ResponseCode.DECLINED, 214, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. This function is currently unavailable."),
- RRC_2_215(ResponseCode.DECLINED, 215, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The encrypted PIN field format is invalid."),
- RRC_2_216(ResponseCode.DECLINED, 216, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The ATM term ID is invalid."),
- RRC_2_217(ResponseCode.DECLINED, 217, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. This transaction experienced a general message format problem."),
- RRC_2_218(ResponseCode.DECLINED, 218, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The PIN block format or PIN availability value is invalid."),
- RRC_2_219(ResponseCode.DECLINED, 219, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The ETC void is unmatched."),
- RRC_2_220(ResponseCode.DECLINED, 220, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The primary CPU is not available."),
- RRC_2_221(ResponseCode.DECLINED, 221, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. The SE number is invalid."),
- RRC_2_222(ResponseCode.DECLINED, 222, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. Duplicate auth requestfrom INAS)."),
- RRC_2_223(ResponseCode.DECLINED, 223, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. This transaction experienced an unspecified error."),
- RRC_2_224(ResponseCode.DECLINED, 224, "This transaction has been declined.", "This error code applies only to merchants on FDC Omaha. Please re-enter the transaction."),
- RRC_3_243(ResponseCode.ERROR, 243, "Recurring billing is not allowed for this eCheck.Net type.", "The combination of values submitted for x_recurring_billing and x_echeck_type is not allowed."),
- RRC_3_244(ResponseCode.ERROR, 244, "This eCheck.Net type is not allowed for this Bank Account Type.", "The combination of values submitted for x_bank_acct_type and x_echeck_type is not allowed."),
- RRC_3_245(ResponseCode.ERROR, 245, "This eCheck.Net type is not allowed when using the payment gateway hosted payment form.", "The value submitted for x_echeck_type is not allowed when using the payment gateway hosted payment form."),
- RRC_3_246(ResponseCode.ERROR, 246, "This eCheck.Net type is not allowed.", "The merchant'ges payment gateway account is not enabled to submit the eCheck.Net type."),
- RRC_3_247(ResponseCode.ERROR, 247, "This eCheck.Net type is not allowed.", "The combination of values submitted for x_type and x_echeck_type is not allowed."),
- RRC_3_248(ResponseCode.ERROR, 248, "The check number is invalid.", "Invalid check number. Check number can only consist of letters and numbers and not more than 15 characters."),
- RRC_2_250(ResponseCode.DECLINED, 250, "This transaction has been declined.", "This transaction was submitted from a blocked IP address."),
- RRC_2_251(ResponseCode.DECLINED, 251, "This transaction has been declined.", "The transaction was declined as a result of triggering a Fraud Detection Suite filter."),
- RRC_4_252(ResponseCode.REVIEW, 252, "Your order has been received. Thank you for your business!", "The transaction was accepted, but is being held for merchant review. The merchant can customize the customer response in the Merchant Interface."),
- RRC_4_253(ResponseCode.REVIEW, 253, "Your order has been received. Thank you for your business!", "The transaction was accepted and was authorized, but is being held for merchant review. The merchant can customize the customer response in the Merchant Interface."),
- RRC_2_254(ResponseCode.DECLINED, 254, "Your transaction has been declined.", "The transaction was declined after manual review."),
- RRC_3_261(ResponseCode.ERROR, 261, "An error occurred during processing. Please try again.", "The transaction experienced an error during sensitive data encryption and was not processed. Please try again."),
- RRC_3_270(ResponseCode.ERROR, 270, "The line itemitem number] is invalid.", "A value submitted in x_line_item for the item referenced is invalid."),
- RRC_3_271(ResponseCode.ERROR, 271, "The number of line items submitted is not allowed. A maximum of 30 line items can be submitted.", "The number of line items submitted exceeds the allowed maximum of 30."),
- RRC_3_288(ResponseCode.ERROR, 288, "Merchant is not registered as a Cardholder Authentication participant. This transaction cannot be accepted.", "The merchant has not indicated participation in any Cardholder Authentication Programs in the Merchant Interface."),
- RRC_3_289(ResponseCode.ERROR, 289, "This processor does not accept zero dollar authorization for this card type.", "Your credit card processing service does not yet accept zero dollar authorizations for Visa credit cards. You can find your credit card processor listed on your merchant profile."),
- RRC_3_290(ResponseCode.ERROR, 290, "One or more required AVS values for zero dollar authorization were not submitted.", "When submitting authorization requests for Visa, the address and zip code fields must be entered."),
- RRC_4_295(ResponseCode.REVIEW, 295, "The amount of this request was only partially approved on the given prepaid card. Additional payments are required to complete the balance of this transaction.", " The merchant must have partial authorization enabled in the merchant interface in order to receive this error."),
- RRC_3_296(ResponseCode.ERROR, 296, "The specified SplitTenderId is not valid.", ""),
- RRC_3_297(ResponseCode.ERROR, 297, "A Transaction ID and a Split Tender ID cannot both be used in a single transaction request.", ""),
- RRC_3_300(ResponseCode.ERROR, 300, "The device ID is invalid.", "The value submitted for x_device_id is invalid."),
- RRC_3_301(ResponseCode.ERROR, 301, "The device batch ID is invalid.", "The value submitted for x_device_batch_id is invalid."),
- RRC_3_302(ResponseCode.ERROR, 302, "The reversal flag is invalid.", "The value submitted for x_reversal is invalid."),
- RRC_3_303(ResponseCode.ERROR, 303, "The device batch is full. Please close the batch.", "The current device batch must be closed manually from the POS device."),
- RRC_3_304(ResponseCode.ERROR, 304, "The original transaction is in a closed batch.", "The original transaction has been settled and cannot be reversed."),
- RRC_3_305(ResponseCode.ERROR, 305, "The merchant is configured for auto-close.", "This merchant is configured for auto-close and cannot manually close batches."),
- RRC_3_306(ResponseCode.ERROR, 306, "The batch is already closed.", "The batch is already closed."),
- RRC_1_307(ResponseCode.APPROVED, 307, "The reversal was processed successfully.", "The reversal was processed successfully."),
- RRC_1_308(ResponseCode.APPROVED, 308, "Original transaction for reversal not found.", "The transaction submitted for reversal was not found."),
- RRC_3_309(ResponseCode.ERROR, 309, "The device has been disabled.", "The device has been disabled."),
- RRC_1_310(ResponseCode.APPROVED, 310, "This transaction has already been voided.", "This transaction has already been voided."),
- RRC_1_311(ResponseCode.APPROVED, 311, "This transaction has already been captured", "This transaction has already been captured."),
- RRC_2_315(ResponseCode.DECLINED, 315, "The credit card number is invalid.", "This is a processor-issued decline."),
- RRC_2_316(ResponseCode.DECLINED, 316, "The credit card expiration date is invalid.", "This is a processor-issued decline."),
- RRC_2_317(ResponseCode.DECLINED, 317, "The credit card has expired.", "This is a processor-issued decline."),
- RRC_2_318(ResponseCode.DECLINED, 318, "A duplicate transaction has been submitted.", "This is a processor-issued decline."),
- RRC_2_319(ResponseCode.DECLINED, 319, "The transaction cannot be found.", "This is a processor-issued decline."),
- RRC_3_320(ResponseCode.ERROR, 320, "The device identifier is either not registered or not enabled.", ""),
- RRC_0_0(ResponseCode.UNKNOWN, 0, "Unknown.","");
-
-
- final private ResponseCode responseCode;
- final private int responseReasonCode;
- private String reasonText;
- final private String notes;
-
- private ResponseReasonCode(ResponseCode responseCode, int responseReasonCode, String reasonText, String notes) {
- this.responseCode = responseCode;
- this.responseReasonCode = responseReasonCode;
- this.reasonText = reasonText;
- this.notes = notes;
- }
-
- /**
- * Lookup a response reason code by the reason response code itself.
- *
- * @param reasonCode
- * @return Returns a ResponseReasonCode if a reasonCode match is found.
- */
- public static ResponseReasonCode findByReasonCode(int reasonCode) {
- for(ResponseReasonCode responseReasonCode : values()) {
- if(responseReasonCode.responseReasonCode == reasonCode) {
- return responseReasonCode;
- }
- }
-
- return ResponseReasonCode.RRC_0_0;
- }
-
- /**
- * Lookup a response reason code by the reason response code itself.
- *
- * @param reasonCode
- * @return Returns a ResponseReasonCode if a reasonCode match is found.
- */
- public static ResponseReasonCode findByReasonCode(String reasonCode) {
- if(StringUtils.isNotEmpty(reasonCode)) {
- return findByReasonCode(Integer.parseInt(reasonCode));
- }
-
- return ResponseReasonCode.RRC_0_0;
- }
-
- /**
- * @return the responseCode
- */
- public ResponseCode getResponseCode() {
- return responseCode;
- }
-
- /**
- * @return the responseReasonCode
- */
- public int getResponseReasonCode() {
- return responseReasonCode;
- }
-
- /**
- * @return the reasonText
- */
- public String getReasonText() {
- return reasonText;
- }
-
- /**
- * Set the reasonText.
- *
- * @param reasonText
- */
- public void setReasonText(String reasonText) {
- if(StringUtils.isNotEmpty(reasonText)) {
- this.reasonText = reasonText;
- }
- }
-
- /**
- * @return the notes
- */
- public String getNotes() {
- return notes;
- }
-
-}
diff --git a/src/net/authorize/Result.java b/src/net/authorize/Result.java
deleted file mode 100644
index 9b5efb3..0000000
--- a/src/net/authorize/Result.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package net.authorize;
-
-import java.io.Serializable;
-
-
-public abstract class Result implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- protected ITransaction requestTransaction;
-
- /* (non-Javadoc)
- * @see net.authorize.IResult#getRequestTransaction()
- */
- public ITransaction getRequestTransaction() {
- return this.requestTransaction;
- }
-
-}
diff --git a/src/net/authorize/TransactionType.java b/src/net/authorize/TransactionType.java
deleted file mode 100644
index 55cdcf1..0000000
--- a/src/net/authorize/TransactionType.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package net.authorize;
-
-
-/**
- * The credit card transaction types supported by the payment gateway.
- */
-public enum TransactionType {
- AUTH_CAPTURE("AUTH_CAPTURE", "authCaptureTransaction", "profileTransAuthCapture"),
- AUTH_ONLY("AUTH_ONLY", "authOnlyTransaction", "profileTransAuthOnly"),
- PRIOR_AUTH_CAPTURE("PRIOR_AUTH_CAPTURE", "priorAuthCaptureTransaction", "profileTransPriorAuthCapture"),
- CAPTURE_ONLY("CAPTURE_ONLY", "captureOnlyTransaction", "profileTransCaptureOnly"),
- CREDIT("CREDIT", "refundTransaction", "profileTransRefund"),
- UNLINKED_CREDIT("CREDIT", "refundTransaction", "profileTransRefund"),
- VOID("VOID", "voidTransaction", "profileTransVoid");
-
- final private String nvpValue;
- final private String xmlValue;
- final private String cimValue;
-
- private TransactionType(String nvpValue, String xmlValue, String cimValue) {
- this.nvpValue = nvpValue;
- this.xmlValue = xmlValue;
- this.cimValue = cimValue;
- }
-
- /**
- * Return the value needed for SIM/DPM integrations.
- *
- * @return the value
- *
- * @deprecated As of release 2.0.0, replaced by {@link #getNVPValue()}
- */
- @Deprecated
- public String getValue() {
- return nvpValue;
- }
-
- /**
- * Return the value needed for SIM/DPM integrations.
- *
- * @return the value
- */
- public String getNVPValue() {
- return nvpValue;
- }
-
- /**
- * Return the value needed for CIM integrations.
- *
- * @return cim transaction type value.
- */
- public String getCIMValue() {
- return cimValue;
- }
-
- /**
- * Return the value needed for AIM (XML-based) integrations.
- * @return the xmlValue
- */
- public String getXmlValue() {
- return xmlValue;
- }
-
-
-}
diff --git a/src/net/authorize/aim/Result.java b/src/net/authorize/aim/Result.java
deleted file mode 100644
index a3d67ac..0000000
--- a/src/net/authorize/aim/Result.java
+++ /dev/null
@@ -1,898 +0,0 @@
-package net.authorize.aim;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Map;
-
-import net.authorize.AuthNetField;
-import net.authorize.ITransaction;
-import net.authorize.ResponseCode;
-import net.authorize.ResponseReasonCode;
-import net.authorize.cim.Transaction;
-import net.authorize.data.aim.PrepaidCard;
-import net.authorize.data.aim.SplitTenderPayment;
-import net.authorize.data.creditcard.AVSCode;
-import net.authorize.data.creditcard.CardType;
-import net.authorize.data.reporting.CAVVResponseType;
-import net.authorize.data.reporting.CardCodeResponseType;
-import net.authorize.util.StringUtils;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * Extends the core net.authorize.xml.Result for specific AIM result data.
- *
- */
-public class Result extends net.authorize.xml.Result implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private String authCode;
- private AVSCode avsResultCode;
- private CardCodeResponseType cardCodeResponse;
- private CAVVResponseType cavvResultCode;
- private String transId;
- private String refTransId;
- private String transHash;
- private boolean testRequest;
- private String accountNumber;
- private CardType accountType;
- private String responseText;
- private String splitTenderId;
- private PrepaidCard prepaidCard;
- private ArrayList splitTenderPayments;
- protected Hashtable merchantDefinedMap = new Hashtable();
- private ArrayList transactionResponseMessages = new ArrayList();
- private ArrayList transactionResponseErrors = new ArrayList();
-
- protected Result() {
- }
-
- /**
- * Result constructor.
- *
- * @param requestTransaction
- * @param response
- */
- protected Result(ITransaction requestTransaction, String response) {
- super(requestTransaction, response);
- }
-
- /**
- * Create a Result from the request and response data.
- *
- * @param requestTransaction
- * @param response
- *
- * @return Result
- */
- public static Result createResult(ITransaction requestTransaction,
- String response) {
- Result result = new Result(requestTransaction, response);
-
- NodeList txnResponseNodeList = result
- .getXmlResponseDoc()
- .getDocument()
- .getDocumentElement()
- .getElementsByTagName(
- AuthNetField.ELEMENT_TRANSACTION_RESPONSE
- .getFieldName());
- if (txnResponseNodeList == null || txnResponseNodeList.getLength() == 0) {
- return result;
- }
-
- Element docElement = (Element) txnResponseNodeList.item(0);
-
- result.setResponseCode(result.importResponseCode(docElement));
- result.setAuthCode(result.importAuthCode(docElement));
- result.setAvsResultCode(result.importAVSResultCode(docElement));
- result.setCardCodeResponse(result.importCardCodeResponse(docElement));
- result.setCavvResultCode(result.importCAVVResultCode(docElement));
- result.setTransId(result.importTransId(docElement));
- result.setRefTransId(result.importRefTransId(docElement));
- result.setTransHash(result.importTransHash(docElement));
- result.setTestRequest(result.importTestRequest(docElement));
- result.setAccountNumber(result.importAccountNumber(docElement));
- result.setAccountType(result.importAccountType(docElement));
- result.setTransactionResponseMessages(result
- .importTxnResponseMessages(docElement));
- result.setTransactionResponseErrors(result.importErrors(docElement));
- result.setPrepaidCard(result.importPrepaidCard(docElement));
- result.setSplitTenderId(result.importSplitTenderId(docElement));
- result.setSplitTenderPayments(result
- .importSplitTenderPayments(docElement));
- result.setMerchantDefinedMap(result
- .importMerchantDefinedFields(docElement));
-
- return result;
- }
-
- /**
- * Import merchant defined fields.
- *
- * @param docElement
- *
- * @return Hashtable of the merchant defined fields (MDFs)
- */
- private Hashtable importMerchantDefinedFields(
- Element docElement) {
- Hashtable retval = new Hashtable();
- NodeList user_fields_list = docElement
- .getElementsByTagName(AuthNetField.ELEMENT_USER_FIELDS
- .getFieldName());
- if (user_fields_list.getLength() == 0) {
- return retval;
- }
-
- Element user_fields_el = (Element) user_fields_list.item(0);
-
- NodeList user_field_list = user_fields_el
- .getElementsByTagName(AuthNetField.ELEMENT_USER_FIELD
- .getFieldName());
- for (int i = 0; i < user_field_list.getLength(); i++) {
- Element user_field_el = (Element) user_field_list.item(i);
- String name = getElementText(user_field_el,
- AuthNetField.ELEMENT_NAME.getFieldName());
- String value = getElementText(user_field_el,
- AuthNetField.ELEMENT_VALUE.getFieldName());
- retval.put(name, value);
- }
-
- return retval;
- }
-
- /**
- * Import prepaid card information.
- *
- * @param docElement
- *
- * @return prepaid card container
- */
- private PrepaidCard importPrepaidCard(Element docElement) {
- NodeList prepaid_card_list = docElement
- .getElementsByTagName(AuthNetField.ELEMENT_PREPAID_CARD
- .getFieldName());
- if (prepaid_card_list.getLength() == 0) {
- return null;
- }
-
- Element prepaid_card_el = (Element) prepaid_card_list.item(0);
- PrepaidCard retval = PrepaidCard.createPrepaidCard();
-
- retval.setRequestedAmount(this
- .importSplitTenderRequestedAmount(prepaid_card_el));
- retval.setApprovedAmount(this
- .importSplitTenderApprovedAmount(prepaid_card_el));
- retval.setBalanceOnCard(this
- .importSplitTenderBalanceOnCard(prepaid_card_el));
-
- return retval;
- }
-
- /**
- * Import split tender payments.
- *
- * @param docElement
- *
- * @return an ArrayList of SpringTenderPayment objects
- */
- private ArrayList importSplitTenderPayments(
- Element docElement) {
- ArrayList retval = new ArrayList();
- NodeList split_tender_payments_list = docElement
- .getElementsByTagName(AuthNetField.ELEMENT_SPLIT_TENDER_PAYMENTS
- .getFieldName());
- if (split_tender_payments_list.getLength() == 0) {
- return retval;
- }
-
- Element split_tender_payments_el = (Element) split_tender_payments_list
- .item(0);
-
- NodeList split_tender_payment_list = split_tender_payments_el
- .getElementsByTagName(AuthNetField.ELEMENT_SPLIT_TENDER_PAYMENT
- .getFieldName());
- for (int i = 0; i < split_tender_payment_list.getLength(); i++) {
- Element split_tender_el = (Element) split_tender_payment_list
- .item(i);
- SplitTenderPayment splitTenderPayment = SplitTenderPayment
- .createSplitTenderPayment();
- splitTenderPayment.setTransId(this.importTransId(split_tender_el));
- splitTenderPayment.setResponseCode(this
- .importResponseCode(split_tender_el));
- splitTenderPayment.setResponseToCustomer(this
- .importResponseToCustomer(split_tender_el));
- splitTenderPayment
- .setAuthCode(this.importAuthCode(split_tender_el));
- splitTenderPayment.setAccountNumber(this
- .importAccountNumber(split_tender_el));
- splitTenderPayment.setAccountType(this
- .importAccountType(split_tender_el));
- splitTenderPayment.setRequestedAmount(this
- .importSplitTenderRequestedAmount(split_tender_el));
- splitTenderPayment.setApprovedAmount(this
- .importSplitTenderApprovedAmount(split_tender_el));
- splitTenderPayment.setBalanceOnCard(this
- .importSplitTenderBalanceOnCard(split_tender_el));
-
- retval.add(splitTenderPayment);
- }
-
- return retval;
- }
-
- /**
- * Import the errors.
- *
- * @param docElement
- *
- * @return an ArrayList of ResponseReasonCode
- */
- private ArrayList importErrors(Element docElement) {
- ArrayList retval = new ArrayList();
- NodeList errors_list = docElement
- .getElementsByTagName(AuthNetField.ELEMENT_ERRORS
- .getFieldName());
- if (errors_list.getLength() == 0) {
- return retval;
- }
-
- Element errors_el = (Element) errors_list.item(0);
-
- NodeList error_list = errors_el
- .getElementsByTagName(AuthNetField.ELEMENT_ERROR.getFieldName());
- for (int i = 0; i < error_list.getLength(); i++) {
- Element error_el = (Element) error_list.item(i);
- ResponseReasonCode error = ResponseReasonCode
- .findByReasonCode(getElementText(error_el,
- AuthNetField.ELEMENT_ERROR_CODE.getFieldName()));
- error.setReasonText(getElementText(error_el,
- AuthNetField.ELEMENT_ERROR_TEXT.getFieldName()));
- retval.add(error);
- }
-
- return retval;
- }
-
- /**
- * Import the transaction response messages.
- *
- * @param docElement
- *
- * @return an ArrayList of ResponseReasonCode
- */
- private ArrayList importTxnResponseMessages(
- Element docElement) {
- ArrayList retval = new ArrayList();
- NodeList messages_list = docElement
- .getElementsByTagName(AuthNetField.ELEMENT_MESSAGES
- .getFieldName());
- if (messages_list.getLength() == 0) {
- return retval;
- }
-
- Element messages_el = (Element) messages_list.item(0);
-
- NodeList message_list = messages_el
- .getElementsByTagName(AuthNetField.ELEMENT_MESSAGE
- .getFieldName());
- for (int i = 0; i < message_list.getLength(); i++) {
- Element message_el = (Element) message_list.item(i);
- ResponseReasonCode new_message = ResponseReasonCode
- .findByReasonCode(getElementText(message_el,
- AuthNetField.ELEMENT_CODE.getFieldName()));
- new_message.setReasonText(getElementText(message_el,
- AuthNetField.ELEMENT_DESCRIPTION.getFieldName()));
- retval.add(new_message);
- }
-
- return retval;
- }
-
- /**
- * Import the account type.
- *
- * @param docElement
- *
- * @return a CardType
- */
- private CardType importAccountType(Element docElement) {
- return CardType.findByValue(getElementText(docElement,
- AuthNetField.ELEMENT_ACCOUNT_TYPE.getFieldName()));
- }
-
- /**
- * Import the account number.
- *
- * @param docElement
- *
- * @return account number
- */
- private String importAccountNumber(Element docElement) {
- return getElementText(docElement,
- AuthNetField.ELEMENT_ACCOUNT_NUMBER.getFieldName());
- }
-
- /**
- * Import the test request boolean.
- *
- * @param docElement
- *
- * @return true if the request was a test request
- */
- private boolean importTestRequest(Element docElement) {
- return StringUtils.isTrue(getElementText(docElement,
- AuthNetField.ELEMENT_TEST_REQUEST.getFieldName()));
- }
-
- /**
- * Import the transaction hash.
- *
- * @param docElement
- *
- * @return transaction hash
- */
- private String importTransHash(Element docElement) {
- return getElementText(docElement,
- AuthNetField.ELEMENT_TRANS_HASH.getFieldName());
- }
-
- /**
- * Import the ref. transaction id
- *
- * @param docElement
- *
- * @return a String that is the ref. transaction id
- */
- private String importRefTransId(Element docElement) {
- return getElementText(docElement,
- AuthNetField.ELEMENT_REF_TRANS_IDD.getFieldName());
- }
-
- /**
- * Import the split tender id
- *
- * @param docElement
- *
- * @return a String that is the split tender id
- */
- private String importSplitTenderId(Element docElement) {
- return getElementText(docElement,
- AuthNetField.ELEMENT_SPLIT_TENDER_ID.getFieldName());
- }
-
- /**
- * Import the trans id.
- *
- * @param docElement
- *
- * @return a String that is the trans id
- */
- private String importTransId(Element docElement) {
- return getElementText(docElement,
- AuthNetField.ELEMENT_TRANS_ID.getFieldName());
- }
-
- /**
- * Import the response to customer.
- *
- * @param docElement
- *
- * @return a String that is the response to the customer
- */
- private String importResponseToCustomer(Element docElement) {
- return getElementText(docElement,
- AuthNetField.ELEMENT_RESPONSE_TO_CUSTOMER.getFieldName());
- }
-
- /**
- * Import the requested amount of a split transaction.
- *
- * @param docElement
- *
- * @return the requested amount of the split tender transaction
- */
- private BigDecimal importSplitTenderRequestedAmount(Element docElement) {
- BigDecimal amount = null;
-
- String amountStr = getElementText(docElement,
- AuthNetField.ELEMENT_REQUESTED_AMOUNT.getFieldName());
- if (StringUtils.isNotEmpty(amountStr)) {
- amount = new BigDecimal(amountStr);
- amount.setScale(Transaction.CURRENCY_DECIMAL_PLACES,
- BigDecimal.ROUND_HALF_UP);
- }
-
- return amount;
- }
-
- /**
- * Import the approved amount of a split transaction.
- *
- * @param docElement
- *
- * @return the approved amount of the split tender transaction
- */
- private BigDecimal importSplitTenderApprovedAmount(Element docElement) {
- BigDecimal amount = null;
-
- String amountStr = getElementText(docElement,
- AuthNetField.ELEMENT_APPROVED_AMOUNT.getFieldName());
- if (StringUtils.isNotEmpty(amountStr)) {
- amount = new BigDecimal(amountStr);
- amount.setScale(Transaction.CURRENCY_DECIMAL_PLACES,
- BigDecimal.ROUND_HALF_UP);
- }
-
- return amount;
- }
-
- /**
- * Import the balance left on a prepaid card for a split transaction.
- *
- * @param docElement
- *
- * @return the balance left on the prepaid card
- */
- private BigDecimal importSplitTenderBalanceOnCard(Element docElement) {
- BigDecimal amount = null;
-
- String amountStr = getElementText(docElement,
- AuthNetField.ELEMENT_BALANCE_ON_CARD.getFieldName());
- if (StringUtils.isNotEmpty(amountStr)) {
- amount = new BigDecimal(amountStr);
- amount.setScale(Transaction.CURRENCY_DECIMAL_PLACES,
- BigDecimal.ROUND_HALF_UP);
- }
-
- return amount;
- }
-
- /**
- * Import the response code.
- *
- * @param docElem
- *
- * @return ResponseCode
- */
- private ResponseCode importResponseCode(Element docElem) {
- return ResponseCode.findByResponseCode(getElementText(docElem,
- AuthNetField.ELEMENT_RESPONSE_CODE.getFieldName()));
- }
-
- /**
- * Import the authorization code.
- *
- * @param docElem
- *
- * @return String
- */
- private String importAuthCode(Element docElem) {
- return getElementText(docElem,
- AuthNetField.ELEMENT_AUTH_CODE.getFieldName());
- }
-
- /**
- * Import the AVS result code.
- *
- * @param docElem
- *
- * @return AVSCode
- */
- private AVSCode importAVSResultCode(Element docElem) {
- return AVSCode.findByValue(getElementText(docElem,
- AuthNetField.ELEMENT_AVS_RESULT_CODE.getFieldName()));
- }
-
- /**
- * Import the card code response.
- *
- * @param docElem
- *
- * @return CardCodeResponseType
- */
- private CardCodeResponseType importCardCodeResponse(Element docElem) {
- return CardCodeResponseType.findByValue(getElementText(docElem,
- AuthNetField.ELEMENT_CVV_RESULT_CODE.getFieldName()));
- }
-
- /**
- * Import the cardholder authentication verification code.
- *
- * @param docElem
- *
- * @param CAVVResponseType
- */
- private CAVVResponseType importCAVVResultCode(Element docElem) {
- return CAVVResponseType.findByValue(getElementText(docElem,
- AuthNetField.ELEMENT_CAVV_RESULT_CODE.getFieldName()));
- }
-
- /**
- * Return the ResponseCode
- *
- * @return ResponseCode
- */
- public ResponseCode getResponseCode() {
- return this.responseCode;
- }
-
- /**
- * Return the response text.
- *
- * @return the reponseText
- */
- public String getResponseText() {
- return responseText;
- }
-
- /**
- * Return the authorization code.
- *
- * @return the authCode
- */
- public String getAuthCode() {
- return authCode;
- }
-
- /**
- * Set the authorization code.
- *
- * @param authCode
- * the authCode to set
- */
- public void setAuthCode(String authCode) {
- this.authCode = authCode;
- }
-
- /**
- * Return the AVS result code.
- *
- * @return the avsResultCode
- */
- public AVSCode getAvsResultCode() {
- return avsResultCode;
- }
-
- /**
- * Set the AVS result code.
- *
- * @param avsResultCode
- * the avsResultCode to set
- */
- public void setAvsResultCode(AVSCode avsResultCode) {
- this.avsResultCode = avsResultCode;
- }
-
- /**
- * Return the CAVV result code.
- *
- * @return the cavvResultCode
- */
- public CAVVResponseType getCavvResultCode() {
- return cavvResultCode;
- }
-
- /**
- * Set the CAVV result code.
- *
- * @param cavvResultCode
- * the cavvResultCode to set
- */
- public void setCavvResultCode(CAVVResponseType cavvResultCode) {
- this.cavvResultCode = cavvResultCode;
- }
-
- /**
- * Return the transaction id.
- *
- * @return the transId
- */
- public String getTransId() {
- return transId;
- }
-
- /**
- * Set the transaction id.
- *
- * @param transId
- * the transId to set
- */
- public void setTransId(String transId) {
- this.transId = transId;
- }
-
- /**
- * Return the payment gateway assigned transaction ID of an original
- * transaction
- *
- * @return the refTransId
- */
- public String getRefTransId() {
- return refTransId;
- }
-
- /**
- * Set the payment gateway assigned transaction ID of an original
- * transaction
- *
- * @param refTransId
- * the refTransId to set
- */
- public void setRefTransId(String refTransId) {
- this.refTransId = refTransId;
- }
-
- /**
- * Return the payment gateway generated MD5 hash value that can be used to
- * authenticate the transaction response.
- *
- * @return the transHash
- */
- public String getTransHash() {
- return transHash;
- }
-
- /**
- * Set the payment gateway generated MD5 hash value that can be used to
- * authenticate the transaction response.
- *
- * @param transHash
- * the transHash to set
- */
- public void setTransHash(String transHash) {
- this.transHash = transHash;
- }
-
- /**
- * Return true if the request was a test request.
- *
- * @return the testRequest
- */
- public boolean isTestRequest() {
- return testRequest;
- }
-
- /**
- * Set the testRequest value.
- *
- * @param testRequest
- * the testRequest to set
- */
- public void setTestRequest(boolean testRequest) {
- this.testRequest = testRequest;
- }
-
- /**
- * Return the account number.
- *
- * @return the accountNumber
- */
- public String getAccountNumber() {
- return accountNumber;
- }
-
- /**
- * Set the account number.
- *
- * @param accountNumber
- * the accountNumber to set
- */
- public void setAccountNumber(String accountNumber) {
- this.accountNumber = accountNumber;
- }
-
- /**
- * Return the account card type.
- *
- * @return the accountType
- */
- public CardType getAccountType() {
- return accountType;
- }
-
- /**
- * Set the account card type.
- *
- * @param accountType
- * the accountType to set
- */
- public void setAccountType(CardType accountType) {
- this.accountType = accountType;
- }
-
- /**
- * Returns a list of transaction response errors.
- *
- * @return the errors
- */
- public ArrayList getTransactionResponseErrors() {
- return transactionResponseErrors;
- }
-
- /**
- * Sets the transaction response errors.
- *
- * @param errors
- * the errors to set
- */
- public void setTransactionResponseErrors(
- ArrayList errors) {
- this.transactionResponseErrors = errors;
- }
-
- /**
- * Return a list of split tender payment information.
- *
- * @return the splitTenderPayments
- */
- public ArrayList getSplitTenderPayments() {
- return splitTenderPayments;
- }
-
- /**
- * Set the split tender payment information.
- *
- * @param splitTenderPayments
- * the splitTenderPayments to set
- */
- public void setSplitTenderPayments(
- ArrayList splitTenderPayments) {
- this.splitTenderPayments = splitTenderPayments;
- }
-
- /**
- * Return the merchant defined fields map.
- *
- * @return the merchantDefinedMap
- */
- public Map getMerchantDefinedMap() {
- return merchantDefinedMap;
- }
-
- /**
- * Sets the merchant defined fields map.
- *
- * @param merchantDefinedMap
- * the merchantDefinedMap to set
- */
- public void setMerchantDefinedMap(
- Hashtable merchantDefinedMap) {
- this.merchantDefinedMap = merchantDefinedMap;
- }
-
- /**
- * Set the response code.
- *
- * @param responseCode
- * the responseCode to set
- */
- public void setResponseCode(ResponseCode responseCode) {
- this.responseCode = responseCode;
- }
-
- /**
- * Set the response text.
- *
- * @param responseText
- * the responseText to set
- */
- public void setResponseText(String responseText) {
- this.responseText = responseText;
- }
-
- /**
- * Return the card code response.
- *
- * @return the cardCodeResponse
- */
- public CardCodeResponseType getCardCodeResponse() {
- return cardCodeResponse;
- }
-
- /**
- * Set the card code response.
- *
- * @param cardCodeResponse
- * the cardCodeResponse to set
- */
- public void setCardCodeResponse(CardCodeResponseType cardCodeResponse) {
- this.cardCodeResponse = cardCodeResponse;
- }
-
- /**
- * Return the transaction response messages.
- *
- * @return the transactionResponseMessages
- */
- public ArrayList getTransactionResponseMessages() {
- return transactionResponseMessages;
- }
-
- /**
- * Set the transaction response messages.
- *
- * @param transactionResponseMessages
- * the transactionResponseMessages to set
- */
- public void setTransactionResponseMessages(
- ArrayList transactionResponseMessages) {
- this.transactionResponseMessages = transactionResponseMessages;
- }
-
- /**
- * Return the split tender transaction id.
- *
- * @return the splitTenderId
- */
- public String getSplitTenderId() {
- return splitTenderId;
- }
-
- /**
- * Set the split tender transaction id.
- *
- * @param splitTenderId
- */
- public void setSplitTenderId(String splitTenderId) {
- this.splitTenderId = splitTenderId;
- }
-
- /**
- * Return the prepaid card information.
- *
- * @return the prepaidCard
- */
- public PrepaidCard getPrepaidCard() {
- return prepaidCard;
- }
-
- /**
- * Set the prepaid card information.
- *
- * @param prepaidCard
- * the prepaidCard to set
- */
- public void setPrepaidCard(PrepaidCard prepaidCard) {
- this.prepaidCard = prepaidCard;
- }
-
- /**
- * Verify that the relay response post is actually coming from AuthorizeNet.
- *
- * @return boolean true if the txn came from Authorize.Net
- */
- public boolean isAuthorizeNet() {
-
- String amount = ((net.authorize.aim.Transaction) this
- .getRequestTransaction()).getTotalAmount().toPlainString();
-
- String md5Check = null;
-
- try {
- MessageDigest digest = java.security.MessageDigest
- .getInstance("MD5");
- String s = this.getRequestTransaction().getMerchant().getMD5Value()
- + this.getRequestTransaction().getMerchant()
- .getMerchantAuthentication().getName()
- + getTransId() + amount;
- digest.update(s.getBytes());
- md5Check = new BigInteger(1, digest.digest()).toString(16)
- .toUpperCase();
- while (md5Check.length() < 32) {
- md5Check = "0" + md5Check;
- }
- } catch (NoSuchAlgorithmException nsae) {
- //
- }
-
- return md5Check != null && md5Check.equalsIgnoreCase(transHash);
- }
-
-}
diff --git a/src/net/authorize/aim/Transaction.java b/src/net/authorize/aim/Transaction.java
deleted file mode 100644
index 4c2bf17..0000000
--- a/src/net/authorize/aim/Transaction.java
+++ /dev/null
@@ -1,955 +0,0 @@
-package net.authorize.aim;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.Hashtable;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.logging.Level;
-
-import net.authorize.AuthNetField;
-import net.authorize.Environment;
-import net.authorize.ITransaction;
-import net.authorize.Merchant;
-import net.authorize.TransactionType;
-import net.authorize.aim.cardpresent.DeviceType;
-import net.authorize.aim.cardpresent.MarketType;
-import net.authorize.data.Address;
-import net.authorize.data.Order;
-import net.authorize.data.OrderItem;
-import net.authorize.data.creditcard.CreditCardPresenceType;
-import net.authorize.util.BasicXmlDocument;
-import net.authorize.util.HttpClient;
-import net.authorize.util.StringUtils;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Container to hold all payment related information that gets passed back and
- * forth to the payment gateway.
- *
- */
-public class Transaction extends net.authorize.xml.XMLTransaction implements Serializable, ITransaction {
-
- private static final long serialVersionUID = 2L;
-
- private BigDecimal totalAmount = ZERO_AMOUNT;
- protected TransactionType transactionType;
- protected Hashtable merchantDefinedMap = new Hashtable();
-
- private String refTransId; // original transaction id of a prior auth/capture
- private String splitTenderId; // used if partial auth is set to true
- private String authCode; // auth code of prior authorization that was NOT submitted via the gateway
-
- protected Transaction() {}
-
- /**
- * Constructor for creation a transaction with typed objects.
- *
- * @param merchant - Merchant container
- * @param transactionType - Transaction type
- */
- protected Transaction(Merchant merchant,
- TransactionType transactionType) {
-
- this.merchant = merchant;
- this.transactionType = transactionType!=null?transactionType : TransactionType.AUTH_CAPTURE;
- }
-
- public static Transaction createTransaction(Merchant merchant,
- TransactionType transactionType, BigDecimal amount) {
- Transaction transaction = new Transaction(merchant, transactionType);
- transaction.totalAmount = amount;
-
- return transaction;
- }
-
- /**
- * Create a payment transaction request.
- */
- private void createTransactionRequest() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + AuthNetField.ELEMENT_CREATE_TRANSACTION_REQUEST.getFieldName()
- + " xmlns:xsi = \"" + XML_XSI + "\""
- + " xmlns:xsd = \"" + XML_XSD + "\""
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addTransactionData(document);
-
- currentRequest = document;
- }
-
- /**
- * Adds transaction specific information to the request.
- *
- * @param document
- */
- private void addTransactionData(BasicXmlDocument document) {
-
- Element transaction_req_el = document.createElement(AuthNetField.ELEMENT_TRANSACTION_REQUEST.getFieldName());
-
- // transactionType
- Element transaction_type_el = document.createElement(AuthNetField.ELEMENT_TRANSACTION_TYPE.getFieldName());
- transaction_type_el.appendChild(document.getDocument().createTextNode(this.transactionType.getXmlValue()));
- transaction_req_el.appendChild(transaction_type_el);
-
- // set up additional components for specific txn types
- Element ref_trans_id_el = null;
- Element split_tender_id_el = null;
-
- if(this.refTransId != null) {
- ref_trans_id_el = document.createElement(AuthNetField.ELEMENT_REF_TRANS_ID.getFieldName());
- ref_trans_id_el.appendChild(document.getDocument().createTextNode(this.refTransId));
- } else if (this.splitTenderId != null && this.merchant.isAllowPartialAuth()) {
- split_tender_id_el = document.createElement(AuthNetField.ELEMENT_SPLIT_TENDER_ID.getFieldName());
- split_tender_id_el.appendChild(document.getDocument().createTextNode(this.splitTenderId));
- }
-
- // amount
- Element amount_el = document.createElement(AuthNetField.ELEMENT_AMOUNT.getFieldName());
- amount_el.appendChild(document.getDocument().createTextNode(
- this.totalAmount.setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()));
- transaction_req_el.appendChild(amount_el);
-
-
- switch (this.transactionType) {
- case AUTH_ONLY:
- case AUTH_CAPTURE:
- case PRIOR_AUTH_CAPTURE:
- case CREDIT:
- case VOID:
- // payment
- if(this.creditCard != null || this.bankAccount != null) {
- transaction_req_el.appendChild(
- createPaymentElement(document.createElement(AuthNetField.ELEMENT_PAYMENT.getFieldName())));
- }
-
- // check on the refTransId/splitTransId
- if(ref_trans_id_el != null) {
- transaction_req_el.appendChild(ref_trans_id_el);
- } else if (split_tender_id_el != null) {
- transaction_req_el.appendChild(split_tender_id_el);
- }
-
- break;
- case CAPTURE_ONLY:
- // payment
- transaction_req_el.appendChild(
- createPaymentElement(document.createElement(AuthNetField.ELEMENT_PAYMENT.getFieldName())));
-
- Element auth_code_el = document.createElement(AuthNetField.ELEMENT_AUTH_CODE.getFieldName());
- auth_code_el.appendChild(document.getDocument().createTextNode(this.authCode));
- transaction_req_el.appendChild(auth_code_el);
-
- // check on the refTransId/splitTransId
- if(ref_trans_id_el != null) {
- transaction_req_el.appendChild(ref_trans_id_el);
- } else if (split_tender_id_el != null) {
- transaction_req_el.appendChild(split_tender_id_el);
- }
-
- break;
- default:
- // payment
- transaction_req_el.appendChild(
- createPaymentElement(document.createElement(AuthNetField.ELEMENT_PAYMENT.getFieldName())));
-
- break;
- }
-
- // order
- transaction_req_el.appendChild(
- createOrderElement(document.createElement(AuthNetField.ELEMENT_ORDER.getFieldName())));
-
- // line items
- transaction_req_el.appendChild(
- createLineItemsElement(document.createElement(AuthNetField.ELEMENT_LINE_ITEMS.getFieldName())));
-
- // shipping charges
- if(this.shippingCharges != null) {
- // tax
- transaction_req_el.appendChild(
- createTaxElement(document.createElement(AuthNetField.ELEMENT_TAX.getFieldName())));
- // duty
- transaction_req_el.appendChild(
- createDutyElement(document.createElement(AuthNetField.ELEMENT_DUTY.getFieldName())));
- // shipping
- transaction_req_el.appendChild(
- createShippingElement(document.createElement(AuthNetField.ELEMENT_SHIPPING.getFieldName())));
- }
-
- // order po number
- if(order != null && StringUtils.isNotEmpty(order.getPurchaseOrderNumber())) {
- Element invoice_number_el = document.createElement(AuthNetField.ELEMENT_PO_NUMBER.getFieldName());
- invoice_number_el.appendChild(document.getDocument().createTextNode(order.getPurchaseOrderNumber()));
- transaction_req_el.appendChild(invoice_number_el);
- }
-
- // customer
- transaction_req_el.appendChild(
- createCustomerElement(document.createElement(AuthNetField.ELEMENT_CUSTOMER.getFieldName())));
-
- // billTo
- transaction_req_el.appendChild(
- createBillToElement(document.createElement(AuthNetField.ELEMENT_BILL_TO.getFieldName())));
-
- // shipTo
- transaction_req_el.appendChild(
- createShipToElement(document.createElement(AuthNetField.ELEMENT_SHIP_TO.getFieldName())));
-
- // customerIP
- if(customer != null && customer.getCustomerIP() != null) {
- Element customer_ip_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_IP.getFieldName());
- customer_ip_el.appendChild(document.getDocument().createTextNode(
- this.customer.getCustomerIP()));
- transaction_req_el.appendChild(customer_ip_el);
- }
-
- // cardholder auth
- if(this.creditCard != null
- && this.creditCard.getCardholderAuthenticationIndicator() != null
- && this.creditCard.getCardholderAuthenticationValue() != null) {
-
- Element auth_indicator_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_IP.getFieldName());
- auth_indicator_el.appendChild(document.getDocument().createTextNode(
- this.creditCard.getCardholderAuthenticationIndicator()));
- transaction_req_el.appendChild(auth_indicator_el);
-
- Element cardholder_auth_value_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_IP.getFieldName());
- cardholder_auth_value_el.appendChild(document.getDocument().createTextNode(
- this.creditCard.getCardholderAuthenticationValue()));
- transaction_req_el.appendChild(cardholder_auth_value_el);
- }
-
- Element retail_el = document.createElement(AuthNetField.ELEMENT_RETAIL.getFieldName());
-
- if(this.merchant.getMarketType() != null) {
- Element market_type_el = document.createElement(AuthNetField.ELEMENT_MARKET_TYPE.getFieldName());
- market_type_el.appendChild(document.getDocument().createTextNode(
- this.merchant.getMarketType().getValue()));
- retail_el.appendChild(market_type_el);
- }
-
- if(this.merchant.getDeviceType() != null) {
- Element device_type_el = document.createElement(AuthNetField.ELEMENT_DEVICE_TYPE.getFieldName());
- device_type_el.appendChild(document.getDocument().createTextNode(
- this.merchant.getDeviceType().getValue()));
- retail_el.appendChild(device_type_el);
- }
-
- //presense of this node indicates CP transaction on server side
- if(retail_el.hasChildNodes()){
- transaction_req_el.appendChild(retail_el);
- }
-
-
-
-
-
- // transaction settings
- transaction_req_el.appendChild(
- createTransactionSettingsElement(document.createElement(AuthNetField.ELEMENT_TRANSACTION_SETTINGS.getFieldName())));
-
- // user defined fields
- transaction_req_el.appendChild(
- createUserFieldsElement(document.createElement(AuthNetField.ELEMENT_USER_FIELDS.getFieldName())));
-
- document.getDocumentElement().appendChild(transaction_req_el);
- }
-
- /**
- * Create a payment element.
- *
- * @param paymentElement empty payment element.
- * @return populated element with credit card/bank information.
- */
- private Element createPaymentElement(Element paymentElement) {
-
- Document doc = paymentElement.getOwnerDocument();
-
- if(this.creditCard!=null){
- switch(creditCard.cardPresenseType()){
- case CARD_NOT_PRESENT_UNENCRYPTED:
- // credit card - not card present, unencrypted
-
- Element credit_card_el = doc.createElement(AuthNetField.ELEMENT_CREDIT_CARD.getFieldName());
- // card number
- Element card_number_el = doc.createElement(AuthNetField.ELEMENT_CARD_NUMBER.getFieldName());
- card_number_el.appendChild(doc.createTextNode(this.creditCard.getCreditCardNumber()));
- credit_card_el.appendChild(card_number_el);
-
- // card exp
- if(this.creditCard.getExpirationDate() != null) {
- Element expiration_date_el = doc.createElement(AuthNetField.ELEMENT_EXPIRATION_DATE.getFieldName());
- expiration_date_el.appendChild(doc.createTextNode(this.creditCard.getExpirationMonth()+
- this.creditCard.getExpirationYear()));
- credit_card_el.appendChild(expiration_date_el);
- }
-
- // card code
- if(StringUtils.isNotEmpty(this.creditCard.getCardCode())) {
- Element card_code_el = doc.createElement(AuthNetField.ELEMENT_CARD_CODE.getFieldName());
- card_code_el.appendChild(doc.createTextNode(this.creditCard.getCardCode()));
- credit_card_el.appendChild(card_code_el);
- }
-
- paymentElement.appendChild(credit_card_el);
- break;
- case CARD_PRESENT_UNENCRYPTED:
- // credit card - card present
- Element track_data_el = doc.createElement(AuthNetField.ELEMENT_TRACK_DATA.getFieldName());
-
- // track1
- if(StringUtils.isNotEmpty(this.creditCard.getTrack1())) {
- Element track1_el = doc.createElement(AuthNetField.ELEMENT_TRACK1.getFieldName());
- track1_el.appendChild(doc.createTextNode(this.creditCard.getTrack1()));
- track_data_el.appendChild(track1_el);
- }
-
- // track2
- else if(StringUtils.isNotEmpty(this.creditCard.getTrack2())) {
- Element track2_el = doc.createElement(AuthNetField.ELEMENT_TRACK2.getFieldName());
- track2_el.appendChild(doc.createTextNode(this.creditCard.getTrack2()));
- track_data_el.appendChild(track2_el);
- }
-
- paymentElement.appendChild(track_data_el);
- break;
- case CARD_PRESENT_ENCRYPTED:
-
-
- Element encrypted_track_data_el = doc.createElement(AuthNetField.ELEMENT_ENCRYPTED_TRACK_DATA.getFieldName());
- paymentElement.appendChild(encrypted_track_data_el);
- Element form_of_payment_el = doc.createElement(AuthNetField.ELEMENT_FORM_OF_PAYMENT.getFieldName());
- encrypted_track_data_el.appendChild(form_of_payment_el);
- // card number
-
- Element value_el = doc.createElement(AuthNetField.ELEMENT_VALUE_CAPITAL.getFieldName());
- form_of_payment_el.appendChild(value_el);
- Element encoding_el = doc.createElement(AuthNetField.ELEMENT_ENCODING.getFieldName());
- encoding_el.appendChild(doc.createTextNode(this.creditCard.getSwipperData().getEncoding().getFieldName()));
- Element algorithm_el = doc.createElement(AuthNetField.ELEMENT_ENCRYPTION_ALGORITHM.getFieldName());
- algorithm_el.appendChild(doc.createTextNode(this.creditCard.getSwipperData().getEncryptionAlgorithm().getFieldName()));
- value_el.appendChild(encoding_el);
- value_el.appendChild(algorithm_el);
- Element scheme_el = doc.createElement(AuthNetField.ELEMENT_SCHEME.getFieldName());
- value_el.appendChild(scheme_el);
- Element dukpt_el = doc.createElement(AuthNetField.ELEMENT_DUKPT.getFieldName());
- scheme_el.appendChild(dukpt_el);
- Element operation_el = doc.createElement(AuthNetField.ELEMENT_OPERATION.getFieldName());
- operation_el.appendChild(doc.createTextNode(this.creditCard.getSwipperData().getOperation().getFieldName()));
- Element mode_el = doc.createElement(AuthNetField.ELEMENT_MODE.getFieldName());
-
- Element pin_el = doc.createElement(AuthNetField.ELEMENT_PIN_CAPITAL.getFieldName());
- pin_el.appendChild(doc.createTextNode(this.creditCard.getSwipperData().getMode().getFieldName()));
-
- mode_el.appendChild(pin_el);
-
- Element data_el = doc.createElement(AuthNetField.ELEMENT_DATA_CAPITAL.getFieldName());
- data_el.appendChild(doc.createTextNode(this.creditCard.getSwipperData().getMode().getFieldName()));
- mode_el.appendChild(data_el);
- //
-
- dukpt_el.appendChild(operation_el);
- dukpt_el.appendChild(mode_el);
-
- if (this.creditCard.getSwipperData().getDeviceInfo() != null) {
- Element device_info_el = doc.createElement(AuthNetField.ELEMENT_DEVICE_INFO.getFieldName());
- Element description_el = doc.createElement(AuthNetField.ELEMENT_DESCRIPTION_CAPITAL.getFieldName());
- description_el.appendChild(doc.createTextNode(this.creditCard.getSwipperData().getDeviceInfo()));
- device_info_el.appendChild(description_el);
- dukpt_el.appendChild(device_info_el);
- }
- if (this.creditCard.getSwipperData().getEncryptedData() != null) {
- Element encrypted_data_el = doc.createElement(AuthNetField.ELEMENT_ENCRYPTED_DATA.getFieldName());
- Element data_el2 = doc.createElement(AuthNetField.ELEMENT_VALUE_CAPITAL.getFieldName());
- data_el2.appendChild(doc.createTextNode(this.creditCard.getSwipperData().getEncryptedData()));
- encrypted_data_el.appendChild(data_el2);
- dukpt_el.appendChild(encrypted_data_el);
- }
-
- break;
- }
- }
-
- // bank account / echeck
- else if(this.bankAccount != null) {
- Element bank_account_el = doc.createElement(AuthNetField.ELEMENT_BANK_ACCOUNT.getFieldName());
-
- Element account_type_el = doc.createElement(AuthNetField.ELEMENT_ACCOUNT_TYPE.getFieldName());
- account_type_el.appendChild(doc.createTextNode(this.bankAccount.getBankAccountType().getValue().toLowerCase()));
-
- Element account_number_el = doc.createElement(AuthNetField.ELEMENT_ACCOUNT_NUMBER.getFieldName());
- account_number_el.appendChild(doc.createTextNode(this.bankAccount.getBankAccountNumber()));
-
- Element routing_number_el = doc.createElement(AuthNetField.ELEMENT_ROUTING_NUMBER.getFieldName());
- routing_number_el.appendChild(doc.createTextNode(this.bankAccount.getRoutingNumber()));
-
- Element name_on_account_el = doc.createElement(AuthNetField.ELEMENT_NAME_ON_ACCOUNT.getFieldName());
- name_on_account_el.appendChild(doc.createTextNode(this.bankAccount.getBankAccountName()));
-
- Element bank_name_el = doc.createElement(AuthNetField.ELEMENT_BANK_NAME.getFieldName());
- bank_name_el.appendChild(doc.createTextNode(this.bankAccount.getBankName()));
-
- Element echeck_type_el = doc.createElement(AuthNetField.ELEMENT_ECHECK_TYPE.getFieldName());
- echeck_type_el.appendChild(doc.createTextNode(this.bankAccount.getECheckType().getValue()));
-
- if(this.bankAccount.getBankAccountType() != null) {
- bank_account_el.appendChild(account_type_el);
- }
- bank_account_el.appendChild(routing_number_el);
- bank_account_el.appendChild(account_number_el);
- bank_account_el.appendChild(name_on_account_el);
- bank_account_el.appendChild(echeck_type_el);
- bank_account_el.appendChild(bank_name_el);
-
- paymentElement.appendChild(bank_account_el);
- }
-
- return paymentElement;
- }
-
- /**
- * Create order element.
- *
- * @param orderElement empty order element.
- * @return populate element with order invoice number and description.
- */
- private Element createOrderElement(Element orderElement) {
-
- Document doc = orderElement.getOwnerDocument();
- if(this.order != null) {
-
- if(StringUtils.isNotEmpty(this.order.getInvoiceNumber())) {
- Element invoice_number_el = doc.createElement(AuthNetField.ELEMENT_INVOICE_NUMBER.getFieldName());
- invoice_number_el.appendChild(doc.createTextNode(order.getInvoiceNumber()));
- orderElement.appendChild(invoice_number_el);
- }
-
- if(StringUtils.isNotEmpty(this.order.getDescription())) {
- Element description_el = doc.createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- description_el.appendChild(doc.createTextNode(order.getDescription()));
- orderElement.appendChild(description_el);
- }
- }
-
- return orderElement;
- }
-
- /**
- * Create line items element.
- *
- * @param lineItemsElement empty line items element.
- * @return populate element with line item information.
- */
- private Element createLineItemsElement(Element lineItemsElement) {
-
- Document doc = lineItemsElement.getOwnerDocument();
- if(this.order != null && this.order.getOrderItems() != null) {
-
- int i = 0;
- for(OrderItem orderItem : this.order.getOrderItems()) {
- i++;
- if(i > Order.MAX_ORDER_ITEM_SIZE) { break; }
- Element lineItem = doc.createElement(AuthNetField.ELEMENT_LINE_ITEM.getFieldName());
- Element item_id_el = doc.createElement(AuthNetField.ELEMENT_ITEM_ID.getFieldName());
- item_id_el.appendChild(doc.createTextNode(orderItem.getItemId()));
-
- Element name_el = doc.createElement(AuthNetField.ELEMENT_NAME.getFieldName());
- name_el.appendChild(doc.createTextNode(orderItem.getItemName()));
-
- Element description_el = doc.createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- description_el.appendChild(doc.createTextNode(orderItem.getItemDescription()));
-
- Element quantity_el = doc.createElement(AuthNetField.ELEMENT_QUANTITY.getFieldName());
- quantity_el.appendChild(doc.createTextNode(
- orderItem.getItemQuantity().setScale(Transaction.QUANTITY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()));
-
- Element unit_price_el = doc.createElement(AuthNetField.ELEMENT_UNIT_PRICE.getFieldName());
- unit_price_el.appendChild(doc.createTextNode(
- orderItem.getItemPrice().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()));
-
- lineItem.appendChild(item_id_el);
- lineItem.appendChild(name_el);
- lineItem.appendChild(description_el);
- lineItem.appendChild(quantity_el);
- lineItem.appendChild(unit_price_el);
- lineItemsElement.appendChild(lineItem);
- }
- }
-
- return lineItemsElement;
- }
-
- /**
- * Create a tax element.
- *
- * @param taxElement empty tax element.
- * @return populated element with tax information.
- */
- private Element createTaxElement(Element taxElement) {
- // tax
- Document doc = taxElement.getOwnerDocument();
- if(this.shippingCharges != null) {
-
- if(shippingCharges.getTaxAmount() != null) {
- Element tax_amount_el = doc.createElement(AuthNetField.ELEMENT_AMOUNT.getFieldName());
- tax_amount_el.appendChild(doc.createTextNode(
- shippingCharges.getTaxAmount().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()));
- taxElement.appendChild(tax_amount_el);
- }
- if(shippingCharges.getTaxItemName() != null) {
- Element tax_name_el = doc.createElement(AuthNetField.ELEMENT_NAME.getFieldName());
- tax_name_el.appendChild(doc.createTextNode(
- shippingCharges.getTaxItemName()));
- taxElement.appendChild(tax_name_el);
- }
- if(shippingCharges.getTaxDescription() != null) {
- Element tax_description_el = doc.createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- tax_description_el.appendChild(doc.createTextNode(
- shippingCharges.getTaxDescription()));
- taxElement.appendChild(tax_description_el);
- }
- }
-
- return taxElement;
- }
-
- /**
- * Create a duty element.
- *
- * @param dutyElement empty duty element.
- * @return populated element with duty information.
- */
- private Element createDutyElement(Element dutyElement) {
- // duty
- Document doc = dutyElement.getOwnerDocument();
- if(this.shippingCharges != null) {
-
- if(shippingCharges.getDutyAmount() != null) {
- Element duty_amount_el = doc.createElement(AuthNetField.ELEMENT_AMOUNT.getFieldName());
- duty_amount_el.appendChild(doc.createTextNode(
- shippingCharges.getDutyAmount().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()));
- dutyElement.appendChild(duty_amount_el);
- }
- if(shippingCharges.getDutyItemName() != null) {
- Element duty_name_el = doc.createElement(AuthNetField.ELEMENT_NAME.getFieldName());
- duty_name_el.appendChild(doc.createTextNode(
- shippingCharges.getTaxItemName()));
- dutyElement.appendChild(duty_name_el);
- }
- if(shippingCharges.getDutyItemDescription() != null) {
- Element duty_description_el = doc.createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- duty_description_el.appendChild(doc.createTextNode(
- shippingCharges.getDutyItemDescription()));
- dutyElement.appendChild(duty_description_el);
- }
- }
-
- return dutyElement;
- }
-
- /**
- * Create a shipping element.
- *
- * @param shippingElement empty shipping element.
- * @return populated element with shipping charges information.
- */
- private Element createShippingElement(Element shippingElement) {
- // shipping charges
- Document doc = shippingElement.getOwnerDocument();
- if(this.shippingCharges != null) {
- if(shippingCharges.getFreightAmount() != null) {
- Element shipping_amount_el = doc.createElement(AuthNetField.ELEMENT_AMOUNT.getFieldName());
- shipping_amount_el.appendChild(doc.createTextNode(
- shippingCharges.getFreightAmount().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()));
- shippingElement.appendChild(shipping_amount_el);
- }
- if(shippingCharges.getFreightItemName() != null) {
- Element shipping_name_el = doc.createElement(AuthNetField.ELEMENT_NAME.getFieldName());
- shipping_name_el.appendChild(doc.createTextNode(
- shippingCharges.getFreightItemName()));
- shippingElement.appendChild(shipping_name_el);
- }
- if(shippingCharges.getFreightDescription() != null) {
- Element shipping_description_el = doc.createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- shipping_description_el.appendChild(doc.createTextNode(
- shippingCharges.getFreightDescription()));
- shippingElement.appendChild(shipping_description_el);
- }
- }
-
- return shippingElement;
- }
-
- /**
- * Create a customer element.
- *
- * @param customerElement empty customer element
- * @return populate element with customer information.
- */
- private Element createCustomerElement(Element customerElement) {
- // customer information
- Document doc = customerElement.getOwnerDocument();
- if(this.customer != null) {
- if(customer.getCustomerType() != null) {
- Element customer_type_el = doc.createElement(AuthNetField.ELEMENT_TYPE.getFieldName());
- customer_type_el.appendChild(doc.createTextNode(
- customer.getCustomerType().getValue()));
- customerElement.appendChild(customer_type_el);
- }
- if(customer.getCustomerId() != null) {
- Element customer_id_el = doc.createElement(AuthNetField.ELEMENT_ID.getFieldName());
- customer_id_el.appendChild(doc.createTextNode(
- customer.getId()));
- customerElement.appendChild(customer_id_el);
- }
- if(customer.getEmail() != null) {
- Element customer_email_el = doc.createElement(AuthNetField.ELEMENT_EMAIL.getFieldName());
- customer_email_el.appendChild(doc.createTextNode(
- customer.getEmail()));
- customerElement.appendChild(customer_email_el);
- }
- }
-
- return customerElement;
- }
-
- /**
- * Create a billTo element.
- *
- * @param billToElement empty billTo element
- * @return populate element with bill-to address information.
- */
- private Element createBillToElement(Element billToElement) {
- // billTo information
- Document doc = billToElement.getOwnerDocument();
- if(this.customer != null && this.customer.getBillTo() != null) {
- Address billToAddress = this.customer.getBillTo();
- if(billToAddress.getFirstName() != null) {
- Element first_name_el = doc.createElement(AuthNetField.ELEMENT_FIRST_NAME.getFieldName());
- first_name_el.appendChild(doc.createTextNode(
- billToAddress.getFirstName()));
- billToElement.appendChild(first_name_el);
- }
- if(billToAddress.getLastName() != null) {
- Element last_name_el = doc.createElement(AuthNetField.ELEMENT_LAST_NAME.getFieldName());
- last_name_el.appendChild(doc.createTextNode(
- billToAddress.getLastName()));
- billToElement.appendChild(last_name_el);
- }
- if(billToAddress.getCompany() != null) {
- Element company_el = doc.createElement(AuthNetField.ELEMENT_COMPANY.getFieldName());
- company_el.appendChild(doc.createTextNode(
- billToAddress.getCompany()));
- billToElement.appendChild(company_el);
- }
- if(billToAddress.getAddress() != null) {
- Element address_el = doc.createElement(AuthNetField.ELEMENT_ADDRESS.getFieldName());
- address_el.appendChild(doc.createTextNode(
- billToAddress.getAddress()));
- billToElement.appendChild(address_el);
- }
- if(billToAddress.getCity() != null) {
- Element city_el = doc.createElement(AuthNetField.ELEMENT_CITY.getFieldName());
- city_el.appendChild(doc.createTextNode(
- billToAddress.getCity()));
- billToElement.appendChild(city_el);
- }
- if(billToAddress.getState() != null) {
- Element state_el = doc.createElement(AuthNetField.ELEMENT_STATE.getFieldName());
- state_el.appendChild(doc.createTextNode(
- billToAddress.getState()));
- billToElement.appendChild(state_el);
- }
- if(billToAddress.getZipPostalCode() != null) {
- Element zip_el = doc.createElement(AuthNetField.ELEMENT_ZIP.getFieldName());
- zip_el.appendChild(doc.createTextNode(
- billToAddress.getZipPostalCode()));
- billToElement.appendChild(zip_el);
- }
- if(billToAddress.getCountry() != null) {
- Element country_el = doc.createElement(AuthNetField.ELEMENT_COUNTRY.getFieldName());
- country_el.appendChild(doc.createTextNode(
- billToAddress.getCountry()));
- billToElement.appendChild(country_el);
- }
- if(billToAddress.getPhoneNumber() != null) {
- Element phone_number_el = doc.createElement(AuthNetField.ELEMENT_PHONE_NUMBER.getFieldName());
- phone_number_el.appendChild(doc.createTextNode(
- billToAddress.getPhoneNumber()));
- billToElement.appendChild(phone_number_el);
- }
- if(billToAddress.getFaxNumber() != null) {
- Element fax_number_el = doc.createElement(AuthNetField.ELEMENT_FAX_NUMBER.getFieldName());
- fax_number_el.appendChild(doc.createTextNode(
- billToAddress.getFaxNumber()));
- billToElement.appendChild(fax_number_el);
- }
- }
-
- return billToElement;
- }
-
- /**
- * Create a shipTo element.
- *
- * @param shipToElement empty shipTo element.
- * @return populate element with ship-to address information.
- */
- private Element createShipToElement(Element shipToElement) {
- // shipTo information
- Document doc = shipToElement.getOwnerDocument();
- if(this.customer != null && this.customer.getShipTo() != null) {
- Address shipToAddress = this.customer.getShipTo() ;
- if(shipToAddress.getFirstName() != null) {
- Element first_name_el = doc.createElement(AuthNetField.ELEMENT_FIRST_NAME.getFieldName());
- first_name_el.appendChild(doc.createTextNode(
- shipToAddress.getFirstName()));
- shipToElement.appendChild(first_name_el);
- }
- if(shipToAddress.getLastName() != null) {
- Element last_name_el = doc.createElement(AuthNetField.ELEMENT_LAST_NAME.getFieldName());
- last_name_el.appendChild(doc.createTextNode(
- shipToAddress.getLastName()));
- shipToElement.appendChild(last_name_el);
- }
- if(shipToAddress.getCompany() != null) {
- Element company_el = doc.createElement(AuthNetField.ELEMENT_COMPANY.getFieldName());
- company_el.appendChild(doc.createTextNode(
- shipToAddress.getCompany()));
- shipToElement.appendChild(company_el);
- }
- if(shipToAddress.getAddress() != null) {
- Element address_el = doc.createElement(AuthNetField.ELEMENT_ADDRESS.getFieldName());
- address_el.appendChild(doc.createTextNode(
- shipToAddress.getAddress()));
- shipToElement.appendChild(address_el);
- }
- if(shipToAddress.getCity() != null) {
- Element city_el = doc.createElement(AuthNetField.ELEMENT_CITY.getFieldName());
- city_el.appendChild(doc.createTextNode(
- shipToAddress.getCity()));
- shipToElement.appendChild(city_el);
- }
- if(shipToAddress.getState() != null) {
- Element state_el = doc.createElement(AuthNetField.ELEMENT_STATE.getFieldName());
- state_el.appendChild(doc.createTextNode(
- shipToAddress.getState()));
- shipToElement.appendChild(state_el);
- }
- if(shipToAddress.getZipPostalCode() != null) {
- Element zip_el = doc.createElement(AuthNetField.ELEMENT_ZIP.getFieldName());
- zip_el.appendChild(doc.createTextNode(
- shipToAddress.getZipPostalCode()));
- shipToElement.appendChild(zip_el);
- }
- if(shipToAddress.getCountry() != null) {
- Element country_el = doc.createElement(AuthNetField.ELEMENT_COUNTRY.getFieldName());
- country_el.appendChild(doc.createTextNode(
- shipToAddress.getCountry()));
- shipToElement.appendChild(country_el);
- }
- }
-
- return shipToElement;
- }
-
-
- /**
- * Create a transaction settings element.
- *
- * @param transactionSettingsElement empty transaction settings element.
- * @return populate element with transaction settings.
- */
- private Element createTransactionSettingsElement(Element transactionSettingsElement) {
-
- // shipTo information
- Document doc = transactionSettingsElement.getOwnerDocument();
-
- LinkedHashMap transactionSettings = new LinkedHashMap();
- // allow partial auth
- transactionSettings.put(AuthNetField.ELEMENT_NAME_ALLOW_PARTIAL_AUTH.getFieldName(),
- Boolean.toString(this.merchant.isAllowPartialAuth()));
- // duplicate window
- if(this.merchant.getDuplicateTxnWindowSeconds() >= 0) {
- transactionSettings.put(AuthNetField.ELEMENT_NAME_DUPLICATE_WINDOW.getFieldName(),
- Integer.toString(this.merchant.getDuplicateTxnWindowSeconds()));
- }
- // email customer
- transactionSettings.put(AuthNetField.ELEMENT_NAME_EMAIL_CUSTOMER.getFieldName(),
- Boolean.toString(this.merchant.isEmailCustomer()));
- // merchant confirmation email
- if(StringUtils.isNotEmpty(merchant.getMerchantEmail())) {
- transactionSettings.put(AuthNetField.ELEMENT_MERCHANT_EMAIL.getFieldName(), merchant.getMerchantEmail());
- }
- if(emailReceipt != null) {
- // email header
- if(StringUtils.isNotEmpty(emailReceipt.getHeaderEmailReceipt())) {
- transactionSettings.put(AuthNetField.ELEMENT_HEADER_EMAIL_RECEIPT.getFieldName(),
- "");
- }
- // email footer
- if(StringUtils.isNotEmpty(emailReceipt.getFooterEmailReceipt())) {
- transactionSettings.put(AuthNetField.ELEMENT_FOOTER_EMAIL_RECEIPT.getFieldName(),
- "");
- }
- }
-
- // recurring billing
- transactionSettings.put(AuthNetField.ELEMENT_NAME_RECURRING_BILLING.getFieldName(),
- Boolean.toString(this.merchant.isRecurringBilling()));
- // test request
- transactionSettings.put(AuthNetField.ELEMENT_NAME_TEST_REQUEST.getFieldName(),
- Boolean.toString(this.merchant.getEnvironment().equals(Environment.SANDBOX_TESTMODE) ||
- this.merchant.getEnvironment().equals(Environment.PRODUCTION_TESTMODE)));
-
- // loop through the transaction settings and populate them in key/value fashion
- for(Map.Entry entry : transactionSettings.entrySet()) {
- Element setting_el = doc.createElement(AuthNetField.ELEMENT_SETTING.getFieldName());
- Element setting_name_el = doc.createElement(AuthNetField.ELEMENT_SETTING_NAME.getFieldName());
- setting_name_el.appendChild(doc.createTextNode(entry.getKey()));
- Element setting_value_el = doc.createElement(AuthNetField.ELEMENT_SETTING_VALUE.getFieldName());
- setting_value_el.appendChild(doc.createTextNode(entry.getValue()));
-
- setting_el.appendChild(setting_name_el);
- setting_el.appendChild(setting_value_el);
- transactionSettingsElement.appendChild(setting_el);
- }
- return transactionSettingsElement;
- }
-
- /**
- * Create a user fields element.
- *
- * @param userFieldsElement empty user fields element.
- * @return populate element with user field values.
- */
- private Element createUserFieldsElement(Element userFieldsElement) {
-
- // shipTo information
- Document doc = userFieldsElement.getOwnerDocument();
-
- for(Map.Entry entry : merchantDefinedMap.entrySet()) {
- Element user_field_el = doc.createElement(AuthNetField.ELEMENT_USER_FIELD.getFieldName());
- Element name_el = doc.createElement(AuthNetField.ELEMENT_NAME.getFieldName());
- name_el.appendChild(doc.createTextNode(entry.getKey()));
- Element value_el = doc.createElement(AuthNetField.ELEMENT_VALUE.getFieldName());
- value_el.appendChild(doc.createTextNode(entry.getValue()));
-
- user_field_el.appendChild(name_el);
- user_field_el.appendChild(value_el);
- userFieldsElement.appendChild(user_field_el);
- }
- return userFieldsElement;
- }
-
- /**
- * @return the refId
- */
- public String getRefId() {
- return refId;
- }
-
- /**
- * @param refId the refId to set
- */
- public void setRefId(String refId) {
- this.refId = refId;
- }
-
- /**
- * Convert request to XML.
- */
- public String toAuthNetPOSTString() {
-
- createTransactionRequest();
- return currentRequest.dump();
- }
-
- /* (non-Javadoc)
- * @see net.authorize.ITransaction#getTransactionType()
- */
- public Enum> getTransactionType() {
- return this.transactionType;
- }
-
- /**
- * @param merchantDefinedMap the merchantDefinedMap to set
- */
- public void setMerchantDefinedMap(Hashtable merchantDefinedMap) {
- this.merchantDefinedMap = merchantDefinedMap;
- }
-
- /**
- * Add merchant defined field to the merchant defined fields map.
- *
- * @param key
- * @param value
- */
- public void setMerchantDefinedField(String key, String value) {
- if(this.merchantDefinedMap == null) {
- this.merchantDefinedMap = new Hashtable();
- }
- this.merchantDefinedMap.put(key, value);
- }
- /**
- * @param refTransId the refTransId to set
- */
- public void setRefTransId(String refTransId) {
- this.refTransId = refTransId;
- }
-
- /**
- * @param splitTenderId the splitTenderId to set
- */
- public void setSplitTenderId(String splitTenderId) {
- this.splitTenderId = splitTenderId;
- }
-
- /**
- * @param authCode the authCode to set
- */
- public void setAuthCode(String authCode) {
- this.authCode = authCode;
- }
-
- /**
- * @return the merchantDefinedMap
- */
- public Hashtable getMerchantDefinedMap() {
- return merchantDefinedMap;
- }
-
- /**
- * @return the refTransId
- */
- public String getRefTransId() {
- return refTransId;
- }
-
- /**
- * @return the splitTenderId
- */
- public String getSplitTenderId() {
- return splitTenderId;
- }
-
- /**
- * @return the authCode
- */
- public String getAuthCode() {
- return authCode;
- }
-
- /**
- * @return the totalAmount
- */
- public BigDecimal getTotalAmount() {
- return this.totalAmount.setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
-
-}
diff --git a/src/net/authorize/aim/cardpresent/DeviceType.java b/src/net/authorize/aim/cardpresent/DeviceType.java
deleted file mode 100644
index d0fa5f4..0000000
--- a/src/net/authorize/aim/cardpresent/DeviceType.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package net.authorize.aim.cardpresent;
-
-
-
-/**
- * DeviceType is used for Card Present transactions.
- *
- */
-public enum DeviceType {
-
- UNKNOWN("1"),
- UNATTENDED("2"),
- SELF_SERVICE_TERMINAL("3"),
- ELECTRONIC_CASH_REGISTER("4"),
- PERSONAL_COMPUTER_BASED_TERMINAL("5"),
- AIRPAY("6"),
- WIRELESS_POS("7"),
- WEBSITE("8"),
- DIAL_TERMINAL("9"),
- VIRTUAL_TERMINAL("10");
-
- final private String value;
-
- private DeviceType(String value) {
- this.value = value;
- }
-
- /**
- * Return the DeviceType value.
- *
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Lookup a DeviceType by it's value.
- * @param value
- *
- * @return Returns a DeviceType if a value match is found.
- */
- public static DeviceType findByValue(String value) {
- for(DeviceType deviceType : values()) {
- if(deviceType.value.equals(value)) {
- return deviceType;
- }
- }
-
- return DeviceType.UNKNOWN;
- }
-
-}
diff --git a/src/net/authorize/aim/cardpresent/MarketType.java b/src/net/authorize/aim/cardpresent/MarketType.java
deleted file mode 100644
index 6ca665a..0000000
--- a/src/net/authorize/aim/cardpresent/MarketType.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package net.authorize.aim.cardpresent;
-
-
-/**
- * MarketType is used for Card Present transactions.
- */
-public enum MarketType {
- ECOMMERCE("0"),
- MOTO("1"),
- RETAIL("2"),
- RESTAURANT("3"),
- LODGING("4"),
- AUTORENTAL("5")
- ;
-
- final private String value;
-
- private MarketType(String value) {
- this.value = value;
- }
-
- /**
- * Return the MarketType value.
- *
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Lookup a MarketType by it's value.
- * @param value
- *
- * @return Returns a MarketType if a value match is found.
- */
- public static MarketType findByValue(String value) {
- for(MarketType marketType : values()) {
- if(marketType.value.equals(value)) {
- return marketType;
- }
- }
-
- return null;
- }
-
-}
diff --git a/src/net/authorize/arb/Result.java b/src/net/authorize/arb/Result.java
deleted file mode 100644
index 4b6e88c..0000000
--- a/src/net/authorize/arb/Result.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package net.authorize.arb;
-
-import java.io.Serializable;
-
-import net.authorize.AuthNetField;
-import net.authorize.ITransaction;
-import net.authorize.data.arb.SubscriptionStatusType;
-
-/**
- * Wrapper container for passing back the result from the request gateway.
- *
- */
-public class Result extends net.authorize.xml.Result implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- protected SubscriptionStatusType subscriptionStatus = null;
- protected String resultSubscriptionId = null;
-
- protected Result() { }
-
- protected Result(ITransaction requestTransaction, String response) {
- super(requestTransaction, response);
- importSubscriptionInfo();
- }
-
- public static Result createResult(ITransaction requestTransaction, String response) {
- Result result = new Result(requestTransaction, response);
-
- return result;
- }
-
- /**
- * Returns the result subscription id.
- *
- * @return String containing the subscription id.
- */
- public String getResultSubscriptionId(){
- return resultSubscriptionId;
- }
-
- /**
- * @return the status
- */
- public SubscriptionStatusType getSubscriptionStatus() {
- return subscriptionStatus;
- }
-
- /**
- * Import the subscription information into the result.
- */
- protected void importSubscriptionInfo() {
-
- resultSubscriptionId = getElementText(getXmlResponseDoc().getDocumentElement(),AuthNetField.ELEMENT_SUBSCRIPTION_ID.getFieldName());
-
- if(TransactionType.GET_SUBSCRIPTION_STATUS.equals(this.requestTransaction.getTransactionType())) {
- String statusStr = getElementText(getXmlResponseDoc().getDocumentElement(),AuthNetField.ELEMENT_SUBSCRIPTION_STATUS.getFieldName());
- // this has been added since the documentation appears to be out of sync with the implementation... just a safeguard
- if(statusStr == null) {
- statusStr =
- getElementText(getXmlResponseDoc().getDocumentElement(),AuthNetField.ELEMENT_SUBSCRIPTION_STATUS.getFieldName().toLowerCase());
- }
- subscriptionStatus = SubscriptionStatusType.fromValue(statusStr);
- }
- }
-
- public void printMessages() {
- super.printMessages();
- if(resultSubscriptionId != null){
- System.out.println("Result Subscription Id: " + resultSubscriptionId);
- }
- }
-}
diff --git a/src/net/authorize/arb/Transaction.java b/src/net/authorize/arb/Transaction.java
deleted file mode 100644
index 63adc27..0000000
--- a/src/net/authorize/arb/Transaction.java
+++ /dev/null
@@ -1,483 +0,0 @@
-package net.authorize.arb;
-
-import java.math.BigDecimal;
-
-import net.authorize.AuthNetField;
-import net.authorize.Merchant;
-import net.authorize.data.Address;
-import net.authorize.data.Order;
-import net.authorize.data.Payment;
-import net.authorize.data.arb.PaymentSchedule;
-import net.authorize.data.arb.Subscription;
-import net.authorize.data.creditcard.CreditCard;
-import net.authorize.data.echeck.BankAccount;
-import net.authorize.util.BasicXmlDocument;
-import net.authorize.util.StringUtils;
-
-import org.w3c.dom.Element;
-
-/**
- * Transaction object for ARB.
- *
- */
-public class Transaction extends net.authorize.xml.XMLTransaction {
-
- private static final long serialVersionUID = 2L;
-
- private TransactionType transactionType;
- private Subscription subscription;
-
- /**
- * Private constructor.
- *
- * @param merchant
- * @param transactionType
- * @param subscription
- */
- private Transaction(Merchant merchant, TransactionType transactionType,
- Subscription subscription) {
-
- this.merchant = merchant;
- this.transactionType = transactionType;
- this.subscription = subscription;
- }
-
- /**
- * Creates a transaction.
- *
- * @param merchant
- * @param transactionType
- * @param subscription
- *
- * @return Transaction
- */
- public static Transaction createTransaction(Merchant merchant, TransactionType transactionType, Subscription subscription) {
- return new Transaction(merchant, transactionType, subscription);
- }
-
- /**
- * @return the transactionType
- */
- public TransactionType getTransactionType() {
- return transactionType;
- }
-
- /**
- * Add the subscription id to the request.
- *
- * @param document
- * @param subscription
- */
- private void addSubscriptionIdToRequest(BasicXmlDocument document, Subscription subscription){
- if(subscription.getSubscriptionId() != null) {
- Element subscr_id_el = document.createElement(AuthNetField.ELEMENT_SUBSCRIPTION_ID.getFieldName());
- subscr_id_el.appendChild(document.getDocument().createTextNode(subscription.getSubscriptionId()));
- document.getDocumentElement().appendChild(subscr_id_el);
- }
- }
-
- /**
- * Add subscription information to the subscription request.
- *
- * @param document
- * @param subscription
- */
- private void addSubscriptionToRequest(BasicXmlDocument document, Subscription subscription){
-
- addSubscriptionIdToRequest(document, subscription);
-
- Element subscr_el = document.createElement(AuthNetField.ELEMENT_SUBSCRIPTION.getFieldName());
- if(subscription.getName() != null){
- Element name_el = document.createElement(AuthNetField.ELEMENT_NAME.getFieldName());
- name_el.appendChild(document.getDocument().createTextNode(subscription.getName()));
- subscr_el.appendChild(name_el);
- }
-
- addPaymentScheduleToSubscription(document, subscription, subscr_el);
- if(!subscription.getAmount().equals(ZERO_AMOUNT) || !subscription.getTrialAmount().equals(ZERO_AMOUNT)) {
- Element amount_el = document.createElement(AuthNetField.ELEMENT_AMOUNT.getFieldName());
- amount_el.appendChild(document.getDocument().createTextNode(
- subscription.getAmount().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()) );
- subscr_el.appendChild(amount_el);
-
- Element trial_el = document.createElement(AuthNetField.ELEMENT_TRIAL_AMOUNT.getFieldName());
- trial_el.appendChild(document.getDocument().createTextNode(
- subscription.getTrialAmount().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()) );
- subscr_el.appendChild(trial_el);
- }
-
- addPaymentToSubscription(document, subscription, subscr_el);
- addBillingInfoToSubscription(document, subscription, subscr_el);
- document.getDocumentElement().appendChild(subscr_el);
- }
-
- /**
- * Add billing information to the subscription request.
- *
- * @param document
- * @param subscription
- * @param subscr_el
- */
- private void addBillingInfoToSubscription(BasicXmlDocument document, Subscription subscription, Element subscr_el){
- if(subscription.getCustomer() == null || subscription.getCustomer().getBillTo() == null) {
- return;
- }
-
- // order info
- Order order_info = subscription.getOrder();
- if(order_info != null) {
- Element order_el = document.createElement(AuthNetField.ELEMENT_ORDER.getFieldName());
-
- if(StringUtils.isNotEmpty(order_info.getInvoiceNumber())) {
- Element invoice_num_el = document.createElement(AuthNetField.ELEMENT_INVOICE_NUMBER.getFieldName());
- invoice_num_el.appendChild(document.getDocument().createTextNode(order_info.getInvoiceNumber()));
- order_el.appendChild(invoice_num_el);
- }
-
- if(StringUtils.isNotEmpty(order_info.getDescription())) {
- Element description_el = document.createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- description_el.appendChild(document.getDocument().createTextNode(order_info.getDescription()));
- order_el.appendChild(description_el);
- }
-
- subscr_el.appendChild(order_el);
- }
-
- net.authorize.data.Customer customer_info = subscription.getCustomer();
- if(customer_info != null) {
- Element customer_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER.getFieldName());
-
- if(StringUtils.isNotEmpty(customer_info.getId())) {
- Element id_el = document.createElement(AuthNetField.ELEMENT_ID.getFieldName());
- id_el.appendChild(document.getDocument().createTextNode(customer_info.getId()));
- customer_el.appendChild(id_el);
- }
-
- if(StringUtils.isNotEmpty(customer_info.getEmail())) {
- Element email_el = document.createElement(AuthNetField.ELEMENT_EMAIL.getFieldName());
- email_el.appendChild(document.getDocument().createTextNode(customer_info.getEmail()));
- customer_el.appendChild(email_el);
- }
-
- if(customer_info.getBillTo() != null) {
- if (StringUtils.isNotEmpty(customer_info.getBillTo().getPhoneNumber())) {
- Element phone_el = document.createElement(AuthNetField.ELEMENT_PHONE_NUMBER.getFieldName());
- phone_el.appendChild(document.getDocument().createTextNode(customer_info.getBillTo().getPhoneNumber()));
- customer_el.appendChild(phone_el);
- }
-
- if(StringUtils.isNotEmpty(customer_info.getBillTo().getFaxNumber())) {
- Element fax_el = document.createElement(AuthNetField.ELEMENT_FAX_NUMBER.getFieldName());
- fax_el.appendChild(document.getDocument().createTextNode(customer_info.getBillTo().getFaxNumber()));
- customer_el.appendChild(fax_el);
- }
- }
-
- subscr_el.appendChild(customer_el);
- }
-
- // add billTo
- addAddressInfoSubscription(document, AuthNetField.ELEMENT_BILL_TO.getFieldName(),
- subscription.getCustomer().getBillTo(), subscr_el);
- // add shipTo
- addAddressInfoSubscription(document, AuthNetField.ELEMENT_SHIP_TO.getFieldName(),
- subscription.getCustomer().getShipTo(), subscr_el);
- }
-
- /**
- * Add address info (shipTo / billTo).
- *
- * @param document
- * @param elementName
- * @param address
- * @param subscr_el
- */
- private void addAddressInfoSubscription(BasicXmlDocument document, String elementName,
- Address address, Element subscr_el) {
-
- if(address != null) {
- Element address_el = document.createElement(elementName);
-
- if(StringUtils.isNotEmpty(address.getFirstName())) {
- Element fname_el = document.createElement(AuthNetField.ELEMENT_FIRST_NAME.getFieldName());
- fname_el.appendChild(document.getDocument().createTextNode(address.getFirstName()));
- address_el.appendChild(fname_el);
- }
-
- if(StringUtils.isNotEmpty(address.getFirstName())) {
- Element lname_el = document.createElement(AuthNetField.ELEMENT_LAST_NAME.getFieldName());
- lname_el.appendChild(document.getDocument().createTextNode(address.getLastName()));
- address_el.appendChild(lname_el);
- }
-
- if(StringUtils.isNotEmpty(address.getCompany())) {
- Element company_el = document.createElement(AuthNetField.ELEMENT_COMPANY.getFieldName());
- company_el.appendChild(document.getDocument().createTextNode(address.getCompany()));
- address_el.appendChild(company_el);
- }
-
- if(StringUtils.isNotEmpty(address.getAddress())) {
- Element address_line_el = document.createElement(AuthNetField.ELEMENT_ADDRESS.getFieldName());
- address_line_el.appendChild(document.getDocument().createTextNode(address.getAddress()));
- address_el.appendChild(address_line_el);
- }
-
- if(StringUtils.isNotEmpty(address.getCity())) {
- Element city_el = document.createElement(AuthNetField.ELEMENT_CITY.getFieldName());
- city_el.appendChild(document.getDocument().createTextNode(address.getCity()));
- address_el.appendChild(city_el);
- }
-
- if(StringUtils.isNotEmpty(address.getState())) {
- Element state_el = document.createElement(AuthNetField.ELEMENT_STATE.getFieldName());
- state_el.appendChild(document.getDocument().createTextNode(address.getState()));
- address_el.appendChild(state_el);
- }
-
- if(StringUtils.isNotEmpty(address.getZipPostalCode())) {
- Element zip_el = document.createElement(AuthNetField.ELEMENT_ZIP.getFieldName());
- zip_el.appendChild(document.getDocument().createTextNode(address.getZipPostalCode()));
- address_el.appendChild(zip_el);
- }
-
- if(StringUtils.isNotEmpty(address.getCountry())) {
- Element country_el = document.createElement(AuthNetField.ELEMENT_COUNTRY.getFieldName());
- country_el.appendChild(document.getDocument().createTextNode(address.getCountry()));
- address_el.appendChild(country_el);
- }
-
- subscr_el.appendChild(address_el);
- }
- }
-
- /**
- * Add payment information to the subscription request.
- *
- * @param document
- * @param subscription
- * @param subscr_el
- */
- private void addPaymentToSubscription(BasicXmlDocument document, Subscription subscription, Element subscr_el){
- Payment payment = subscription.getPayment();
- if(payment == null) return;
-
- Element payment_el = document.createElement(AuthNetField.ELEMENT_PAYMENT.getFieldName());
- CreditCard credit_card= payment.getCreditCard();
- BankAccount bank_account = payment.getBankAccount();
-
- if (credit_card != null){
- Element cc_el = document.createElement(AuthNetField.ELEMENT_CREDIT_CARD.getFieldName());
-
- if(StringUtils.isNotEmpty(credit_card.getCreditCardNumber())) {
- Element cc_num_el = document.createElement(AuthNetField.ELEMENT_CREDIT_CARD_NUMBER.getFieldName());
- cc_num_el.appendChild(document.getDocument().createTextNode(credit_card.getCreditCardNumber()));
- cc_el.appendChild(cc_num_el);
- }
-
- if(credit_card.getExpirationDate() != null) {
- Element cc_exp_el = document.createElement(AuthNetField.ELEMENT_CREDIT_CARD_EXPIRY.getFieldName());
- cc_exp_el.appendChild(document.getDocument().createTextNode(net.authorize.util.DateUtil.getFormattedDate(credit_card.getExpirationDate(),
- CreditCard.ARB_EXPIRY_DATE_FORMAT)));
- cc_el.appendChild(cc_exp_el);
- }
-
- payment_el.appendChild(cc_el);
- }
- else if (bank_account != null) {
- Element bankacct_el = document.createElement(AuthNetField.ELEMENT_BANK_ACCOUNT.getFieldName());
-
- if(bank_account.getBankAccountType() != null) {
- Element account_type_el = document.createElement(AuthNetField.ELEMENT_ACCOUNT_TYPE.getFieldName());
- account_type_el.appendChild(document.getDocument().createTextNode(bank_account.getBankAccountType().getValue().toLowerCase()));
- bankacct_el.appendChild(account_type_el);
- }
-
- if(StringUtils.isNotEmpty(bank_account.getRoutingNumber())) {
- Element routing_number_el = document.createElement(AuthNetField.ELEMENT_ROUTING_NUMBER.getFieldName());
- routing_number_el.appendChild(document.getDocument().createTextNode(bank_account.getRoutingNumber()));
- bankacct_el.appendChild(routing_number_el);
- }
-
- if(StringUtils.isNotEmpty(bank_account.getBankAccountNumber())) {
- Element acct_number_el = document.createElement(AuthNetField.ELEMENT_ACCOUNT_NUMBER.getFieldName());
- acct_number_el.appendChild(document.getDocument().createTextNode(bank_account.getBankAccountNumber()));
- bankacct_el.appendChild(acct_number_el);
- }
-
- if(StringUtils.isNotEmpty(bank_account.getBankAccountName())) {
- Element name_on_acct_el = document.createElement(AuthNetField.ELEMENT_NAME_ON_ACCOUNT.getFieldName());
- name_on_acct_el.appendChild(document.getDocument().createTextNode(bank_account.getBankAccountName()));
- bankacct_el.appendChild(name_on_acct_el);
- }
-
- if(bank_account.getECheckType() != null) {
- Element echeck_type_el = document.createElement(AuthNetField.ELEMENT_ECHECK_TYPE.getFieldName());
- echeck_type_el.appendChild(document.getDocument().createTextNode(bank_account.getECheckType().getValue()));
- bankacct_el.appendChild(echeck_type_el);
- }
-
- if(StringUtils.isNotEmpty(bank_account.getBankName())) {
- Element bank_name_el = document.createElement(AuthNetField.ELEMENT_BANK_NAME.getFieldName());
- bank_name_el.appendChild(document.getDocument().createTextNode(bank_account.getBankName()));
- bankacct_el.appendChild(bank_name_el);
- }
-
- payment_el.appendChild(bankacct_el);
- }
-
- subscr_el.appendChild(payment_el);
- }
-
- /**
- * Add a payment schedule to the payment request.
- *
- * @param document
- * @param subscription
- * @param subscr_el
- */
- private void addPaymentScheduleToSubscription(BasicXmlDocument document, Subscription subscription, Element subscr_el){
- PaymentSchedule schedule = subscription.getSchedule();
- if(schedule == null) return;
-
- Element payment_el = document.createElement(AuthNetField.ELEMENT_PAYMENT_SCHEDULE.getFieldName());
-
- // Add the interval
- //
- if(schedule.getIntervaLength() > 0){
- Element interval_el = document.createElement(AuthNetField.ELEMENT_INTERVAL.getFieldName());
- Element length_el = document.createElement(AuthNetField.ELEMENT_LENGTH.getFieldName());
- Element unit_el = document.createElement(AuthNetField.ELEMENT_UNIT.getFieldName());
- length_el.appendChild(document.getDocument().createTextNode(Integer.toString(schedule.getIntervaLength())));
- interval_el.appendChild(length_el);
- interval_el.appendChild(unit_el);
- unit_el.appendChild(document.getDocument().createTextNode(schedule.getSubscriptionUnit().value()));
-
- payment_el.appendChild(interval_el);
- }
-
- Element start_date_el = document.createElement(AuthNetField.ELEMENT_START_DATE.getFieldName());
- start_date_el.appendChild(document.getDocument().createTextNode(net.authorize.util.DateUtil.getFormattedDate(schedule.getStartDate(),
- PaymentSchedule.SCHEDULE_DATE_FORMAT)));
- payment_el.appendChild(start_date_el);
-
- Element total_el = document.createElement(AuthNetField.ELEMENT_TOTAL_OCCURRENCES.getFieldName());
- total_el.appendChild(document.getDocument().createTextNode(Integer.toString(schedule.getTotalOccurrences())));
- payment_el.appendChild(total_el);
-
- Element trial_el = document.createElement(AuthNetField.ELEMENT_TRIAL_OCCURRENCES.getFieldName());
- trial_el.appendChild(document.getDocument().createTextNode(Integer.toString(schedule.getTrialOccurrences())));
- payment_el.appendChild(trial_el);
-
- subscr_el.appendChild(payment_el);
- }
-
-
- /**
- * Create subscription request core.
- *
- * @param subscription
- */
- private void createSubscriptionRequest(Subscription subscription){
-
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.CREATE_SUBSCRIPTION.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addSubscriptionToRequest(document,subscription);
- currentRequest = document;
- }
-
- /**
- * Update subscription request core.
- *
- * @param subscription
- */
- private void updateSubscriptionRequest(Subscription subscription){
-
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.UPDATE_SUBSCRIPTION.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addSubscriptionToRequest(document,subscription);
- currentRequest = document;
- }
-
- /**
- * Cancel subscription request core.
- *
- * @param subscription
- */
- private void cancelSubscriptionRequest(Subscription subscription){
-
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.CANCEL_SUBSCRIPTION.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addSubscriptionIdToRequest(document,subscription);
- currentRequest = document;
- }
-
- /**
- * Get subscription request (query request) core.
- *
- * @param subscription
- */
- private void getSubscriptionStatusRequest(Subscription subscription){
-
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.GET_SUBSCRIPTION_STATUS.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addSubscriptionIdToRequest(document,subscription);
- currentRequest = document;
- }
-
- /**
- * @return the refId
- */
- public String getRefId() {
- return refId;
- }
-
- /**
- * @param refId the refId to set
- */
- public void setRefId(String refId) {
- this.refId = refId;
- }
-
-
- /**
- * Convert request to XML.
- *
- */
- public String toAuthNetPOSTString() {
- switch (this.transactionType) {
- case CANCEL_SUBSCRIPTION :
- cancelSubscriptionRequest(this.subscription);
- break;
- case CREATE_SUBSCRIPTION :
- createSubscriptionRequest(this.subscription);
- break;
- case GET_SUBSCRIPTION_STATUS :
- getSubscriptionStatusRequest(this.subscription);
- break;
- case UPDATE_SUBSCRIPTION :
- updateSubscriptionRequest(this.subscription);
- break;
- default:
- break;
- }
-
- return currentRequest.dump();
- }
-
-}
diff --git a/src/net/authorize/arb/TransactionType.java b/src/net/authorize/arb/TransactionType.java
deleted file mode 100644
index 10db96f..0000000
--- a/src/net/authorize/arb/TransactionType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.authorize.arb;
-
-
-public enum TransactionType {
-
- CREATE_SUBSCRIPTION("ARBCreateSubscriptionRequest"),
- UPDATE_SUBSCRIPTION("ARBUpdateSubscriptionRequest"),
- CANCEL_SUBSCRIPTION("ARBCancelSubscriptionRequest"),
- GET_SUBSCRIPTION_STATUS("ARBGetSubscriptionStatusRequest");
-
- final private String value;
-
- private TransactionType(String value) {
- this.value = value;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
-}
diff --git a/src/net/authorize/auth/AbstractMerchantAuthentication.java b/src/net/authorize/auth/AbstractMerchantAuthentication.java
deleted file mode 100644
index ae858ac..0000000
--- a/src/net/authorize/auth/AbstractMerchantAuthentication.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package net.authorize.auth;
-
-import java.io.Serializable;
-
-/**
- * Abstract authenticator.
- *
- */
-public class AbstractMerchantAuthentication implements IMerchantAuthentication, Serializable {
-
- private static final long serialVersionUID = 2L;
-
- protected String name;
- protected String secret;
- protected MerchantAuthenticationType merchantAuthenticationType;
-
- /**
- * @see IMerchantAuthentication#getMerchantAuthenticationType()
- */
- public MerchantAuthenticationType getMerchantAuthenticationType() {
- return this.merchantAuthenticationType;
- }
-
- /**
- * @see IMerchantAuthentication#getName()
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * @see IMerchantAuthentication#getSecret()
- */
- public String getSecret() {
- return this.secret;
- }
-
-}
diff --git a/src/net/authorize/auth/AbstractMobileMerchantAuthentication.java b/src/net/authorize/auth/AbstractMobileMerchantAuthentication.java
deleted file mode 100644
index 525ad4a..0000000
--- a/src/net/authorize/auth/AbstractMobileMerchantAuthentication.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.authorize.auth;
-
-import java.io.Serializable;
-
-/**
- * Abstract mobile merchant authenticator.
- *
- */
-public class AbstractMobileMerchantAuthentication extends AbstractMerchantAuthentication implements IMerchantAuthentication, Serializable {
-
- private static final long serialVersionUID = 2L;
-
- protected String mobileDeviceId;
-
- /**
- * Mobile device id.
- *
- * @return the mobileDeviceId
- */
- public String getMobileDeviceId() {
- return mobileDeviceId;
- }
-
-}
diff --git a/src/net/authorize/auth/IMerchantAuthentication.java b/src/net/authorize/auth/IMerchantAuthentication.java
deleted file mode 100644
index b3b491a..0000000
--- a/src/net/authorize/auth/IMerchantAuthentication.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package net.authorize.auth;
-
-/**
- * Common interface for merchant authenticators.
- *
- */
-public interface IMerchantAuthentication {
-
- /**
- * Returns the merchant authentication type.
- *
- * @return MerchantAuthenticationType
- */
- public MerchantAuthenticationType getMerchantAuthenticationType();
-
- /**
- * Return the name associated used in conjunction with the authentication value.
- *
- * @return name
- */
- public String getName();
-
- /**
- * Return the authentication secret/value associated with the name.
- *
- * @return secret
- */
- public String getSecret();
-}
diff --git a/src/net/authorize/auth/MerchantAuthenticationType.java b/src/net/authorize/auth/MerchantAuthenticationType.java
deleted file mode 100644
index 8707343..0000000
--- a/src/net/authorize/auth/MerchantAuthenticationType.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.authorize.auth;
-
-/**
- * Defines the type of merchant authentication mechanisms that are supported.
- *
- */
-public enum MerchantAuthenticationType {
- PASSWORD,
- TRANSACTION_KEY,
- SESSION_TOKEN
-}
diff --git a/src/net/authorize/auth/PasswordAuthentication.java b/src/net/authorize/auth/PasswordAuthentication.java
deleted file mode 100644
index 9be9755..0000000
--- a/src/net/authorize/auth/PasswordAuthentication.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package net.authorize.auth;
-
-/**
- * Password authenticator.
- *
- */
-public class PasswordAuthentication extends AbstractMobileMerchantAuthentication implements IMerchantAuthentication {
-
- private static final long serialVersionUID = 2L;
-
- private PasswordAuthentication() {}
-
- /**
- * Creates a password authenticator.
- *
- * @param name
- * @param secret
- * @param mobileDeviceId
- *
- * @return PasswordAuthentication object
- */
- public static PasswordAuthentication createMerchantAuthentication(String name,
- String secret, String mobileDeviceId) {
-
- PasswordAuthentication authenticator = new PasswordAuthentication();
- authenticator.name = name;
- authenticator.secret = secret;
- authenticator.mobileDeviceId = mobileDeviceId;
- authenticator.merchantAuthenticationType = MerchantAuthenticationType.PASSWORD;
-
- return authenticator;
- }
-
-}
diff --git a/src/net/authorize/auth/SessionTokenAuthentication.java b/src/net/authorize/auth/SessionTokenAuthentication.java
deleted file mode 100644
index 6ea10c2..0000000
--- a/src/net/authorize/auth/SessionTokenAuthentication.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package net.authorize.auth;
-
-/**
- * Session token authenticator.
- *
- */
-public class SessionTokenAuthentication extends
- AbstractMobileMerchantAuthentication implements IMerchantAuthentication {
-
- private static final long serialVersionUID = 2L;
-
- private SessionTokenAuthentication() {
- }
-
- /**
- * Creates a session token authenticator.
- *
- * @param name
- * @param secret
- * @param mobileDeviceId
- *
- * @return SessionTokenAuthentication object
- */
- public static SessionTokenAuthentication createMerchantAuthentication(
- String name, String secret, String mobileDeviceId) {
-
- SessionTokenAuthentication authenticator = new SessionTokenAuthentication();
- authenticator.name = name;
- authenticator.secret = secret;
- authenticator.mobileDeviceId = mobileDeviceId;
- authenticator.merchantAuthenticationType = MerchantAuthenticationType.SESSION_TOKEN;
-
- return authenticator;
- }
-
- /**
- * Creates a session token authenticator from an existing auth, but with an
- * updated sessionToken.
- *
- * @param sessionTokenAuth
- * @param secret
- *
- * @return SessionTokenAuthentcation object.
- */
- public static SessionTokenAuthentication createMerchantAuthentication(
- SessionTokenAuthentication sessionTokenAuth, String secret) {
-
- SessionTokenAuthentication authenticator = new SessionTokenAuthentication();
- authenticator.name = null;
- authenticator.secret = secret;
- authenticator.mobileDeviceId = sessionTokenAuth.mobileDeviceId;
- authenticator.merchantAuthenticationType = MerchantAuthenticationType.SESSION_TOKEN;
-
- return authenticator;
- }
-
-}
diff --git a/src/net/authorize/auth/TransactionKeyAuthentication.java b/src/net/authorize/auth/TransactionKeyAuthentication.java
deleted file mode 100644
index 2cf0555..0000000
--- a/src/net/authorize/auth/TransactionKeyAuthentication.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.authorize.auth;
-
-/**
- * Transaction key authenticator.
- */
-public class TransactionKeyAuthentication extends
- AbstractMerchantAuthentication implements IMerchantAuthentication {
-
- private static final long serialVersionUID = 2L;
-
- private TransactionKeyAuthentication() {
- }
-
- /**
- * Creates a transaction key authenticator.
- *
- * @param name
- * @param secret
- *
- * @return TransactionKeyAuthentication container
- */
- public static TransactionKeyAuthentication createMerchantAuthentication(
- String name, String secret) {
-
- TransactionKeyAuthentication authenticator = new TransactionKeyAuthentication();
- authenticator.name = name;
- authenticator.secret = secret;
- authenticator.merchantAuthenticationType = MerchantAuthenticationType.TRANSACTION_KEY;
-
- return authenticator;
- }
-
-}
diff --git a/src/net/authorize/cim/Result.java b/src/net/authorize/cim/Result.java
deleted file mode 100644
index ae3155c..0000000
--- a/src/net/authorize/cim/Result.java
+++ /dev/null
@@ -1,478 +0,0 @@
-package net.authorize.cim;
-
-import java.util.ArrayList;
-
-import net.authorize.AuthNetField;
-import net.authorize.ITransaction;
-import net.authorize.data.Address;
-import net.authorize.data.CustomerType;
-import net.authorize.data.Payment;
-import net.authorize.data.cim.CustomerProfile;
-import net.authorize.data.cim.DirectResponse;
-import net.authorize.data.cim.PaymentProfile;
-import net.authorize.data.creditcard.CreditCard;
-import net.authorize.data.echeck.BankAccount;
-import net.authorize.data.echeck.BankAccountType;
-import net.authorize.util.StringUtils;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * Wrapper container for passing back the result from the gateway request.
- *
- */
-public class Result extends net.authorize.xml.Result {
-
- private static final long serialVersionUID = 2L;
-
- protected ArrayList customerProfileIdList = new ArrayList();
- protected CustomerProfile customerProfile;
-
- protected ArrayList customerPaymentProfileIdList = new ArrayList();
- protected ArrayList paymentProfileList = new ArrayList();
-
- protected ArrayList customerShippingAddressIdList = new ArrayList();
- protected ArrayList directResponseList = new ArrayList();
-
- protected Result() { }
-
- protected Result(ITransaction requestTransaction, String response) {
- super(requestTransaction, response);
- }
-
- public static Result createResult(ITransaction requestTransaction, String response) {
- Result result = new Result(requestTransaction, response);
-
- result.importCustomerProfileId();
- result.importCustomerPaymentProfileId();
- result.importCustomerShippingAddressIdList();
- result.importCustomerShippingAddressId();
- result.importDirectResponse();
- switch ((TransactionType)requestTransaction.getTransactionType()) {
- case GET_CUSTOMER_PROFILE_IDS:
- result.importCustomerProfileIdList();
- break;
- case GET_CUSTOMER_PAYMENT_PROFILE:
- result.importCustomerPaymentProfile();
- break;
- case GET_CUSTOMER_PROFILE:
- result.importCustomerProfile();
- break;
- case GET_CUSTOMER_SHIPPING_ADDRESS:
- result.importShippingAddress();
- break;
- default:
- break;
- }
-
- return result;
- }
-
- /**
- * Import the customer shipping address.
- */
- private void importCustomerShippingAddressId() {
- String customerShippingAddress = getElementText(
- getXmlResponseDoc().getDocument().getDocumentElement(), AuthNetField.ELEMENT_CUSTOMER_ADDRESS_ID.getFieldName());
- if(!StringUtils.isEmpty(customerShippingAddress)) {
- this.customerShippingAddressIdList.add(customerShippingAddress);
- }
- }
-
- /**
- * Import the customer profile id.
- */
- private void importCustomerProfileId() {
- String customerProfileId = getElementText(getXmlResponseDoc().getDocumentElement(),AuthNetField.ELEMENT_CUSTOMER_PROFILE_ID.getFieldName());
- if(!StringUtils.isEmpty(customerProfileId)) {
- this.customerProfileIdList.add(customerProfileId);
- }
- }
-
- /**
- * Import the customer payment profile id (list).
- */
- private void importCustomerPaymentProfileId(){
- NodeList payment_profile_id_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_CUSTOMER_PAYMENT_PROFILE_ID_LIST.getFieldName());
-
- if(payment_profile_id_list.getLength() == 1) {
- Element payment_profile_id_el = (Element)payment_profile_id_list.item(0);
- NodeList numeric_list = payment_profile_id_el.getChildNodes();
- for(int i = 0; i < numeric_list.getLength(); i++) {
- String numericStr = numeric_list.item(i).getTextContent();
- if(!net.authorize.util.StringUtils.isEmpty(numericStr)) {
- this.customerPaymentProfileIdList.add(numericStr);
- }
- }
- }
- // look for singular element data
- else {
- String paymentProfileIdStr = getElementText(
- getXmlResponseDoc().getDocument().getDocumentElement(),
- AuthNetField.ELEMENT_CUSTOMER_PAYMENT_PROFILE_ID.getFieldName());
- if(!net.authorize.util.StringUtils.isEmpty(paymentProfileIdStr)) {
- this.customerPaymentProfileIdList.add(paymentProfileIdStr);
- }
- }
- }
-
- /**
- * Import the customer shipping address id list.
- */
- private void importCustomerShippingAddressIdList(){
- NodeList shipping_address_id_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_CUSTOMER_SHIPPING_ADDRESS_ID_LIST.getFieldName());
- if(shipping_address_id_list.getLength() == 1) {
- Element shipping_address_id_el = (Element)shipping_address_id_list.item(0);
- NodeList numeric_list = shipping_address_id_el.getChildNodes();
- for(int i = 0; i < numeric_list.getLength(); i++) {
- String numericStr = numeric_list.item(i).getTextContent();
- if(!net.authorize.util.StringUtils.isEmpty(numericStr)) {
- this.customerShippingAddressIdList.add(numericStr);
- }
- }
- }
- }
-
- /**
- * Import the customer profile id list.
- *
- * @param txn
- */
- private void importCustomerProfileIdList() {
- NodeList profile_id_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_IDS.getFieldName());
- if(profile_id_list.getLength() == 1) {
- Element profile_id_el = (Element)profile_id_list.item(0);
- NodeList numeric_list = profile_id_el.getChildNodes();
- for(int i = 0; i < numeric_list.getLength(); i++) {
- String numericStr = numeric_list.item(i).getTextContent();
- if(!net.authorize.util.StringUtils.isEmpty(numericStr)) {
- this.customerProfileIdList.add(numericStr);
- }
- }
- }
- }
-
- /**
- * Import the customer profile information.
- *
- * @param transaction
- */
- private void importCustomerProfile() {
- NodeList profile_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_PROFILE.getFieldName());
- if(profile_list.getLength() == 0) {
- return;
- }
-
- Element profile_el = (Element)profile_list.item(0);
-
- // customer profile
- customerProfile = CustomerProfile.createCustomerProfile();
- customerProfile.setCustomerProfileId(getElementText(profile_el, AuthNetField.ELEMENT_CUSTOMER_PROFILE_ID.getFieldName()));
- customerProfile.setMerchantCustomerId(getElementText(profile_el, AuthNetField.ELEMENT_MERCHANT_CUSTOMER_ID.getFieldName()));
- customerProfile.setDescription(getElementText(profile_el, AuthNetField.ELEMENT_DESCRIPTION.getFieldName()));
- customerProfile.setEmail(getElementText(profile_el, AuthNetField.ELEMENT_EMAIL.getFieldName()));
- // payment profiles
- importPaymentProfiles(profile_el);
- importShipToList(profile_el, customerProfile);
- }
-
- /**
- * Import the shipping address
- *
- * @param transaction
- */
- private void importShippingAddress() {
- NodeList address_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_ADDRESS.getFieldName());
- if(address_list.getLength() == 0) {
- return;
- }
-
- Element address_el = (Element)address_list.item(0);
-
- // customer profile
- customerProfile = CustomerProfile.createCustomerProfile();
- Address shipToAddress = Address.createAddress();
- shipToAddress.setFirstName(getElementText(address_el, AuthNetField.ELEMENT_FIRST_NAME.getFieldName()));
- shipToAddress.setLastName(getElementText(address_el, AuthNetField.ELEMENT_LAST_NAME.getFieldName()));
- shipToAddress.setCompany(getElementText(address_el, AuthNetField.ELEMENT_COMPANY.getFieldName()));
- shipToAddress.setAddress(getElementText(address_el, AuthNetField.ELEMENT_ADDRESS.getFieldName(), true));
- shipToAddress.setCity(getElementText(address_el, AuthNetField.ELEMENT_CITY.getFieldName()));
- shipToAddress.setState(getElementText(address_el, AuthNetField.ELEMENT_STATE.getFieldName()));
- shipToAddress.setZipPostalCode(getElementText(address_el, AuthNetField.ELEMENT_ZIP.getFieldName()));
- shipToAddress.setCountry(getElementText(address_el, AuthNetField.ELEMENT_COUNTRY.getFieldName()));
- shipToAddress.setPhoneNumber(getElementText(address_el, AuthNetField.ELEMENT_PHONE_NUMBER.getFieldName()));
- shipToAddress.setFaxNumber(getElementText(address_el, AuthNetField.ELEMENT_FAX_NUMBER.getFieldName()));
- shipToAddress.setAddressId(getElementText(address_el, AuthNetField.ELEMENT_CUSTOMER_ADDRESS_ID.getFieldName()));
- customerProfile.addShipToAddress(shipToAddress);
- }
-
- /**
- * Import ship to address
- * @param root_el
- * @param customerProfile
- */
- private void importShipToList(Element root_el, CustomerProfile customerProfile) {
- NodeList ship_to_list = root_el.getElementsByTagName(AuthNetField.ELEMENT_SHIP_TO_LIST.getFieldName());
-
- for(int i = 0; i < ship_to_list.getLength(); i++) {
- Address shipToAddress = Address.createAddress();
- Element ship_to_el = (Element)ship_to_list.item(i);
- shipToAddress.setFirstName(getElementText(ship_to_el, AuthNetField.ELEMENT_FIRST_NAME.getFieldName()));
- shipToAddress.setLastName(getElementText(ship_to_el, AuthNetField.ELEMENT_LAST_NAME.getFieldName()));
- shipToAddress.setCompany(getElementText(ship_to_el, AuthNetField.ELEMENT_COMPANY.getFieldName()));
- shipToAddress.setAddress(getElementText(ship_to_el, AuthNetField.ELEMENT_ADDRESS.getFieldName(), true));
- shipToAddress.setCity(getElementText(ship_to_el, AuthNetField.ELEMENT_CITY.getFieldName()));
- shipToAddress.setState(getElementText(ship_to_el, AuthNetField.ELEMENT_STATE.getFieldName()));
- shipToAddress.setZipPostalCode(getElementText(ship_to_el, AuthNetField.ELEMENT_ZIP.getFieldName()));
- shipToAddress.setCountry(getElementText(ship_to_el, AuthNetField.ELEMENT_COUNTRY.getFieldName()));
- shipToAddress.setPhoneNumber(getElementText(ship_to_el, AuthNetField.ELEMENT_PHONE_NUMBER.getFieldName()));
- shipToAddress.setFaxNumber(getElementText(ship_to_el, AuthNetField.ELEMENT_FAX_NUMBER.getFieldName()));
- shipToAddress.setAddressId(getElementText(ship_to_el, AuthNetField.ELEMENT_CUSTOMER_ADDRESS_ID.getFieldName()));
- customerProfile.addShipToAddress(shipToAddress);
- }
- }
-
- /**
- * Import payment profile information.
- *
- * @param root_el
- */
- private void importPaymentProfiles(Element root_el) {
- NodeList payment_profile_list = root_el.getElementsByTagName(AuthNetField.ELEMENT_PAYMENT_PROFILES.getFieldName());
-
- for(int i = 0; i < payment_profile_list.getLength(); i++) {
- PaymentProfile paymentProfile = PaymentProfile.createPaymentProfile();
- Element payment_profile_el = (Element)payment_profile_list.item(i);
- paymentProfile.setCustomerType(CustomerType.findByName(getElementText(payment_profile_el, AuthNetField.ELEMENT_CUSTOMER_TYPE.getFieldName())));
- importBillTo(payment_profile_el, paymentProfile);
- paymentProfile.setCustomerPaymentProfileId(getElementText(payment_profile_el, AuthNetField.ELEMENT_CUSTOMER_PAYMENT_PROFILE_ID.getFieldName()));
- importPaymentInfo(payment_profile_el, paymentProfile);
- this.paymentProfileList.add(paymentProfile);
- }
- }
-
- /**
- * Import a customer payment profile.
- *
- * @param transaction
- */
- private void importCustomerPaymentProfile() {
- NodeList payment_profile_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_PAYMENT_PROFILE.getFieldName());
- if(payment_profile_list.getLength() == 0) {
- return;
- }
-
- Element payment_profile_el = (Element)payment_profile_list.item(0);
- PaymentProfile paymentProfile = PaymentProfile.createPaymentProfile();
- paymentProfile.setCustomerType(CustomerType.findByName(getElementText(payment_profile_el, AuthNetField.ELEMENT_CUSTOMER_TYPE.getFieldName())));
- importBillTo(payment_profile_el, paymentProfile);
- paymentProfile.setCustomerPaymentProfileId(getElementText(payment_profile_el, AuthNetField.ELEMENT_CUSTOMER_PAYMENT_PROFILE_ID.getFieldName()));
- importPaymentInfo(payment_profile_el, paymentProfile);
- this.paymentProfileList.add(paymentProfile);
- }
-
- /**
- * Import the bill to address
- * @param root_el
- * @param paymentProfile
- */
- private void importBillTo(Element root_el, PaymentProfile paymentProfile) {
- NodeList bill_to_list = root_el.getElementsByTagName(AuthNetField.ELEMENT_BILL_TO.getFieldName());
- if(bill_to_list.getLength() == 1) {
- Element bill_to_el = (Element)bill_to_list.item(0);
- Address billTo = Address.createAddress();
- billTo.setFirstName(getElementText(bill_to_el, AuthNetField.ELEMENT_FIRST_NAME.getFieldName()));
- billTo.setLastName(getElementText(bill_to_el, AuthNetField.ELEMENT_LAST_NAME.getFieldName()));
- billTo.setCompany(getElementText(bill_to_el, AuthNetField.ELEMENT_COMPANY.getFieldName()));
- billTo.setAddress(getElementText(bill_to_el, AuthNetField.ELEMENT_ADDRESS.getFieldName()));
- billTo.setCity(getElementText(bill_to_el, AuthNetField.ELEMENT_CITY.getFieldName()));
- billTo.setState(getElementText(bill_to_el, AuthNetField.ELEMENT_STATE.getFieldName()));
- billTo.setZipPostalCode(getElementText(bill_to_el, AuthNetField.ELEMENT_ZIP.getFieldName()));
- billTo.setCountry(getElementText(bill_to_el, AuthNetField.ELEMENT_COUNTRY.getFieldName()));
- paymentProfile.setBillTo(billTo);
- }
- }
-
- /**
- * Import the payment information.
- *
- * @param payment_profile_el
- * @param paymentProfile
- */
- private void importPaymentInfo(Element root_el, PaymentProfile paymentProfile) {
- NodeList payment_list = root_el.getElementsByTagName(AuthNetField.ELEMENT_PAYMENT.getFieldName());
-
- if(payment_list.getLength() == 0) {
- return;
- }
-
- Element payment_el = (Element)payment_list.item(0);
- NodeList credit_card_list = payment_el.getElementsByTagName(AuthNetField.ELEMENT_CREDIT_CARD.getFieldName());
- if(credit_card_list.getLength() != 0) {
- Element credit_card_el = (Element)credit_card_list.item(0);
- CreditCard creditCard = CreditCard.createCreditCard();
- creditCard.setMaskedCreditCardNumber(getElementText(credit_card_el, AuthNetField.ELEMENT_CREDIT_CARD_NUMBER.getFieldName()));
- creditCard.setExpirationDate(getElementText(credit_card_el, AuthNetField.ELEMENT_CREDIT_CARD_EXPIRY.getFieldName()));
-
- paymentProfile.addPayment(Payment.createPayment(creditCard));
- }
-
- NodeList bank_account_list = payment_el.getElementsByTagName(AuthNetField.ELEMENT_BANK_ACCOUNT.getFieldName());
- if(bank_account_list.getLength() != 0) {
- Element bank_account_el = (Element)bank_account_list.item(0);
- BankAccount bankAccount = BankAccount.createBankAccount();
- bankAccount.setBankAccountType(BankAccountType.findByValue(
- getElementText(bank_account_el, AuthNetField.ELEMENT_ACCOUNT_TYPE.getFieldName())));
- bankAccount.setRoutingNumber(getElementText(bank_account_el, AuthNetField.ELEMENT_ROUTING_NUMBER.getFieldName()));
- bankAccount.setBankAccountNumber(getElementText(bank_account_el, AuthNetField.ELEMENT_ACCOUNT_NUMBER.getFieldName()));
- bankAccount.setBankAccountName(getElementText(bank_account_el, AuthNetField.ELEMENT_NAME_ON_ACCOUNT.getFieldName()));
- bankAccount.setBankName(getElementText(bank_account_el, AuthNetField.ELEMENT_BANK_NAME.getFieldName()));
- }
- }
-
- /**
- * Import the (validation) direct response (list).
- */
- private void importDirectResponse(){
- NodeList validation_direct_response_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_VALIDATION_DIRECT_RESPONSE_LIST.getFieldName());
-
- if(validation_direct_response_list.getLength() > 0) {
- for(int i = 0; i < validation_direct_response_list.getLength(); i++){
- Element validation_direct_response_el = (Element)validation_direct_response_list.item(i);
- String validationDirectResponseStr = validation_direct_response_el.getTextContent();
- if(!StringUtils.isEmpty(validationDirectResponseStr)) {
- DirectResponse validationDirectResponse =
- DirectResponse.createDirectResponse(validationDirectResponseStr);
- this.directResponseList.add(validationDirectResponse);
- }
- }
- }
- // look for singular element data
- else {
- // look for validation direct response
- String directResponseStr = getElementText(
- getXmlResponseDoc().getDocument().getDocumentElement(),
- AuthNetField.ELEMENT_VALIDATION_DIRECT_RESPONSE.getFieldName());
- // if a validation direct response was not found, look for a direct response
- if(StringUtils.isEmpty(directResponseStr)) {
- directResponseStr = getElementText(
- getXmlResponseDoc().getDocument().getDocumentElement(),
- AuthNetField.ELEMENT_DIRECT_RESPONSE.getFieldName());
- }
-
- // assuming a direct response exists to some degree, get the container for it
- if(!StringUtils.isEmpty(directResponseStr)) {
- DirectResponse validationDirectResponse =
- DirectResponse.createDirectResponse(directResponseStr);
- this.directResponseList.add(validationDirectResponse);
- }
- }
- }
-
- /**
- * Get the first/only customer profile id from a possible list of many
- *
- * @return the customerProfileId
- */
- public String getCustomerProfileId() {
- String retval = null;
- if(this.customerProfileIdList != null &&
- !this.customerProfileIdList.isEmpty()) {
- retval = this.customerProfileIdList.get(0);
-
- }
-
- return retval;
- }
-
- /**
- * Get the directResponse list
- *
- * @return the directResponseList
- */
- public ArrayList getDirectResponseList() {
- return directResponseList;
- }
-
- /**
- * @return the refId
- */
- public String getRefId() {
- return refId;
- }
-
- /**
- * @return the customerPaymentProfileIdList
- */
- public ArrayList getCustomerPaymentProfileIdList() {
- return customerPaymentProfileIdList;
- }
-
- /**
- * @return the customerShippingAddressIdList
- */
- public ArrayList getCustomerShippingAddressIdList() {
- return customerShippingAddressIdList;
- }
-
- /**
- * @return the customerProfileIdList
- */
- public ArrayList getCustomerProfileIdList() {
- return customerProfileIdList;
- }
-
- /**
- * @return the paymentProfile
- */
- public ArrayList getCustomerPaymentProfileList() {
- return paymentProfileList;
- }
-
- /**
- * Get the first/only payment profile from a possible list of many
- *
- * @return the customerProfileId
- */
- public PaymentProfile getCustomerPaymentProfile() {
- PaymentProfile retval = null;
- if(this.paymentProfileList != null &&
- !this.paymentProfileList.isEmpty()) {
- retval = this.paymentProfileList.get(0);
- }
-
- return retval;
- }
-
- /**
- * Get the customer shipping address.
- *
- * @return Address
- */
- public Address getCustomerShippingAddress() {
- CustomerProfile customerProfile = getCustomerProfile();
- if(customerProfile != null) {
- return customerProfile.getShipToAddress();
- }
-
- return null;
- }
-
- /**
- * @return the customerProfile
- */
- public CustomerProfile getCustomerProfile() {
- return customerProfile;
- }
-
- /**
- * Print out messages for debugging.
- */
- public void printMessages() {
- super.printMessages();
- if(getCustomerProfileId() != null){
- System.out.println("Result customerProfile Id: " + getCustomerProfileId());
- }
- }
-}
diff --git a/src/net/authorize/cim/SplitTenderStatus.java b/src/net/authorize/cim/SplitTenderStatus.java
deleted file mode 100644
index 8aae0fc..0000000
--- a/src/net/authorize/cim/SplitTenderStatus.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package net.authorize.cim;
-
-
-public enum SplitTenderStatus {
- VOIDED,
- COMPLETED;
-}
diff --git a/src/net/authorize/cim/Transaction.java b/src/net/authorize/cim/Transaction.java
deleted file mode 100644
index 3d622ba..0000000
--- a/src/net/authorize/cim/Transaction.java
+++ /dev/null
@@ -1,1281 +0,0 @@
-package net.authorize.cim;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Map;
-
-import net.authorize.AuthNetField;
-import net.authorize.ITransaction;
-import net.authorize.Merchant;
-import net.authorize.data.Address;
-import net.authorize.data.OrderItem;
-import net.authorize.data.Payment;
-import net.authorize.data.ShippingCharges;
-import net.authorize.data.cim.CustomerProfile;
-import net.authorize.data.cim.PaymentProfile;
-import net.authorize.data.creditcard.CreditCard;
-import net.authorize.data.echeck.BankAccount;
-import net.authorize.util.BasicXmlDocument;
-import net.authorize.util.StringUtils;
-
-import org.w3c.dom.Element;
-
-/**
- * Transaction object for CIM.
- *
- */
-public class Transaction extends net.authorize.xml.XMLTransaction implements ITransaction {
-
- private static final long serialVersionUID = 2L;
-
- private TransactionType transactionType;
- private net.authorize.TransactionType paymentTransactionType;
-
- private String cardCode;
- private String customerPaymentProfileId;
- private String customerShippingAddressId;
- private String splitTenderId;
- private SplitTenderStatus splitTenderStatus = null;
- private String approvalCode;
- private String transactionId;
- private String creditCardNumberMasked;
- private String bankRoutingNumberMasked;
- private String bankAccountNumberMasked;
-
- private CustomerProfile customerProfile = CustomerProfile.createCustomerProfile();
- private ArrayList paymentProfileList = new ArrayList();
- protected Hashtable extraOptions = new Hashtable();
-
- private ValidationModeType validationMode = ValidationModeType.NONE;
-
- /**
- * Private constructor.
- *
- * @param merchant
- * @param transactionType
- */
- protected Transaction(Merchant merchant, TransactionType transactionType) {
- this.merchant = merchant;
- this.transactionType = transactionType;
- }
-
- /**
- * Creates a transaction.
- *
- * @param merchant
- * @param transactionType
- *
- * @return Transaction
- */
- public static Transaction createTransaction(Merchant merchant, TransactionType transactionType) {
- return new Transaction(merchant, transactionType);
- }
-
- /**
- * @return the transactionType
- */
- public TransactionType getTransactionType() {
- return transactionType;
- }
-
- /**
- * Add the customer profile id to the request.
- *
- * @param document
- */
- private void addCustomerProfileId(BasicXmlDocument document) {
- if(customerProfile != null && customerProfile.getCustomerProfileId() != null) {
- Element customer_profile_id_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_PROFILE_ID.getFieldName());
- customer_profile_id_el.appendChild(document.getDocument().createTextNode(customerProfile.getCustomerProfileId()));
- document.getDocumentElement().appendChild(customer_profile_id_el);
- }
- }
-
- /**
- * Add the customer address id to the request.
- *
- * @param document
- */
- private void addCustomerAddressId(BasicXmlDocument document) {
- if(this.customerShippingAddressId != null) {
- Element customer_shipping_address_id_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_ADDRESS_ID.getFieldName());
- customer_shipping_address_id_el.appendChild(document.getDocument().createTextNode(this.customerShippingAddressId));
- document.getDocumentElement().appendChild(customer_shipping_address_id_el);
- }
- }
- /**
- * Add the customer shipping address id to the request.
- *
- * @param document
- */
- private void addCustomerShippingAddressId(BasicXmlDocument document) {
- if(this.customerShippingAddressId != null) {
- Element customer_shipping_address_id_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_SHIPPING_ADDRESS_ID.getFieldName());
- customer_shipping_address_id_el.appendChild(document.getDocument().createTextNode(this.customerShippingAddressId));
- document.getDocumentElement().appendChild(customer_shipping_address_id_el);
- }
- }
-
- /**
- * Add the customer payment profile id to the request.
- *
- * @param document
- */
- private void addCustomerPaymentProfileId(BasicXmlDocument document) {
- if(this.customerPaymentProfileId != null) {
- Element customer_payment_profile_id_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_PAYMENT_PROFILE_ID.getFieldName());
- customer_payment_profile_id_el.appendChild(document.getDocument().createTextNode(this.customerPaymentProfileId));
- document.getDocumentElement().appendChild(customer_payment_profile_id_el);
- }
- }
-
- /**
- * Add the card code to the request.
- *
- * @param document
- */
- private void addCardCode(BasicXmlDocument document) {
- if(!StringUtils.isEmpty(this.cardCode)) {
- Element card_code_el = document.createElement(AuthNetField.ELEMENT_CARD_CODE.getFieldName());
- card_code_el.appendChild(document.getDocument().createTextNode(this.cardCode));
- document.getDocumentElement().appendChild(card_code_el);
- }
- }
-
- /**
- * Add customer profile to the request.
- *
- * @param document
- */
- private void addCustomerProfile(BasicXmlDocument document) {
- if(customerProfile != null) {
-
- Element profile_el = document.createElement(AuthNetField.ELEMENT_PROFILE.getFieldName());
- document.getDocumentElement().appendChild(profile_el);
-
- // merchantCustomerId
- if(StringUtils.isNotEmpty(this.customerProfile.getMerchantCustomerId())) {
- Element merchant_customer_id_el = document.createElement(AuthNetField.ELEMENT_MERCHANT_CUSTOMER_ID.getFieldName());
- merchant_customer_id_el.appendChild(document.getDocument().createTextNode(
- StringUtils.subString(this.customerProfile.getMerchantCustomerId(),20)));
- profile_el.appendChild(merchant_customer_id_el);
- }
-
- // description
- if(StringUtils.isNotEmpty(this.customerProfile.getDescription())) {
- Element description_el = document.createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- description_el.appendChild(document.getDocument().createTextNode(
- StringUtils.subString(this.customerProfile.getDescription(),255)));
- profile_el.appendChild(description_el);
- }
- // email
- if(StringUtils.isNotEmpty(this.customerProfile.getEmail())) {
- Element email_el = document.createElement(AuthNetField.ELEMENT_EMAIL.getFieldName());
- email_el.appendChild(document.getDocument().createTextNode(
- StringUtils.subString(this.customerProfile.getEmail(),255)));
- profile_el.appendChild(email_el);
- }
-
- // customerProfileId
- if(!StringUtils.isEmpty(this.customerProfile.getCustomerProfileId())) {
- Element customer_profile_id_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_PROFILE_ID.getFieldName());
- customer_profile_id_el.appendChild(document.getDocument().createTextNode(this.customerProfile.getCustomerProfileId()));
- profile_el.appendChild(customer_profile_id_el);
- }
-
- // add payment profiles
- addPaymentProfiles(document, profile_el);
- // add shipping address
- addAddress(document, AuthNetField.ELEMENT_SHIP_TO.getFieldName(), this.customerProfile.getShipToAddress(), document.getDocumentElement());
- }
- }
-
- /**
- * Add payment profiles to the request profile.
- *
- * @param document
- * @param profile_el - if null handles the singular element case
- */
- private void addPaymentProfiles(BasicXmlDocument document, Element profile_el) {
- if(this.paymentProfileList != null) {
- Element payment_profiles_el = null;
- // paymentProfile vs paymentProfiles
- if(profile_el == null && paymentProfileList.size() == 1) {
- payment_profiles_el = document.createElement(AuthNetField.ELEMENT_PAYMENT_PROFILE.getFieldName());
- } else {
- payment_profiles_el = document.createElement(AuthNetField.ELEMENT_PAYMENT_PROFILES.getFieldName());
- }
-
- if(this.paymentProfileList != null) {
- for(PaymentProfile paymentProfile : this.paymentProfileList) {
-
- if(paymentProfile != null) {
- if(paymentProfile.getCustomerType() != null) {
- Element cutomer_type_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_TYPE.getFieldName());
- cutomer_type_el.appendChild(document.getDocument().createTextNode(paymentProfile.getCustomerType().name().toLowerCase()));
- payment_profiles_el.appendChild(cutomer_type_el);
- }
-
- // billTo
- addAddress(document, AuthNetField.ELEMENT_BILL_TO.getFieldName(),
- paymentProfile.getBillTo(), payment_profiles_el);
- // payment
- Payment payment = paymentProfile.getPaymentList() != null &&
- !paymentProfile.getPaymentList().isEmpty() ?
- paymentProfile.getPaymentList().get(0):null;
-
- addPayment(document, payment, payment_profiles_el);
-
- // add the payment profile id if avail
- if(!StringUtils.isEmpty(paymentProfile.getCustomerPaymentProfileId())) {
- Element customer_payment_profile_id_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_PAYMENT_PROFILE_ID.getFieldName());
- customer_payment_profile_id_el.appendChild(document.getDocument().createTextNode(paymentProfile.getCustomerPaymentProfileId()));
- payment_profiles_el.appendChild(customer_payment_profile_id_el);
- }
-
- // append to the doc properly
- if(profile_el != null) {
- profile_el.appendChild(payment_profiles_el);
- } else {
- document.getDocumentElement().appendChild(payment_profiles_el);
- break; // handle the paymentProfile singular case
- }
- }
- }
- }
- }
- }
-
- /**
- * Add payment information to the payment profile.
- *
- * @param document
- * @param payment
- * @param parent_el
- */
- private void addPayment(BasicXmlDocument document, Payment payment,
- Element parent_el) {
-
- if(payment == null) return;
-
- Element payment_el = document.createElement(AuthNetField.ELEMENT_PAYMENT.getFieldName());
- CreditCard credit_card= payment.getCreditCard();
- BankAccount bank_account = payment.getBankAccount();
-
- if (credit_card != null) {
- Element cc_el = document.createElement(AuthNetField.ELEMENT_CREDIT_CARD.getFieldName());
-
- Element cc_num_el = document.createElement(AuthNetField.ELEMENT_CREDIT_CARD_NUMBER.getFieldName());
- cc_num_el.appendChild(document.getDocument().createTextNode(credit_card.getCreditCardNumber()));
- cc_el.appendChild(cc_num_el);
-
- Element cc_exp_el = document.createElement(AuthNetField.ELEMENT_CREDIT_CARD_EXPIRY.getFieldName());
- cc_exp_el.appendChild(document.getDocument().createTextNode(net.authorize.util.DateUtil.getFormattedDate(credit_card.getExpirationDate(),
- CreditCard.ARB_EXPIRY_DATE_FORMAT)));
- cc_el.appendChild(cc_exp_el);
-
- payment_el.appendChild(cc_el);
- }
- else if (bank_account != null) {
- Element bankacct_el = document.createElement(AuthNetField.ELEMENT_BANK_ACCOUNT.getFieldName());
-
- if(bank_account.getBankAccountType() != null) {
- Element account_type_el = document.createElement(AuthNetField.ELEMENT_ACCOUNT_TYPE.getFieldName());
- account_type_el.appendChild(document.getDocument().createTextNode(bank_account.getBankAccountType().getValue().toLowerCase()));
- bankacct_el.appendChild(account_type_el);
- }
-
- Element routing_number_el = document.createElement(AuthNetField.ELEMENT_ROUTING_NUMBER.getFieldName());
- routing_number_el.appendChild(document.getDocument().createTextNode(bank_account.getRoutingNumber()));
- bankacct_el.appendChild(routing_number_el);
-
- Element acct_number_el = document.createElement(AuthNetField.ELEMENT_ACCOUNT_NUMBER.getFieldName());
- acct_number_el.appendChild(document.getDocument().createTextNode(bank_account.getBankAccountNumber()));
- bankacct_el.appendChild(acct_number_el);
-
- Element name_on_acct_el = document.createElement(AuthNetField.ELEMENT_NAME_ON_ACCOUNT.getFieldName());
- name_on_acct_el.appendChild(document.getDocument().createTextNode(bank_account.getBankAccountName()));
- bankacct_el.appendChild(name_on_acct_el);
-
- if(bank_account.getECheckType() != null) {
- Element echeck_type_el = document.createElement(AuthNetField.ELEMENT_ECHECK_TYPE.getFieldName());
- echeck_type_el.appendChild(document.getDocument().createTextNode(bank_account.getECheckType().getValue()));
- bankacct_el.appendChild(echeck_type_el);
- }
-
- Element bank_name_el = document.createElement(AuthNetField.ELEMENT_BANK_NAME.getFieldName());
- bank_name_el.appendChild(document.getDocument().createTextNode(bank_account.getBankName()));
- bankacct_el.appendChild(bank_name_el);
-
- payment_el.appendChild(bankacct_el);
- }
-
- parent_el.appendChild(payment_el);
- }
-
- /**
- * Add address info (shipTo / billTo).
- *
- * @param document
- * @param elementName
- * @param address
- * @param parent_el - can be null if adding directly to the document
- */
- private void addAddress(BasicXmlDocument document, String elementName,
- Address address, Element parent_el) {
-
- if(address != null) {
- Element address_el = document.createElement(elementName);
-
- if(StringUtils.isNotEmpty(address.getFirstName())) {
- Element fname_el = document.createElement(AuthNetField.ELEMENT_FIRST_NAME.getFieldName());
- fname_el.appendChild(document.getDocument().createTextNode(address.getFirstName()));
- address_el.appendChild(fname_el);
- }
-
- if(StringUtils.isNotEmpty(address.getLastName())) {
- Element lname_el = document.createElement(AuthNetField.ELEMENT_LAST_NAME.getFieldName());
- lname_el.appendChild(document.getDocument().createTextNode(address.getLastName()));
- address_el.appendChild(lname_el);
- }
-
- if(StringUtils.isNotEmpty(address.getCompany())) {
- Element company_el = document.createElement(AuthNetField.ELEMENT_COMPANY.getFieldName());
- company_el.appendChild(document.getDocument().createTextNode(address.getCompany()));
- address_el.appendChild(company_el);
- }
-
- if(StringUtils.isNotEmpty(address.getAddress())) {
- Element address_line_el = document.createElement(AuthNetField.ELEMENT_ADDRESS.getFieldName());
- address_line_el.appendChild(document.getDocument().createTextNode(address.getAddress()));
- address_el.appendChild(address_line_el);
- }
-
- if(StringUtils.isNotEmpty(address.getCity())) {
- Element city_el = document.createElement(AuthNetField.ELEMENT_CITY.getFieldName());
- city_el.appendChild(document.getDocument().createTextNode(address.getCity()));
- address_el.appendChild(city_el);
- }
-
- if(StringUtils.isNotEmpty(address.getState())) {
- Element state_el = document.createElement(AuthNetField.ELEMENT_STATE.getFieldName());
- state_el.appendChild(document.getDocument().createTextNode(address.getState()));
- address_el.appendChild(state_el);
- }
-
- if(StringUtils.isNotEmpty(address.getZipPostalCode())) {
- Element zip_el = document.createElement(AuthNetField.ELEMENT_ZIP.getFieldName());
- zip_el.appendChild(document.getDocument().createTextNode(address.getZipPostalCode()));
- address_el.appendChild(zip_el);
- }
-
- if(StringUtils.isNotEmpty(address.getCountry())) {
- Element country_el = document.createElement(AuthNetField.ELEMENT_COUNTRY.getFieldName());
- country_el.appendChild(document.getDocument().createTextNode(address.getCountry()));
- address_el.appendChild(country_el);
- }
-
- if(StringUtils.isNotEmpty(address.getPhoneNumber())) {
- Element phone_el = document.createElement(AuthNetField.ELEMENT_PHONE_NUMBER.getFieldName());
- phone_el.appendChild(document.getDocument().createTextNode(address.getPhoneNumber()));
- address_el.appendChild(phone_el);
- }
-
- if(StringUtils.isNotEmpty(address.getFaxNumber())) {
- Element fax_el = document.createElement(AuthNetField.ELEMENT_FAX_NUMBER.getFieldName());
- fax_el.appendChild(document.getDocument().createTextNode(address.getFaxNumber()));
- address_el.appendChild(fax_el);
- }
-
- if(!StringUtils.isEmpty(address.getAddressId())) {
- Element address_id_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_ADDRESS_ID.getFieldName());
- address_id_el.appendChild(document.getDocument().createTextNode(address.getAddressId()));
- address_el.appendChild(address_id_el);
- }
-
- parent_el.appendChild(address_el);
- }
- }
-
- /**
- * Set the validation mode on the request.
- *
- * @param document
- */
- private void addValidationMode(BasicXmlDocument document) {
- if(this.validationMode != null) {
- Element validation_mode_el = document.createElement(AuthNetField.ELEMENT_VALIDATION_MODE.getFieldName());
- validation_mode_el.appendChild(document.getDocument().createTextNode(this.validationMode.getValue()));
- document.getDocumentElement().appendChild(validation_mode_el);
- }
- }
-
- /**
- * Adds transaction specific information to the request.
- *
- * @param document
- */
- private void addPaymentTransaction(BasicXmlDocument document) {
- boolean authOrCaptureTxn = (net.authorize.TransactionType.AUTH_ONLY.equals(this.transactionType) ||
- net.authorize.TransactionType.AUTH_CAPTURE.equals(this.transactionType) ||
- net.authorize.TransactionType.CAPTURE_ONLY.equals(this.transactionType) );
-
- Element transaction_el = document.createElement(AuthNetField.ELEMENT_TRANSACTION.getFieldName());
-
- Element profile_trans_x_el = document.createElement(
- this.paymentTransactionType.getCIMValue());
-
- ShippingCharges shippingCharges = null;
-
- // amount
- if(order != null && order.getTotalAmount() != null) {
- shippingCharges = order.getShippingCharges();
- Element amount_el = document.createElement(AuthNetField.ELEMENT_AMOUNT.getFieldName());
- amount_el.appendChild(document.getDocument().createTextNode(
- order.getTotalAmount().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()));
- profile_trans_x_el.appendChild(amount_el);
- if(shippingCharges != null) {
-
- // tax
- Element tax_el = document.createElement(AuthNetField.ELEMENT_TAX.getFieldName());
- Element tax_amount_el = document.createElement(AuthNetField.ELEMENT_AMOUNT.getFieldName());
- Element tax_name_el = document.createElement(AuthNetField.ELEMENT_NAME.getFieldName());
- Element tax_description_el = document.createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- if(shippingCharges.getTaxAmount() != null) {
- tax_amount_el.appendChild(document.getDocument().createTextNode(
- shippingCharges.getTaxAmount().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()));
- }
- if(shippingCharges.getTaxItemName() != null) {
- tax_name_el.appendChild(document.getDocument().createTextNode(
- shippingCharges.getTaxItemName()));
- }
- if(shippingCharges.getTaxDescription() != null) {
- tax_description_el.appendChild(document.getDocument().createTextNode(
- shippingCharges.getTaxDescription()));
- }
- tax_el.appendChild(tax_amount_el);
- tax_el.appendChild(tax_name_el);
- tax_el.appendChild(tax_description_el);
- profile_trans_x_el.appendChild(tax_el);
-
- // shipping
- Element shipping_el = document.createElement(AuthNetField.ELEMENT_SHIPPING.getFieldName());
- Element shipping_amount_el = document.createElement(AuthNetField.ELEMENT_AMOUNT.getFieldName());
- Element shipping_name_el = document.createElement(AuthNetField.ELEMENT_NAME.getFieldName());
- Element shipping_description_el = document.createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- if(shippingCharges.getFreightAmount() != null) {
- shipping_amount_el.appendChild(document.getDocument().createTextNode(
- shippingCharges.getFreightAmount().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()));
- }
- if(shippingCharges.getFreightItemName() != null) {
- shipping_name_el.appendChild(document.getDocument().createTextNode(
- shippingCharges.getFreightItemName()));
- }
- if(shippingCharges.getFreightDescription() != null) {
- shipping_description_el.appendChild(document.getDocument().createTextNode(
- shippingCharges.getFreightDescription()));
- }
- shipping_el.appendChild(shipping_amount_el);
- shipping_el.appendChild(shipping_name_el);
- shipping_el.appendChild(shipping_description_el);
- profile_trans_x_el.appendChild(shipping_el);
-
- // line items
- for(OrderItem orderItem : order.getOrderItems()) {
- Element line_item_el = document.createElement(AuthNetField.ELEMENT_LINE_ITEMS.getFieldName());
-
- Element item_id_el = document.createElement(AuthNetField.ELEMENT_ITEM_ID.getFieldName());
- item_id_el.appendChild(document.getDocument().createTextNode(orderItem.getItemId()));
-
- Element name_el = document.createElement(AuthNetField.ELEMENT_NAME.getFieldName());
- name_el.appendChild(document.getDocument().createTextNode(orderItem.getItemName()));
-
- Element description_el = document.createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- description_el.appendChild(document.getDocument().createTextNode(orderItem.getItemDescription()));
-
- Element quantity_el = document.createElement(AuthNetField.ELEMENT_QUANTITY.getFieldName());
- quantity_el.appendChild(document.getDocument().createTextNode(orderItem.getItemQuantity().toBigInteger().toString()));
-
- Element unit_price_el = document.createElement(AuthNetField.ELEMENT_UNIT_PRICE.getFieldName());
- unit_price_el.appendChild(document.getDocument().createTextNode(
- orderItem.getItemPrice().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString()));
-
- Element taxable_el = document.createElement(AuthNetField.ELEMENT_TAXABLE.getFieldName());
- taxable_el.appendChild(document.getDocument().createTextNode(orderItem.isItemTaxable()?TRUE.toLowerCase():FALSE.toLowerCase()));
-
- line_item_el.appendChild(item_id_el);
- line_item_el.appendChild(name_el);
- line_item_el.appendChild(description_el);
- line_item_el.appendChild(quantity_el);
- line_item_el.appendChild(unit_price_el);
- line_item_el.appendChild(taxable_el);
-
- profile_trans_x_el.appendChild(line_item_el);
- }
- }
- }
-
- // customer profile id
- if(customerProfile != null && !StringUtils.isEmpty(customerProfile.getCustomerProfileId())) {
- Element customer_profile_id_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_PROFILE_ID.getFieldName());
- customer_profile_id_el.appendChild(document.getDocument().createTextNode(customerProfile.getCustomerProfileId()));
- profile_trans_x_el.appendChild(customer_profile_id_el);
- }
-
- // customer payment profile id
- if(!StringUtils.isEmpty(this.customerPaymentProfileId)) {
- Element customer_payment_profile_id_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_PAYMENT_PROFILE_ID.getFieldName());
- customer_payment_profile_id_el.appendChild(document.getDocument().createTextNode(this.customerPaymentProfileId));
- profile_trans_x_el.appendChild(customer_payment_profile_id_el);
- }
-
- // customer shipping address id
- if(!StringUtils.isEmpty(this.customerShippingAddressId)) {
- Element customer_shipping_address_id_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_SHIPPING_ADDRESS_ID.getFieldName());
- customer_shipping_address_id_el.appendChild(document.getDocument().createTextNode(this.customerShippingAddressId));
- profile_trans_x_el.appendChild(customer_shipping_address_id_el);
- }
-
- // creditCardNumberMasked
- if(!StringUtils.isEmpty(this.creditCardNumberMasked)) {
- Element credit_card_num_mask_el = document.createElement(AuthNetField.ELEMENT_CREDIT_CARD_NUMBER_MASKED.getFieldName());
- credit_card_num_mask_el.appendChild(document.getDocument().createTextNode(this.creditCardNumberMasked));
- profile_trans_x_el.appendChild(credit_card_num_mask_el);
- }
- // bankRoutingNumberMasked
- // bankAccountNumberMasked
- else if (!StringUtils.isEmpty(this.bankAccountNumberMasked)) {
- Element bank_routing_num_mask_el = document.createElement(AuthNetField.ELEMENT_BANK_ROUTING_NUMBER_MASKED.getFieldName());
- bank_routing_num_mask_el.appendChild(document.getDocument().createTextNode(this.bankRoutingNumberMasked));
- profile_trans_x_el.appendChild(bank_routing_num_mask_el);
-
- Element bank_acct_num_mask_el = document.createElement(AuthNetField.ELEMENT_BANK_ACCOUNT_NUMBER_MASKED.getFieldName());
- bank_acct_num_mask_el.appendChild(document.getDocument().createTextNode(this.bankAccountNumberMasked));
- profile_trans_x_el.appendChild(bank_acct_num_mask_el);
- }
-
- // check for prior auth/capture which is unique
- if (!net.authorize.TransactionType.PRIOR_AUTH_CAPTURE.equals(this.paymentTransactionType)) {
-
- if (order != null) {
- Element order_el = document.createElement(AuthNetField.ELEMENT_ORDER
- .getFieldName());
- Element invoice_number_el = document
- .createElement(AuthNetField.ELEMENT_INVOICE_NUMBER.getFieldName());
- Element description_el = document
- .createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- Element purchase_order_number_el = document
- .createElement(AuthNetField.ELEMENT_PURCHASE_ORDER_NUMBER
- .getFieldName());
-
- // invoice #
- if (StringUtils.isNotEmpty(order.getInvoiceNumber())) {
- invoice_number_el.appendChild(document.getDocument().createTextNode(
- order.getInvoiceNumber()));
- order_el.appendChild(invoice_number_el);
- }
-
- // order description
- if (StringUtils.isNotEmpty(order.getDescription())) {
- description_el.appendChild(document.getDocument().createTextNode(
- order.getDescription()));
- order_el.appendChild(description_el);
- }
-
- // shipping charges PO
- if (shippingCharges != null
- && StringUtils.isNotEmpty(shippingCharges.getPurchaseOrderNumber())) {
- purchase_order_number_el.appendChild(document.getDocument()
- .createTextNode(shippingCharges.getPurchaseOrderNumber()));
- order_el.appendChild(purchase_order_number_el);
- }
-
- profile_trans_x_el.appendChild(order_el);
- }
-
- // tax exempt
- if (shippingCharges != null) {
- Element tax_exempt_el = document
- .createElement(AuthNetField.ELEMENT_TAX_EXEMPT.getFieldName());
- tax_exempt_el.appendChild(document.getDocument().createTextNode(
- shippingCharges.isTaxExempt() ? TRUE.toLowerCase() : FALSE
- .toLowerCase()));
- profile_trans_x_el.appendChild(tax_exempt_el);
- }
-
- if (authOrCaptureTxn) {
- // recurring billing
- Element recurring_billing_el = document
- .createElement(AuthNetField.ELEMENT_RECURRING_BILLING
- .getFieldName());
- recurring_billing_el.appendChild(document.getDocument().createTextNode(
- this.merchant.isRecurringBilling() ? TRUE.toLowerCase() : FALSE
- .toLowerCase()));
- profile_trans_x_el.appendChild(recurring_billing_el);
-
- // card code
- if(!StringUtils.isEmpty(this.cardCode)) {
- Element card_code_el = document
- .createElement(AuthNetField.ELEMENT_CARD_CODE.getFieldName());
- card_code_el.appendChild(document.getDocument().createTextNode(
- this.cardCode));
- profile_trans_x_el.appendChild(card_code_el);
- }
- }
-
- // split tender id
- if (!StringUtils.isEmpty(this.splitTenderId)) {
- Element split_tender_id_el = document
- .createElement(AuthNetField.ELEMENT_SPLIT_TENDER_ID.getFieldName());
- split_tender_id_el.appendChild(document.getDocument().createTextNode(
- this.splitTenderId));
- profile_trans_x_el.appendChild(split_tender_id_el);
- }
- }
-
- // transId
- if(!StringUtils.isEmpty(this.transactionId)) {
- Element trans_id_el = document.createElement(AuthNetField.ELEMENT_TRANS_ID.getFieldName());
- trans_id_el.appendChild(document.getDocument().createTextNode(this.transactionId));
- profile_trans_x_el.appendChild(trans_id_el);
- }
-
- // approval code
- if(StringUtils.isNotEmpty(this.approvalCode)) {
- Element approval_code_el = document.createElement(AuthNetField.ELEMENT_APPROVAL_CODE.getFieldName());
- approval_code_el.appendChild(document.getDocument().createTextNode(this.approvalCode));
- profile_trans_x_el.appendChild(approval_code_el);
- }
-
- transaction_el.appendChild(profile_trans_x_el);
- document.getDocumentElement().appendChild(transaction_el);
- }
-
- /**
- * Add extra options that do not exist with CIM (see AIM).
- *
- * @param document
- */
- private void addExtraOptions(BasicXmlDocument document) {
- if(this.extraOptions != null && this.extraOptions.size() > 0) {
- Element extra_options_el = document.createElement(AuthNetField.ELEMENT_EXTRA_OPTIONS.getFieldName());
- StringBuilder cDataBuffer = new StringBuilder();
-
- for(String key : extraOptions.keySet()) {
- String value = extraOptions.get(key).toString();
- cDataBuffer.append(key).append("=").append(value).append("&");
- }
- if(cDataBuffer.length() > 0) {
- cDataBuffer.deleteCharAt(cDataBuffer.length()-1);
- extra_options_el.appendChild(document.getDocument().createCDATASection(cDataBuffer.toString()));
- document.getDocumentElement().appendChild(extra_options_el);
- }
- }
- }
-
- /**
- * Add the split tender id and status to the document.
- *
- * @param document
- */
- private void addSplitTenderInfo(BasicXmlDocument document) {
- if(this.splitTenderId != null) {
- Element split_tender_id_el = document.createElement(AuthNetField.ELEMENT_SPLIT_TENDER_ID.getFieldName());
- split_tender_id_el.appendChild(document.getDocument().createTextNode(this.splitTenderId));
- document.getDocumentElement().appendChild(split_tender_id_el);
- }
-
- if(this.splitTenderStatus != null) {
- Element split_tender_status_el = document.createElement(AuthNetField.ELEMENT_SPLIT_TENDER_STATUS.getFieldName());
- split_tender_status_el.appendChild(document.getDocument().createTextNode(
- this.splitTenderStatus.name().toLowerCase()));
- document.getDocumentElement().appendChild(split_tender_status_el);
- }
- }
-
- /**
- * Convert request to XML.
- */
- public String toAuthNetPOSTString() {
- switch (this.transactionType) {
- case CREATE_CUSTOMER_PROFILE :
- createCustomerProfile();
- break;
- case CREATE_CUSTOMER_PAYMENT_PROFILE :
- createCustomerPaymentProfile();
- break;
- case CREATE_CUSTOMER_SHIPPING_ADDRESS :
- createCustomerShippingAddress();
- break;
- case CREATE_CUSTOMER_PROFILE_TRANSACTION :
- createCustomerProfileTransaction();
- break;
- case DELETE_CUSTOMER_PROFILE :
- deleteCustomerProfile();
- break;
- case DELETE_CUSTOMER_PAYMENT_PROFILE :
- deleteCustomerPaymentProfile();
- break;
- case DELETE_CUSTOMER_SHIPPING_ADDRESS :
- deleteCustomerShippingAddress();
- break;
- case GET_CUSTOMER_PROFILE_IDS :
- getCustomerProfileIds();
- break;
- case GET_CUSTOMER_PROFILE :
- getCustomerProfile();
- break;
- case GET_CUSTOMER_PAYMENT_PROFILE :
- getCustomerPaymentProfile();
- break;
- case GET_CUSTOMER_SHIPPING_ADDRESS :
- getCustomerShippingAddress();
- break;
- case UPDATE_CUSTOMER_PROFILE :
- updateCustomerProfile();
- break;
- case UPDATE_CUSTOMER_PAYMENT_PROFILE :
- updateCustomerPaymentProfile();
- break;
- case UPDATE_CUSTOMER_SHIPPING_ADDRESS :
- updateCustomerShippingAddress();
- break;
- case UPDATE_SPLIT_TENDER_GROUP :
- updateSplitTenderGroup();
- break;
- case VALIDATE_CUSTOMER_PAYMENT_PROFILE :
- validateCustomerPaymentProfile();
- break;
- default:
- break;
- }
-
- return currentRequest.dump();
- }
-
- /**
- * Validate customer payment profile request.
- */
- private void validateCustomerPaymentProfile() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.VALIDATE_CUSTOMER_PAYMENT_PROFILE.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addCustomerProfileId(document);
- addCustomerPaymentProfileId(document);
- addCustomerShippingAddressId(document);
- addCardCode(document);
- addValidationMode(document);
- currentRequest = document;
- }
-
- /**
- * Update the split tender group.
- */
- private void updateSplitTenderGroup() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.UPDATE_SPLIT_TENDER_GROUP.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addSplitTenderInfo(document);
- currentRequest = document;
- }
-
- /**
- * Update the customer shipping address.
- */
- private void updateCustomerShippingAddress() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.UPDATE_CUSTOMER_SHIPPING_ADDRESS.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addCustomerProfileId(document);
- // add shipping address
- addAddress(document, AuthNetField.ELEMENT_ADDRESS.getFieldName(),
- this.customerProfile.getShipToAddress(),
- document.getDocumentElement());
- currentRequest = document;
- }
-
- /**
- * Update the customer payment profile.
- */
- private void updateCustomerPaymentProfile() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.UPDATE_CUSTOMER_PAYMENT_PROFILE.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addCustomerProfileId(document);
- addPaymentProfiles(document, null);
- addValidationMode(document);
-
- currentRequest = document;
- }
-
- /**
- * Update the customer profile.
- */
- private void updateCustomerProfile() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.UPDATE_CUSTOMER_PROFILE.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addCustomerProfile(document);
- currentRequest = document;
- }
-
- /**
- * Get customer shipping address request.
- */
- private void getCustomerShippingAddress() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.GET_CUSTOMER_SHIPPING_ADDRESS.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addCustomerProfileId(document);
- addCustomerAddressId(document);
- currentRequest = document;
- }
-
- /**
- * Get customer payment profile request.
- */
- private void getCustomerPaymentProfile() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.GET_CUSTOMER_PAYMENT_PROFILE.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addCustomerProfileId(document);
- addCustomerPaymentProfileId(document);
- currentRequest = document;
- }
-
- /**
- * Get customer profile request.
- */
- private void getCustomerProfile() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.GET_CUSTOMER_PROFILE.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addCustomerProfileId(document);
- currentRequest = document;
- }
-
- /**
- * Get customer profile ids request.
- */
- private void getCustomerProfileIds() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.GET_CUSTOMER_PROFILE_IDS.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- currentRequest = document;
- }
-
- /**
- * Delete customer shipping address request.
- */
- private void deleteCustomerShippingAddress() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.DELETE_CUSTOMER_SHIPPING_ADDRESS.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addCustomerProfileId(document);
- addCustomerAddressId(document);
- currentRequest = document;
- }
-
- /**
- * Delete customer payment profile.
- */
- private void deleteCustomerPaymentProfile() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.DELETE_CUSTOMER_PAYMENT_PROFILE.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addCustomerProfileId(document);
- addCustomerPaymentProfileId(document);
- currentRequest = document;
- }
-
- /**
- * Delete customer profile request.
- */
- private void deleteCustomerProfile() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.DELETE_CUSTOMER_PROFILE.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addCustomerProfileId(document);
- currentRequest = document;
- }
-
- /**
- * Create customer profile transaction request.
- */
- private void createCustomerProfileTransaction() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.CREATE_CUSTOMER_PROFILE_TRANSACTION.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addPaymentTransaction(document);
- addExtraOptions(document);
- addAddress(document, AuthNetField.ELEMENT_ADDRESS.getFieldName(),
- this.customerProfile.getShipToAddress(),
- document.getDocumentElement());
-
- currentRequest = document;
- }
-
- /**
- * Create customer shipping address request.
- */
- private void createCustomerShippingAddress() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.CREATE_CUSTOMER_SHIPPING_ADDRESS.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addCustomerProfileId(document);
- addAddress(document, AuthNetField.ELEMENT_ADDRESS.getFieldName(),
- this.customerProfile.getShipToAddress(), document.getDocumentElement());
-
- currentRequest = document;
- }
-
- /**
- * Create customer payment profile request.
- */
- private void createCustomerPaymentProfile() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.CREATE_CUSTOMER_PAYMENT_PROFILE.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addCustomerProfileId(document);
- addPaymentProfiles(document, null);
- addValidationMode(document);
-
- currentRequest = document;
- }
-
- /**
- * Create customer profile request.
- */
- private void createCustomerProfile() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.CREATE_CUSTOMER_PROFILE.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addCustomerProfile(document);
- addValidationMode(document);
-
- currentRequest = document;
- }
-
- /**
- * @return the paymentProfileList
- */
- public ArrayList getPaymentProfileList() {
- return paymentProfileList;
- }
-
- /**
- * @param paymentProfileList the paymentProfileList to set
- */
- public void setPaymentProfileList(ArrayList paymentProfileList) {
- this.paymentProfileList = paymentProfileList;
- }
-
- /**
- * Add a payment profile.
- *
- * @param paymentProfile
- */
- public void addPaymentProfile(PaymentProfile paymentProfile) {
- if(this.paymentProfileList == null) {
- this.paymentProfileList = new ArrayList();
- }
-
- this.paymentProfileList.add(paymentProfile);
- }
-
- /**
- * Set shipping information.
- *
- * @param shipTo
- */
- public void setShipTo(Address shipTo) {
- if(this.customerProfile == null) {
- customerProfile = CustomerProfile.createCustomerProfile();
- }
-
- customerProfile.addShipToAddress(shipTo);
- }
-
- /**
- * Get the validation mode.
- *
- * @return the validationMode
- */
- public ValidationModeType getValidationMode() {
- return validationMode;
- }
-
- /**
- * Set the validation mode for the request.
- *
- * @param validationMode the validationMode to set
- */
- public void setValidationMode(ValidationModeType validationMode) {
- this.validationMode = validationMode;
- }
-
- /**
- * Set the customer profile.
- *
- * @param customerProfile the customerProfile to set
- */
- public void setCustomerProfile(CustomerProfile customerProfile) {
- if(customerProfile != null) {
- if(StringUtils.isEmpty(customerProfile.getCustomerProfileId())) {
- customerProfile.setCustomerProfileId(this.customerProfile.getCustomerProfileId());
- }
- }
- this.customerProfile = customerProfile;
- }
-
- /**
- * Set the customer profile id.
- *
- * @param customerProfileId
- */
- public void setCustomerProfileId(String customerProfileId) {
- if(this.customerProfile == null) {
- this.customerProfile = CustomerProfile.createCustomerProfile();
- }
- this.customerProfile.setCustomerProfileId(customerProfileId);
- }
-
- /**
- * Set the customer payment profile id.
- *
- * @param customerPaymentProfileId
- */
- public void setCustomerPaymentProfileId(String customerPaymentProfileId) {
- this.customerPaymentProfileId = customerPaymentProfileId;
- }
-
- /**
- * Set the customer shipping address id.
- *
- * @param customerShippingAddressId
- */
- public void setCustomerShippingAddressId(String customerShippingAddressId) {
- this.customerShippingAddressId = customerShippingAddressId;
- }
-
- /**
- * Set the card code for specific transactions.
- *
- * @param cardCode
- */
- public void setCardCode(String cardCode) {
- this.cardCode = cardCode;
- }
-
- /**
- * Sets the extra options.
- *
- * @param extraOptions the extraOptions to set
- */
- public void setExtraOptions(Hashtable extraOptions) {
- this.extraOptions = extraOptions;
- }
-
- /**
- * Add extra option to the extra options map.
- *
- * @param key
- * @param value
- */
- public void addExtraOption(String key, String value) {
- if(this.extraOptions == null) {
- this.extraOptions = new Hashtable();
- }
- this.extraOptions.put(key, value);
- }
-
- /**
- * @return the splitTenderId
- */
- public String getSplitTenderId() {
- return splitTenderId;
- }
-
- /**
- * @param splitTenderId the splitTenderId to set
- */
- public void setSplitTenderId(String splitTenderId) {
- this.splitTenderId = splitTenderId;
- }
-
- /**
- * @return the splitTenderStatus
- */
- public SplitTenderStatus getSplitTenderStatus() {
- return splitTenderStatus;
- }
-
- /**
- * @param splitTenderStatus the splitTenderStatus to set
- */
- public void setSplitTenderStatus(SplitTenderStatus splitTenderStatus) {
- this.splitTenderStatus = splitTenderStatus;
- }
-
- /**
- * @return the approvalCode
- */
- public String getApprovalCode() {
- return approvalCode;
- }
-
- /**
- * @param approvalCode the approvalCode to set
- */
- public void setApprovalCode(String approvalCode) {
- this.approvalCode = approvalCode;
- }
-
- /**
- * @return the transactionId
- */
- public String getTransactionId() {
- return transactionId;
- }
-
- /**
- * @param transactionId the transactionId to set
- */
- public void setTransactionId(String transactionId) {
- this.transactionId = transactionId;
- }
-
- /**
- * @return the creditCardNumberMasked
- */
- public String getCreditCardNumberMasked() {
- return creditCardNumberMasked;
- }
-
- /**
- * @param creditCardNumberMasked the creditCardNumberMasked to set
- */
- public void setCreditCardNumberMasked(String creditCardNumberMasked) {
- this.creditCardNumberMasked = creditCardNumberMasked;
- }
-
- /**
- * @return the bankRoutingNumberMasked
- */
- public String getBankRoutingNumberMasked() {
- return bankRoutingNumberMasked;
- }
-
- /**
- * @param bankRoutingNumberMasked the bankRoutingNumberMasked to set
- */
- public void setBankRoutingNumberMasked(String bankRoutingNumberMasked) {
- this.bankRoutingNumberMasked = bankRoutingNumberMasked;
- }
-
- /**
- * @return the bankAccountNumberMasked
- */
- public String getBankAccountNumberMasked() {
- return bankAccountNumberMasked;
- }
-
- /**
- * @param bankAccountNumberMasked the bankAccountNumberMasked to set
- */
- public void setBankAccountNumberMasked(String bankAccountNumberMasked) {
- this.bankAccountNumberMasked = bankAccountNumberMasked;
- }
-
- /**
- * @return the cardCode
- */
- public String getCardCode() {
- return cardCode;
- }
-
- /**
- * @return the customerPaymentProfileId
- */
- public String getCustomerPaymentProfileId() {
- return customerPaymentProfileId;
- }
-
- /**
- * @return the customerShippingAddressId
- */
- public String getCustomerShippingAddressId() {
- return customerShippingAddressId;
- }
-
- /**
- * @return the extraOptions
- */
- public Map getExtraOptions() {
- return extraOptions;
- }
-
- /**
- * @return the paymentTransactionType
- */
- public net.authorize.TransactionType getPaymentTransactionType() {
- return paymentTransactionType;
- }
-
- /**
- * @param paymentTransactionType the paymentTransactionType to set
- */
- public void setPaymentTransactionType(
- net.authorize.TransactionType paymentTransactionType) {
- this.paymentTransactionType = paymentTransactionType;
- }
-
- public void setTransId(String transId) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/src/net/authorize/cim/TransactionType.java b/src/net/authorize/cim/TransactionType.java
deleted file mode 100644
index 8f6aa94..0000000
--- a/src/net/authorize/cim/TransactionType.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package net.authorize.cim;
-
-
-/**
- * Enumeration of CIM transaction types that are supported by Authorize.Net
- */
-public enum TransactionType {
-
- CREATE_CUSTOMER_PROFILE("createCustomerProfileRequest"),
- CREATE_CUSTOMER_PAYMENT_PROFILE("createCustomerPaymentProfileRequest"),
- CREATE_CUSTOMER_SHIPPING_ADDRESS("createCustomerShippingAddressRequest"),
- CREATE_CUSTOMER_PROFILE_TRANSACTION("createCustomerProfileTransactionRequest"),
- DELETE_CUSTOMER_PROFILE("deleteCustomerProfileRequest"),
- DELETE_CUSTOMER_PAYMENT_PROFILE("deleteCustomerPaymentProfileRequest"),
- DELETE_CUSTOMER_SHIPPING_ADDRESS("deleteCustomerShippingAddressRequest"),
- GET_CUSTOMER_PROFILE_IDS("getCustomerProfileIdsRequest"),
- GET_CUSTOMER_PROFILE("getCustomerProfileRequest"),
- GET_CUSTOMER_PAYMENT_PROFILE("getCustomerPaymentProfileRequest"),
- GET_CUSTOMER_SHIPPING_ADDRESS("getCustomerShippingAddressRequest"),
- UPDATE_CUSTOMER_PROFILE("updateCustomerProfileRequest"),
- UPDATE_CUSTOMER_PAYMENT_PROFILE("updateCustomerPaymentProfileRequest"),
- UPDATE_CUSTOMER_SHIPPING_ADDRESS("updateCustomerShippingAddressRequest"),
- UPDATE_SPLIT_TENDER_GROUP("updateSplitTenderGroupRequest"),
- VALIDATE_CUSTOMER_PAYMENT_PROFILE("validateCustomerPaymentProfileRequest");
-
- final private String value;
-
- private TransactionType(String value) {
- this.value = value;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
-}
diff --git a/src/net/authorize/cim/ValidationModeType.java b/src/net/authorize/cim/ValidationModeType.java
deleted file mode 100644
index 5cdaafe..0000000
--- a/src/net/authorize/cim/ValidationModeType.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.authorize.cim;
-
-
-public enum ValidationModeType {
- NONE("none"),
- TEST_MODE("testMode"),
- LIVE_MODE("liveMode");
-
- final private String value;
-
- private ValidationModeType(String value) {
- this.value = value;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
-}
diff --git a/src/net/authorize/data/Address.java b/src/net/authorize/data/Address.java
deleted file mode 100644
index ca717a1..0000000
--- a/src/net/authorize/data/Address.java
+++ /dev/null
@@ -1,199 +0,0 @@
-package net.authorize.data;
-
-import java.io.Serializable;
-
-public class Address implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- public static final int MAX_FIRST_NAME_LENGTH = 50;
- public static final int MAX_LAST_NAME_LENGTH = 50;
- public static final int MAX_COMPANY_LENGTH = 50;
- public static final int MAX_ADDRESS_LENGTH = 60;
- public static final int MAX_CITY_LENGTH = 40;
- public static final int MAX_STATE_LENGTH = 40;
- public static final int MAX_ZIP_LENGTH = 20;
- public static final int MAX_COUNTRY_LENGTH = 60;
-
- protected String firstName;
- protected String lastName;
- protected String company;
- protected String address;
- protected String city;
- protected String state;
- protected String zipPostalCode;
- protected String country;
- protected String phoneNumber;
- protected String faxNumber;
- protected String addressId;
-
- protected Address() {
- }
-
- public static Address createAddress() {
- return new Address();
- }
-
- /**
- * @return the firstName
- */
- public String getFirstName() {
- return firstName;
- }
-
- /**
- * @param firstName
- * the firstName to set
- */
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- /**
- * @return the lastName
- */
- public String getLastName() {
- return lastName;
- }
-
- /**
- * @param lastName
- * the lastName to set
- */
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- /**
- * @return the company
- */
- public String getCompany() {
- return company;
- }
-
- /**
- * @param company
- * the company to set
- */
- public void setCompany(String company) {
- this.company = company;
- }
-
- /**
- * @return the address
- */
- public String getAddress() {
- return address;
- }
-
- /**
- * @param address
- * the address to set
- */
- public void setAddress(String address) {
- this.address = address;
- }
-
- /**
- * @return the city
- */
- public String getCity() {
- return city;
- }
-
- /**
- * @param city
- * the city to set
- */
- public void setCity(String city) {
- this.city = city;
- }
-
- /**
- * @return the state
- */
- public String getState() {
- return state;
- }
-
- /**
- * @param state
- * the state to set
- */
- public void setState(String state) {
- this.state = state;
- }
-
- /**
- * @return the zipPostalCode
- */
- public String getZipPostalCode() {
- return zipPostalCode;
- }
-
- /**
- * @param zipPostalCode
- * the zip / postal code to set
- */
- public void setZipPostalCode(String zipPostalCode) {
- this.zipPostalCode = zipPostalCode;
- }
-
- /**
- * @return the country
- */
- public String getCountry() {
- return country;
- }
-
- /**
- * @param country
- * the country to set
- */
- public void setCountry(String country) {
- this.country = country;
- }
-
- /**
- * @return the phoneNumber
- */
- public String getPhoneNumber() {
- return phoneNumber;
- }
-
- /**
- * @param phoneNumber the phoneNumber to set
- */
- public void setPhoneNumber(String phoneNumber) {
- this.phoneNumber = phoneNumber;
- }
-
- /**
- * @return the faxNumber
- */
- public String getFaxNumber() {
- return faxNumber;
- }
-
- /**
- * @param faxNumber the faxNumber to set
- */
- public void setFaxNumber(String faxNumber) {
- this.faxNumber = faxNumber;
- }
-
- /**
- * @return the addressId
- */
- public String getAddressId() {
- return addressId;
- }
-
- /**
- * @param addressId the addressId to set
- */
- public void setAddressId(String addressId) {
- this.addressId = addressId;
- }
-
-}
diff --git a/src/net/authorize/data/Customer.java b/src/net/authorize/data/Customer.java
deleted file mode 100644
index 45e2c9e..0000000
--- a/src/net/authorize/data/Customer.java
+++ /dev/null
@@ -1,345 +0,0 @@
-package net.authorize.data;
-
-import java.io.Serializable;
-
-
-/**
- * Customer specific information.
- *
- */
-public class Customer implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- public static final int MAX_FIRST_NAME_LENGTH = 50;
- public static final int MAX_LAST_NAME_LENGTH = 50;
- public static final int MAX_COMPANY_LENGTH = 50;
- public static final int MAX_ADDRES_LENGTH = 60;
- public static final int MAX_CITY_LENGTH = 40;
- public static final int MAX_STATE_LENGTH = 40;
- public static final int MAX_ZIP_LENGTH = 20;
- public static final int MAX_COUNTRY_LENGTH = 60;
- public static final int MAX_FAX_LENGTH = 25;
- public static final int MAX_EMAIL_LENGTH = 255;
- public static final int MAX_CUSTOMER_ID_LENGTH = 20;
- public static final int MAX_CUSTOMER_IP_LENGTH = 15;
-
- private String id;
- private Address billTo;
- private Address shipTo;
- private DriversLicense license;
-
- private String email;
- private String customerId;
- private String customerIP;
-
- private CustomerType customerType;
-
- private String taxId;
-
- protected Customer(){
-
- }
-
- public static Customer createCustomer() {
- Customer customer = new Customer();
-
- return customer;
- }
-
- public static Customer createCustomer(CustomerType customerType) {
- Customer customer = new Customer();
- customer.setCustomerType(customerType);
-
- return customer;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Address getBillTo() {
- if(this.billTo == null) {
- this.billTo = Address.createAddress();
- }
- return billTo;
- }
-
- public void setBillTo(Address bill_to) {
- this.billTo = bill_to;
- }
-
- public boolean isDriversLicenseSpecified() {
- return this.license != null;
- }
-
- public DriversLicense getLicense() {
- return license;
- }
-
- public void setLicense(DriversLicense license) {
- this.license = license;
- }
-
- public Address getShipTo() {
- if(this.shipTo == null) {
- this.shipTo = Address.createAddress();
- }
- return shipTo;
- }
-
- public void setShipTo(Address ship_to) {
- this.shipTo = ship_to;
- }
-
- public String getTaxId() {
- return taxId;
- }
-
- public void setTaxId(String taxId) {
- this.taxId = taxId;
- }
-
- public CustomerType getCustomerType() {
- return customerType;
- }
-
- public void setCustomerType(CustomerType type) {
- this.customerType = type;
- }
-
- /**
- * @return the email
- */
- public String getEmail() {
- return email;
- }
-
- /**
- * @param email the email to set
- */
- public void setEmail(String email) {
- this.email = email;
- }
-
- /**
- * @return the customerId
- */
- public String getCustomerId() {
- return customerId;
- }
-
- /**
- * @param customerId the customerId to set
- */
- public void setCustomerId(String customerId) {
- this.customerId = customerId;
- }
-
- /**
- * @return the customerIP
- */
- public String getCustomerIP() {
- return customerIP;
- }
-
- /**
- * @param customerIP the customerIP to set
- */
- public void setCustomerIP(String customerIP) {
- this.customerIP = customerIP;
- }
-
- /**
- * @return the firstName
- */
- public String getFirstName() {
- return this.billTo!=null?this.billTo.getFirstName():null;
- }
-
- /**
- * @param firstName the firstName to set
- */
- public void setFirstName(String firstName) {
- if(this.billTo == null) {
- this.billTo = Address.createAddress();
- }
- this.billTo.setFirstName(firstName);
- }
-
- /**
- * @return the lastName
- *
- */
- public String getLastName() {
- return this.billTo!=null?this.billTo.getLastName():null;
- }
-
- /**
- * @param lastName the lastName to set
- */
- public void setLastName(String lastName) {
- if(this.billTo == null) {
- this.billTo = Address.createAddress();
- }
- this.billTo.setLastName(lastName);
- }
-
- /**
- * @return the company
- *
- */
- public String getCompany() {
- return this.billTo!=null?this.billTo.getCompany():null;
- }
-
- /**
- * @param company the company to set
- *
- */
- public void setCompany(String company) {
- if(this.billTo == null) {
- this.billTo = Address.createAddress();
- }
- this.billTo.setCompany(company);
- }
-
- /**
- * @return the address
- *
- */
- public String getAddress() {
- return this.billTo!=null?this.billTo.getAddress():null;
- }
-
- /**
- * @param address the address to set
- *
- */
- public void setAddress(String address) {
- if(this.billTo == null) {
- this.billTo = Address.createAddress();
- }
- this.billTo.setAddress(address);
- }
-
- /**
- * @return the city
- *
- */
- public String getCity() {
- return this.billTo!=null?this.billTo.getCity():null;
- }
-
- /**
- * @param city the city to set
- *
- */
- public void setCity(String city) {
- if(this.billTo == null) {
- this.billTo = Address.createAddress();
- }
- this.billTo.setCity(city);
- }
-
- /**
- * @return the state
- *
- */
- public String getState() {
- return this.billTo!=null?this.billTo.getCity():null;
- }
-
- /**
- * @param state the state to set
- *
- */
- public void setState(String state) {
- if(this.billTo == null) {
- this.billTo = Address.createAddress();
- }
- this.billTo.setState(state);
- }
-
- /**
- * @return the zipPostalCode
- *
- */
- public String getZipPostalCode() {
- return this.billTo!=null?this.billTo.getZipPostalCode():null;
- }
-
- /**
- * @param zipPostalCode the zipPostalCode to set
- *
- */
- public void setZipPostalCode(String zipPostalCode) {
- if(this.billTo == null) {
- this.billTo = Address.createAddress();
- }
- this.billTo.setZipPostalCode(zipPostalCode);
- }
-
- /**
- * @return the country
- *
- */
- public String getCountry() {
- return this.billTo!=null?this.billTo.getCountry():null;
- }
-
- /**
- * @param country the country to set
- *
- */
- public void setCountry(String country) {
- if(this.billTo == null) {
- this.billTo = Address.createAddress();
- }
- this.billTo.setCountry(country);
- }
-
- /**
- * @return the phone
- *
- */
- public String getPhone() {
- return this.billTo.getPhoneNumber();
- }
-
- /**
- * @param phone the phone to set
- *
- */
- public void setPhone(String phone) {
- if(this.billTo == null) {
- this.billTo = Address.createAddress();
- }
- this.billTo.setPhoneNumber(phone);
- }
-
- /**
- * @return the fax
- *
- */
- public String getFax() {
- return this.billTo!=null?this.billTo.getFaxNumber():null;
- }
-
- /**
- * @param fax the fax to set
- *
- */
- public void setFax(String fax) {
- if(this.billTo == null) {
- this.billTo = Address.createAddress();
- }
- this.billTo.setFaxNumber(fax);
- }
-
-
-}
diff --git a/src/net/authorize/data/CustomerType.java b/src/net/authorize/data/CustomerType.java
deleted file mode 100644
index df6e901..0000000
--- a/src/net/authorize/data/CustomerType.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package net.authorize.data;
-
-
-public enum CustomerType {
- INDIVIDUAL("individual"),
- BUSINESS("business");
-
- private String value;
-
- private CustomerType(String value) {
- this.value = value;
- }
-
- /**
- * Lookup a CustomerType by it's name.
- *
- * @param name
- *
- * @return Returns a CustomerType if the name match is found.
- */
- public static CustomerType findByName(String name) {
- for(CustomerType customerType : values()) {
- if(customerType.name().equalsIgnoreCase(name)) {
- return customerType;
- }
- }
-
- return null;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
-}
diff --git a/src/net/authorize/data/DriversLicense.java b/src/net/authorize/data/DriversLicense.java
deleted file mode 100644
index e6f6892..0000000
--- a/src/net/authorize/data/DriversLicense.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package net.authorize.data;
-import java.io.Serializable;
-import java.util.Date;
-
-public class DriversLicense implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private String number;
- private String state;
- private Date birth_date;
- public static String LICENSE_DATE_FORMAT = "yyyy-MM-dd";
-
- public DriversLicense(){
- }
-
-
- public Date getBirthDate() {
- return birth_date;
- }
-
- public void setBirthDate(String date){
- this.birth_date = net.authorize.util.DateUtil.getDateFromFormattedDate(date, LICENSE_DATE_FORMAT);
- }
- public void setBirthDate(Date birth_date) {
- this.birth_date = birth_date;
- }
-
- public String getNumber() {
- return number;
- }
-
- public void setNumber(String number) {
- this.number = number;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-}
diff --git a/src/net/authorize/data/EmailReceipt.java b/src/net/authorize/data/EmailReceipt.java
deleted file mode 100644
index 8b800c4..0000000
--- a/src/net/authorize/data/EmailReceipt.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package net.authorize.data;
-
-import java.io.Serializable;
-
-
-/**
- * Merchants can opt to send a payment gateway generated email receipt to
- * customers who provide an email address with their transaction.
- *
- * The email receipt includes a summary and results of the transaction.
- */
-public class EmailReceipt implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- public static final int MAX_EMAIL_LENGTH = 255;
-
- private String headerEmailReceipt;
- private String footerEmailReceipt;
-
- private EmailReceipt() { };
-
- public static EmailReceipt createEmailReceipt() {
-
- return new EmailReceipt();
- }
-
- /**
- * @return the headerEmailReceipt
- */
- public String getHeaderEmailReceipt() {
- return headerEmailReceipt;
- }
-
- /**
- * @param headerEmailReceipt the headerEmailReceipt to set
- */
- public void setHeaderEmailReceipt(String headerEmailReceipt) {
- this.headerEmailReceipt = headerEmailReceipt;
- }
-
- /**
- * @return the footerEmailReceipt
- */
- public String getFooterEmailReceipt() {
- return footerEmailReceipt;
- }
-
- /**
- * @param footerEmailReceipt the footerEmailReceipt to set
- */
- public void setFooterEmailReceipt(String footerEmailReceipt) {
- this.footerEmailReceipt = footerEmailReceipt;
- }
-
-}
diff --git a/src/net/authorize/data/MerchantAccountDetails.java b/src/net/authorize/data/MerchantAccountDetails.java
deleted file mode 100644
index 0afc52a..0000000
--- a/src/net/authorize/data/MerchantAccountDetails.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package net.authorize.data;
-
-import java.io.Serializable;
-
-import net.authorize.aim.cardpresent.DeviceType;
-import net.authorize.aim.cardpresent.MarketType;
-
-public class MerchantAccountDetails implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private DeviceType deviceType;
- private MarketType marketType;
-
- private MerchantAccountDetails(){
-
- }
-
- public static MerchantAccountDetails getInstance(){
- return new MerchantAccountDetails();
- }
- public DeviceType getDeviceType() {
- return deviceType;
- }
- public void setDeviceType(DeviceType deviceType) {
- this.deviceType = deviceType;
- }
- public MarketType getMarketType() {
- return marketType;
- }
- public void setMarketType(MarketType marketType) {
- this.marketType = marketType;
- }
-
-}
diff --git a/src/net/authorize/data/Order.java b/src/net/authorize/data/Order.java
deleted file mode 100644
index 42605b8..0000000
--- a/src/net/authorize/data/Order.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package net.authorize.data;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * General order related information.
- *
- */
-public class Order implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- public static final int MAX_INVOICE_NUMBER_LENGTH = 20;
- public static final int MAX_DESCRIPTION_LENGTH = 255;
- public static final int MAX_ORDER_ITEM_SIZE = 30;
-
- protected String invoiceNumber;
- protected String purchaseOrderNumber;
- protected String description;
- protected BigDecimal totalAmount = new BigDecimal(0.00);
- protected ShippingCharges shippingCharges;
-
- protected List orderItems = new ArrayList();
-
- protected Order() { }
-
- public static Order createOrder() {
-
- return new Order();
- }
-
- /**
- * @return the invoiceNumber
- */
- public String getInvoiceNumber() {
- return invoiceNumber;
- }
-
- /**
- * @param invoiceNumber the invoiceNumber to set
- */
- public void setInvoiceNumber(String invoiceNumber) {
- this.invoiceNumber = invoiceNumber;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Return the total amount of the order.
- *
- * @return the totalAmount
- */
- public BigDecimal getTotalAmount() {
- return totalAmount;
- }
-
- /**
- * Set the total amount of the order.
- *
- * @param totalAmount the totalAmount to set
- */
- public void setTotalAmount(BigDecimal totalAmount) {
- this.totalAmount = totalAmount;
- }
-
- /**
- * @return the orderItems
- */
- public List getOrderItems() {
- return orderItems;
- }
-
- /**
- * Sets the list of OrderItems to the list being passed in. The list will
- * be truncated to 30 items, which is the max number of OrderItems allowed.
- *
- * @param orderItems the orderItems to set
- */
- public void setOrderItems(List orderItems) {
- synchronized(this) {
- int itemListMax = orderItems.size()>MAX_ORDER_ITEM_SIZE?MAX_ORDER_ITEM_SIZE:orderItems.size();
- try {
- this.orderItems = new ArrayList(orderItems.subList(0, itemListMax));
- } catch (Exception e) {
- ;
- }
- }
- }
-
- /**
- * Adds an OrderItem to the list of OrderItems - provided the list of items
- * isn't already at the max of 30.
- *
- * @param orderItem
- */
- public void addOrderItem(OrderItem orderItem) {
- synchronized(this) {
- if(this.orderItems.size() < MAX_ORDER_ITEM_SIZE) {
- this.orderItems.add(orderItem);
- }
- }
- }
-
- /**
- * Get the shipping charges associated with this order.
- *
- * @return the shippingCharges
- */
- public ShippingCharges getShippingCharges() {
- return shippingCharges;
- }
-
- /**
- * Set the shipping charges assocaited with this order.
- *
- * @param shippingCharges the shippingCharges to set
- */
- public void setShippingCharges(ShippingCharges shippingCharges) {
- this.shippingCharges = shippingCharges;
- }
-
- /**
- * @return the purchaseOrderNumber
- */
- public String getPurchaseOrderNumber() {
- return purchaseOrderNumber;
- }
-
- /**
- * @param purchaseOrderNumber the purchaseOrderNumber to set
- */
- public void setPurchaseOrderNumber(String purchaseOrderNumber) {
- this.purchaseOrderNumber = purchaseOrderNumber;
- }
-
-
-}
diff --git a/src/net/authorize/data/OrderItem.java b/src/net/authorize/data/OrderItem.java
deleted file mode 100644
index c4afa6c..0000000
--- a/src/net/authorize/data/OrderItem.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package net.authorize.data;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-import net.authorize.aim.Transaction;
-import net.authorize.util.StringUtils;
-
-/**
- * Itemized order information.
- *
- */
-public class OrderItem implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- public static final int MAX_ITEM_ID_LENGTH = 31;
- public static final int MAX_ITEM_NAME_LENGTH = 31;
- public static final int MAX_ITEM_DESCRIPTION_LENGTH = 255;
-
- protected String itemId;
- protected String itemName;
- protected String itemDescription;
- protected BigDecimal itemQuantity = new BigDecimal(0.00);
- protected BigDecimal itemPrice = new BigDecimal(0.00);
- protected boolean itemTaxable = false;
-
- protected OrderItem() { }
-
- public static OrderItem createOrderItem() {
- OrderItem orderItem = new OrderItem();
-
- return orderItem;
- }
-
- /**
- * @return the itemId
- */
- public String getItemId() {
- return itemId;
- }
-
- /**
- * @param itemId the itemId to set
- */
- public void setItemId(String itemId) {
- this.itemId = itemId;
- }
-
- /**
- * @return the itemName
- */
- public String getItemName() {
- return itemName;
- }
-
- /**
- * @param itemName the itemName to set
- */
- public void setItemName(String itemName) {
- this.itemName = itemName;
- }
-
- /**
- * @return the itemDescription
- */
- public String getItemDescription() {
- return itemDescription;
- }
-
- /**
- * @param itemDescription the itemDescription to set
- */
- public void setItemDescription(String itemDescription) {
- this.itemDescription = itemDescription;
- }
-
- /**
- * @return the itemQuantity
- */
- public BigDecimal getItemQuantity() {
- return itemQuantity;
- }
-
- /**
- * @param itemQuantity the itemQuantity to set
- */
- public void setItemQuantity(BigDecimal itemQuantity) {
- this.itemQuantity = itemQuantity;
- if(this.itemQuantity != null) {
- this.itemQuantity.setScale(Transaction.QUANTITY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @param itemQuantity the itemQuantity to set
- */
- public void setItemQuantity(String itemQuantity) {
- if(StringUtils.isNotEmpty(itemQuantity)) {
- this.itemQuantity = new BigDecimal(itemQuantity).setScale(Transaction.QUANTITY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the itemPrice
- */
- public BigDecimal getItemPrice() {
- return itemPrice;
- }
-
- /**
- * @param itemPrice the itemPrice to set
- */
- public void setItemPrice(BigDecimal itemPrice) {
- this.itemPrice = itemPrice;
- }
-
- /**
- * @param itemPrice the itemPrice to set
- */
- public void setItemPrice(String itemPrice) {
- if(StringUtils.isNotEmpty(itemPrice)) {
- this.itemPrice = new BigDecimal(itemPrice).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the itemTaxable
- */
- public boolean isItemTaxable() {
- return itemTaxable;
- }
-
- /**
- * @param itemTaxable the itemTaxable to set
- */
- public void setItemTaxable(boolean itemTaxable) {
- this.itemTaxable = itemTaxable;
- }
-
- /**
- * @param itemTaxable the itemTaxable to set
- */
- public void setItemTaxable(String itemTaxable) {
- if(StringUtils.isNotEmpty(itemTaxable)) {
- this.itemTaxable = Boolean.valueOf(itemTaxable);
- }
- }
-
-}
diff --git a/src/net/authorize/data/Payment.java b/src/net/authorize/data/Payment.java
deleted file mode 100644
index 88e865c..0000000
--- a/src/net/authorize/data/Payment.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package net.authorize.data;
-
-import java.io.Serializable;
-
-import net.authorize.data.creditcard.CreditCard;
-import net.authorize.data.echeck.BankAccount;
-
-public class Payment implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private CreditCard credit_card;
- private BankAccount bank_account;
-
- protected Payment(){
-
- }
-
- public static Payment createPayment(CreditCard in_credit) {
- Payment payment = new Payment();
- payment.credit_card = in_credit;
-
- return payment;
- }
-
- public static Payment createPayment(BankAccount in_account) {
- Payment payment = new Payment();
- payment.bank_account = in_account;
-
- return payment;
- }
-
- public BankAccount getBankAccount() {
- return bank_account;
- }
- public void setBankAccount(BankAccount bank_account) {
- this.bank_account = bank_account;
- }
- public CreditCard getCreditCard() {
- return credit_card;
- }
- public void setCreditCard(CreditCard credit_card) {
- this.credit_card = credit_card;
- }
-
-}
diff --git a/src/net/authorize/data/PaymentMethod.java b/src/net/authorize/data/PaymentMethod.java
deleted file mode 100644
index 48bbb00..0000000
--- a/src/net/authorize/data/PaymentMethod.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package net.authorize.data;
-
-
-/**
- * The method of payment for the transaction.
- * CC (credit card) or ECHECK (electronic check).
- */
-public enum PaymentMethod {
- CREDIT_CARD("CC"),
- E_CHECK("ECHECK"),
- UNKNOWN("UNKNOWN");
-
- private final String method;
-
- private PaymentMethod(String method) {
- this.method = method;
- }
-
- /**
- * @return the method
- */
- public String getMethod() {
- return method;
- }
-
-
-}
diff --git a/src/net/authorize/data/PermissionType.java b/src/net/authorize/data/PermissionType.java
deleted file mode 100644
index c81bd09..0000000
--- a/src/net/authorize/data/PermissionType.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package net.authorize.data;
-
-
-/**
- * Permissions that are associated with accounts.
- */
-public enum PermissionType {
- API_MERCHANT_BASIC_REPORTING("API_Merchant_BasicReporting"),
- MOBILE_ADMIN("Mobile_Admin"),
- SUBMIT_CHARGE("Submit_Charge"),
- SUBMIT_REFUND("Submit_Refund"),
- SUBMIT_UPDATE("Submit_Update");
-
- final private String value;
-
- private PermissionType(String value) {
- this.value = value;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Lookup a permission by it's value.
- *
- * @param value
- * @return PermissionType
- */
- public static PermissionType findByValue(String value) {
- for(PermissionType permission : values()) {
- if(permission.value.equals(value)) {
- return permission;
- }
- }
-
- return null; // unknown
- }
-
-}
diff --git a/src/net/authorize/data/ShippingAddress.java b/src/net/authorize/data/ShippingAddress.java
deleted file mode 100644
index 2024498..0000000
--- a/src/net/authorize/data/ShippingAddress.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.authorize.data;
-
-import java.io.Serializable;
-
-
-/**
- * Product shipping address.
- */
-public class ShippingAddress extends Address implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
-
- private ShippingAddress() {
- super();
- }
-
- public static ShippingAddress createShippingAddress() {
- return new ShippingAddress();
- }
-
-}
diff --git a/src/net/authorize/data/ShippingCharges.java b/src/net/authorize/data/ShippingCharges.java
deleted file mode 100644
index 2a42f51..0000000
--- a/src/net/authorize/data/ShippingCharges.java
+++ /dev/null
@@ -1,235 +0,0 @@
-package net.authorize.data;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-import net.authorize.aim.Transaction;
-import net.authorize.util.StringUtils;
-
-/**
- * Shipping charges (tax, freight/shipping, duty)
- *
- */
-public class ShippingCharges implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- public static final int MAX_PO_NUMBER_LENGTH = 25;
-
- private String taxItemName;
- private String taxDescription;
- private BigDecimal taxAmount = new BigDecimal(0.00);
-
- private String freightItemName;
- private String freightDescription;
- private BigDecimal freightAmount = new BigDecimal(0.00);
-
- private String dutyItemName;
- private String dutyItemDescription;
- private BigDecimal dutyAmount = new BigDecimal(0.00);
-
- private boolean taxExempt = false;
- private String purchaseOrderNumber;
-
- private ShippingCharges() { }
-
- public static ShippingCharges createShippingCharges() {
- return new ShippingCharges();
- }
-
- /**
- * @return the taxItemName
- */
- public String getTaxItemName() {
- return taxItemName;
- }
-
- /**
- * @param taxItemName
- * the taxItemName to set
- */
- public void setTaxItemName(String taxItemName) {
- this.taxItemName = taxItemName;
- }
-
- /**
- * @return the taxDescription
- */
- public String getTaxDescription() {
- return taxDescription;
- }
-
- /**
- * @param taxDescription
- * the taxDescription to set
- */
- public void setTaxDescription(String taxDescription) {
- this.taxDescription = taxDescription;
- }
-
- /**
- * @return the taxAmount
- */
- public BigDecimal getTaxAmount() {
- return taxAmount;
- }
-
- /**
- * @param taxAmount
- * the taxAmount to set
- */
- public void setTaxAmount(BigDecimal taxAmount) {
- this.taxAmount = taxAmount;
- }
-
- /**
- * @param taxAmount
- * the taxAmount to set
- */
- public void setTaxAmount(String taxAmount) {
- if(StringUtils.isNotEmpty(taxAmount)) {
- this.taxAmount = new BigDecimal(taxAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the freightItemName
- */
- public String getFreightItemName() {
- return freightItemName;
- }
-
- /**
- * @param freightItemName
- * the freightItemName to set
- */
- public void setFreightItemName(String freightItemName) {
- this.freightItemName = freightItemName;
- }
-
- /**
- * @return the freightDescription
- */
- public String getFreightDescription() {
- return freightDescription;
- }
-
- /**
- * @param freightDescription
- * the freightDescription to set
- */
- public void setFreightDescription(String freightDescription) {
- this.freightDescription = freightDescription;
- }
-
- /**
- * @return the freightAmount
- */
- public BigDecimal getFreightAmount() {
- return freightAmount;
- }
-
- /**
- * @param freightAmount
- * the freightAmount to set
- */
- public void setFreightAmount(BigDecimal freightAmount) {
- this.freightAmount = freightAmount;
- }
-
- /**
- * @param freightAmount
- * the freightAmount to set
- */
- public void setFreightAmount(String freightAmount) {
- if(StringUtils.isNotEmpty(freightAmount)) {
- this.freightAmount = new BigDecimal(freightAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the dutyItemName
- */
- public String getDutyItemName() {
- return dutyItemName;
- }
-
- /**
- * @param dutyItemName
- * the dutyItemName to set
- */
- public void setDutyItemName(String dutyItemName) {
- this.dutyItemName = dutyItemName;
- }
-
- /**
- * @return the dutyItemDescription
- */
- public String getDutyItemDescription() {
- return dutyItemDescription;
- }
-
- /**
- * @param dutyItemDescription
- * the dutyItemDescription to set
- */
- public void setDutyItemDescription(String dutyItemDescription) {
- this.dutyItemDescription = dutyItemDescription;
- }
-
- /**
- * @return the dutyAmount
- */
- public BigDecimal getDutyAmount() {
- return dutyAmount;
- }
-
- /**
- * @param dutyAmount
- * the dutyAmount to set
- */
- public void setDutyAmount(BigDecimal dutyAmount) {
- this.dutyAmount = dutyAmount;
- }
-
- /**
- * @param dutyAmount
- * the dutyAmount to set
- */
- public void setDutyAmount(String dutyAmount) {
- if(StringUtils.isNotEmpty(dutyAmount)) {
- this.dutyAmount = new BigDecimal(dutyAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the taxExempt
- */
- public boolean isTaxExempt() {
- return taxExempt;
- }
-
- /**
- * @param taxExempt
- * the taxExempt to set
- */
- public void setTaxExempt(boolean taxExempt) {
- this.taxExempt = taxExempt;
- }
-
- /**
- * @return the purchaseOrderNumber
- */
- public String getPurchaseOrderNumber() {
- return purchaseOrderNumber;
- }
-
- /**
- * @param purchaseOrderNumber
- * the purchaseOrderNumber to set
- */
- public void setPurchaseOrderNumber(String purchaseOrderNumber) {
- this.purchaseOrderNumber = purchaseOrderNumber;
- }
-
-}
diff --git a/src/net/authorize/data/aim/PrepaidCard.java b/src/net/authorize/data/aim/PrepaidCard.java
deleted file mode 100644
index 44987ff..0000000
--- a/src/net/authorize/data/aim/PrepaidCard.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package net.authorize.data.aim;
-
-import java.math.BigDecimal;
-
-/**
- * Container used in split tender transactions.
- *
- */
-public class PrepaidCard {
-
- private BigDecimal requestedAmount = null;
- private BigDecimal approvedAmount = null;
- private BigDecimal balanceOnCard = null;
-
- private PrepaidCard() {
- }
-
- public static PrepaidCard createPrepaidCard() {
- return new PrepaidCard();
- }
-
- /**
- * @return the requestedAmount
- */
- public BigDecimal getRequestedAmount() {
- return requestedAmount;
- }
-
- /**
- * @param requestedAmount
- * the requestedAmount to set
- */
- public void setRequestedAmount(BigDecimal requestedAmount) {
- this.requestedAmount = requestedAmount;
- }
-
- /**
- * @return the approvedAmount
- */
- public BigDecimal getApprovedAmount() {
- return approvedAmount;
- }
-
- /**
- * @param approvedAmount
- * the approvedAmount to set
- */
- public void setApprovedAmount(BigDecimal approvedAmount) {
- this.approvedAmount = approvedAmount;
- }
-
- /**
- * @return the balanceOnCard
- */
- public BigDecimal getBalanceOnCard() {
- return balanceOnCard;
- }
-
- /**
- * @param balanceOnCard
- * the balanceOnCard to set
- */
- public void setBalanceOnCard(BigDecimal balanceOnCard) {
- this.balanceOnCard = balanceOnCard;
- }
-
-}
diff --git a/src/net/authorize/data/aim/SplitTenderPayment.java b/src/net/authorize/data/aim/SplitTenderPayment.java
deleted file mode 100644
index bbe9390..0000000
--- a/src/net/authorize/data/aim/SplitTenderPayment.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package net.authorize.data.aim;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-import net.authorize.ResponseCode;
-import net.authorize.data.creditcard.CardType;
-
-public class SplitTenderPayment implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private String transId;
- private ResponseCode responseCode;
- private String responseToCustomer;
- private String authCode;
- private String accountNumber;
- private CardType accountType;
- private BigDecimal requestedAmount;
- private BigDecimal approvedAmount;
- private BigDecimal balanceOnCard;
-
- public static SplitTenderPayment createSplitTenderPayment() {
- return new SplitTenderPayment();
- }
-
- /**
- * @return the transId
- */
- public String getTransId() {
- return transId;
- }
-
- /**
- * @param transId
- * the transId to set
- */
- public void setTransId(String transId) {
- this.transId = transId;
- }
-
- /**
- * @return the responseToCustomer
- */
- public String getResponseToCustomer() {
- return responseToCustomer;
- }
-
- /**
- * @param responseToCustomer
- * the responseToCustomer to set
- */
- public void setResponseToCustomer(String responseToCustomer) {
- this.responseToCustomer = responseToCustomer;
- }
-
- /**
- * @return the authCode
- */
- public String getAuthCode() {
- return authCode;
- }
-
- /**
- * @param authCode
- * the authCode to set
- */
- public void setAuthCode(String authCode) {
- this.authCode = authCode;
- }
-
- /**
- * @return the accountNumber
- */
- public String getAccountNumber() {
- return accountNumber;
- }
-
- /**
- * @param accountNumber
- * the accountNumber to set
- */
- public void setAccountNumber(String accountNumber) {
- this.accountNumber = accountNumber;
- }
-
- /**
- * @return the accountType
- */
- public CardType getAccountType() {
- return accountType;
- }
-
- /**
- * @param accountType
- * the accountType to set
- */
- public void setAccountType(CardType accountType) {
- this.accountType = accountType;
- }
-
- /**
- * @return the requestedAmount
- */
- public BigDecimal getRequestedAmount() {
- return requestedAmount;
- }
-
- /**
- * @param requestedAmount
- * the requestedAmount to set
- */
- public void setRequestedAmount(BigDecimal requestedAmount) {
- this.requestedAmount = requestedAmount;
- }
-
- /**
- * @return the approvedAmount
- */
- public BigDecimal getApprovedAmount() {
- return approvedAmount;
- }
-
- /**
- * @param approvedAmount
- * the approvedAmount to set
- */
- public void setApprovedAmount(BigDecimal approvedAmount) {
- this.approvedAmount = approvedAmount;
- }
-
- /**
- * @return the balanceOnCard
- */
- public BigDecimal getBalanceOnCard() {
- return balanceOnCard;
- }
-
- /**
- * @param balanceOnCard
- * the balanceOnCard to set
- */
- public void setBalanceOnCard(BigDecimal balanceOnCard) {
- this.balanceOnCard = balanceOnCard;
- }
-
- /**
- * @return the responseCode
- */
- public ResponseCode getResponseCode() {
- return responseCode;
- }
-
- /**
- * @param responseCode
- * the responseCode to set
- */
- public void setResponseCode(ResponseCode responseCode) {
- this.responseCode = responseCode;
- }
-
-}
diff --git a/src/net/authorize/data/arb/PaymentSchedule.java b/src/net/authorize/data/arb/PaymentSchedule.java
deleted file mode 100644
index 5af5cf1..0000000
--- a/src/net/authorize/data/arb/PaymentSchedule.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package net.authorize.data.arb;
-import java.io.Serializable;
-import java.util.Date;
-
-public class PaymentSchedule implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 2L;
-
- public static String SCHEDULE_DATE_FORMAT = "yyyy-MM-dd";
-
- private int interval_length = 0;
- private SubscriptionUnitType subscription_unit = SubscriptionUnitType.DAYS; // days | months
- private Date start_date = null;
- private int total_occurrences = 0;
- private int trial_occurrences = 0;
-
- protected PaymentSchedule(){
-
- }
-
- public static PaymentSchedule createPaymentSchedule() {
- return new PaymentSchedule();
- }
-
- public int getIntervaLength() {
- return interval_length;
- }
-
- public void setIntervalLength(int interval_length) {
- this.interval_length = interval_length;
- }
-
- public Date getStartDate() {
- return start_date;
- }
- public void setStartDate(Date date){
- this.start_date = date;
- }
- public void setStartDate(String start_date) {
- this.start_date = net.authorize.util.DateUtil.getDateFromFormattedDate(start_date, SCHEDULE_DATE_FORMAT);
- }
-
- public SubscriptionUnitType getSubscriptionUnit() {
- return subscription_unit;
- }
-
- public void setSubscriptionUnit(SubscriptionUnitType subscription_unit) {
- this.subscription_unit = subscription_unit;
- }
-
- public int getTotalOccurrences() {
- return total_occurrences;
- }
-
- public void setTotalOccurrences(int total_occurrences) {
- this.total_occurrences = total_occurrences;
- }
-
- public int getTrialOccurrences() {
- return trial_occurrences;
- }
-
- public void setTrialOccurrences(int trial_occurrences) {
- this.trial_occurrences = trial_occurrences;
- }
-}
diff --git a/src/net/authorize/data/arb/Subscription.java b/src/net/authorize/data/arb/Subscription.java
deleted file mode 100644
index 510a337..0000000
--- a/src/net/authorize/data/arb/Subscription.java
+++ /dev/null
@@ -1,185 +0,0 @@
- package net.authorize.data.arb;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-import net.authorize.arb.Transaction;
-import net.authorize.data.Order;
-import net.authorize.data.Customer;
-import net.authorize.data.Payment;
-
-/**
- * Subscription container.
- */
-public class Subscription implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private String subscription_id = null;
-
- private String name = null;
- private PaymentSchedule schedule = null;
- private BigDecimal amount = Transaction.ZERO_AMOUNT;
- private BigDecimal trial_amount = Transaction.ZERO_AMOUNT;
- private Payment payment = null;
- private Customer customer;
- private Order order = null;
-
- /**
- *
- */
- protected Subscription() {
-
- }
-
- /**
- * Create a subscription.
- *
- * @return Subscription
- */
- public static Subscription createSubscription() {
- return new Subscription();
- }
-
- /**
- * Get the subscription id.
- *
- * @return String
- */
- public String getSubscriptionId() {
- return subscription_id;
- }
-
- /**
- * Set the subscription id.
- *
- * @param subscription_id
- */
- public void setSubscriptionId(String subscription_id) {
- this.subscription_id = subscription_id;
- }
-
- /**
- * Get the customer container.
- *
- * @return Customer
- */
- public Customer getCustomer() {
- return this.customer;
- }
-
- /**
- * Set the customer container.
- *
- * @param customer
- */
- public void setCustomer(Customer customer) {
- this.customer = customer;
- }
-
- /**
- * Get the subscription amount.
- *
- * @return BigDecimal
- */
- public BigDecimal getAmount() {
- return amount;
- }
-
- /**
- * Set the subscription amount.
- *
- * @param amount
- */
- public void setAmount(BigDecimal amount) {
- this.amount = amount;
- }
-
- /**
- * Get the name of the subscription.
- *
- * @return String
- */
- public String getName() {
- return name;
- }
-
- /**
- * Set the name of the subscription.
- *
- * @param name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Get the payment container.
- *
- * @return Payment
- */
- public Payment getPayment() {
- return payment;
- }
-
- /**
- * Set the payment container for the subscription.
- *
- * @param payment
- */
- public void setPayment(Payment payment) {
- this.payment = payment;
- }
-
- /**
- * Get the payment schedule of the subscription.
- *
- * @return PaymentSchedule
- */
- public PaymentSchedule getSchedule() {
- return schedule;
- }
-
- /**
- * Set the payment schedule of the subscription.
- *
- * @param schedule
- */
- public void setSchedule(PaymentSchedule schedule) {
- this.schedule = schedule;
- }
-
- /**
- * Get the trial amount of the subscription.
- *
- * @return BigDecimal
- */
- public BigDecimal getTrialAmount() {
- return trial_amount;
- }
-
- /**
- * Set the trial amount of the subscription.
- *
- * @param trial_amount
- */
- public void setTrialAmount(BigDecimal trial_amount) {
- this.trial_amount = trial_amount;
- }
-
- /**
- * @return the order
- */
- public Order getOrder() {
- return order;
- }
-
- /**
- * @param order the order to set
- */
- public void setOrder(Order order) {
- this.order = order;
- }
-
-
-}
diff --git a/src/net/authorize/data/arb/SubscriptionStatusType.java b/src/net/authorize/data/arb/SubscriptionStatusType.java
deleted file mode 100644
index 403c0ff..0000000
--- a/src/net/authorize/data/arb/SubscriptionStatusType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package net.authorize.data.arb;
-
-
-public enum SubscriptionStatusType {
-
- ACTIVE("active"),
- EXPIRED("expired"),
- SUSPENDED("suspended"),
- CANCELED("canceled"),
- TERMINATED("terminated");
-
- private final String value;
-
- SubscriptionStatusType(String v) {
- value = v;
- }
-
- public String value() {
- return value;
- }
-
- public static SubscriptionStatusType fromValue(String v) {
- for (SubscriptionStatusType c: SubscriptionStatusType.values()) {
- if (c.value.equals(v)) {
- return c;
- }
- }
- throw new IllegalArgumentException(v);
- }
-
-}
diff --git a/src/net/authorize/data/arb/SubscriptionUnitType.java b/src/net/authorize/data/arb/SubscriptionUnitType.java
deleted file mode 100644
index 2c5e357..0000000
--- a/src/net/authorize/data/arb/SubscriptionUnitType.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package net.authorize.data.arb;
-
-
-public enum SubscriptionUnitType {
- DAYS("days"),
- MONTHS("months");
-
- private final String value;
-
- SubscriptionUnitType(String v) {
- value = v;
- }
-
- public String value() {
- return value;
- }
-
- public static SubscriptionUnitType fromValue(String v) {
- for (SubscriptionUnitType c: SubscriptionUnitType.values()) {
- if (c.value.equals(v)) {
- return c;
- }
- }
- throw new IllegalArgumentException(v);
- }
-
-}
diff --git a/src/net/authorize/data/cim/CustomerProfile.java b/src/net/authorize/data/cim/CustomerProfile.java
deleted file mode 100644
index b7fd963..0000000
--- a/src/net/authorize/data/cim/CustomerProfile.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package net.authorize.data.cim;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-import net.authorize.data.Address;
-
-public class CustomerProfile implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- protected String merchantCustomerId;
- protected String description;
- protected String email;
- protected String customerProfileId;
- protected ArrayList shipToAddressList = new ArrayList();
-
- private CustomerProfile() { }
-
- /**
- * Create a new CustomerProfile object
- *
- * @return CustomerProfile
- */
- public static CustomerProfile createCustomerProfile() {
- return new CustomerProfile();
- }
-
- /**
- * Get the customer profile id.
- *
- * @return the id
- */
- public String getCustomerProfileId() {
- return customerProfileId;
- }
-
- /**
- * Set the customer profile id.
- *
- * @param id the id to set
- */
- public void setCustomerProfileId(String id) {
- this.customerProfileId = id;
- }
-
- /**
- * Gets the value of the merchantCustomerId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMerchantCustomerId() {
- return merchantCustomerId;
- }
-
- /**
- * Sets the value of the merchantCustomerId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMerchantCustomerId(String value) {
- this.merchantCustomerId = value;
- }
-
- /**
- * Gets the value of the description property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the value of the description property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setDescription(String value) {
- this.description = value;
- }
-
- /**
- * Gets the value of the email property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getEmail() {
- return email;
- }
-
- /**
- * Sets the value of the email property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setEmail(String value) {
- this.email = value;
- }
-
- /**
- * @return the shipToAddressList
- */
- public ArrayList getShipToAddressList() {
- return shipToAddressList;
- }
-
- /**
- * @param shipToAddressList the shipToAddressList to set
- */
- public void setShipToAddressList(ArrayList shipToAddressList) {
- this.shipToAddressList = shipToAddressList;
- }
-
- /**
- * Add an address to the ship to list.
- *
- * @param shipTo
- */
- public void addShipToAddress(Address shipTo) {
- if(this.shipToAddressList == null) {
- this.shipToAddressList = new ArrayList();
- }
-
- this.shipToAddressList.add(shipTo);
- }
-
- /**
- * Return the first (perhaps only) address in the list.
- *
- * @return Address
- */
- public Address getShipToAddress() {
-
- Address retval = null;
- if(this.shipToAddressList != null &&
- this.shipToAddressList.size() > 0) {
-
- retval = this.shipToAddressList.get(0);
- }
-
- return retval;
- }
-}
diff --git a/src/net/authorize/data/cim/DirectResponse.java b/src/net/authorize/data/cim/DirectResponse.java
deleted file mode 100644
index 1a50fe6..0000000
--- a/src/net/authorize/data/cim/DirectResponse.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package net.authorize.data.cim;
-
-import java.io.Serializable;
-import java.util.Map;
-
-import net.authorize.ResponseField;
-import net.authorize.util.ResponseParser;
-
-public class DirectResponse implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- public static final String RESPONSE_DELIMITER = ",";
- private String directResponseString;
- private Map directResponseMap;
-
- private DirectResponse(String directResponseString) {
- this.directResponseString = directResponseString;
-
- this.directResponseMap = ResponseParser.parseResponseString(
- directResponseString,RESPONSE_DELIMITER);
- }
-
- /**
- * Create a validation direct response from a passed in string.
- *
- * @param directResponseString
- *
- * @return DirectResponse object
- */
- public static DirectResponse createDirectResponse(
- String directResponseString) {
- return new DirectResponse(directResponseString);
- }
-
- /**
- * @return the directResponseString
- */
- public String getDirectResponseString() {
- return directResponseString;
- }
- /**
- * @return the directResponseMap
- */
- public Map getDirectResponseMap() {
- return directResponseMap;
- }
-}
diff --git a/src/net/authorize/data/cim/PaymentProfile.java b/src/net/authorize/data/cim/PaymentProfile.java
deleted file mode 100644
index 538dfec..0000000
--- a/src/net/authorize/data/cim/PaymentProfile.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package net.authorize.data.cim;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-import net.authorize.data.Address;
-import net.authorize.data.CustomerType;
-import net.authorize.data.Payment;
-
-public class PaymentProfile implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- protected CustomerType customerType;
- protected Address billTo;
- protected ArrayList paymentList = new ArrayList();
- protected String customerPaymentProfileId;
-
- private PaymentProfile() {}
-
- public static PaymentProfile createPaymentProfile() {
- return new PaymentProfile();
- }
-
- /**
- * Gets the value of the customerType property.
- *
- * @return
- * possible object is
- * {@link CustomerType }
- *
- */
- public CustomerType getCustomerType() {
- return customerType;
- }
-
- /**
- * Sets the value of the customerType property.
- *
- * @param value
- * allowed object is
- * {@link CustomerType }
- *
- */
- public void setCustomerType(CustomerType value) {
- this.customerType = value;
- }
-
- /**
- * Gets the value of the billTo property.
- *
- * @return
- * possible object is
- * {@link Address }
- *
- */
- public Address getBillTo() {
- return billTo;
- }
-
- /**
- * Sets the value of the billTo property.
- *
- * @param value
- * allowed object is
- * {@link Address }
- *
- */
- public void setBillTo(Address value) {
- this.billTo = value;
- }
-
- /**
- * @return the paymentList
- */
- public ArrayList getPaymentList() {
- return paymentList;
- }
-
- /**
- * Add a Payment container to the payment list.
- * @param payment
- */
- public void addPayment(Payment payment) {
- if(this.paymentList == null) {
- this.paymentList = new ArrayList();
- }
-
- this.paymentList.add(payment);
- }
-
- /**
- * @param paymentList the payments to set
- */
- public void setPaymentList(ArrayList paymentList) {
- this.paymentList = paymentList;
- }
-
- /**
- * @return the customerPaymentProfileId
- */
- public String getCustomerPaymentProfileId() {
- return customerPaymentProfileId;
- }
-
- /**
- * @param customerPaymentProfileId the customerPaymentProfileId to set
- */
- public void setCustomerPaymentProfileId(String customerPaymentProfileId) {
- this.customerPaymentProfileId = customerPaymentProfileId;
- }
-
-
-}
diff --git a/src/net/authorize/data/creditcard/AVSCode.java b/src/net/authorize/data/creditcard/AVSCode.java
deleted file mode 100644
index e29a899..0000000
--- a/src/net/authorize/data/creditcard/AVSCode.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package net.authorize.data.creditcard;
-
-
-
-/**
- * Address Verification Service (AVS) response codes.
- *
- */
-public enum AVSCode {
- A("A", "Address (Street) matches, ZIP does not"),
- B("B", "Address information not provided for AVS check"),
- E("E", "AVS error"),
- G("G", "Non-U.S. Card Issuing Bank"),
- N("N", "No Match on Address (Street) or ZIP"),
- P("P", "AVS not applicable for this transaction"),
- R("R", "Retry - System unavailable or timed out"),
- S("S", "Service not supported by issuer"),
- U("U", "Address information is unavailable"),
- W("W", "Nine digit ZIP matches, Address (Street) does not"),
- X("X", "Address (Street) and nine digit ZIP match"),
- Y("Y", "Address (Street) and five digit ZIP match"),
- Z("Z", "Five digit ZIP matches, Address (Street) does not");
-
- private final String value;
- private final String description;
-
- private AVSCode(String value, String description) {
- this.value = value;
- this.description = description;
- }
-
- public static AVSCode findByValue(String value) {
- for(AVSCode avs : values()) {
- if(avs.value.equals(value)) {
- return avs;
- }
- }
-
- return null;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
-}
diff --git a/src/net/authorize/data/creditcard/CardType.java b/src/net/authorize/data/creditcard/CardType.java
deleted file mode 100644
index d871e0a..0000000
--- a/src/net/authorize/data/creditcard/CardType.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package net.authorize.data.creditcard;
-
-
-
-/**
- * Supported payment card types.
- *
- */
-public enum CardType {
- VISA("Visa"),
- MASTER_CARD("MasterCard"),
- AMERICAN_EXPRESS("American Express"),
- DISCOVER("Discover"),
- DINERS_CLUB("Diners Club"),
- JCB("JCB"),
- ECHECK("eCheck"), // added for the reporting API
- UNKNOWN("");
-
- private final String value;
-
- private CardType(String value) {
- this.value = value;
- }
-
- public static CardType findByValue(String value) {
- if(value != null) {
- for(CardType cardType : values()) {
- if(cardType.value.equals(value)) {
- return cardType;
- }
- }
- }
-
- return CardType.UNKNOWN;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
-}
diff --git a/src/net/authorize/data/creditcard/CreditCard.java b/src/net/authorize/data/creditcard/CreditCard.java
deleted file mode 100644
index ef95d8f..0000000
--- a/src/net/authorize/data/creditcard/CreditCard.java
+++ /dev/null
@@ -1,313 +0,0 @@
-package net.authorize.data.creditcard;
-
-import java.io.Serializable;
-import java.util.Calendar;
-import java.util.Date;
-
-import net.authorize.data.swiperdata.SwiperData;
-import net.authorize.util.Luhn;
-
-/**
- * Credit card specific information.
- *
- */
-public class CreditCard implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- public static String ARB_EXPIRY_DATE_FORMAT = "yyyy-MM";
- private static String EXPIRY_DATE_FORMAT = "MM/yyyy";
-
- private String creditCardNumber = null;
- private String maskedCardNumber = null;
- private String anetDuplicatemaskedCardNumber = null;
- private String expirationMonth;
- private String expirationYear;
- private Date expirationDate;
- private CardType cardType;
- private String cardCode;
-
- private String cardholderAuthenticationIndicator;
- private String cardholderAuthenticationValue;
-
- private AVSCode avsCode;
- private String track1;
- private String track2;
- private CreditCardPresenceType cardPresent = CreditCardPresenceType.CARD_NOT_PRESENT_UNENCRYPTED;
-
- //debug
- protected SwiperData swipperData = new SwiperData();
-
- protected CreditCard() {
-
- }
- public SwiperData getSwipperData() {
- return swipperData;
- }
-
- public void setSwipperData(SwiperData swipperData) {
- this.swipperData = swipperData;
- }
-
- public static CreditCard createCreditCard() {
- return new CreditCard();
- }
-
- /**
- * @return the creditCardNumber
- */
- public String getCreditCardNumber() {
- return this.creditCardNumber != null?creditCardNumber:maskedCardNumber;
- }
-
- /**
- * @param creditCardNumber
- * the creditCardNumber to set
- */
- public void setCreditCardNumber(String creditCardNumber) {
- this.cardType = Luhn.getCardType(creditCardNumber);
-
- this.creditCardNumber = Luhn.stripNonDigits(creditCardNumber);
- }
-
-
-
- /**
- * Used to get masked card number to be displayed on Signature page
- * Duplicate variable, original sdk maskednumber is buggy
- *
- * @param maskedCreditCardNumber
- */
- public String getAnetDuplicatemaskedCardNumber() {
- return anetDuplicatemaskedCardNumber;
- }
-
- /**
- * Used to set masked card number to be displayed on Signature page
- * Duplicate variable, original sdk maskednumber is buggy
- *
- * @param maskedCreditCardNumber
- */
- public void setAnetDuplicatemaskedCardNumber(
- String anetDuplicatemaskedCardNumber) {
- this.anetDuplicatemaskedCardNumber = anetDuplicatemaskedCardNumber;
- }
- /**
- * Used in the response that comes back to offer access to the partial credit card number.
- *
- * @param maskedCreditCardNumber
- */
- public void setMaskedCreditCardNumber(String maskedCreditCardNumber) {
- this.creditCardNumber = null;
- this.maskedCardNumber = maskedCreditCardNumber;
- }
-
- /**
- * @return the expirationMonth
- */
- public String getExpirationMonth() {
- return expirationMonth;
- }
-
- /**
- * @param expirationMonth
- * the expirationMonth to set
- */
- public void setExpirationMonth(String expirationMonth) {
- this.expirationMonth = expirationMonth;
- setExpirationDate();
- }
-
- /**
- * @return the expirationYear
- */
- public String getExpirationYear() {
- return expirationYear;
- }
-
- /**
- * @param expirationYear
- * the expirationYear to set
- */
- public void setExpirationYear(String expirationYear) {
- this.expirationYear = expirationYear;
- setExpirationDate();
- }
-
- /**
- * Return the expiration date.
- *
- * @return expirationDate
- */
- public Date getExpirationDate() {
- return expirationDate;
- }
-
- /**
- * Set the expiration date.
- *
- * @param expirationDate
- */
- public void setExpirationDate(Date expirationDate) {
- this.expirationDate = expirationDate;
- extractMonthYearFromExpiration();
- }
-
- /**
- * Set the expiration date using yyyy-MM as the format.
- *
- * @param expiration_date
- */
- public void setExpirationDate(String expiration_date) {
- this.expirationDate = net.authorize.util.DateUtil.getDateFromFormattedDate(expiration_date, ARB_EXPIRY_DATE_FORMAT);
- extractMonthYearFromExpiration();
- }
-
- /**
- * Sets the expiration date using the MM/YYYY format.
- */
- private void setExpirationDate() {
- if(this.expirationMonth != null && this.expirationYear != null) {
- this.expirationDate = net.authorize.util.DateUtil.getDateFromFormattedDate(
- this.expirationMonth+"/"+this.expirationYear, EXPIRY_DATE_FORMAT);
- }
- }
-
- /**
- * Extract the month and year from the expiration date.
- */
- private void extractMonthYearFromExpiration() {
- if(this.expirationDate != null) {
- Calendar cal = Calendar.getInstance();
- cal.setTime(this.expirationDate);
- this.expirationMonth = Integer.toString(cal.get(Calendar.MONTH)+1);
- this.expirationYear = Integer.toString(cal.get(Calendar.YEAR));
- }
- }
-
- /**
- * @return the cardType
- */
- public CardType getCardType() {
- return cardType;
- }
-
- /**
- * @param cardType
- * the cardType to set
- */
- public void setCardType(CardType cardType) {
- this.cardType = cardType;
- }
-
- /**
- *
- * @return the card code
- */
- public String getCardCode() {
- return cardCode;
- }
-
- /**
- * @param cardCode the card code to set
- */
- public void setCardCode(String cardCode) {
- this.cardCode = cardCode;
- }
-
- /**
- * @return the cardholderAuthenticationIndicator
- */
- public String getCardholderAuthenticationIndicator() {
- return cardholderAuthenticationIndicator;
- }
-
- /**
- * @param cardholderAuthenticationIndicator the cardholderAuthenticationIndicator to set
- */
- public void setCardholderAuthenticationIndicator(
- String cardholderAuthenticationIndicator) {
- this.cardholderAuthenticationIndicator = cardholderAuthenticationIndicator;
- }
-
- /**
- * @return the cardholderAuthenticationValue
- */
- public String getCardholderAuthenticationValue() {
- return cardholderAuthenticationValue;
- }
-
- /**
- * @param cardholderAuthenticationValue
- * the cardholderAuthenticationValue to set
- */
- public void setCardholderAuthenticationValue(
- String cardholderAuthenticationValue) {
- this.cardholderAuthenticationValue = cardholderAuthenticationValue;
- }
-
- /**
- * @return the avsCode
- */
- public AVSCode getAvsCode() {
- return avsCode;
- }
-
- /**
- * @param avsCode the avsCode to set
- */
- public void setAvsCode(AVSCode avsCode) {
- this.avsCode = avsCode;
- }
-
- /**
- * @return the track1
- */
- public String getTrack1() {
- return track1;
- }
-
- /**
- * @param track1 the track1 to set
- */
- public void setTrack1(String track1) {
- this.track1 = track1;
- if(this.track1 != null) {
- this.track1 = this.track1.replaceAll("(^[%]|[?]$)","");
- }
- }
-
- /**
- * @return the track2
- */
- public String getTrack2() {
- return track2;
- }
-
- /**
- * @param track2 the track2 to set
- */
- public void setTrack2(String track2) {
- this.track2 = track2;
- if(this.track2 != null) {
- this.track2 = this.track2.replaceAll("(^[;]|[?]$)","");
- }
- }
-
- /**
- * @return the cardPresent
- */
- public CreditCardPresenceType cardPresenseType() {
- return cardPresent;
- }
-
- /**
- * @param cardPresent the cardPresent to set
- */
- public void setCardPresenseType(CreditCardPresenceType cardPresent) {
- this.cardPresent = cardPresent;
- }
-
-
-
-}
diff --git a/src/net/authorize/data/creditcard/CreditCardPresenceType.java b/src/net/authorize/data/creditcard/CreditCardPresenceType.java
deleted file mode 100644
index d778f94..0000000
--- a/src/net/authorize/data/creditcard/CreditCardPresenceType.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package net.authorize.data.creditcard;
-
-public enum CreditCardPresenceType {
- CARD_PRESENT_UNENCRYPTED(0),
- CARD_PRESENT_ENCRYPTED(1),
- CARD_NOT_PRESENT_UNENCRYPTED(2),
- CARD_NOT_PRESENT_ENCRYPTED(3);
-
- final private int presenseType;
-
- private CreditCardPresenceType(int presenseType){
- this.presenseType = presenseType;
- }
-
- public int value() {
- return this.presenseType;
- }
-
-}
diff --git a/src/net/authorize/data/echeck/BankAccount.java b/src/net/authorize/data/echeck/BankAccount.java
deleted file mode 100644
index 932e584..0000000
--- a/src/net/authorize/data/echeck/BankAccount.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package net.authorize.data.echeck;
-
-import java.io.Serializable;
-
-
-public class BankAccount implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- public static final int MAX_ROUTING_NUMBER_LENGTH = 9;
- public static final int MAX_ACCOUNT_NUMBER_LENGTH = 20;
- public static final int MAX_BANK_NAME_LENGTH = 50;
- public static final int MAX_BANK_ACCOUNT_LENGTH = 50;
- public static final int MAX_BANK_CHECK_NUMBER_LENGTH = 15;
-
- protected String routingNumber;
- protected String bankAccountNumber;
- protected BankAccountType bankAccountType;
- protected String bankName;
- protected String bankAccountName;
- protected ECheckType eCheckType;
- protected String bankCheckNumber;
-
- /**
- * @return the routingNumber
- */
- public String getRoutingNumber() {
- return routingNumber;
- }
- /**
- * @param routingNumber the routingNumber to set
- */
- public void setRoutingNumber(String routingNumber) {
- this.routingNumber = routingNumber;
- }
- /**
- * @return the bankAccountNumber
- */
- public String getBankAccountNumber() {
- return bankAccountNumber;
- }
- /**
- * @param bankAccountNumber the bankAccountNumber to set
- */
- public void setBankAccountNumber(String bankAccountNumber) {
- this.bankAccountNumber = bankAccountNumber;
- }
- /**
- * @return the bankAccountType
- */
- public BankAccountType getBankAccountType() {
- return bankAccountType;
- }
- /**
- * @param bankAccountType the bankAccountType to set
- */
- public void setBankAccountType(BankAccountType bankAccountType) {
- this.bankAccountType = bankAccountType;
- }
- /**
- * @return the bankName
- */
- public String getBankName() {
- return bankName;
- }
- /**
- * @param bankName the bankName to set
- */
- public void setBankName(String bankName) {
- this.bankName = bankName;
- }
- /**
- * @return the bankAccountName
- */
- public String getBankAccountName() {
- return bankAccountName;
- }
- /**
- * @param bankAccountName the bankAccountName to set
- */
- public void setBankAccountName(String bankAccountName) {
- this.bankAccountName = bankAccountName;
- }
- /**
- * @return the eCheckType
- */
- public ECheckType getECheckType() {
- return eCheckType;
- }
- /**
- * @param eCheckType the eCheckType to set
- */
- public void setECheckType(ECheckType eCheckType) {
- this.eCheckType = eCheckType;
- }
- /**
- * @return the bankCheckNumber
- */
- public String getBankCheckNumber() {
- return bankCheckNumber;
- }
- /**
- * @param bankCheckNumber the bankCheckNumber to set
- */
- public void setBankCheckNumber(String bankCheckNumber) {
- this.bankCheckNumber = bankCheckNumber;
- }
-
-
- protected BankAccount() { }
-
- public static BankAccount createBankAccount() {
- return new BankAccount();
- }
-
-
-}
diff --git a/src/net/authorize/data/echeck/BankAccountType.java b/src/net/authorize/data/echeck/BankAccountType.java
deleted file mode 100644
index 441f929..0000000
--- a/src/net/authorize/data/echeck/BankAccountType.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package net.authorize.data.echeck;
-
-
-/**
- * Supported bank account types.
- *
- */
-public enum BankAccountType {
- CHECKING("CHECKING"),
- BUSINESSCHECKING("BUSINESSCHECKING"),
- SAVINGS("SAVINGS"),
- UNKNOWN("UNKNOWN");
-
- private final String value;
-
- private BankAccountType(String value) {
- this.value = value;
- }
-
- public static BankAccountType findByValue(String value) {
- for(BankAccountType bankAccountType : values()) {
- if(bankAccountType.value.equals(value)) {
- return bankAccountType;
- }
- }
-
- return BankAccountType.UNKNOWN;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
-}
diff --git a/src/net/authorize/data/echeck/ECheck.java b/src/net/authorize/data/echeck/ECheck.java
deleted file mode 100644
index 230b078..0000000
--- a/src/net/authorize/data/echeck/ECheck.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package net.authorize.data.echeck;
-
-
-/**
- * Container used to hold ECheck related information.
- *
- */
-public class ECheck extends BankAccount {
-
- private static final long serialVersionUID = 2L;
-
- protected ECheck() { }
-
- public static ECheck createECheck() {
- return new ECheck();
- }
-
-}
diff --git a/src/net/authorize/data/echeck/ECheckType.java b/src/net/authorize/data/echeck/ECheckType.java
deleted file mode 100644
index 2c92a7b..0000000
--- a/src/net/authorize/data/echeck/ECheckType.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package net.authorize.data.echeck;
-
-
-/**
- * eCheck.Net transaction types supported by the Authorize.Net Payment Gateway
- *
- * ARC - Accounts Receivable Conversion
- * BOC - Back Office Conversion
- * CCD - Cash Concentration or Disbursement
- * PPD - Prearranged Payment and Deposit Entry
- * TEL - Telephone-Initiated Entry
- * WEB - Internet-Initiated Entry
- */
-public enum ECheckType {
- ARC("ARC"),
- BOC("BOC"),
- CCD("CCD"),
- PPD("PPD"),
- TEL("TEL"),
- WEB("WEB"),
- UNKNOWN("UNKNOWN");
-
- private final String value;
-
- private ECheckType(String value) {
- this.value = value;
- }
-
- public static ECheckType findByValue(String value) {
- for(ECheckType echeckType : values()) {
- if(echeckType.value.equals(value)) {
- return echeckType;
- }
- }
-
- return ECheckType.UNKNOWN;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
-}
diff --git a/src/net/authorize/data/echeck/NOCCode.java b/src/net/authorize/data/echeck/NOCCode.java
deleted file mode 100644
index ef61641..0000000
--- a/src/net/authorize/data/echeck/NOCCode.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package net.authorize.data.echeck;
-
-
-
-/**
- * ACH notice of change (NOC) codes that may be received from the customer's
- * bank in the event of a discrepancy in the bank information provided with the transaction.
- *
- */
-public enum NOCCode {
- C01("C01", "Incorrect DFI account number", "The customer's bank account number is incorrect."),
- C02("C02", "Incorrect routing number", "The bank's ABA routing number is incorrect."),
- C03("C03", "Incorrect routing number and incorrect DFI account number", "The bank's ABA routing number is incorrect and as a result the bank account number structure is also incorrect."),
- C04("C04", "Incorrect individual name / receiving company name", "The individual or company name associated with the bank account is incorrect."),
- C05("C05", "Incorrect transaction code", "The transaction was submitted to a certain account type but includes a conflicting account type code (checking / savings)."),
- C06("C06", "Incorrect DFI account number and incorrect transaction code", "The customer's bank account number is incorrect and the transaction should be submitted to a different account type (checking / savings)."),
- C07("C07", "Incorrect routing number, incorrect DFI account number, and incorrect transaction code", "The bank's ABA routing number and the bank account number are incorrect; and the transaction was submitted to a certain account type but includes a conflicting account type code (checking / savings).");
-
- private final String code;
- private final String nocReason;
- private final String description;
-
- private NOCCode(String code, String nocReason, String description) {
- this.code = code;
- this.nocReason = nocReason;
- this.description = description;
- }
-
- public static NOCCode findByCode(String code) {
- for(NOCCode nocCode : values()) {
- if(nocCode.code.equals(code)) {
- return nocCode;
- }
- }
-
- return null;
- }
-
- /**
- * @return the code
- */
- public String getCode() {
- return code;
- }
-
- /**
- * @return the nocReason
- */
- public String getNocReason() {
- return nocReason;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
-
-}
diff --git a/src/net/authorize/data/echeck/ReturnCode.java b/src/net/authorize/data/echeck/ReturnCode.java
deleted file mode 100644
index c6a5906..0000000
--- a/src/net/authorize/data/echeck/ReturnCode.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package net.authorize.data.echeck;
-
-
-
-public enum ReturnCode {
- R01("R01", "Insufficient Funds (NSF)", "Insufficient Funds"),
- R02("R02", "Administrative Return", "Account Closed"),
- R03("R03", "Administrative Return", "No Account/Unable to Locate Account"),
- R04("R04", "Administrative Return", "Invalid Account Number"),
- R05("R05", "Administrative Return", "Unauthorized Debit to Consumer Account Using Corporate SEC Code"),
- R06("R06", "Administrative Return", "Returned per ODFI Request"),
- R07("R07", "Chargeback", "Authorization Revoked by Customer"),
- R08("R08", "Chargeback", "Payment Stopped by Customer"),
- R09("R09", "Insufficient Funds (NSF)", "Uncollected Funds"),
- R10("R10", "Chargeback", "Customer Advises Unauthorized"),
- R12("R12", "Administrative Return", "Branch Sold to Another DFI"),
- R13("R13", "Administrative Return", "RDFI Not Qualified to Participate"),
- R14("R14", "Administrative Return", "Representativ e Payee Deceased"),
- R15("R15", "Administrative Return", "Beneficiary or Account Holder Deceased"),
- R16("R16", "Administrative Return", "Account Frozen"),
- R17("R17", "Administrative Return", "RDFI Cannot Process"),
- R20("R20", "Administrative Return", "Non- Transaction Account"),
- R23("R23", "Administrative Return", "Credit Refused by Customer"),
- R24("R24", "Administrative Return", "Duplicate Entry"),
- R29("R29", "Chargeback", "Corporate Customer Advises Not Authorized"),
- R30("R30", "Administrative Return", "RDFI is Not an ACH Participant"),
- R31("R31", "Administrative Return", "Permissible Return"),
- R32("R32", "Administrative Return", "RDFI is not a Settlement RDFI"),
- R34("R34", "Administrative Return", "RDFI not Qualified to Participate"),
- R35("R35", "Administrative Return", "Return of Improper Debit Entry"),
- R36("R36", "Administrative Return", "Return of Improper Credit Entry");
-
- private final String code;
- private final String returnType;
- private final String shortTitle;
-
- private ReturnCode(String code, String returnType, String shortTitle) {
- this.code = code;
- this.returnType = returnType;
- this.shortTitle = shortTitle;
- }
-
- public static ReturnCode findByCode(String code) {
- for(ReturnCode returnCode : values()) {
- if(returnCode.code.equals(code)) {
- return returnCode;
- }
- }
-
- return null;
- }
-
- /**
- * @return the code
- */
- public String getCode() {
- return code;
- }
-
- /**
- * @return the returnType
- */
- public String getReturnType() {
- return returnType;
- }
-
- /**
- * @return the shortTitle
- */
- public String getShortTitle() {
- return shortTitle;
- }
-
-
-}
diff --git a/src/net/authorize/data/mobile/MerchantContact.java b/src/net/authorize/data/mobile/MerchantContact.java
deleted file mode 100644
index cec1f95..0000000
--- a/src/net/authorize/data/mobile/MerchantContact.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package net.authorize.data.mobile;
-
-import java.io.Serializable;
-
-public class MerchantContact implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private String companyName;
- private String address;
- private String city;
- private String state;
- private String zip;
- private String phone;
-
- private MerchantContact() {
- }
-
- /**
- * Create a merchant contact.
- *
- * @return MerchantContact
- */
- public static MerchantContact createMerchantContact() {
- return new MerchantContact();
- }
-
- /**
- * Create a merchant contact.
- *
- * @param companyName
- * @param address
- * @param city
- * @param state
- * @param zip
- * @param phone
- *
- * @return MerchantContact container
- */
- public static MerchantContact createMerchantContact(String companyName,
- String address, String city, String state, String zip, String phone) {
- MerchantContact merchantContact = new MerchantContact();
- merchantContact.companyName = companyName;
- merchantContact.address = address;
- merchantContact.city = city;
- merchantContact.state = state;
- merchantContact.zip = zip;
- merchantContact.phone = phone;
-
- return merchantContact;
- }
-
- /**
- * @return the companyName
- */
- public String getCompanyName() {
- return companyName;
- }
-
- /**
- * @param companyName
- * the companyName to set
- */
- public void setCompanyName(String companyName) {
- this.companyName = companyName;
- }
-
- /**
- * @return the address
- */
- public String getAddress() {
- return address;
- }
-
- /**
- * @param address
- * the address to set
- */
- public void setAddress(String address) {
- this.address = address;
- }
-
- /**
- * @return the city
- */
- public String getCity() {
- return city;
- }
-
- /**
- * @param city
- * the city to set
- */
- public void setCity(String city) {
- this.city = city;
- }
-
- /**
- * @return the state
- */
- public String getState() {
- return state;
- }
-
- /**
- * @param state
- * the state to set
- */
- public void setState(String state) {
- this.state = state;
- }
-
- /**
- * @return the zip
- */
- public String getZip() {
- return zip;
- }
-
- /**
- * @param zip
- * the zip to set
- */
- public void setZip(String zip) {
- this.zip = zip;
- }
-
- /**
- * @return the phone
- */
- public String getPhone() {
- return phone;
- }
-
- /**
- * @param phone
- * the phone to set
- */
- public void setPhone(String phone) {
- this.phone = phone;
- }
-
-}
diff --git a/src/net/authorize/data/mobile/MobileDevice.java b/src/net/authorize/data/mobile/MobileDevice.java
deleted file mode 100644
index 5e270cd..0000000
--- a/src/net/authorize/data/mobile/MobileDevice.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package net.authorize.data.mobile;
-
-import java.io.Serializable;
-
-/**
- * Defines a MobileDevice
- */
-public class MobileDevice implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private String mobileDeviceId;
- private String description;
- private String phoneNumber;
- private String devicePlatform;
-
- private MobileDevice() {}
-
- /**
- * Create a MobileDevice.
- *
- * @return mobile device object
- */
- public static MobileDevice createMobileDevice() {
- return new MobileDevice();
- }
-
- /**
- * Create a MobileDevice from description & phone number.
- *
- * @param mobileDeviceId
- * @param description
- * @param phoneNumber
- *
- * @return mobile device information
- */
- public static MobileDevice createMobileDevice(String mobileDeviceId, String description, String phoneNumber) {
- MobileDevice mobileDevice = new MobileDevice();
- mobileDevice.mobileDeviceId = mobileDeviceId;
- mobileDevice.description = description;
- mobileDevice.phoneNumber = phoneNumber;
-
- return mobileDevice;
- }
- public static MobileDevice createMobileDevice(String mobileDeviceId, String description, String phoneNumber,
- String devicePlatform) {
- MobileDevice mobileDevice = new MobileDevice();
- mobileDevice.mobileDeviceId = mobileDeviceId;
- mobileDevice.description = description;
- mobileDevice.phoneNumber = phoneNumber;
- mobileDevice.devicePlatform = devicePlatform;
- return mobileDevice;
- }
-
- /**
- * Get the description of the mobile device.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Set the description of the mobile device.
- *
- * @param description the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Get the phone number of the mobile device.
- *
- * @return the phoneNumber
- */
- public String getPhoneNumber() {
- return phoneNumber;
- }
-
- /**
- * Set the phone number of the mobile device.
- *
- * @param phoneNumber the phoneNumber to set
- */
- public void setPhoneNumber(String phoneNumber) {
- this.phoneNumber = phoneNumber;
- }
-
- /**
- * @return the mobileDeviceId
- */
- public String getMobileDeviceId() {
- return mobileDeviceId;
- }
-
- /**
- * @param mobileDeviceId the mobileDeviceId to set
- */
- public void setMobileDeviceId(String mobileDeviceId) {
- this.mobileDeviceId = mobileDeviceId;
- }
-
- public String getDevicePlatform() {
- return devicePlatform;
- }
-
- public void setDevicePlatform(String devicePlatform) {
- this.devicePlatform = devicePlatform;
- }
-
-
-
-
-
-
-}
diff --git a/src/net/authorize/data/reporting/BatchDetails.java b/src/net/authorize/data/reporting/BatchDetails.java
deleted file mode 100644
index c027a8a..0000000
--- a/src/net/authorize/data/reporting/BatchDetails.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package net.authorize.data.reporting;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
-
-import net.authorize.util.StringUtils;
-
-/**
- * Batch related reporting information.
- *
- */
-public class BatchDetails implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private BatchDetails() { }
- private String batchId;
- private Date settlementTimeUTC;
- private Date settlementTimeLocal;
- private SettlementStateType settlementState;
- private String paymentMethod;
- private ArrayList batchStatisticsList = new ArrayList();
-
- public static BatchDetails createBatchDetail() {
- return new BatchDetails();
- }
-
- /**
- * @return the batchId
- */
- public String getBatchId() {
- return batchId;
- }
-
- /**
- * @param batchId the batchId to set
- */
- public void setBatchId(String batchId) {
- this.batchId = batchId;
- }
-
- /**
- * @return the settlementTimeUTC
- */
- public Date getSettlementTimeUTC() {
- return settlementTimeUTC;
- }
-
- /**
- * @param settlementTimeUTC the settlementTimeUTC to set
- */
- public void setSettlementTimeUTC(Date settlementTimeUTC) {
- this.settlementTimeUTC = settlementTimeUTC;
- }
-
- /**
- * Set the settlement time UTC.
- *
- * @param settlementTimeUTC
- */
- public void setSettlementTimeUTC(String settlementTimeUTC) {
- if(StringUtils.isNotEmpty(settlementTimeUTC)) {
- this.settlementTimeUTC = net.authorize.util.DateUtil.getDateFromFormattedDate(
- settlementTimeUTC, ReportingDetails.DATE_FORMAT);
- }
- }
-
- /**
- * @return the settlementTimeLocal
- */
- public Date getSettlementTimeLocal() {
- return settlementTimeLocal;
- }
-
- /**
- * @param settlementTimeLocal the settlementTimeLocal to set
- */
- public void setSettlementTimeLocal(Date settlementTimeLocal) {
- this.settlementTimeLocal = settlementTimeLocal;
- }
-
- /**
- * @param settlementTimeLocal the settlementTimeLocal to set
- */
- public void setSettlementTimeLocal(String settlementTimeLocal) {
- if(StringUtils.isNotEmpty(settlementTimeLocal)) {
- this.settlementTimeLocal = net.authorize.util.DateUtil.getDateFromFormattedDate(
- settlementTimeLocal, ReportingDetails.DATE_FORMAT);
- }
- }
-
- /**
- * @return the settlementState
- */
- public SettlementStateType getSettlementState() {
- return settlementState;
- }
-
- /**
- * @param settlementState the settlementState to set
- */
- public void setSettlementState(SettlementStateType settlementState) {
- this.settlementState = settlementState;
- }
-
- /**
- * @return the batchStatisticsList
- */
- public ArrayList getBatchStatisticsList() {
- return batchStatisticsList;
- }
-
- /**
- * Add batch statistics object to the existing list.
- *
- * @param batchStatistics
- */
- public void addBatchStatistics(BatchStatistics batchStatistics) {
- if(this.batchStatisticsList == null) {
- this.batchStatisticsList = new ArrayList();
- }
-
- this.batchStatisticsList.add(batchStatistics);
- }
-
- /**
- * @param batchStatisticsList the batchStatisticsList to set
- */
- public void setBatchStatisticsList(
- ArrayList batchStatisticsList) {
- this.batchStatisticsList = batchStatisticsList;
- }
-
- /**
- * @return the paymentMethod
- */
- public String getPaymentMethod() {
- return paymentMethod;
- }
-
- /**
- * @param paymentMethod the paymentMethod to set
- */
- public void setPaymentMethod(String paymentMethod) {
- this.paymentMethod = paymentMethod;
- }
-
-}
diff --git a/src/net/authorize/data/reporting/BatchStatistics.java b/src/net/authorize/data/reporting/BatchStatistics.java
deleted file mode 100644
index c493176..0000000
--- a/src/net/authorize/data/reporting/BatchStatistics.java
+++ /dev/null
@@ -1,539 +0,0 @@
-package net.authorize.data.reporting;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-import net.authorize.aim.Transaction;
-import net.authorize.data.creditcard.CardType;
-import net.authorize.util.StringUtils;
-
-/**
- * Batch statistical data.
- */
-public class BatchStatistics implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private CardType accountType;
- private BigDecimal chargeAmount;
- private long chargeCount = 0;
- private BigDecimal refundAmount;
- private long refundCount = 0;
- private long voidCount = 0;
- private long declineCount = 0;
- private long errorCount = 0;
- private BigDecimal returnedItemAmount;
- private long returnedItemCount = 0;
- private BigDecimal chargebackAmount;
- private long chargebackCount = 0;
- private long correctionNoticeCount = 0;
- private BigDecimal chargeChargebackAmount;
- private long chargeChargebackCount = 0;
- private BigDecimal refundChargebackAmount;
- private long refundChargebackCount = 0;
- private BigDecimal chargeReturnedItemsAmount;
- private long chargeReturnedItemsCount = 0;
- private BigDecimal refundReturnedItemsAmount;
- private long refundReturnedItemsCount = 0;
-
- private BatchStatistics() {
- chargeAmount = new BigDecimal(0.00).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- chargeCount = 0;
- refundAmount = new BigDecimal(0.00).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- refundCount = 0;
- voidCount = 0;
- declineCount = 0;
- errorCount = 0;
- returnedItemAmount = new BigDecimal(0.00).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- returnedItemCount = 0;
- chargebackAmount = new BigDecimal(0.00).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- chargebackCount = 0;
- correctionNoticeCount = 0;
- chargeChargebackAmount = new BigDecimal(0.00).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- chargeChargebackCount = 0;
- refundChargebackAmount = new BigDecimal(0.00).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- refundChargebackCount = 0;
- chargeReturnedItemsAmount = new BigDecimal(0.00).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- chargeReturnedItemsCount = 0;
- refundReturnedItemsAmount = new BigDecimal(0.00).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- refundReturnedItemsCount = 0;
- }
-
- public static BatchStatistics createBatchStatistics() {
- return new BatchStatistics();
- }
-
- /**
- * @return the accountType
- */
- public CardType getAccountType() {
- return accountType;
- }
-
- /**
- * @param accountType the accountType to set
- */
- public void setAccountType(CardType accountType) {
- this.accountType = accountType;
- }
-
- /**
- * @return the chargeAmount
- */
- public BigDecimal getChargeAmount() {
- return chargeAmount;
- }
-
- /**
- * @param chargeAmount the chargeAmount to set
- */
- public void setChargeAmount(BigDecimal chargeAmount) {
- this.chargeAmount = chargeAmount;
- }
-
- /**
- * @param chargeAmount the chargeAmount to set
- */
- public void setChargeAmount(String chargeAmount) {
- if(StringUtils.isNotEmpty(chargeAmount)) {
- this.chargeAmount = new BigDecimal(chargeAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the chargeCount
- */
- public long getChargeCount() {
- return chargeCount;
- }
-
- /**
- * @param chargeCount the chargeCount to set
- */
- public void setChargeCount(long chargeCount) {
- this.chargeCount = chargeCount;
- }
-
- /**
- * @param chargeCount the chargeCount to set
- */
- public void setChargeCount(String chargeCount) {
- if(StringUtils.isNotEmpty(chargeCount)) {
- this.chargeCount = Long.parseLong(chargeCount);
- }
- }
-
- /**
- * @return the refundAmount
- */
- public BigDecimal getRefundAmount() {
- return refundAmount;
- }
-
- /**
- * @param refundAmount the refundAmount to set
- */
- public void setRefundAmount(BigDecimal refundAmount) {
- this.refundAmount = refundAmount;
- }
-
- /**
- * @param refundAmount the refundAmount to set
- */
- public void setRefundAmount(String refundAmount) {
- if(StringUtils.isNotEmpty(refundAmount)) {
- this.refundAmount = new BigDecimal(refundAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the refundCount
- */
- public long getRefundCount() {
- return refundCount;
- }
-
- /**
- * @param refundCount the refundCount to set
- */
- public void setRefundCount(long refundCount) {
- this.refundCount = refundCount;
- }
-
- /**
- * @param refundCount the refundCount to set
- */
- public void setRefundCount(String refundCount) {
- if(StringUtils.isNotEmpty(refundCount)) {
- this.refundCount = Long.parseLong(refundCount);
- }
- }
-
- /**
- * @return the voidCount
- */
- public long getVoidCount() {
- return voidCount;
- }
-
- /**
- * @param voidCount the voidCount to set
- */
- public void setVoidCount(long voidCount) {
- this.voidCount = voidCount;
- }
-
- /**
- * @param voidCount the voidCount to set
- */
- public void setVoidCount(String voidCount) {
- if(StringUtils.isNotEmpty(voidCount)) {
- this.voidCount = Long.parseLong(voidCount);
- }
- }
-
- /**
- * @return the declineCount
- */
- public long getDeclineCount() {
- return declineCount;
- }
-
- /**
- * @param declineCount the declineCount to set
- */
- public void setDeclineCount(long declineCount) {
- this.declineCount = declineCount;
- }
-
- /**
- * @param declineCount the declineCount to set
- */
- public void setDeclineCount(String declineCount) {
- if(StringUtils.isNotEmpty(declineCount)) {
- this.declineCount = Long.parseLong(declineCount);
- }
- }
-
- /**
- * @return the errorCount
- */
- public long getErrorCount() {
- return errorCount;
- }
-
- /**
- * @param errorCount the errorCount to set
- */
- public void setErrorCount(long errorCount) {
- this.errorCount = errorCount;
- }
-
- /**
- * @param errorCount the errorCount to set
- */
- public void setErrorCount(String errorCount) {
- if(StringUtils.isNotEmpty(errorCount)) {
- this.errorCount = Long.parseLong(errorCount);
- }
- }
-
- /**
- * @return the returnedItemAmount
- */
- public BigDecimal getReturnedItemAmount() {
- return returnedItemAmount;
- }
-
- /**
- * @param returnedItemAmount the returnedItemAmount to set
- */
- public void setReturnedItemAmount(BigDecimal returnedItemAmount) {
- this.returnedItemAmount = returnedItemAmount;
- }
-
- /**
- * @param returnedItemAmount the returnedItemAmount to set
- */
- public void setReturnedItemAmount(String returnedItemAmount) {
- if(StringUtils.isNotEmpty(returnedItemAmount)) {
- this.returnedItemAmount = new BigDecimal(returnedItemAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the returnedItemCount
- */
- public long getReturnedItemCount() {
- return returnedItemCount;
- }
-
- /**
- * @param returnedItemCount the returnedItemCount to set
- */
- public void setReturnedItemCount(long returnedItemCount) {
- this.returnedItemCount = returnedItemCount;
- }
-
- /**
- * @param returnedItemCount the returnedItemCount to set
- */
- public void setReturnedItemCount(String returnedItemCount) {
- if(StringUtils.isNotEmpty(returnedItemCount)) {
- this.returnedItemCount = Long.parseLong(returnedItemCount);
- }
- }
-
- /**
- * @return the ChargebackAmount
- */
- public BigDecimal getChargebackAmount() {
- return chargebackAmount;
- }
-
- /**
- * @param ChargebackAmount the ChargebackAmount to set
- */
- public void setChargebackAmount(BigDecimal ChargebackAmount) {
- this.chargebackAmount = ChargebackAmount;
- }
-
- /**
- * @param ChargebackAmount the ChargebackAmount to set
- */
- public void setChargebackAmount(String ChargebackAmount) {
- if(StringUtils.isNotEmpty(ChargebackAmount)) {
- this.chargebackAmount = new BigDecimal(ChargebackAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the ChargebackCount
- */
- public long getChargebackCount() {
- return chargebackCount;
- }
-
- /**
- * @param ChargebackCount the ChargebackCount to set
- */
- public void setChargebackCount(long ChargebackCount) {
- this.chargebackCount = ChargebackCount;
- }
-
- /**
- * @param ChargebackCount the ChargebackCount to set
- */
- public void setChargebackCount(String ChargebackCount) {
- if(StringUtils.isNotEmpty(ChargebackCount)) {
- this.chargebackCount = Long.parseLong(ChargebackCount);
- }
- }
-
- /**
- * @return the correctionNoticeCount
- */
- public long getCorrectionNoticeCount() {
- return correctionNoticeCount;
- }
-
- /**
- * @param correctionNoticeCount the correctionNoticeCount to set
- */
- public void setCorrectionNoticeCount(long correctionNoticeCount) {
- this.correctionNoticeCount = correctionNoticeCount;
- }
-
- /**
- * @param correctionNoticeCount the correctionNoticeCount to set
- */
- public void setCorrectionNoticeCount(String correctionNoticeCount) {
- if(StringUtils.isNotEmpty(correctionNoticeCount)) {
- this.correctionNoticeCount = Long.parseLong(correctionNoticeCount);
- }
- }
-
- /**
- * @return the chargeChargebackAmount
- */
- public BigDecimal getChargeChargebackAmount() {
- return chargeChargebackAmount;
- }
-
- /**
- * @param chargeChargebackAmount the chargeChargebackAmount to set
- */
- public void setChargeChargebackAmount(BigDecimal chargeChargebackAmount) {
- this.chargeChargebackAmount = chargeChargebackAmount;
- }
-
- /**
- * @param chargeChargebackAmount the chargeChargebackAmount to set
- */
- public void setChargeChargebackAmount(String chargeChargebackAmount) {
- if(StringUtils.isNotEmpty(chargeChargebackAmount)) {
- this.chargeChargebackAmount = new BigDecimal(chargeChargebackAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the chargeChargebackCount
- */
- public long getChargeChargebackCount() {
- return chargeChargebackCount;
- }
-
- /**
- * @param chargeChargebackCount the chargeChargebackCount to set
- */
- public void setChargeChargebackCount(long chargeChargebackCount) {
- this.chargeChargebackCount = chargeChargebackCount;
- }
-
- /**
- * @param chargeChargebackCount the chargeChargebackCount to set
- */
- public void setChargeChargebackCount(String chargeChargebackCount) {
- if(StringUtils.isNotEmpty(chargeChargebackCount)) {
- this.chargeChargebackCount = Long.parseLong(chargeChargebackCount);
- }
- }
-
- /**
- * @return the refundChargebackAmount
- */
- public BigDecimal getRefundChargebackAmount() {
- return refundChargebackAmount;
- }
-
- /**
- * @param refundChargebackAmount the refundChargebackAmount to set
- */
- public void setRefundChargebackAmount(BigDecimal refundChargebackAmount) {
- this.refundChargebackAmount = refundChargebackAmount;
- }
-
- /**
- * @param refundChargebackAmount the refundChargebackAmount to set
- */
- public void setRefundChargebackAmount(String refundChargebackAmount) {
- if(StringUtils.isNotEmpty(refundChargebackAmount)) {
- this.refundChargebackAmount = new BigDecimal(refundChargebackAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the refundChargebackCount
- */
- public long getRefundChargebackCount() {
- return refundChargebackCount;
- }
-
- /**
- * @param refundChargebackCount the refundChargebackCount to set
- */
- public void setRefundChargebackCount(long refundChargebackCount) {
- this.refundChargebackCount = refundChargebackCount;
- }
-
- /**
- * @param refundChargebackCount the refundChargebackCount to set
- */
- public void setRefundChargebackCount(String refundChargebackCount) {
- if(StringUtils.isNotEmpty(refundChargebackCount)) {
- this.refundChargebackCount = Long.parseLong(refundChargebackCount);
- }
- }
-
- /**
- * @return the chargeReturnedItemsAmount
- */
- public BigDecimal getChargeReturnedItemsAmount() {
- return chargeReturnedItemsAmount;
- }
-
- /**
- * @param chargeReturnedItemsAmount the chargeReturnedItemsAmount to set
- */
- public void setChargeReturnedItemsAmount(BigDecimal chargeReturnedItemsAmount) {
- this.chargeReturnedItemsAmount = chargeReturnedItemsAmount;
- }
-
- /**
- * @param chargeReturnedItemsAmount the chargeReturnedItemsAmount to set
- */
- public void setChargeReturnedItemsAmount(String chargeReturnedItemsAmount) {
- if(StringUtils.isNotEmpty(chargeReturnedItemsAmount)) {
- this.chargeReturnedItemsAmount = new BigDecimal(chargeReturnedItemsAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the chargeReturnedItemsCount
- */
- public long getChargeReturnedItemsCount() {
- return chargeReturnedItemsCount;
- }
-
- /**
- * @param chargeReturnedItemsCount the chargeReturnedItemsCount to set
- */
- public void setChargeReturnedItemsCount(long chargeReturnedItemsCount) {
- this.chargeReturnedItemsCount = chargeReturnedItemsCount;
- }
-
- /**
- * @param chargeReturnedItemsCount the chargeReturnedItemsCount to set
- */
- public void setChargeReturnedItemsCount(String chargeReturnedItemsCount) {
- if(StringUtils.isNotEmpty(chargeReturnedItemsCount)) {
- this.chargeReturnedItemsCount = Long.parseLong(chargeReturnedItemsCount);
- }
- }
-
- /**
- * @return the refundReturnedItemsAmount
- */
- public BigDecimal getRefundReturnedItemsAmount() {
- return refundReturnedItemsAmount;
- }
-
- /**
- * @param refundReturnedItemsAmount the refundReturnedItemsAmount to set
- */
- public void setRefundReturnedItemsAmount(BigDecimal refundReturnedItemsAmount) {
- this.refundReturnedItemsAmount = refundReturnedItemsAmount;
- }
-
- /**
- * @param refundReturnedItemsAmount the refundReturnedItemsAmount to set
- */
- public void setRefundReturnedItemsAmount(String refundReturnedItemsAmount) {
- if(StringUtils.isNotEmpty(refundReturnedItemsAmount)) {
- this.refundReturnedItemsAmount = new BigDecimal(refundReturnedItemsAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the refundReturnedItemsCount
- */
- public long getRefundReturnedItemsCount() {
- return refundReturnedItemsCount;
- }
-
- /**
- * @param refundReturnedItemsCount the refundReturnedItemsCount to set
- */
- public void setRefundReturnedItemsCount(long refundReturnedItemsCount) {
- this.refundReturnedItemsCount = refundReturnedItemsCount;
- }
-
- /**
- * @param refundReturnedItemsCount the refundReturnedItemsCount to set
- */
- public void setRefundReturnedItemsCount(String refundReturnedItemsCount) {
- if(StringUtils.isNotEmpty(refundReturnedItemsCount)) {
- this.chargeReturnedItemsCount = Long.parseLong(refundReturnedItemsCount);
- }
- }
-}
diff --git a/src/net/authorize/data/reporting/CAVVResponseType.java b/src/net/authorize/data/reporting/CAVVResponseType.java
deleted file mode 100644
index 7df06ab..0000000
--- a/src/net/authorize/data/reporting/CAVVResponseType.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package net.authorize.data.reporting;
-
-
-/**
- * Cardholder Authentication Verification type.
- */
-public enum CAVVResponseType {
- NOT_VALIDATED("", "CAVV not validated"),
- CAVV_0("0", "CAVV not validated because erroneous data was submitted"),
- CAVV_1("1", "CAVV failed validation"),
- CAVV_2("2", "CAVV passed validation"),
- CAVV_3("3", "CAVV validation could not be performed; issuer attempt incomplete"),
- CAVV_4("4", "CAVV validation could not be performed; issuer system error"),
- CAVV_5("5", "Reserved for future use"),
- CAVV_6("6", "Reserved for future use"),
- CAVV_7("7", "CAVV attempt Ñ failed validation Ñ issuer available (U.S.-issued card/non-U.S. acquirer)"),
- CAVV_8("8", "CAVV attempt Ñ passed validation Ñ issuer available (U.S.-issued card/non-U.S. acquirer)"),
- CAVV_9("9", "CAVV attempt Ñ failed validation Ñ issuer unavailable (U.S.-issued card/non-U.S. acquirer)"),
- CAVV_A("A", "CAVV attempt Ñ passed validation Ñ issuer unavailable (U.S.-issued card/non-U.S. acquirer)"),
- CAVV_B("B", "CAVV passed validation, information only, no liability shift");
-
- private final String value;
- private final String description;
-
- private CAVVResponseType(String value, String description) {
- this.value = value;
- this.description = description;
- }
-
- public static CAVVResponseType findByValue(String value) {
- if(value != null) {
- for(CAVVResponseType responseType : values()) {
- if(responseType.value.equals(value)) {
- return responseType;
- }
- }
- }
-
- return CAVVResponseType.NOT_VALIDATED;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
-
-}
diff --git a/src/net/authorize/data/reporting/CardCodeResponseType.java b/src/net/authorize/data/reporting/CardCodeResponseType.java
deleted file mode 100644
index 42f98d8..0000000
--- a/src/net/authorize/data/reporting/CardCodeResponseType.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package net.authorize.data.reporting;
-
-
-/**
- * Card code type.
- */
-public enum CardCodeResponseType {
- M("M", "Match"),
- N("N", "No Match"),
- P("P", "Not Processed"),
- S("S", "Should have been present"),
- U("U", "Issuer unable to process request");
-
- private final String value;
- private final String description;
-
- private CardCodeResponseType(String value, String description) {
- this.value = value;
- this.description = description;
- }
-
- public static CardCodeResponseType findByValue(String value) {
- if(value != null) {
- for(CardCodeResponseType responseType : values()) {
- if(responseType.value.equals(value)) {
- return responseType;
- }
- }
- }
-
- return null;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
-}
diff --git a/src/net/authorize/data/reporting/FDSFilter.java b/src/net/authorize/data/reporting/FDSFilter.java
deleted file mode 100644
index 76b983a..0000000
--- a/src/net/authorize/data/reporting/FDSFilter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package net.authorize.data.reporting;
-
-import java.io.Serializable;
-
-/**
- * Fraud Detection Suite filter enumeration.
- */
-public class FDSFilter implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private String name;
- private FDSFilterActionType action;
-
- private FDSFilter() { }
-
- public static FDSFilter createFDSFilter() {
- return new FDSFilter();
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
- /**
- * @return the action
- */
- public FDSFilterActionType getAction() {
- return action;
- }
- /**
- * @param action the action to set
- */
- public void setAction(FDSFilterActionType action) {
- this.action = action;
- }
-
-
-}
diff --git a/src/net/authorize/data/reporting/FDSFilterActionType.java b/src/net/authorize/data/reporting/FDSFilterActionType.java
deleted file mode 100644
index 2ea4c5a..0000000
--- a/src/net/authorize/data/reporting/FDSFilterActionType.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.authorize.data.reporting;
-
-
-/**
- * The action taken for a transaction that triggered one or more of the
- * Advanced Fraud Detection Suite filters.
- */
-public enum FDSFilterActionType {
- REJECT("reject"),
- DECLINE("decline"),
- HOLD("hold"),
- AUTH_AND_HOLD("authAndHold"),
- REPORT("report");
-
- private final String value;
-
- private FDSFilterActionType(String value) {
- this.value = value;
- }
-
- public static FDSFilterActionType findByValue(String value) {
- if(value != null) {
- for(FDSFilterActionType filterAction : values()) {
- if(filterAction.value.equals(value)) {
- return filterAction;
- }
- }
- }
-
- return null;
- }
-
-}
diff --git a/src/net/authorize/data/reporting/ReportingDetails.java b/src/net/authorize/data/reporting/ReportingDetails.java
deleted file mode 100644
index 5015af8..0000000
--- a/src/net/authorize/data/reporting/ReportingDetails.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package net.authorize.data.reporting;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
-
-/**
- * Reporting details.
- */
-public class ReportingDetails implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- public static String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
- public static String DATE_FORMAT_FULL = "yyyy-MM-dd'T'HH:mm:ss.SSS";
-
- private boolean batchIncludeStatistics = false;
- private Date batchFirstSettlementDate = null;
- private Date batchLastSettlementDate = null;
- private String batchId = null;
- private String transactionId = null;
- private ArrayList batchDetailsList = new ArrayList();
- private ArrayList transactionDetailList = new ArrayList();
-
- private ReportingDetails () { }
-
- public static ReportingDetails createReportingDetails() {
- return new ReportingDetails();
- }
-
- /**
- * @return the batchIncludeStatistics
- */
- public boolean isBatchIncludeStatistics() {
- return batchIncludeStatistics;
- }
-
- /**
- * @param batchIncludeStatistics the batchIncludeStatistics to set
- */
- public void setBatchIncludeStatistics(boolean batchIncludeStatistics) {
- this.batchIncludeStatistics = batchIncludeStatistics;
- }
-
- /**
- * @return the batchFirstSettlementDate
- */
- public Date getBatchFirstSettlementDate() {
- return batchFirstSettlementDate;
- }
-
- /**
- * @param batchFirstSettlementDate the batchFirstSettlementDate to set
- */
- public void setBatchFirstSettlementDate(Date batchFirstSettlementDate) {
- this.batchFirstSettlementDate = batchFirstSettlementDate;
- }
-
- /**
- * @param batchFirstSettlementDate the batchFirstSettlementDate to set
- */
- public void setBatchFirstSettlementDate(String batchFirstSettlementDate) {
- this.batchFirstSettlementDate = net.authorize.util.DateUtil.getDateFromFormattedDate(
- batchFirstSettlementDate, DATE_FORMAT);
- }
-
- /**
- * @return the batchLastSettlementDate
- */
- public Date getBatchLastSettlementDate() {
- return batchLastSettlementDate;
- }
-
- /**
- * @param batchLastSettlementDate the batchLastSettlementDate to set
- */
- public void setBatchLastSettlementDate(Date batchLastSettlementDate) {
- this.batchLastSettlementDate = batchLastSettlementDate;
- }
-
- /**
- * @param batchLastSettlementDate the batchLastSettlementDate to set
- */
- public void setBatchLastSettlementDate(String batchLastSettlementDate) {
- this.batchLastSettlementDate = net.authorize.util.DateUtil.getDateFromFormattedDate(
- batchLastSettlementDate, DATE_FORMAT);
- }
-
- /**
- * @return the batchId
- */
- public String getBatchId() {
- return batchId;
- }
-
- /**
- * @param batchId the batchId to set
- */
- public void setBatchId(String batchId) {
- this.batchId = batchId;
- }
-
- /**
- * @return the transactionId
- */
- public String getTransactionId() {
- return transactionId;
- }
-
- /**
- * @param transactionId the transactionId to set
- */
- public void setTransactionId(String transactionId) {
- this.transactionId = transactionId;
- }
-
- /**
- * @return the batchDetailList
- */
- public ArrayList getBatchDetailsList() {
- return batchDetailsList;
- }
-
- /**
- * @param batchDetailList the batchDetailList to set
- */
- public void setBatchDetailsList(ArrayList batchDetailList) {
- this.batchDetailsList = batchDetailList;
- }
-
- /**
- * @return the transactionDetailList
- */
- public ArrayList getTransactionDetailList() {
- return transactionDetailList;
- }
-
- /**
- * @param transactionDetailList the transactionDetailList to set
- */
- public void setTransactionDetailList(
- ArrayList transactionDetailList) {
- this.transactionDetailList = transactionDetailList;
- }
-
-
-}
diff --git a/src/net/authorize/data/reporting/ReportingTransactionType.java b/src/net/authorize/data/reporting/ReportingTransactionType.java
deleted file mode 100644
index 7d03a87..0000000
--- a/src/net/authorize/data/reporting/ReportingTransactionType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package net.authorize.data.reporting;
-
-
-/**
- * ReportingTransactionType enumeration.
- */
-public enum ReportingTransactionType {
-
- AUTH_CAPTURE("authCaptureTransaction"),
- AUTH_ONLY("authOnlyTransaction"),
- CAPTURE_ONLY("captureOnlyTransaction"),
- REFUND("refundTransaction");
-
- private final String value;
-
- private ReportingTransactionType(String v) {
- value = v;
- }
-
- public String value() {
- return value;
- }
-
- public static ReportingTransactionType fromValue(String v) {
- for (ReportingTransactionType c: ReportingTransactionType.values()) {
- if (c.value.equals(v)) {
- return c;
- }
- }
-
- return null;
- }
-
-}
-
diff --git a/src/net/authorize/data/reporting/SettlementStateType.java b/src/net/authorize/data/reporting/SettlementStateType.java
deleted file mode 100644
index 0593257..0000000
--- a/src/net/authorize/data/reporting/SettlementStateType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package net.authorize.data.reporting;
-
-
-/**
- * Settlement state enumeration.
- */
-public enum SettlementStateType {
- SETTLED_SUCCESSFULLY("settledSuccessfully"),
- ERROR("error");
-
- private final String value;
-
- private SettlementStateType(String v) {
- value = v;
- }
-
- public String value() {
- return value;
- }
-
- public static SettlementStateType fromValue(String v) {
- for (SettlementStateType c: SettlementStateType.values()) {
- if (c.value.equals(v)) {
- return c;
- }
- }
-
- return null;
- }
-
-}
diff --git a/src/net/authorize/data/reporting/TransactionDetails.java b/src/net/authorize/data/reporting/TransactionDetails.java
deleted file mode 100644
index df0aa31..0000000
--- a/src/net/authorize/data/reporting/TransactionDetails.java
+++ /dev/null
@@ -1,624 +0,0 @@
-package net.authorize.data.reporting;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-
-import net.authorize.ResponseCode;
-import net.authorize.ResponseReasonCode;
-import net.authorize.aim.Transaction;
-import net.authorize.data.Customer;
-import net.authorize.data.Order;
-import net.authorize.data.Payment;
-import net.authorize.data.creditcard.AVSCode;
-import net.authorize.data.creditcard.CardType;
-import net.authorize.util.StringUtils;
-
-/**
- * Reporting transaction details.
- */
-public class TransactionDetails implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private String transId;
- private String refTransId;
- private String splitTenderId;
- private Date submitTimeUTC;
- private Date submitTimeLocal;
- private ReportingTransactionType transactionType;
- private TransactionStatusType transactionStatus;
- private ResponseCode responseCode;
- private ResponseReasonCode responseReasonCode;
- private String authCode;
- private AVSCode avsResponse;
- private CardCodeResponseType cardCodeResponse;
- private CAVVResponseType CAVVResponse;
- private FDSFilterActionType FDSFilterAction;
- private ArrayList FDSFilterList = new ArrayList();
- private BatchDetails batch;
- private Order order;
- // reporting
- private BigDecimal prepaidBalanceRemaining = null;
- private boolean itemTaxExempt;
-
- private BigDecimal requestedAmount;
- private BigDecimal authAmount;
- private BigDecimal settleAmount;
- private Payment payment;
- private Customer customer;
- private boolean recurringBilling;
- private String customerIP;
-
- private String invoiceNumber;
- private String firstName;
- private String lastName;
- private CardType accountType;
- private String accountNumber;
-
- private boolean fullTransactionDetails = false;
-
- private TransactionDetails() { }
-
- public static TransactionDetails createTransactionDetails() {
- return new TransactionDetails();
- }
-
- /**
- * @return the transId
- */
- public String getTransId() {
- return transId;
- }
-
- /**
- * @param transId
- * the transId to set
- */
- public void setTransId(String transId) {
- this.transId = transId;
- }
-
- /**
- * @return the submitTimeUTC
- */
- public Date getSubmitTimeUTC() {
- return submitTimeUTC;
- }
-
- /**
- * @param submitTimeUTC
- * the submitTimeUTC to set
- */
- public void setSubmitTimeUTC(Date submitTimeUTC) {
- this.submitTimeUTC = submitTimeUTC;
- }
-
- /**
- * @param submitTimeUTC
- * the submitTimeUTC to set
- */
- public void setSubmitTimeUTC(String submitTimeUTC) {
- if (StringUtils.isNotEmpty(submitTimeUTC)) {
- this.submitTimeUTC = net.authorize.util.DateUtil
- .getDateFromFormattedDate(submitTimeUTC,
- fullTransactionDetails?ReportingDetails.DATE_FORMAT_FULL:ReportingDetails.DATE_FORMAT);
- }
- }
-
- /**
- * @return the submitTimeLocal
- */
- public Date getSubmitTimeLocal() {
- return submitTimeLocal;
- }
-
- /**
- * @param submitTimeLocal
- * the submitTimeLocal to set
- */
- public void setSubmitTimeLocal(Date submitTimeLocal) {
- this.submitTimeLocal = submitTimeLocal;
- }
-
- /**
- * @param submitTimeLocal
- * the submitTimeLocal to set
- */
- public void setSubmitTimeLocal(String submitTimeLocal) {
- if (StringUtils.isNotEmpty(submitTimeLocal)) {
- this.submitTimeLocal = net.authorize.util.DateUtil
- .getDateFromFormattedDate(submitTimeLocal,
- fullTransactionDetails?ReportingDetails.DATE_FORMAT_FULL:ReportingDetails.DATE_FORMAT);
- }
- }
-
- /**
- * @return the transactionStatus
- */
- public TransactionStatusType getTransactionStatus() {
- return transactionStatus;
- }
-
- /**
- * @param transactionStatus
- * the transactionStatus to set
- */
- public void setTransactionStatus(TransactionStatusType transactionStatus) {
- this.transactionStatus = transactionStatus;
- }
-
- /**
- * @param transactionStatus
- * the transactionStatus to set
- */
- public void setTransactionStatus(String transactionStatus) {
- if (StringUtils.isNotEmpty(transactionStatus)) {
- this.transactionStatus = TransactionStatusType
- .fromValue(transactionStatus);
- }
- }
-
- /**
- * @return the invoiceNumber
- */
- public String getInvoiceNumber() {
- return invoiceNumber;
- }
-
- /**
- * @param invoiceNumber
- * the invoiceNumber to set
- */
- public void setInvoiceNumber(String invoiceNumber) {
- this.invoiceNumber = invoiceNumber;
- }
-
- /**
- * @return the firstName
- */
- public String getFirstName() {
- return firstName;
- }
-
- /**
- * @param firstName
- * the firstName to set
- */
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- /**
- * @return the lastName
- */
- public String getLastName() {
- return lastName;
- }
-
- /**
- * @param lastName
- * the lastName to set
- */
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- /**
- * @return the accountType
- */
- public CardType getAccountType() {
- return accountType;
- }
-
- /**
- * @param accountType
- * the accountType to set
- */
- public void setAccountType(CardType accountType) {
- this.accountType = accountType;
- }
-
- /**
- * @param accountType
- * the accountType to set
- */
- public void setAccountType(String accountType) {
- if (StringUtils.isNotEmpty(accountType)) {
- this.accountType = CardType.findByValue(accountType);
- }
- }
-
- /**
- * @return the accountNumber
- */
- public String getAccountNumber() {
- return accountNumber;
- }
-
- /**
- * @param accountNumber
- * the accountNumber to set
- */
- public void setAccountNumber(String accountNumber) {
- this.accountNumber = accountNumber;
- }
-
- /**
- * @return the fullTransactionDetails
- */
- public boolean isFullTransactionDetails() {
- return fullTransactionDetails;
- }
-
- /**
- * @param fullTransactionDetails the fullTransactionDetails to set
- */
- public void setFullTransactionDetails(boolean fullTransactionDetails) {
- this.fullTransactionDetails = fullTransactionDetails;
- }
-
- /**
- * @return the refTransId
- */
- public String getRefTransId() {
- return refTransId;
- }
-
- /**
- * @param refTransId the refTransId to set
- */
- public void setRefTransId(String refTransId) {
- this.refTransId = refTransId;
- }
-
- /**
- * @return the splitTenderId
- */
- public String getSplitTenderId() {
- return splitTenderId;
- }
-
- /**
- * @param splitTenderId the splitTenderId to set
- */
- public void setSplitTenderId(String splitTenderId) {
- this.splitTenderId = splitTenderId;
- }
-
- /**
- * @return the transactionType
- */
- public ReportingTransactionType getTransactionType() {
- return transactionType;
- }
-
- /**
- * @param transactionType the transactionType to set
- */
- public void setTransactionType(ReportingTransactionType transactionType) {
- this.transactionType = transactionType;
- }
-
- /**
- * @return the responseCode
- */
- public ResponseCode getResponseCode() {
- return responseCode;
- }
-
- /**
- * @param responseCode the responseCode to set
- */
- public void setResponseCode(ResponseCode responseCode) {
- this.responseCode = responseCode;
- }
-
- /**
- * @return the responseReasonCode
- */
- public ResponseReasonCode getResponseReasonCode() {
- return responseReasonCode;
- }
-
- /**
- * @param responseReasonCode the responseReasonCode to set
- */
- public void setResponseReasonCode(ResponseReasonCode responseReasonCode) {
- this.responseReasonCode = responseReasonCode;
- }
-
- /**
- * @return the authCode
- */
- public String getAuthCode() {
- return authCode;
- }
-
- /**
- * @param authCode the authCode to set
- */
- public void setAuthCode(String authCode) {
- this.authCode = authCode;
- }
-
- /**
- * @return the avsResponse
- */
- public AVSCode getAvsResponse() {
- return avsResponse;
- }
-
- /**
- * @param avsResponse the avsResponse to set
- */
- public void setAvsResponse(AVSCode avsResponse) {
- this.avsResponse = avsResponse;
- }
-
- /**
- * @return the cardCodeResponse
- */
- public CardCodeResponseType getCardCodeResponse() {
- return cardCodeResponse;
- }
-
- /**
- * @param cardCodeResponse the cardCodeResponse to set
- */
- public void setCardCodeResponse(CardCodeResponseType cardCodeResponse) {
- this.cardCodeResponse = cardCodeResponse;
- }
-
- /**
- * @return the cAVVResponse
- */
- public CAVVResponseType getCAVVResponse() {
- return CAVVResponse;
- }
-
- /**
- * @param cAVVResponse the cAVVResponse to set
- */
- public void setCAVVResponse(CAVVResponseType cAVVResponse) {
- CAVVResponse = cAVVResponse;
- }
-
- /**
- * @return the fDSFilterAction
- */
- public FDSFilterActionType getFDSFilterAction() {
- return FDSFilterAction;
- }
-
- /**
- * @param fDSFilterAction the fDSFilterAction to set
- */
- public void setFDSFilterAction(FDSFilterActionType fDSFilterAction) {
- FDSFilterAction = fDSFilterAction;
- }
-
- /**
- * @return the fDSFilterList
- */
- public ArrayList getFDSFilterList() {
- return FDSFilterList;
- }
-
- /**
- * @param fDSFilterList the fDSFilterList to set
- */
- public void setFDSFilterList(ArrayList fDSFilterList) {
- FDSFilterList = fDSFilterList;
- }
-
- /**
- * @return the batch
- */
- public BatchDetails getBatch() {
- return batch;
- }
-
- /**
- * @param batch the batch to set
- */
- public void setBatch(BatchDetails batch) {
- this.batch = batch;
- }
-
- /**
- * @return the order
- */
- public Order getOrder() {
- return order;
- }
-
- /**
- * @param order the order to set
- */
- public void setOrder(Order order) {
- this.order = order;
- }
-
- /**
- * @return the requestedAmount
- */
- public BigDecimal getRequestedAmount() {
- return requestedAmount;
- }
-
- /**
- * @param requestedAmount the requestedAmount to set
- */
- public void setRequestedAmount(BigDecimal requestedAmount) {
- this.requestedAmount = requestedAmount;
- }
-
- /**
- * @param requestedAmount the requestedAmount to set
- */
- public void setRequestedAmount(String requestedAmount) {
- if(StringUtils.isNotEmpty(requestedAmount)) {
- this.requestedAmount = new BigDecimal(requestedAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the authAmount
- */
- public BigDecimal getAuthAmount() {
- return authAmount;
- }
-
- /**
- * @param authAmount the authAmount to set
- */
- public void setAuthAmount(BigDecimal authAmount) {
- this.authAmount = authAmount;
- }
-
- /**
- * @param authAmount the authAmount to set
- */
- public void setAuthAmount(String authAmount) {
- if(StringUtils.isNotEmpty(authAmount)) {
- this.authAmount = new BigDecimal(authAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the settleAmount
- */
- public BigDecimal getSettleAmount() {
- return settleAmount;
- }
-
- /**
- * @param settleAmount the settleAmount to set
- */
- public void setSettleAmount(BigDecimal settleAmount) {
- this.settleAmount = settleAmount;
- }
-
- /**
- * @param settleAmount the settleAmount to set
- */
- public void setSettleAmount(String settleAmount) {
- if(StringUtils.isNotEmpty(settleAmount)) {
- this.settleAmount = new BigDecimal(settleAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the payment
- */
- public Payment getPayment() {
- return payment;
- }
-
- /**
- * @param payment the payment to set
- */
- public void setPayment(Payment payment) {
- this.payment = payment;
- }
-
- /**
- * @return the customer
- */
- public Customer getCustomer() {
- return customer;
- }
-
- /**
- * @param customer the customer to set
- */
- public void setCustomer(Customer customer) {
- this.customer = customer;
- }
-
- /**
- * @return the recurringBilling
- */
- public boolean isRecurringBilling() {
- return recurringBilling;
- }
-
- /**
- * @param recurringBilling the recurringBilling to set
- */
- public void setRecurringBilling(boolean recurringBilling) {
- this.recurringBilling = recurringBilling;
- }
-
- /**
- * @param recurringBilling the recurringBilling to set
- */
- public void setRecurringBilling(String recurringBilling) {
- if(StringUtils.isNotEmpty(recurringBilling)) {
- this.recurringBilling = Boolean.valueOf(recurringBilling);
- }
- }
-
- /**
- * @return the customerIP
- */
- public String getCustomerIP() {
- return customerIP;
- }
-
- /**
- * @param customerIP the customerIP to set
- */
- public void setCustomerIP(String customerIP) {
- this.customerIP = customerIP;
- }
-
- /**
- * @return the prepaidBalanceRemaining
- */
- public BigDecimal getPrepaidBalanceRemaining() {
- return prepaidBalanceRemaining;
- }
-
- /**
- * @param prepaidBalanceRemaining the prepaidBalanceRemaining to set
- */
- public void setPrepaidBalanceRemaining(BigDecimal prepaidBalanceRemaining) {
- this.prepaidBalanceRemaining = prepaidBalanceRemaining;
- }
-
- /**
- * @param prepaidBalanceRemaining the prepaidBalanceRemaining to set
- */
- public void setPrepaidBalanceRemaining(String prepaidBalanceRemaining) {
- if(StringUtils.isNotEmpty(prepaidBalanceRemaining)) {
- this.prepaidBalanceRemaining = new BigDecimal(prepaidBalanceRemaining).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
- }
- }
-
- /**
- * @return the itemTaxExempt
- */
- public boolean isItemTaxExempt() {
- return itemTaxExempt;
- }
-
- /**
- * @param itemTaxExempt the itemTaxExempt to set
- */
- public void setItemTaxExempt(boolean itemTaxExempt) {
- this.itemTaxExempt = itemTaxExempt;
- }
-
- /**
- * @param itemTaxExempt the itemTaxExempt to set
- */
- public void setItemTaxExempt(String itemTaxExempt) {
- if(StringUtils.isNotEmpty(itemTaxExempt)) {
- this.itemTaxExempt = Boolean.valueOf(itemTaxExempt);
- }
- }
-
-}
diff --git a/src/net/authorize/data/reporting/TransactionStatusType.java b/src/net/authorize/data/reporting/TransactionStatusType.java
deleted file mode 100644
index ab1ff83..0000000
--- a/src/net/authorize/data/reporting/TransactionStatusType.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package net.authorize.data.reporting;
-
-
-/**
- * Transaction status enumeration.
- */
-public enum TransactionStatusType {
- AUTHORIZED_PENDING_CAPTURE("authorizedPendingCapture"),
- CAPTURED_PENDING_SETTLEMENT("capturedPendingSettlement"),
- COMMUNICATION_ERROR("communicationError"),
- REFUND_SETTLED_SUCCESSFULLY("refundSettledSuccessfully"),
- REFUND_PENDING_SETTLEMENT("refundPendingSettlement"),
- APPROVED_REVIEW("approvedReview"),
- DECLINED("declined"),
- COULD_NOT_VOID("couldNotVoid"),
- EXPIRED("expired"),
- GENERAL_ERROR("generalError"),
- PENDING_FINAL_SETTLEMENT("pendingFinalSettlement"),
- PENDING_SETTLEMENT("pendingSettlement"),
- FAILED_REVIEW("failedReview"),
- SETTLED_SUCCESSFULLY("settledSuccessfully"),
- SETTLEMENT_ERROR("settlementError"),
- UNDER_REVIEW("underReview"),
- UPDATING_SETTLEMENT("updatingSettlement"),
- VOIDED("voided"),
- FDS_PENDING_REVIEW("FDSPendingReview"),
- FDS_AUTHORIZED_PENDING_REVIEW("FDSAuthorizedPendingReview"),
- RETURNED_ITEM("returnedItem"),
- CHARGEBACK("chargeback"),
- CHARGEBACK_REVERSAL("chargebackReversal"),
- AUTHORIZED_PENDING_RELEASE("authorizedPendingRelease");
-
- private final String value;
-
- private TransactionStatusType(String v) {
- value = v;
- }
-
- public String value() {
- return value;
- }
-
- public static TransactionStatusType fromValue(String v) {
- for (TransactionStatusType c: TransactionStatusType.values()) {
- if (c.value.equals(v)) {
- return c;
- }
- }
-
- return null;
- }
-
-}
diff --git a/src/net/authorize/data/sim/HostedPaymentFormSettings.java b/src/net/authorize/data/sim/HostedPaymentFormSettings.java
deleted file mode 100644
index 620f321..0000000
--- a/src/net/authorize/data/sim/HostedPaymentFormSettings.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package net.authorize.data.sim;
-
-import java.io.Serializable;
-
-/**
- * When using the hosted payment form, settings can be configured to match the look of
- * the merchantÕs website. The purpose of this class is just that - to
- * store the hosted payment form settings.
- */
-public class HostedPaymentFormSettings implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private String header;
- private String footer;
- private String backgroundColor;
- private String linkColor;
- private String textColor;
- private String merchantLogoUrl;
- private String backgroundUrl;
-
- private HostedPaymentFormSettings() { }
-
- public static HostedPaymentFormSettings createHostedPaymentFormSettings() {
- return new HostedPaymentFormSettings();
- }
-
- /**
- * @return the header
- */
- public String getHeader() {
- return header;
- }
-
- /**
- * @param header the header to set
- */
- public void setHeader(String header) {
- this.header = header;
- }
-
- /**
- * @return the footer
- */
- public String getFooter() {
- return footer;
- }
-
- /**
- * @param footer the footer to set
- */
- public void setFooter(String footer) {
- this.footer = footer;
- }
-
- /**
- * @return the backgroundColor
- */
- public String getBackgroundColor() {
- return backgroundColor;
- }
-
- /**
- * @param backgroundColor the backgroundColor to set
- */
- public void setBackgroundColor(String backgroundColor) {
- this.backgroundColor = backgroundColor;
- }
-
- /**
- * @return the linkColor
- */
- public String getLinkColor() {
- return linkColor;
- }
-
- /**
- * @param linkColor the linkColor to set
- */
- public void setLinkColor(String linkColor) {
- this.linkColor = linkColor;
- }
-
- /**
- * @return the textColor
- */
- public String getTextColor() {
- return textColor;
- }
-
- /**
- * @param textColor the textColor to set
- */
- public void setTextColor(String textColor) {
- this.textColor = textColor;
- }
-
- /**
- * @return the merchantLogoUrl
- */
- public String getMerchantLogoUrl() {
- return merchantLogoUrl;
- }
-
- /**
- * @param merchantLogoUrl the merchantLogoUrl to set
- */
- public void setMerchantLogoUrl(String merchantLogoUrl) {
- this.merchantLogoUrl = merchantLogoUrl;
- }
-
- /**
- * @return the backgroundUrl
- */
- public String getBackgroundUrl() {
- return backgroundUrl;
- }
-
- /**
- * @param backgroundUrl the backgroundUrl to set
- */
- public void setBackgroundUrl(String backgroundUrl) {
- this.backgroundUrl = backgroundUrl;
- }
-
-
-}
diff --git a/src/net/authorize/data/sim/HostedReceiptPageSettings.java b/src/net/authorize/data/sim/HostedReceiptPageSettings.java
deleted file mode 100644
index 1e1ba81..0000000
--- a/src/net/authorize/data/sim/HostedReceiptPageSettings.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package net.authorize.data.sim;
-
-import java.io.Serializable;
-
-import net.authorize.sim.LinkMethod;
-
-/**
- * The hosted receipt page provides the customer with the status of their transaction and can include a
- * link back to the merchantÕs website. It can be customized to reflect the look and feel of the
- * merchantÕs website.
- *
- */
-public class HostedReceiptPageSettings implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private LinkMethod linkMethod;
- private String linkText;
- private String linkUrl;
-
- private HostedReceiptPageSettings() { }
-
- /**
- * Creates an instance of a HostedReceiptPageSettings class.
- *
- * @return a HostedReceiptPageSettings object.
- */
- public static HostedReceiptPageSettings createHostedReceiptPageSettings() {
- return new HostedReceiptPageSettings();
- }
-
- /**
- * @return the linkMethod
- */
- public LinkMethod getLinkMethod() {
- return linkMethod;
- }
-
- /**
- * @param linkMethod the linkMethod to set
- */
- public void setLinkMethod(LinkMethod linkMethod) {
- this.linkMethod = linkMethod;
- }
-
- /**
- * @return the linkText
- */
- public String getLinkText() {
- return linkText;
- }
-
- /**
- * @param linkText the linkText to set
- */
- public void setLinkText(String linkText) {
- this.linkText = linkText;
- }
-
- /**
- * @return the linkUrl
- */
- public String getLinkUrl() {
- return linkUrl;
- }
-
- /**
- * @param linkUrl the linkUrl to set
- */
- public void setLinkUrl(String linkUrl) {
- this.linkUrl = linkUrl;
- }
-
-}
diff --git a/src/net/authorize/data/swiperdata/SwiperData.java b/src/net/authorize/data/swiperdata/SwiperData.java
deleted file mode 100644
index a0cbfde..0000000
--- a/src/net/authorize/data/swiperdata/SwiperData.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package net.authorize.data.swiperdata;
-
-import java.io.Serializable;
-
-
-public class SwiperData implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private SwiperEncodingType encoding;
- private SwiperEncryptionAlgorithmType encryptionAlgorithm;
- private SwiperOperationType operation;
- private SwiperModeType mode;
- private String deviceInfo = "testDeviceInfo";
- private String encryptedData;
-
- public SwiperOperationType getOperation() {
- return operation;
- }
-
- public void setOperation(SwiperOperationType operation) {
- this.operation = operation;
- }
-
- public SwiperModeType getMode() {
- return mode;
- }
-
- public void setMode(SwiperModeType mode) {
- this.mode = mode;
- }
-
- public SwiperEncodingType getEncoding() {
- return encoding;
- }
-
- public void setEncoding(SwiperEncodingType encoding) {
- this.encoding = encoding;
- }
-
- public SwiperEncryptionAlgorithmType getEncryptionAlgorithm() {
- return encryptionAlgorithm;
- }
-
- public void setEncryptionAlgorithm(
- SwiperEncryptionAlgorithmType encryptionAlgorithm) {
- //hard coded for now
-// this.encryptionAlgorithm = encryptionAlgorithm;
- }
-
- public String getDeviceInfo() {
- return deviceInfo;
- }
-
- public void setDeviceInfo(String deviceInfo) {
- this.deviceInfo = deviceInfo;
- }
-
- public String getEncryptedData() {
- return encryptedData;
- }
-
- public void setEncryptedData(String encryptedData) {
- this.encryptedData = encryptedData;
- }
-
-
-
- public SwiperData(){
- encoding = SwiperEncodingType.HEX;
- encryptionAlgorithm = SwiperEncryptionAlgorithmType.TDES;
- operation = SwiperOperationType.DECRYPT;
- mode = SwiperModeType.DATA;
-
- }
-
-
-
-}
diff --git a/src/net/authorize/data/swiperdata/SwiperEncodingType.java b/src/net/authorize/data/swiperdata/SwiperEncodingType.java
deleted file mode 100644
index 9dbc032..0000000
--- a/src/net/authorize/data/swiperdata/SwiperEncodingType.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package net.authorize.data.swiperdata;
-
-public enum SwiperEncodingType {
- BASE64("Base64"),
- HEX("Hex");
-
- final private String fieldName;
-
- private SwiperEncodingType(String fieldName) {
- this.fieldName = fieldName;
- }
-
- public String getFieldName() {
- return this.fieldName;
- }
-}
diff --git a/src/net/authorize/data/swiperdata/SwiperEncryptionAlgorithmType.java b/src/net/authorize/data/swiperdata/SwiperEncryptionAlgorithmType.java
deleted file mode 100644
index 1a139d8..0000000
--- a/src/net/authorize/data/swiperdata/SwiperEncryptionAlgorithmType.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package net.authorize.data.swiperdata;
-
-public enum SwiperEncryptionAlgorithmType {
- TDES("TDES"),
- AES("AES"),
- RSA("RSA"),
- TEST("TEST");
-
- final private String fieldName;
-
- private SwiperEncryptionAlgorithmType(String fieldName) {
- this.fieldName = fieldName;
- }
-
- public String getFieldName() {
- return this.fieldName;
- }
-
- public static SwiperEncryptionAlgorithmType getEnum(String value) {
- for (SwiperEncryptionAlgorithmType orient : values()) {
- if (orient.fieldName.equals(value)) {
- return orient;
- }
- }
-
- return null;
- }
-}
-
-
\ No newline at end of file
diff --git a/src/net/authorize/data/swiperdata/SwiperModeType.java b/src/net/authorize/data/swiperdata/SwiperModeType.java
deleted file mode 100644
index e7201d3..0000000
--- a/src/net/authorize/data/swiperdata/SwiperModeType.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package net.authorize.data.swiperdata;
-
-public enum SwiperModeType {
- PIN("0"),
- DATA("1");
-
- final private String fieldName;
-
- private SwiperModeType(String fieldName) {
- this.fieldName = fieldName;
- }
-
- public String getFieldName() {
- return this.fieldName;
- }
-}
diff --git a/src/net/authorize/data/swiperdata/SwiperOperationType.java b/src/net/authorize/data/swiperdata/SwiperOperationType.java
deleted file mode 100644
index 6b99d27..0000000
--- a/src/net/authorize/data/swiperdata/SwiperOperationType.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package net.authorize.data.swiperdata;
-
-public enum SwiperOperationType {
- DECRYPT("DECRYPT");
-
- final private String fieldName;
-
- private SwiperOperationType(String fieldName) {
- this.fieldName = fieldName;
- }
-
- public String getFieldName() {
- return this.fieldName;
- }
-
-}
diff --git a/src/net/authorize/mobile/Result.java b/src/net/authorize/mobile/Result.java
deleted file mode 100644
index 387cea6..0000000
--- a/src/net/authorize/mobile/Result.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package net.authorize.mobile;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-import net.authorize.AuthNetField;
-import net.authorize.ITransaction;
-import net.authorize.aim.cardpresent.DeviceType;
-import net.authorize.aim.cardpresent.MarketType;
-import net.authorize.data.MerchantAccountDetails;
-import net.authorize.data.PermissionType;
-import net.authorize.data.mobile.MerchantContact;
-import net.authorize.util.StringUtils;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * Templated wrapper container for passing back the result from the request gateway.
- *
- */
-public class Result extends net.authorize.xml.Result implements Serializable {
-
- private static final long serialVersionUID = 2L;
- private MerchantContact merchantContact;
- private MerchantAccountDetails merchantDetails;
- private ArrayList userPermissions = new ArrayList();
- private String deviceType;
- private String marketType;
- protected Result() { }
-
- protected Result(ITransaction requestTransaction, String response) {
- this.requestTransaction = requestTransaction;
- this.xmlResponse = response;
-
- this.importRefId();
- this.importResponseMessages();
-
- switch ((TransactionType)this.requestTransaction.getTransactionType()) {
- case MOBILE_DEVICE_LOGIN :
- importSessionToken();
- importMerchantContact();
- importUserPermissions();
- importMerchantAccountDetails();
- break;
- default:
- break;
- }
- }
-
- public static Result createResult(ITransaction requestTransaction, String response) {
- Result result = new Result(requestTransaction, response);
-
- return result;
- }
-
- /**
- * Import the merchant contact information.
- */
- private void importMerchantContact() {
- NodeList merchant_contact_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_MERCHANT_CONTACT.getFieldName());
- if(merchant_contact_list.getLength() == 0) {
- return;
- }
-
- Element merchant_contact_el = (Element)merchant_contact_list.item(0);
-
- // merchant contact information
- this.merchantContact = MerchantContact.createMerchantContact();
- this.merchantContact.setAddress(getElementText(merchant_contact_el, AuthNetField.ELEMENT_MERCHANT_ADDRESS.getFieldName()));
- this.merchantContact.setCompanyName(getElementText(merchant_contact_el, AuthNetField.ELEMENT_MERCHANT_NAME.getFieldName()));
- this.merchantContact.setCity(getElementText(merchant_contact_el, AuthNetField.ELEMENT_MERCHANT_CITY.getFieldName()));
- this.merchantContact.setState(getElementText(merchant_contact_el, AuthNetField.ELEMENT_MERCHANT_STATE.getFieldName()));
- this.merchantContact.setZip(getElementText(merchant_contact_el, AuthNetField.ELEMENT_MERCHANT_ZIP.getFieldName()));
- this.merchantContact.setPhone(getElementText(merchant_contact_el, AuthNetField.ELEMENT_MERCHANT_PHONE.getFieldName()));
- }
-
- /**
- * Import the list of user permissions.
- */
- private void importUserPermissions() {
- NodeList user_perms_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_USER_PERMISSIONS.getFieldName());
-
- if(user_perms_list.getLength() == 0) {
- return;
- } else {
- Element user_permissions_el = (Element)user_perms_list.item(0);
- NodeList permissions_list = user_permissions_el.getElementsByTagName(AuthNetField.ELEMENT_PERMISSION.getFieldName());
-
- for(int i = 0; i < permissions_list.getLength(); i++) {
- Element permissions_el = (Element)permissions_list.item(i);
- String permission = getElementText(permissions_el, AuthNetField.ELEMENT_PERMISSION_NAME.getFieldName());
-
- if(StringUtils.isNotEmpty(permission)) {
- PermissionType userPermission = PermissionType.findByValue(permission);
- if(userPermission != null) {
- this.userPermissions.add(userPermission);
- }
- }
- }
- }
- }
-
- /**
- * @return the merchantContact
- */
- public MerchantContact getMerchantContact() {
- return merchantContact;
- }
-
- /**
- * @return the userPermissions
- */
- public ArrayList getUserPermissions() {
- return userPermissions;
- }
-
- private void importMerchantAccountDetails(){
- NodeList merchant_account_details = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_MERCHANT_ACCOUNT.getFieldName());
- if(merchant_account_details.getLength() == 0) {
- return;
- }
- merchantDetails = MerchantAccountDetails.getInstance();
- Element merchant_contact_el = (Element)merchant_account_details.item(0);
- // merchant contact information
- merchantDetails.setDeviceType(DeviceType.findByValue((getElementText(merchant_contact_el, AuthNetField.ELEMENT_DEVICE_TYPE.getFieldName()))));
- merchantDetails.setMarketType(MarketType.findByValue((getElementText(merchant_contact_el, AuthNetField.ELEMENT_MARKET_TYPE.getFieldName()))));
-
- }
-
- public MerchantAccountDetails getMerchantAccountDetails(){
- return merchantDetails;
- }
-
-}
diff --git a/src/net/authorize/mobile/Transaction.java b/src/net/authorize/mobile/Transaction.java
deleted file mode 100644
index 6c054b6..0000000
--- a/src/net/authorize/mobile/Transaction.java
+++ /dev/null
@@ -1,182 +0,0 @@
-package net.authorize.mobile;
-
-import net.authorize.AuthNetField;
-import net.authorize.Merchant;
-import net.authorize.data.mobile.MobileDevice;
-import net.authorize.util.BasicXmlDocument;
-import net.authorize.util.StringUtils;
-
-import org.w3c.dom.Element;
-
-/**
- * Transaction object for Mobile.
- *
- */
-public class Transaction extends net.authorize.xml.XMLTransaction {
-
- private static final long serialVersionUID = 2L;
-
- private TransactionType transactionType;
- private MobileDevice mobileDevice;
-
- /**
- * Private constructor.
- *
- * @param merchant
- * @param transactionType
- */
- private Transaction(Merchant merchant, TransactionType transactionType) {
-
- this.merchant = merchant;
- this.transactionType = transactionType;
- }
-
- /**
- * Creates a transaction.
- *
- * @param merchant
- * @param transactionType
- *
- * @return Transaction
- */
- public static Transaction createTransaction(Merchant merchant, TransactionType transactionType) {
- return new Transaction(merchant, transactionType);
- }
-
- /**
- * @return the transactionType
- */
- public TransactionType getTransactionType() {
- return transactionType;
- }
-
- /**
- * @return the refId
- */
- public String getRefId() {
- return refId;
- }
-
- /**
- * @param refId the refId to set
- */
- public void setRefId(String refId) {
- this.refId = refId;
- }
-
- /**
- * @return the mobileDevice
- */
- public MobileDevice getMobileDevice() {
- return mobileDevice;
- }
-
- /**
- * @param mobileDevice the mobileDevice to set
- */
- public void setMobileDevice(MobileDevice mobileDevice) {
- this.mobileDevice = mobileDevice;
- }
-
- /**
- * Add the mobile device to the request.
- *
- * @param document
- */
- private void addMobileDevice(BasicXmlDocument document) {
- if(mobileDevice != null && StringUtils.isNotEmpty(mobileDevice.getMobileDeviceId())) {
- Element mobile_device_el = document.createElement(AuthNetField.ELEMENT_MOBILE_DEVICE.getFieldName());
-
- // mobile device id
- Element mobile_device_id_el = document.createElement(AuthNetField.ELEMENT_MOBILE_DEVICE_ID.getFieldName());
- mobile_device_id_el.appendChild(document.getDocument().createTextNode(mobileDevice.getMobileDeviceId()));
- mobile_device_el.appendChild(mobile_device_id_el);
-
- // description
- if(StringUtils.isNotEmpty(mobileDevice.getDescription())) {
- Element description_el = document.createElement(AuthNetField.ELEMENT_DESCRIPTION.getFieldName());
- description_el.appendChild(document.getDocument().createTextNode(mobileDevice.getDescription()));
- mobile_device_el.appendChild(description_el);
- }
-
- // phone number
- if(StringUtils.isNotEmpty(mobileDevice.getPhoneNumber())) {
- Element phone_number_el = document.createElement(AuthNetField.ELEMENT_PHONE_NUMBER.getFieldName());
- phone_number_el.appendChild(document.getDocument().createTextNode(mobileDevice.getPhoneNumber()));
- mobile_device_el.appendChild(phone_number_el);
- }
-
- // device platform
- if(StringUtils.isNotEmpty(mobileDevice.getDevicePlatform())) {
- Element device_platform = document.createElement(AuthNetField.ELEMENT_DEVICE_PLATFORM.getFieldName());
- device_platform.appendChild(document.getDocument().createTextNode(mobileDevice.getDevicePlatform()));
- mobile_device_el.appendChild(device_platform);
- }
-
- document.getDocumentElement().appendChild(mobile_device_el);
- }
- }
-
- /**
- * This method is used to request registration for a mobile device.
- */
- private void createMobileDeviceRegistrationRequest() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.MOBILE_DEVICE_REGISTRATION.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document, false);
- addRefId(document);
- addMobileDevice(document);
- currentRequest = document;
- }
-
- /**
- * This method is used to authenticate a mobile device.
- */
- private void createMobileDeviceLoginRequest() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.MOBILE_DEVICE_LOGIN.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- currentRequest = document;
- }
-
- /**
- * This method is used to end a session from a mobile device.
- */
- private void createLogoutRequest() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.LOGOUT.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- currentRequest = document;
- }
-
- /**
- * Convert request to XML.
- *
- */
- public String toAuthNetPOSTString() {
- switch (this.transactionType) {
- case MOBILE_DEVICE_REGISTRATION :
- createMobileDeviceRegistrationRequest();
- break;
- case MOBILE_DEVICE_LOGIN :
- createMobileDeviceLoginRequest();
- break;
- case LOGOUT :
- createLogoutRequest();
- break;
- default:
- break;
- }
-
- return currentRequest.dump();
- }
-
-}
diff --git a/src/net/authorize/mobile/TransactionType.java b/src/net/authorize/mobile/TransactionType.java
deleted file mode 100644
index 0cf1cf4..0000000
--- a/src/net/authorize/mobile/TransactionType.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.authorize.mobile;
-
-/**
- * Transaction types specific for mobile.
- *
- */
-public enum TransactionType {
-
- MOBILE_DEVICE_REGISTRATION("mobileDeviceRegistrationRequest"),
- MOBILE_DEVICE_LOGIN("mobileDeviceLoginRequest"),
- LOGOUT("logoutRequest");
-
- final private String value;
-
- private TransactionType(String value) {
- this.value = value;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
-}
diff --git a/src/net/authorize/notification/Result.java b/src/net/authorize/notification/Result.java
deleted file mode 100644
index dc78264..0000000
--- a/src/net/authorize/notification/Result.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package net.authorize.notification;
-
-import java.io.Serializable;
-
-import net.authorize.ITransaction;
-
-/**
- * Wrapper container for passing back the result from the request gateway.
- *
- */
-public class Result extends net.authorize.xml.Result implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- /**
- * Result constructor.
- *
- * @param requestTransaction
- * @param response
- */
- protected Result(ITransaction requestTransaction, String response) {
- super(requestTransaction, response);
- }
-
- public static Result createResult(ITransaction requestTransaction, String response) {
- Result result = new Result(requestTransaction, response);
-
- return result;
- }
-
-}
diff --git a/src/net/authorize/notification/Transaction.java b/src/net/authorize/notification/Transaction.java
deleted file mode 100644
index 251338f..0000000
--- a/src/net/authorize/notification/Transaction.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package net.authorize.notification;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import net.authorize.AuthNetField;
-import net.authorize.Merchant;
-import net.authorize.data.EmailReceipt;
-import net.authorize.util.BasicXmlDocument;
-import net.authorize.util.StringUtils;
-
-import org.w3c.dom.Element;
-
-/**
- * Transaction object for ARB.
- *
- */
-public class Transaction extends net.authorize.xml.XMLTransaction {
-
- private static final long serialVersionUID = 2L;
-
- private TransactionType transactionType;
- private EmailReceipt emailReceipt;
- private String customerEmailAddress;
- private String transId;
-
- /**
- * Private constructor.
- *
- * @param merchant
- * @param transactionType
- * @param transId
- * @param emailAddress
- * @param emailReceipt
- */
- private Transaction(Merchant merchant, TransactionType transactionType,
- String transId, String emailAddress, EmailReceipt emailReceipt) {
-
- this.merchant = merchant;
- this.transactionType = transactionType;
- this.transId = transId;
- this.customerEmailAddress = emailAddress;
- this.emailReceipt = emailReceipt;
- }
-
- /**
- * Create a transaction.
- *
- * @param merchant
- * @param transactionType
- * @param transId
- * @param customerEmail
- * @param emailReceiptSettings
- * @return Transaction
- */
- public static Transaction createTransaction(Merchant merchant,
- TransactionType transactionType, String transId, String customerEmail,
- EmailReceipt emailReceiptSettings) {
- return new Transaction(merchant, transactionType, transId, customerEmail,
- emailReceiptSettings);
- }
-
- /**
- * Create a transaction.
- *
- * @param merchant
- * @param transactionType
- * @return Transaction
- */
- public static Transaction createTransaction(Merchant merchant,
- TransactionType transactionType) {
- return new Transaction(merchant, transactionType, null, null, null);
- }
-
- /**
- * @return the transactionType
- */
- public TransactionType getTransactionType() {
- return transactionType;
- }
-
-
- /**
- * Add the transId to the request.
- *
- * @param document
- */
- protected void addTransId(BasicXmlDocument document) {
- if(transId != null) {
- Element trans_id_el = document.createElement(AuthNetField.ELEMENT_TRANS_ID.getFieldName());
- trans_id_el.appendChild(document.getDocument().createTextNode(transId));
- document.getDocumentElement().appendChild(trans_id_el);
- }
- }
-
- /**
- * Add the customerEmail to the request.
- *
- * @param document
- */
- protected void addCustomerEmail(BasicXmlDocument document) {
- if(StringUtils.isNotEmpty(this.customerEmailAddress)) {
- Element email_el = document.createElement(AuthNetField.ELEMENT_CUSTOMER_EMAIL.getFieldName());
- email_el.appendChild(document.getDocument().createTextNode(
- StringUtils.subString(this.customerEmailAddress,255)));
- document.getDocumentElement().appendChild(email_el);
- }
- }
-
- /**
- * Add emailSettings to the request.
- *
- * @param document
- */
- protected void addEmailSettings(BasicXmlDocument document) {
- LinkedHashMap transactionSettings = new LinkedHashMap();
-
- if(emailReceipt != null) {
- // email header
- if(StringUtils.isNotEmpty(emailReceipt.getHeaderEmailReceipt())) {
- transactionSettings.put(AuthNetField.ELEMENT_HEADER_EMAIL_RECEIPT.getFieldName(),
- "");
- }
- // email footer
- if(StringUtils.isNotEmpty(emailReceipt.getFooterEmailReceipt())) {
- transactionSettings.put(AuthNetField.ELEMENT_FOOTER_EMAIL_RECEIPT.getFieldName(),
- "");
- }
- }
-
- // loop through the transaction settings and populate them in key/value fashion
- for(Map.Entry entry : transactionSettings.entrySet()) {
- Element setting_el = document.createElement(AuthNetField.ELEMENT_SETTING.getFieldName());
- Element setting_name_el = document.createElement(AuthNetField.ELEMENT_SETTING_NAME.getFieldName());
- setting_name_el.appendChild(document.getDocument().createTextNode(entry.getKey()));
- Element setting_value_el = document.createElement(AuthNetField.ELEMENT_SETTING_VALUE.getFieldName());
- setting_value_el.appendChild(document.getDocument().createTextNode(entry.getValue()));
-
- setting_el.appendChild(setting_name_el);
- setting_el.appendChild(setting_value_el);
- document.getDocument().appendChild(setting_el);
- }
- }
-
- /**
- * Create subscription request core.
- *
- * @param subscription
- */
- private void sendCustomerTransactionReceiptRequest(){
-
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.CUSTOMER_TRANSACTION_RECEIPT_EMAIL.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addRefId(document);
- addTransId(document);
- addCustomerEmail(document);
- addEmailSettings(document);
- currentRequest = document;
- }
-
- /**
- * @return the customerEmailAddress
- */
- protected String getCustomerEmailAddress() {
- return customerEmailAddress;
- }
-
- /**
- * @param customerEmailAddress the emailAddress to set
- */
- public void setCustomerEmailAddress(String customerEmailAddress) {
- this.customerEmailAddress = customerEmailAddress;
- }
-
- /**
- * @return the transId
- */
- protected String getTransId() {
- return transId;
- }
-
- /**
- * @param transId the transId to set
- */
- public void setTransId(String transId) {
- this.transId = transId;
- }
-
- /**
- * Convert request to XML.
- *
- */
- public String toAuthNetPOSTString() {
- switch (this.transactionType) {
- case CUSTOMER_TRANSACTION_RECEIPT_EMAIL :
- sendCustomerTransactionReceiptRequest();
- break;
- default:
- break;
- }
-
- return currentRequest.dump();
- }
-
-}
diff --git a/src/net/authorize/notification/TransactionType.java b/src/net/authorize/notification/TransactionType.java
deleted file mode 100644
index a1479cb..0000000
--- a/src/net/authorize/notification/TransactionType.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package net.authorize.notification;
-
-
-public enum TransactionType {
-
- CUSTOMER_TRANSACTION_RECEIPT_EMAIL("sendCustomerTransactionReceiptRequest");
-
- final private String value;
-
- private TransactionType(String value) {
- this.value = value;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
-}
diff --git a/src/net/authorize/reporting/Result.java b/src/net/authorize/reporting/Result.java
deleted file mode 100644
index d07ca2c..0000000
--- a/src/net/authorize/reporting/Result.java
+++ /dev/null
@@ -1,367 +0,0 @@
-package net.authorize.reporting;
-
-import java.util.ArrayList;
-
-import net.authorize.AuthNetField;
-import net.authorize.ITransaction;
-import net.authorize.ResponseCode;
-import net.authorize.ResponseReasonCode;
-import net.authorize.data.Address;
-import net.authorize.data.Customer;
-import net.authorize.data.CustomerType;
-import net.authorize.data.Order;
-import net.authorize.data.OrderItem;
-import net.authorize.data.Payment;
-import net.authorize.data.ShippingCharges;
-import net.authorize.data.creditcard.AVSCode;
-import net.authorize.data.creditcard.CardType;
-import net.authorize.data.creditcard.CreditCard;
-import net.authorize.data.echeck.BankAccount;
-import net.authorize.data.echeck.ECheckType;
-import net.authorize.data.reporting.BatchDetails;
-import net.authorize.data.reporting.BatchStatistics;
-import net.authorize.data.reporting.CAVVResponseType;
-import net.authorize.data.reporting.CardCodeResponseType;
-import net.authorize.data.reporting.FDSFilter;
-import net.authorize.data.reporting.FDSFilterActionType;
-import net.authorize.data.reporting.ReportingDetails;
-import net.authorize.data.reporting.ReportingTransactionType;
-import net.authorize.data.reporting.SettlementStateType;
-import net.authorize.data.reporting.TransactionDetails;
-import net.authorize.data.reporting.TransactionStatusType;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * Reporting specific templated wrapper container for passing back the result from the request gateway.
- *
- */
-public class Result extends net.authorize.xml.Result {
-
- private static final long serialVersionUID = 2L;
-
- protected ReportingDetails reportingDetails;
-
- protected Result() { }
-
- protected Result(ITransaction requestTransaction, String response) {
- super(requestTransaction, response);
- }
-
- public static Result createResult(ITransaction requestTransaction, String response) {
- Result result = new Result(requestTransaction, response);
-
- switch ((TransactionType)requestTransaction.getTransactionType()) {
- case GET_SETTLED_BATCH_LIST :
- result.importBatchSettledInformation();
- break;
- case GET_TRANSACTION_LIST :
- result.importTransactionList();
- break;
- case GET_TRANSACTION_DETAILS :
- result.importTransactionDetails();
- break;
- case GET_BATCH_STATISTICS :
- result.importBatchSettledInformation();
- break;
- case GET_UNSETTLED_TRANSACTION_LIST :
- result.importTransactionList();
- break;
- default:
- break;
- }
-
- return result;
- }
-
- /**
- * Import batch settled reporting information.
- */
- private void importBatchSettledInformation() {
- this.reportingDetails = ((Transaction)requestTransaction).getReportingDetails();
- NodeList batchlist_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_BATCH.getFieldName());
-
- if(this.reportingDetails == null || batchlist_list.getLength() == 0) {
- return;
- } else {
- for(int i = 0; i < batchlist_list.getLength(); i++) {
- Element batch_el = (Element)batchlist_list.item(i);
- BatchDetails batchDetail = BatchDetails.createBatchDetail();
- batchDetail.setBatchId(getElementText(batch_el, AuthNetField.ELEMENT_BATCH_ID.getFieldName()));
- batchDetail.setSettlementTimeLocal(getElementText(batch_el, AuthNetField.ELEMENT_SETTLEMENT_TIME_LOCAL.getFieldName()));
- batchDetail.setSettlementTimeUTC(getElementText(batch_el, AuthNetField.ELEMENT_SETTLEMENT_TIME_UTC.getFieldName()));
- batchDetail.setSettlementState(SettlementStateType.fromValue(getElementText(batch_el, AuthNetField.ELEMENT_SETTLEMENT_STATE.getFieldName())));
- batchDetail.setPaymentMethod(getElementText(batch_el, AuthNetField.ELEMENT_PAYMENT_METHOD.getFieldName()));
- // include statistics
- NodeList statistics_list = batch_el.getElementsByTagName(AuthNetField.ELEMENT_STATISTIC.getFieldName());
- for(int j = 0; j < statistics_list.getLength(); j++) {
- BatchStatistics batchStats = BatchStatistics.createBatchStatistics();
- Element statistic_el = (Element)statistics_list.item(j);
- batchStats.setAccountType(
- CardType.findByValue(getElementText(statistic_el, AuthNetField.ELEMENT_ACCOUNT_TYPE.getFieldName())));
- batchStats.setChargeAmount(getElementText(statistic_el, AuthNetField.ELEMENT_CHARGE_AMOUNT.getFieldName()));
- batchStats.setChargeCount(getElementText(statistic_el, AuthNetField.ELEMENT_CHARGE_COUNT.getFieldName()));
- batchStats.setRefundAmount(getElementText(statistic_el, AuthNetField.ELEMENT_REFUND_AMOUNT.getFieldName()));
- batchStats.setRefundCount(getElementText(statistic_el, AuthNetField.ELEMENT_REFUND_COUNT.getFieldName()));
- batchStats.setVoidCount(getElementText(statistic_el, AuthNetField.ELEMENT_VOID_COUNT.getFieldName()));
- batchStats.setDeclineCount(getElementText(statistic_el, AuthNetField.ELEMENT_DECLINE_COUNT.getFieldName()));
- batchStats.setErrorCount(getElementText(statistic_el, AuthNetField.ELEMENT_ERROR_COUNT.getFieldName()));
-
- batchStats.setReturnedItemAmount(getElementText(statistic_el, AuthNetField.ELEMENT_RETURNED_ITEM_AMOUNT.getFieldName()));
- batchStats.setReturnedItemCount(getElementText(statistic_el, AuthNetField.ELEMENT_RETURNED_ITEM_COUNT.getFieldName()));
-
- batchStats.setChargebackAmount(getElementText(statistic_el, AuthNetField.ELEMENT_CHARGEBACK_AMOUNT.getFieldName()));
- batchStats.setChargebackCount(getElementText(statistic_el, AuthNetField.ELEMENT_CHARGEBACK_COUNT.getFieldName()));
-
- batchStats.setCorrectionNoticeCount(getElementText(statistic_el, AuthNetField.ELEMENT_CORRECTION_NOTICE_COUNT.getFieldName()));
-
- batchStats.setChargeChargebackAmount(getElementText(statistic_el, AuthNetField.ELEMENT_CHARGE_CHARGEBACK_AMOUNT.getFieldName()));
- batchStats.setChargeChargebackCount(getElementText(statistic_el, AuthNetField.ELEMENT_CHARGE_CHARGEBACK_COUNT.getFieldName()));
-
- batchStats.setRefundChargebackAmount(getElementText(statistic_el, AuthNetField.ELEMENT_REFUND_CHARGEBACK_AMOUNT.getFieldName()));
- batchStats.setRefundChargebackCount(getElementText(statistic_el, AuthNetField.ELEMENT_REFUND_CHARGEBACK_COUNT.getFieldName()));
-
- batchStats.setChargeReturnedItemsAmount(getElementText(statistic_el, AuthNetField.ELEMENT_CHARGE_RETURNED_ITEMS_AMOUNT.getFieldName()));
- batchStats.setChargeReturnedItemsCount(getElementText(statistic_el, AuthNetField.ELEMENT_CHARGE_RETURNED_ITEMS_COUNT.getFieldName()));
-
- batchStats.setRefundReturnedItemsAmount(getElementText(statistic_el, AuthNetField.ELEMENT_REFUND_RETURNED_ITEMS_AMOUNT.getFieldName()));
- batchStats.setRefundReturnedItemsCount(getElementText(statistic_el, AuthNetField.ELEMENT_REFUND_RETURNED_ITEMS_COUNT.getFieldName()));
-
- batchDetail.addBatchStatistics(batchStats);
- }
- this.reportingDetails.getBatchDetailsList().add(batchDetail);
- }
- }
- }
-
- /**
- * Import reporting transaction information.
- */
- private void importTransactionList() {
- this.reportingDetails = ((Transaction)requestTransaction).getReportingDetails();
- NodeList transactions_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_TRANSACTION.getFieldName());
-
- if(transactions_list.getLength() == 0) {
- return;
- } else {
- ArrayList transactionDetailList = new ArrayList();
- for(int i = 0; i < transactions_list.getLength(); i++) {
- Element transaction_el = (Element)transactions_list.item(i);
- TransactionDetails transactionDetails = TransactionDetails.createTransactionDetails();
- transactionDetails.setTransId(getElementText(transaction_el, AuthNetField.ELEMENT_TRANS_ID.getFieldName()));
- transactionDetails.setSubmitTimeLocal(getElementText(transaction_el, AuthNetField.ELEMENT_SUBMIT_TIME_LOCAL.getFieldName()));
- transactionDetails.setSubmitTimeUTC(getElementText(transaction_el, AuthNetField.ELEMENT_SUBMIT_TIME_UTC.getFieldName()));
- transactionDetails.setTransactionStatus(TransactionStatusType.fromValue(getElementText(transaction_el, AuthNetField.ELEMENT_TRANSACTION_STATUS.getFieldName())));
- transactionDetails.setInvoiceNumber(getElementText(transaction_el, AuthNetField.ELEMENT_INVOICE_NUMBER.getFieldName()));
- transactionDetails.setFirstName(getElementText(transaction_el, AuthNetField.ELEMENT_FIRST_NAME.getFieldName()));
- transactionDetails.setLastName(getElementText(transaction_el, AuthNetField.ELEMENT_LAST_NAME.getFieldName()));
- transactionDetails.setAccountType(CardType.findByValue(getElementText(transaction_el, AuthNetField.ELEMENT_ACCOUNT_TYPE.getFieldName())));
- transactionDetails.setAccountNumber(getElementText(transaction_el, AuthNetField.ELEMENT_ACCOUNT_NUMBER.getFieldName()));
- transactionDetails.setSettleAmount(getElementText(transaction_el, AuthNetField.ELEMENT_SETTLE_AMOUNT.getFieldName()));
- transactionDetailList.add(transactionDetails);
- }
- this.reportingDetails.setTransactionDetailList(transactionDetailList);
- }
- }
-
- /**
- * Import reporting transaction details.
- */
- private void importTransactionDetails() {
- this.reportingDetails = ((Transaction)requestTransaction).getReportingDetails();
- NodeList transactions_list = getXmlResponseDoc().getDocument().getElementsByTagName(AuthNetField.ELEMENT_TRANSACTION.getFieldName());
- if(transactions_list.getLength() == 0) {
- return;
- }
-
- Element transaction_el =(Element)transactions_list.item(0);
- TransactionDetails transactionDetails = TransactionDetails.createTransactionDetails();
- transactionDetails.setTransId(getElementText(transaction_el, AuthNetField.ELEMENT_TRANS_ID.getFieldName()));
- transactionDetails.setRefTransId(getElementText(transaction_el, AuthNetField.ELEMENT_REF_TRANS_ID.getFieldName()));
- transactionDetails.setSplitTenderId(getElementText(transaction_el, AuthNetField.ELEMENT_SPLIT_TENDER_ID.getFieldName()));
- transactionDetails.setSubmitTimeLocal(getElementText(transaction_el, AuthNetField.ELEMENT_SUBMIT_TIME_LOCAL.getFieldName()));
- transactionDetails.setSubmitTimeUTC(getElementText(transaction_el, AuthNetField.ELEMENT_SUBMIT_TIME_UTC.getFieldName()));
- transactionDetails.setTransactionType(ReportingTransactionType.fromValue(getElementText(transaction_el, AuthNetField.ELEMENT_TRANSACTION_TYPE.getFieldName())));
- transactionDetails.setTransactionStatus(TransactionStatusType.fromValue(getElementText(transaction_el, AuthNetField.ELEMENT_TRANSACTION_STATUS.getFieldName())));
- transactionDetails.setResponseCode(ResponseCode.findByResponseCode(getElementText(transaction_el, AuthNetField.ELEMENT_RESPONSE_CODE.getFieldName())));
-
- // auth codes/responses
- ResponseReasonCode responseReasonCode = ResponseReasonCode.findByReasonCode(getElementText(transaction_el, AuthNetField.ELEMENT_RESPONSE_REASON_CODE.getFieldName()));
- responseReasonCode.setReasonText(getElementText(transaction_el, AuthNetField.ELEMENT_RESPONSE_REASON_DESCRIPTION.getFieldName()));
- transactionDetails.setResponseReasonCode(responseReasonCode);
- transactionDetails.setAuthCode(getElementText(transaction_el, AuthNetField.ELEMENT_AUTH_CODE.getFieldName()));
- transactionDetails.setAvsResponse(AVSCode.findByValue(getElementText(transaction_el, AuthNetField.ELEMENT__AVS_RESPONSE.getFieldName())));
- transactionDetails.setCardCodeResponse(CardCodeResponseType.findByValue(getElementText(transaction_el, AuthNetField.ELEMENT_CARD_CODE_RESPONSE.getFieldName())));
- transactionDetails.setCAVVResponse(CAVVResponseType.findByValue(getElementText(transaction_el, AuthNetField.ELEMENT__CAVV_RESPONSE.getFieldName())));
- transactionDetails.setFDSFilterAction(FDSFilterActionType.findByValue(getElementText(transaction_el, AuthNetField.ELEMENT__FDS_FILTER_ACTION.getFieldName())));
-
- //FDSFilters
- NodeList FDSFilters_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT__FDS_FILTER.getFieldName());
- for(int i = 0; i < FDSFilters_list.getLength(); i++){
- Element FDSFilter_el = (Element)FDSFilters_list.item(i);
- FDSFilter fdsFilter = FDSFilter.createFDSFilter();
- fdsFilter.setName(getElementText(FDSFilter_el,AuthNetField.ELEMENT_NAME.getFieldName()));
- fdsFilter.setAction(FDSFilterActionType.findByValue(getElementText(FDSFilter_el,AuthNetField.ELEMENT_ACTION.getFieldName())));
- transactionDetails.getFDSFilterList().add(fdsFilter);
- }
-
- // batch
- NodeList batch_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT_BATCH.getFieldName());
- if(batch_list!=null && batch_list.getLength() == 1) {
- Element batch_el = (Element)batch_list.item(0);
- BatchDetails batchDetail = BatchDetails.createBatchDetail();
- batchDetail.setBatchId(getElementText(batch_el, AuthNetField.ELEMENT_BATCH_ID.getFieldName()));
- batchDetail.setSettlementTimeLocal(getElementText(batch_el, AuthNetField.ELEMENT_SETTLEMENT_TIME_LOCAL.getFieldName()));
- batchDetail.setSettlementTimeUTC(getElementText(batch_el, AuthNetField.ELEMENT_SETTLEMENT_TIME_UTC.getFieldName()));
- batchDetail.setSettlementState(SettlementStateType.fromValue(getElementText(batch_el, AuthNetField.ELEMENT_SETTLEMENT_STATE.getFieldName())));
- transactionDetails.setBatch(batchDetail);
- }
-
- // order
- Order order = Order.createOrder();
- NodeList order_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT_ORDER.getFieldName());
- if(order_list != null && order_list.getLength() == 1) {
- Element order_el = (Element)order_list.item(0);
- order.setInvoiceNumber(getElementText(order_el, AuthNetField.ELEMENT_INVOICE_NUMBER.getFieldName()));
- transactionDetails.setInvoiceNumber(order.getInvoiceNumber());
- order.setDescription(getElementText(order_el, AuthNetField.ELEMENT_DESCRIPTION.getFieldName()));
- order.setPurchaseOrderNumber(getElementText(order_el, AuthNetField.ELEMENT_PURCHASE_ORDER_NUMBER.getFieldName()));
- }
- transactionDetails.setRequestedAmount(getElementText(transaction_el, AuthNetField.ELEMENT_REQUESTED_AMOUNT.getFieldName()));
- transactionDetails.setAuthAmount(getElementText(transaction_el, AuthNetField.ELEMENT_AUTH_AMOUNT.getFieldName()));
- order.setTotalAmount(transactionDetails.getAuthAmount());
- transactionDetails.setSettleAmount(getElementText(transaction_el, AuthNetField.ELEMENT_SETTLE_AMOUNT.getFieldName()));
-
- // tax, shipping, duty charges are rolled into AIM's ShippingCharges
- ShippingCharges shippingCharges = ShippingCharges.createShippingCharges();
- NodeList tax_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT_TAX.getFieldName());
- if(tax_list != null && tax_list.getLength() == 1) {
- Element tax_el = (Element)tax_list.item(0);
- shippingCharges.setTaxAmount(getElementText(tax_el, AuthNetField.ELEMENT_AMOUNT.getFieldName()));
- shippingCharges.setTaxItemName(getElementText(tax_el, AuthNetField.ELEMENT_NAME.getFieldName()));
- shippingCharges.setTaxDescription(getElementText(tax_el, AuthNetField.ELEMENT_DESCRIPTION.getFieldName()));
- }
- NodeList shipping_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT_SHIPPING.getFieldName());
- if(shipping_list != null && shipping_list.getLength() == 1) {
- Element shipping_el = (Element)shipping_list.item(0);
- shippingCharges.setFreightAmount(getElementText(shipping_el, AuthNetField.ELEMENT_AMOUNT.getFieldName()));
- shippingCharges.setFreightItemName(getElementText(shipping_el, AuthNetField.ELEMENT_NAME.getFieldName()));
- shippingCharges.setFreightDescription(getElementText(shipping_el, AuthNetField.ELEMENT_DESCRIPTION.getFieldName()));
- }
- NodeList duty_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT_DUTY.getFieldName());
- if(duty_list != null && duty_list.getLength() == 1) {
- Element duty_el = (Element)duty_list.item(0);
- shippingCharges.setDutyAmount(getElementText(duty_el, AuthNetField.ELEMENT_AMOUNT.getFieldName()));
- shippingCharges.setDutyItemName(getElementText(duty_el, AuthNetField.ELEMENT_NAME.getFieldName()));
- shippingCharges.setDutyItemDescription(getElementText(duty_el, AuthNetField.ELEMENT_DESCRIPTION.getFieldName()));
- }
- order.setShippingCharges(shippingCharges);
-
- // line items
- ArrayList orderItemList = new ArrayList();
- NodeList orderitem_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT_LINE_ITEM.getFieldName());
- for(int i = 0; i < orderitem_list.getLength(); i++){
- Element orderitem_el = (Element)orderitem_list.item(i);
- OrderItem orderItem = OrderItem.createOrderItem();
- orderItem.setItemId(getElementText(orderitem_el, AuthNetField.ELEMENT_ITEM_ID.getFieldName()));
- orderItem.setItemName(getElementText(orderitem_el, AuthNetField.ELEMENT_NAME.getFieldName()));
- orderItem.setItemDescription(getElementText(orderitem_el, AuthNetField.ELEMENT_DESCRIPTION.getFieldName()));
- orderItem.setItemQuantity(getElementText(orderitem_el, AuthNetField.ELEMENT_QUANTITY.getFieldName()));
- orderItem.setItemPrice(getElementText(orderitem_el, AuthNetField.ELEMENT_UNIT_PRICE.getFieldName()));
- orderItem.setItemTaxable(getElementText(orderitem_el, AuthNetField.ELEMENT_TAXABLE.getFieldName()));
- orderItemList.add(orderItem);
- }
- order.setOrderItems(orderItemList);
- transactionDetails.setOrder(order);
- transactionDetails.setPrepaidBalanceRemaining(getElementText(transaction_el, AuthNetField.ELEMENT_PREPAID_BALANCE_REMAINING.getFieldName()));
- transactionDetails.setItemTaxExempt(getElementText(transaction_el, AuthNetField.ELEMENT_TAX_EXEMPT.getFieldName()));
-
- // payment
- NodeList payment_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT_PAYMENT.getFieldName());
- Payment payment = null;
- if(payment_list != null && payment_list.getLength() == 1) {
- Element payment_el = (Element)payment_list.item(0);
- NodeList credit_card_list = payment_el.getElementsByTagName(AuthNetField.ELEMENT_CREDIT_CARD.getFieldName());
- if(credit_card_list != null && credit_card_list.getLength() == 1) {
- CreditCard creditCard = CreditCard.createCreditCard();
- Element credit_card_el = (Element)credit_card_list.item(0);
- creditCard.setMaskedCreditCardNumber(getElementText(credit_card_el, AuthNetField.ELEMENT_CARD_NUMBER.getFieldName()));
- creditCard.setExpirationDate(getElementText(credit_card_el, AuthNetField.ELEMENT_EXPIRATION_DATE.getFieldName()));
- creditCard.setCardType(CardType.findByValue(getElementText(credit_card_el, AuthNetField.ELEMENT_ACCOUNT_TYPE.getFieldName())));
- payment = Payment.createPayment(creditCard);
- }
- NodeList bank_account_list = payment_el.getElementsByTagName(AuthNetField.ELEMENT_BANK_ACCOUNT.getFieldName());
- if(bank_account_list != null && bank_account_list.getLength() == 1) {
- BankAccount bankAccount = BankAccount.createBankAccount();
- Element bank_account_el = (Element)bank_account_list.item(0);
- bankAccount.setRoutingNumber(getElementText(bank_account_el, AuthNetField.ELEMENT_ROUTING_NUMBER.getFieldName()));
- bankAccount.setBankAccountNumber(getElementText(bank_account_el, AuthNetField.ELEMENT_ACCOUNT_NUMBER.getFieldName()));
- bankAccount.setBankAccountName(getElementText(bank_account_el, AuthNetField.ELEMENT_NAME_ON_ACCOUNT.getFieldName()));
- bankAccount.setECheckType(ECheckType.findByValue(getElementText(bank_account_el, AuthNetField.ELEMENT_ECHECK_TYPE.getFieldName())));
- payment = Payment.createPayment(bankAccount);
- }
- transactionDetails.setPayment(payment);
- }
-
- // customer
- NodeList customer_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT_CUSTOMER.getFieldName());
- Customer customer = null;
- if(customer_list != null && customer_list.getLength() == 1) {
- Element customer_el = (Element)customer_list.item(0);
- customer = Customer.createCustomer(
- CustomerType.findByName(
- getElementText(customer_el, AuthNetField.ELEMENT_TYPE.getFieldName())));
- customer.setId(getElementText(customer_el, AuthNetField.ELEMENT_ID.getFieldName()));
- customer.setEmail(getElementText(customer_el, AuthNetField.ELEMENT_EMAIL.getFieldName()));
- // bill to address
- Address billToAddress = null;
- NodeList bill_to_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT_BILL_TO.getFieldName());
- if(bill_to_list != null && bill_to_list.getLength() == 1) {
- Element address_el = (Element)bill_to_list.item(0);
- billToAddress = Address.createAddress();
- billToAddress.setFirstName(getElementText(address_el, AuthNetField.ELEMENT_FIRST_NAME.getFieldName()));
- billToAddress.setLastName(getElementText(address_el, AuthNetField.ELEMENT_LAST_NAME.getFieldName()));
- billToAddress.setCompany(getElementText(address_el, AuthNetField.ELEMENT_COMPANY.getFieldName()));
- billToAddress.setAddress(getElementText(address_el, AuthNetField.ELEMENT_ADDRESS.getFieldName()));
- billToAddress.setCity(getElementText(address_el, AuthNetField.ELEMENT_CITY.getFieldName()));
- billToAddress.setState(getElementText(address_el, AuthNetField.ELEMENT_STATE.getFieldName()));
- billToAddress.setZipPostalCode(getElementText(address_el, AuthNetField.ELEMENT_ZIP.getFieldName()));
- billToAddress.setCountry(getElementText(address_el, AuthNetField.ELEMENT_COUNTRY.getFieldName()));
- billToAddress.setPhoneNumber(getElementText(address_el, AuthNetField.ELEMENT_PHONE_NUMBER.getFieldName()));
- billToAddress.setFaxNumber(getElementText(address_el, AuthNetField.ELEMENT_FAX_NUMBER.getFieldName()));
- customer.setBillTo(billToAddress);
- }
- // ship to address
- Address shipToAddress = null;
- NodeList ship_to_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT_SHIP_TO.getFieldName());
- if(ship_to_list != null && ship_to_list.getLength() == 1) {
- Element address_el = (Element)ship_to_list.item(0);
- shipToAddress = Address.createAddress();
- shipToAddress.setFirstName(getElementText(address_el, AuthNetField.ELEMENT_FIRST_NAME.getFieldName()));
- shipToAddress.setLastName(getElementText(address_el, AuthNetField.ELEMENT_LAST_NAME.getFieldName()));
- shipToAddress.setCompany(getElementText(address_el, AuthNetField.ELEMENT_COMPANY.getFieldName()));
- shipToAddress.setAddress(getElementText(address_el, AuthNetField.ELEMENT_ADDRESS.getFieldName()));
- shipToAddress.setCity(getElementText(address_el, AuthNetField.ELEMENT_CITY.getFieldName()));
- shipToAddress.setState(getElementText(address_el, AuthNetField.ELEMENT_STATE.getFieldName()));
- shipToAddress.setZipPostalCode(getElementText(address_el, AuthNetField.ELEMENT_ZIP.getFieldName()));
- shipToAddress.setCountry(getElementText(address_el, AuthNetField.ELEMENT_COUNTRY.getFieldName()));
- customer.setShipTo(shipToAddress);
- }
- transactionDetails.setCustomer(customer);
- }
- // recurring billing
- transactionDetails.setRecurringBilling(getElementText(transaction_el, AuthNetField.ELEMENT_RECURRING_BILLING.getFieldName()));
- // customer ip
- transactionDetails.setCustomerIP(getElementText(transaction_el, AuthNetField.ELEMENT_CUSTOMER_IP.getFieldName()));
- this.getReportingDetails().getTransactionDetailList().add(transactionDetails);
- }
-
- /**
- * @return the reportingDetails
- */
- public ReportingDetails getReportingDetails() {
- return reportingDetails;
- }
-
-}
diff --git a/src/net/authorize/reporting/Transaction.java b/src/net/authorize/reporting/Transaction.java
deleted file mode 100644
index 3f4e2c2..0000000
--- a/src/net/authorize/reporting/Transaction.java
+++ /dev/null
@@ -1,221 +0,0 @@
-package net.authorize.reporting;
-
-import net.authorize.AuthNetField;
-import net.authorize.Merchant;
-import net.authorize.data.reporting.ReportingDetails;
-import net.authorize.util.BasicXmlDocument;
-import net.authorize.util.StringUtils;
-
-import org.w3c.dom.Element;
-
-/**
- * Transaction object for Reporting.
- *
- */
-public class Transaction extends net.authorize.xml.XMLTransaction {
-
- private static final long serialVersionUID = 2L;
-
- private TransactionType transactionType;
- private ReportingDetails reportingDetails;
-
- /**
- * Private constructor.
- *
- * @param merchant
- * @param transactionType
- */
- private Transaction(Merchant merchant, TransactionType transactionType) {
- this.merchant = merchant;
- this.transactionType = transactionType;
- }
-
- /**
- * Creates a transaction.
- *
- * @param merchant
- * @param transactionType
- *
- * @return Transaction
- */
- public static Transaction createTransaction(Merchant merchant, TransactionType transactionType) {
- return new Transaction(merchant, transactionType);
- }
-
- /**
- * @return the transactionType
- */
- public TransactionType getTransactionType() {
- return transactionType;
- }
-
- /**
- * Add reporting batch list options.
- *
- * @param document
- */
- private void addReportingBatchListOptions(BasicXmlDocument document) {
- if(this.reportingDetails != null) {
- Element include_statistics_el = document.createElement(AuthNetField.ELEMENT_INCLUDE_STATISTICS.getFieldName());
- include_statistics_el.appendChild(document.getDocument().createTextNode(
- this.reportingDetails.isBatchIncludeStatistics()?TRUE.toLowerCase():FALSE.toLowerCase()));
- document.getDocumentElement().appendChild(include_statistics_el);
-
- if(this.reportingDetails.getBatchFirstSettlementDate() != null) {
- Element first_settlement_date_el = document.createElement(AuthNetField.ELEMENT_FIRST_SETTLEMENT_DATE.getFieldName());
- first_settlement_date_el.appendChild(document.getDocument().createTextNode(
- net.authorize.util.DateUtil.getFormattedDate(this.reportingDetails.getBatchFirstSettlementDate(),
- ReportingDetails.DATE_FORMAT)));
- document.getDocumentElement().appendChild(first_settlement_date_el);
- }
-
- if(this.reportingDetails.getBatchLastSettlementDate() != null) {
- Element last_settlement_date_el = document.createElement(AuthNetField.ELEMENT_LAST_SETTLEMENT_DATE.getFieldName());
- last_settlement_date_el.appendChild(document.getDocument().createTextNode(
- net.authorize.util.DateUtil.getFormattedDate(this.reportingDetails.getBatchLastSettlementDate(),
- ReportingDetails.DATE_FORMAT)));
- document.getDocumentElement().appendChild(last_settlement_date_el);
- }
- }
- }
-
- /**
- * Add a reporting transId to the document request.
- *
- * @param document
- */
- private void addReportingTransactionId(BasicXmlDocument document) {
- if(this.reportingDetails != null && StringUtils.isNotEmpty(this.reportingDetails.getTransactionId())) {
- Element transid_el = document.createElement(AuthNetField.ELEMENT_TRANS_ID.getFieldName());
- transid_el.appendChild(document.getDocument().createTextNode(
- this.reportingDetails.getTransactionId()));
- document.getDocumentElement().appendChild(transid_el);
- }
- }
-
- /**
- * Add a reporting transId to the document request.
- *
- * @param document
- */
- private void addReportingBatchId(BasicXmlDocument document) {
- if(this.reportingDetails != null && StringUtils.isNotEmpty(this.reportingDetails.getBatchId())) {
- Element batchid_el = document.createElement(AuthNetField.ELEMENT_BATCH_ID.getFieldName());
- batchid_el.appendChild(document.getDocument().createTextNode(
- this.reportingDetails.getBatchId()));
- document.getDocumentElement().appendChild(batchid_el);
- }
- }
-
- /**
- * Returns Batch ID, Settlement Time, & Settlement State for all settled
- * batches with an optional range of dates.
- */
- private void getSettledBatchListRequest() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.GET_SETTLED_BATCH_LIST.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addReportingBatchListOptions(document);
-
- currentRequest = document;
- }
-
- /**
- * Return data for all transactions in a specified batch
- */
- private void getTransactionListRequest() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.GET_TRANSACTION_LIST.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addReportingBatchId(document);
-
- currentRequest = document;
- }
-
- /**
- * Get detailed information about one specific transaction.
- */
- private void getTransactionDetailsRequest() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.GET_TRANSACTION_DETAILS.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addReportingTransactionId(document);
-
- currentRequest = document;
- }
-
- /**
- * Return batch statistical data for all transactions in a specified batch
- */
- private void getBatchStatisticsRequest() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.GET_BATCH_STATISTICS.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
- addReportingBatchId(document);
-
- currentRequest = document;
- }
-
- /**
- * Return the most recent 1000 unsettled transactions.
- */
- private void getUnsettledTransactionListRequest() {
- BasicXmlDocument document = new BasicXmlDocument();
- document.parseString("<" + TransactionType.GET_UNSETTLED_TRANSACTION_LIST.getValue()
- + " xmlns = \"" + XML_NAMESPACE + "\" />");
-
- addAuthentication(document);
-
- currentRequest = document;
- }
-
- /**
- * @param reportingDetails the reportingDetails to set
- */
- public void setReportingDetails(ReportingDetails reportingDetails) {
- this.reportingDetails = reportingDetails;
- }
-
- /**
- * @return the reportingDetails
- */
- public ReportingDetails getReportingDetails() {
- return reportingDetails;
- }
-
- /**
- * Convert request to XML.
- */
- public String toAuthNetPOSTString() {
- switch (this.transactionType) {
- case GET_SETTLED_BATCH_LIST :
- getSettledBatchListRequest();
- break;
- case GET_TRANSACTION_DETAILS :
- getTransactionDetailsRequest();
- break;
- case GET_TRANSACTION_LIST :
- getTransactionListRequest();
- break;
- case GET_BATCH_STATISTICS :
- getBatchStatisticsRequest();
- break;
- case GET_UNSETTLED_TRANSACTION_LIST :
- getUnsettledTransactionListRequest();
- break;
- default:
- break;
- }
-
- return currentRequest.dump();
- }
-
-}
diff --git a/src/net/authorize/reporting/TransactionType.java b/src/net/authorize/reporting/TransactionType.java
deleted file mode 100644
index b101ac4..0000000
--- a/src/net/authorize/reporting/TransactionType.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package net.authorize.reporting;
-
-
-/**
- * Enumeration of Reporting transaction types that are supported by Authorize.Net
- */
-public enum TransactionType {
-
- GET_SETTLED_BATCH_LIST("getSettledBatchListRequest"),
- GET_TRANSACTION_LIST("getTransactionListRequest"),
- GET_TRANSACTION_DETAILS("getTransactionDetailsRequest"),
- GET_BATCH_STATISTICS("getBatchStatisticsRequest"),
- GET_UNSETTLED_TRANSACTION_LIST("getUnsettledTransactionListRequest");
-
- final private String value;
-
- private TransactionType(String value) {
- this.value = value;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
-}
diff --git a/src/net/authorize/sim/Fingerprint.java b/src/net/authorize/sim/Fingerprint.java
deleted file mode 100644
index 1cac1ae..0000000
--- a/src/net/authorize/sim/Fingerprint.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package net.authorize.sim;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.util.Random;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.crypto.Mac;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.SecretKeySpec;
-
-import net.authorize.Merchant;
-
-public class Fingerprint implements Serializable {
-
- private static final long serialVersionUID = 2L;
-
- private static Logger logger = java.util.logging.Logger.getLogger(Fingerprint.class.getName());
-
- private long sequence;
- private long timeStamp;
- private String fingerprintHash;
-
- private Fingerprint() {
- }
-
- /**
- * Creates a fingerprint with raw data fields.
- *
- * @param loginID
- * @param transactionKey
- * @param sequence : this number will be concatenated with a random value
- * @param amount
- * @return A Fingerprint object.
- */
- public static Fingerprint createFingerprint(String loginID,
- String transactionKey, long sequence, String amount) {
-
- Fingerprint fingerprint = new Fingerprint();
-
- // a sequence number is randomly generated
- Random generator = new Random();
- fingerprint.sequence = Long.parseLong(sequence+""+generator.nextInt(1000));
- // a timestamp is generated
- fingerprint.timeStamp = System.currentTimeMillis() / 1000;
-
- // This section uses Java Cryptography functions to generate a
- // fingerprint
- try {
- // First, the Transaction key is converted to a "SecretKey" object
- SecretKey key = new SecretKeySpec(transactionKey.getBytes(),
- "HmacMD5");
- // A MAC object is created to generate the hash using the HmacMD5
- // algorithm
- Mac mac = Mac.getInstance("HmacMD5");
- mac.init(key);
- String inputstring = loginID + "^" + fingerprint.sequence + "^" +
- fingerprint.timeStamp + "^" + amount + "^";
- byte[] result = mac.doFinal(inputstring.getBytes());
- // Convert the result from byte[] to hexadecimal format
- StringBuffer strbuf = new StringBuffer(result.length * 2);
- for (int i = 0; i < result.length; i++) {
- if (((int) result[i] & 0xff) < 0x10) {
- strbuf.append("0");
- }
- strbuf.append(Long.toString((int) result[i] & 0xff, 16));
- }
- fingerprint.fingerprintHash = strbuf.toString();
- } catch (NoSuchAlgorithmException nsae) {
- logger.log(Level.WARNING, "Fingerprint creation failed.", nsae);
-
- } catch (InvalidKeyException ike) {
- logger.log(Level.WARNING, "Fingerprint creation failed.", ike);
-
- }
-
- return fingerprint;
- }
-
- /**
- * Create a fingerprint with object based fields.
- *
- * @param merchant
- * @param sequence : this number will be concatenated with a random value
- * @param amount
- * @return A Fingerprint object.
- */
- public static Fingerprint createFingerprint(Merchant merchant, long sequence,
- BigDecimal amount) {
- Fingerprint fingerprint = new Fingerprint();
-
- if (merchant != null && amount != null) {
- fingerprint = Fingerprint.createFingerprint(merchant.getMerchantAuthentication().getName(),
- merchant.getMerchantAuthentication().getSecret(), sequence, amount.setScale(Transaction.CURRENCY_DECIMAL_PLACES,
- BigDecimal.ROUND_HALF_UP).toPlainString());
- }
-
- return fingerprint;
- }
-
- /**
- * Get the sequence that was used in creating the fingerprint.
- *
- * @return the sequence
- */
- public long getSequence() {
- return Math.abs(sequence);
- }
-
- /**
- * Get the timestamp that was used in creating the fingerprint.
- *
- * @return the timeStamp
- */
- public long getTimeStamp() {
- return timeStamp;
- }
-
- /**
- * Get the fingerprint hash.
- *
- * @return the fingerprintHash
- */
- public String getFingerprintHash() {
- return fingerprintHash;
- }
-
-
-}
diff --git a/src/net/authorize/sim/LinkMethod.java b/src/net/authorize/sim/LinkMethod.java
deleted file mode 100644
index 4df9e49..0000000
--- a/src/net/authorize/sim/LinkMethod.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package net.authorize.sim;
-
-
-/**
- * The type of link back to the merchant's website.
- *
- * LINK creates a regular hyperlink.
- * GET creates a button and returns transaction information in the receipt link URL.
- * POST creates a button and returns transaction information as an HTML Form POST.
- *
- */
-public enum LinkMethod {
- LINK,
- POST,
- GET
-}
diff --git a/src/net/authorize/sim/Result.java b/src/net/authorize/sim/Result.java
deleted file mode 100644
index ba75c25..0000000
--- a/src/net/authorize/sim/Result.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package net.authorize.sim;
-
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.authorize.ResponseCode;
-import net.authorize.ResponseField;
-import net.authorize.ResponseReasonCode;
-
-
-public class Result extends net.authorize.Result {
-
- private static final long serialVersionUID = 1L;
- private Map responseMap = new HashMap();
- private ResponseCode responseCode;
- private ResponseReasonCode reasonResponseCode;
- private String responseText;
- private String apiLoginId;
- private String merchantMD5Key;
-
- private Result() { }
-
- /**
- * Reformats the http response map into a usable SIM response map.
- *
- * @param responseMap
- */
- private void reformatResponseMap(Map responseMap) {
- for(String key : responseMap.keySet()) {
- ResponseField responseField = ResponseField.findByFieldName(key);
- String[] value = responseMap.get(key);
- if(responseField != null) {
- this.responseMap.put(responseField.getFieldName(), value.length>0?value[0]:"");
- } else {
- this.responseMap.put(key, value.length>0?value[0]:"");
- }
- }
- }
-
- public static Result createResult(Map responseMap) {
- Result result = new Result();
-
- String responseCodeStr = responseMap.get(ResponseField.RESPONSE_CODE);
- result.responseCode = responseCodeStr!=null && !"".equals(responseCodeStr)?
- ResponseCode.findByResponseCode(Integer.parseInt(responseCodeStr)):
- ResponseCode.UNKNOWN;
-
- String responseReasonCodeStr = responseMap.get(ResponseField.RESPONSE_REASON_CODE);
- result.reasonResponseCode = responseReasonCodeStr!=null && !"".equals(responseReasonCodeStr)?
- ResponseReasonCode.findByReasonCode(Integer.parseInt(responseReasonCodeStr)):
- ResponseReasonCode.RRC_0_0;
-
- result.responseText = responseMap.get(ResponseField.RESPONSE_REASON_TEXT);
-
- return result;
- }
- /**
- * Create a result for SIM based on the response map.
- *
- * @param apiLoginId merchant api login Id
- * @param merchantMD5Key MD5 key that is created in the Security Settings in the merchant interface.
- * @param responseMap
- *
- * @return the result
- */
- public static Result createResult(String apiLoginId, String merchantMD5Key, Map responseMap) {
- Result result = new Result();
-
- result.reformatResponseMap(responseMap);
-
- result.apiLoginId = apiLoginId;
- result.merchantMD5Key = merchantMD5Key;
-
- String responseCodeStr = result.responseMap.get(ResponseField.RESPONSE_CODE.getFieldName());
- String responseReasonCodeStr = result.responseMap.get(ResponseField.RESPONSE_REASON_CODE.getFieldName());
-
- // if this txn didn't come from authnet - bail!
- boolean isMD5Ok = result.isAuthorizeNet();
- if(!isMD5Ok) {
- responseCodeStr = null;
- responseReasonCodeStr = null;
- result.getResponseMap().put(ResponseField.RESPONSE_REASON_TEXT.getFieldName(), "Unable to verify MD5 value.");
- }
-
- result.responseCode = responseCodeStr!=null && !"".equals(responseCodeStr)?
- ResponseCode.findByResponseCode(Integer.parseInt(responseCodeStr)):
- ResponseCode.UNKNOWN;
- result.reasonResponseCode = responseReasonCodeStr!=null && !"".equals(responseReasonCodeStr)?
- ResponseReasonCode.findByReasonCode(Integer.parseInt(responseReasonCodeStr)):
- ResponseReasonCode.RRC_0_0;
- if(isMD5Ok && ResponseReasonCode.RRC_0_0.equals(result.reasonResponseCode)) {
- result.getResponseMap().put(ResponseField.RESPONSE_REASON_TEXT.getFieldName(), "");
- }
-
- return result;
- }
-
- /**
- * Verify that the relay response post is actually coming from
- * AuthorizeNet.
- *
- * @return boolean true if the txn came from Authorize.Net
- */
- public boolean isAuthorizeNet() {
-
- String amount = this.responseMap.get(ResponseField.AMOUNT.getFieldName()) != null ?
- this.responseMap.get(ResponseField.AMOUNT.getFieldName()) : "0.00";
-
- String x_MD5_Hash = this.responseMap.get(ResponseField.MD5_HASH.getFieldName());
- String md5Check = null;
-
- try {
- MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
- String s = merchantMD5Key + this.apiLoginId + this.responseMap.get(ResponseField.TRANSACTION_ID.getFieldName()) + amount;
- digest.update(s.getBytes());
- md5Check = new BigInteger(1,digest.digest()).toString(16).toUpperCase();
- while(md5Check.length() < 32) {
- md5Check = "0" + md5Check;
- }
- } catch (NoSuchAlgorithmException nsae) {
- //
- }
-
- return md5Check != null && md5Check.equalsIgnoreCase(x_MD5_Hash);
- }
-
- public boolean isApproved() {
- return ResponseCode.APPROVED.equals(this.responseCode);
- }
-
- public boolean isDeclined() {
- return ResponseCode.DECLINED.equals(this.responseCode);
- }
-
- public boolean isError() {
- return ResponseCode.ERROR.equals(this.responseCode);
- }
-
- public boolean isReview() {
- return ResponseCode.REVIEW.equals(this.responseCode);
- }
-
- public ResponseCode getResponseCode() {
- return this.responseCode;
- }
-
- public ResponseReasonCode getReasonResponseCode() {
- return this.reasonResponseCode;
- }
-
- public Map getResponseMap() {
- return this.responseMap;
- }
-
- /**
- * @return the responseText
- */
- public String getResponseText() {
- return responseText;
- }
-
-
-}
diff --git a/src/net/authorize/sim/Transaction.java b/src/net/authorize/sim/Transaction.java
deleted file mode 100644
index ccb88ab..0000000
--- a/src/net/authorize/sim/Transaction.java
+++ /dev/null
@@ -1,1098 +0,0 @@
-package net.authorize.sim;
-
-import java.io.UnsupportedEncodingException;
-import java.math.BigDecimal;
-import java.net.URLEncoder;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import net.authorize.AuthNetField;
-import net.authorize.Environment;
-import net.authorize.ITransaction;
-import net.authorize.Merchant;
-import net.authorize.ResponseField;
-import net.authorize.TransactionType;
-import net.authorize.data.Customer;
-import net.authorize.data.EmailReceipt;
-import net.authorize.data.Order;
-import net.authorize.data.OrderItem;
-import net.authorize.data.PaymentMethod;
-import net.authorize.data.ShippingAddress;
-import net.authorize.data.ShippingCharges;
-import net.authorize.data.creditcard.AVSCode;
-import net.authorize.data.creditcard.CardType;
-import net.authorize.data.creditcard.CreditCard;
-import net.authorize.data.echeck.ECheck;
-import net.authorize.data.echeck.ECheckType;
-import net.authorize.data.sim.HostedPaymentFormSettings;
-import net.authorize.data.sim.HostedReceiptPageSettings;
-import net.authorize.sim.button.Button;
-import net.authorize.sim.button.ImageButton;
-import net.authorize.sim.button.TextButton;
-import net.authorize.util.BasicXmlDocument;
-import net.authorize.util.HttpClient;
-import net.authorize.util.StringUtils;
-
-public class Transaction extends net.authorize.NVPTransaction implements ITransaction {
-
- private static final long serialVersionUID = 2L;
-
- private static Logger logger = java.util.logging.Logger.getLogger(Transaction.class.getName());
-
- public static String TRANSACTION_FIELD_DELIMITER = "|";
- public static String ENCAP_CHAR_DELIMITER = "";
- public static final String BRACKET_PIPE_DELIMITER = "<|>";
- public static final int MAX_RECEIPT_LINK_TEXT_LENGTH = 50;
- public static final String PAYMENT_FORM = "PAYMENT_FORM";
-
- protected Hashtable requestMap = new Hashtable();
- private Hashtable responseMap = new Hashtable();
- private BasicXmlDocument currentResponse = null;
- protected Hashtable merchantDefinedMap = new Hashtable();
-
- private LinkedHashMap formInputMap = new LinkedHashMap();
- private Map fieldsToRename = new HashMap();
- private Fingerprint fingerprint;
- private HostedPaymentFormSettings hostedPaymentFormSettings;
- private HostedReceiptPageSettings hostedReceiptPageSettings;
- private Environment environment;
-
- /**
- * Constructor for creation a transaction with typed objects.
- *
- * @param merchant
- * @param transactionType
- * @param amount
- */
- protected Transaction(Merchant merchant,
- TransactionType transactionType, BigDecimal amount) {
-
- this.requestMap.put(AuthNetField.X_VERSION_FIELD.getFieldName(), Transaction.VERSION);
- this.requestMap.put(AuthNetField.X_DELIM_CHAR_FIELD.getFieldName(), Transaction.TRANSACTION_FIELD_DELIMITER);
- this.requestMap.put(AuthNetField.X_DELIM_DATA_FIELD.getFieldName(), TRUE);
- this.requestMap.put(AuthNetField.X_ENCAP_CHAR.getFieldName(), Transaction.ENCAP_CHAR_DELIMITER);
-
- // setup test mode
- if(Environment.PRODUCTION.equals(merchant.getEnvironment()) ||
- Environment.SANDBOX.equals(merchant.getEnvironment()) ) {
- this.requestMap.put(AuthNetField.X_TEST_REQUEST.getFieldName(),FALSE);
- }
- // applies to SANDBOX_TEST & PRODUCTION_TEST
- else {
- this.requestMap.put(AuthNetField.X_TEST_REQUEST.getFieldName(),TRUE);
- }
-
- // setup the merchant
- if(merchant != null) {
- this.requestMap.put(AuthNetField.X_LOGIN.getFieldName(), merchant.getMerchantAuthentication().getName());
- this.requestMap.put(AuthNetField.X_ALLOW_PARTIAL_AUTH.getFieldName(), merchant.isAllowPartialAuth()?TRUE:FALSE);
- }
-
- // default transaction type
- if(transactionType == null) {
- transactionType = TransactionType.AUTH_CAPTURE;
- }
- this.transactionType = transactionType;
- this.requestMap.put(AuthNetField.X_TYPE.getFieldName(), transactionType.getNVPValue());
-
- this.requestMap.put(AuthNetField.X_AMOUNT.getFieldName(), amount != null?
- amount.setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString():
- ZERO_STRING);
-
- // SIM applications use relay response. Set this to false (default) if you are using AIM.
- this.requestMap.put(AuthNetField.X_RELAY_RESPONSE.getFieldName(), TRUE);
-
- this.requestMap.put(AuthNetField.X_DELIM_DATA.getFieldName(), FALSE);
-
- // setup customer/merchant email info
- this.requestMap.put(AuthNetField.X_EMAIL_CUSTOMER.getFieldName(), merchant.isEmailCustomer()?TRUE:FALSE);
- this.requestMap.put(AuthNetField.X_MERCHANT_EMAIL.getFieldName(), merchant.getMerchantEmail()!=null?merchant.getMerchantEmail():EMPTY_STRING);
- this.environment = merchant.getEnvironment();
- }
-
- /**
- * Create a transaction from a responseMap.
- *
- * @param transaction
- * @param responseMap
- * @return a Transaction
- */
- public static final Transaction createTransaction(Transaction transaction, Hashtable responseMap) {
- Transaction _transaction = transaction;
-
- _transaction.responseMap = responseMap;
-
- // populate the authorization code
- if(responseMap.containsKey(ResponseField.AUTHORIZATION_CODE)) {
- _transaction.setAuthorizationCode((String)responseMap.get(ResponseField.AUTHORIZATION_CODE));
- }
-
- // transaction ID
- if(responseMap.containsKey(ResponseField.TRANSACTION_ID)) {
- _transaction.setTransactionId((String)responseMap.get(ResponseField.TRANSACTION_ID));
- }
-
- CreditCard creditCard = _transaction.getCreditCard();
- if(creditCard != null) {
- // masked credit card
- if(responseMap.containsKey(ResponseField.ACCOUNT_NUMBER)) {
- creditCard.setMaskedCreditCardNumber((String)responseMap.get(ResponseField.ACCOUNT_NUMBER));
- }
- // credit card type
- if(responseMap.containsKey(ResponseField.CARD_TYPE)) {
- creditCard.setCardType(CardType.findByValue((String)responseMap.get(ResponseField.CARD_TYPE)));
- }
- // AVS response
- if(responseMap.containsKey(ResponseField.AVS_CODE)) {
- creditCard.setAvsCode(AVSCode.findByValue((String)responseMap.get(ResponseField.AVS_CODE)));
- }
-
- _transaction.setCreditCard(creditCard);
- }
-
- ECheck eCheck = _transaction.getECheck();
- if(eCheck != null) {
- }
-
- return _transaction;
- }
-
- /**
- * Create a Transaction for a given merchant.
- *
- * @param merchant
- * @param transactionType
- * @param fingerPrintSequence
- * @param amount
- *
- * @return a Transaction
- */
- public static Transaction createTransaction(Merchant merchant,
- TransactionType transactionType, long fingerPrintSequence, BigDecimal amount) {
-
- Transaction transaction = new Transaction(merchant, transactionType, amount);
-
- transaction.fingerprint = Fingerprint.createFingerprint(merchant, fingerPrintSequence, amount);
- transaction.requestMap.put(AuthNetField.X_FP_SEQUENCE.getFieldName(), Long.toString(transaction.fingerprint.getSequence()));
- transaction.requestMap.put(AuthNetField.X_FP_TIMESTAMP.getFieldName(),Long.toString(transaction.fingerprint.getTimeStamp()));
- transaction.requestMap.put(AuthNetField.X_FP_HASH.getFieldName(),transaction.fingerprint.getFingerprintHash());
-
- return transaction;
- }
-
- /**
- * Create a transaction from a response XML doc.
- *
- * @param transaction
- * @param response
- * @return Transaction object
- public static final Transaction createTransaction(Transaction transaction, BasicXmlDocument response) {
-
- Transaction _transaction = (Transaction)DeepCopy.copy(transaction);
-
- _transaction.cardPresent = true;
- _transaction.currentResponse = response;
-
- return _transaction;
- }
- */
-
- /**
- * Create a Transaction for a merchant.
- *
- * @param merchant
- * @param transactionType
- * @param amount
- */
- public static Transaction createTransaction(Merchant merchant,
- TransactionType transactionType, BigDecimal amount) {
-
- return new Transaction(merchant, transactionType, amount);
- }
-
- /**
- * Convenience method for overriding the transaction field delimited.
- *
- * Character that will be used to separate fields in the transaction response.
- * The system will use the character passed in this field or the value stored
- * in the Merchant Interface if no value is passed.
- *
- * @param transactionFieldDelimiter
- */
- public static void setTransactionFieldDelimiter(String transactionFieldDelimiter) {
- Transaction.TRANSACTION_FIELD_DELIMITER = transactionFieldDelimiter;
- }
-
- /**
- * Convenience method for overriding the encap char delimiter.
- *
- * Character that will be used to encapsulate the fields in the transaction response.
- * The system will use the character passed in this field or the value stored in
- * the Merchant Interface if no value is passed.
- */
- public static void setEncapCharDelimiter(String encapCharDelimiter) {
- Transaction.ENCAP_CHAR_DELIMITER = encapCharDelimiter;
- }
-
- /**
- * @return the transactionRequestHash
- */
- public Map getRequestMap() {
- return this.requestMap;
- }
-
- /**
- * Return the payment gateway response data map.
- *
- * @return a map of response data
- */
- public Map getResponseMap() {
- return this.responseMap;
- }
-
- /**
- * The payment gateway assigned transaction ID of an original transaction.
- *
- * @param transactionId
- */
- public void setTransactionId(String transactionId) {
- if( this.requestMap.get(AuthNetField.X_SPLIT_TENDER_ID.getFieldName()) == null ||
- this.requestMap.get(AuthNetField.X_SPLIT_TENDER_ID.getFieldName()).equals("")) {
-
- this.requestMap.put(AuthNetField.X_TRANS_ID.getFieldName(),
- transactionId != null?transactionId:EMPTY_STRING);
- this.requestMap.remove(AuthNetField.X_SPLIT_TENDER_ID.getFieldName());
- }
- }
-
- /**
- * The payment gateway assigned slit tender ID of an original transaction.
- *
- * @param splitTenderId
- */
- public void setSplitTenderId(String splitTenderId) {
- if( this.requestMap.get(AuthNetField.X_TRANS_ID.getFieldName()) == null ||
- this.requestMap.get(AuthNetField.X_TRANS_ID.getFieldName()).equals("")) {
-
- this.requestMap.put(AuthNetField.X_SPLIT_TENDER_ID.getFieldName(),
- splitTenderId != null?splitTenderId:EMPTY_STRING);
- this.requestMap.remove(AuthNetField.X_TRANS_ID.getFieldName());
- }
- }
- /**
- * Return the payment gateway assigned transaction ID of the transaction.
- *
- * @return The transaction id.
- */
- public String getTransactionId() {
- return this.requestMap.containsKey(AuthNetField.X_TRANS_ID.getFieldName())?
- this.requestMap.get(AuthNetField.X_TRANS_ID.getFieldName()):EMPTY_STRING;
- }
-
-
- /**
- * Get the transaction type.
- *
- * @return the transactionType
- */
- public TransactionType getTransactionType() {
- return transactionType;
- }
-
- /**
- * The authorization code of an original transaction not captured on the payment gateway.
- *
- * @param authCode
- */
- public void setAuthorizationCode(String authCode) {
- this.requestMap.put(AuthNetField.X_AUTH_CODE.getFieldName(),
- authCode!=null?authCode:EMPTY_STRING);
- }
-
- /**
- * Get the authorization code of the transaction.
- *
- * @return authorizationCode
- */
- public String getAuthorizationCode() {
- return this.requestMap.containsKey(AuthNetField.X_AUTH_CODE.getFieldName())?
- this.requestMap.get(AuthNetField.X_AUTH_CODE.getFieldName()):EMPTY_STRING;
- }
-
- /**
- * Set the CreditCard information for the transaction request.
- *
- * @param creditCard
- */
- public void setCreditCard(CreditCard creditCard) {
- this.creditCard = creditCard;
-
- if(creditCard != null) {
- this.requestMap.put(AuthNetField.X_METHOD.getFieldName(),
- PaymentMethod.CREDIT_CARD.getMethod());
- this.requestMap.put(AuthNetField.X_CARD_NUM.getFieldName(),
- creditCard.getCreditCardNumber()!=null?creditCard.getCreditCardNumber():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_EXP_DATE.getFieldName(),
- creditCard.getExpirationMonth()!=null&&creditCard.getExpirationYear()!=null?
- creditCard.getExpirationMonth()+creditCard.getExpirationYear():EMPTY_STRING);
- // card code
- if(creditCard.getCardCode() != null) {
- this.requestMap.put(AuthNetField.X_CARD_CODE.getFieldName(), creditCard.getCardCode());
- }
- // cardholder authentication
- if(creditCard.getCardholderAuthenticationIndicator() != null &&
- creditCard.getCardholderAuthenticationValue() != null &&
- (TransactionType.AUTH_ONLY.equals(this.transactionType) ||
- TransactionType.AUTH_CAPTURE.equals(this.transactionType)) ) {
-
- this.requestMap.put(AuthNetField.X_AUTHENTICATION_INDICATOR.getFieldName(),
- creditCard.getCardholderAuthenticationIndicator());
- this.requestMap.put(AuthNetField.X_CARDHOLDER_AUTHENTICATION_VALUE.getFieldName(),
- creditCard.getCardholderAuthenticationValue());
- }
- // card present transaction?
- if(StringUtils.isNotEmpty(creditCard.getTrack1()) ||
- StringUtils.isNotEmpty(creditCard.getTrack2())) {
-
- if(creditCard.getCardType() != null) {
- this.requestMap.put(AuthNetField.X_CARD_TYPE.getFieldName(),
- creditCard.getCardType().name().substring(0,0));
- }
- this.requestMap.put(AuthNetField.X_TRACK1.getFieldName(),
- StringUtils.isNotEmpty(creditCard.getTrack1())?creditCard.getTrack1():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_TRACK2.getFieldName(),
- StringUtils.isNotEmpty(creditCard.getTrack2())?creditCard.getTrack2():EMPTY_STRING);
- }
- }
- }
-
- /**
- * Get the CreditCard associated with the transaction.
- *
- * @return credit card object
- */
- public CreditCard getCreditCard() {
- return this.creditCard;
- }
-
- /**
- * @param eCheck the eCheck to set
- */
- public void setECheck(ECheck eCheck) {
- this.eCheck = eCheck;
- if(eCheck != null) {
- this.requestMap.put(AuthNetField.X_METHOD.getFieldName(), PaymentMethod.E_CHECK.getMethod());
- this.requestMap.put(AuthNetField.X_BANK_ABA_CODE.getFieldName(), eCheck.getRoutingNumber());
- this.requestMap.put(AuthNetField.X_BANK_ACCT_NUM.getFieldName(), eCheck.getBankAccountNumber());
- this.requestMap.put(AuthNetField.X_BANK_ACCT_TYPE.getFieldName(), eCheck.getBankAccountType().getValue());
- this.requestMap.put(AuthNetField.X_BANK_NAME.getFieldName(), eCheck.getBankName());
- this.requestMap.put(AuthNetField.X_BANK_ACCT_NAME.getFieldName(), eCheck.getBankAccountName());
- this.requestMap.put(AuthNetField.X_ECHECK_TYPE.getFieldName(), eCheck.getECheckType().getValue());
- if(ECheckType.ARC.equals(eCheck.getECheckType()) ||
- ECheckType.BOC.equals(eCheck.getECheckType()) ) {
-
- this.requestMap.put(AuthNetField.X_BANK_CHECK_NUMBER.getFieldName(),
- eCheck.getBankCheckNumber());
-
- }
- }
- }
-
- /**
- * @return the eCheck
- */
- public ECheck getECheck() {
- return eCheck;
- }
-
- /**
- * Set the Customer information for the transaction request.
- *
- * @param customer
- */
- public void setCustomer(Customer customer) {
- this.customer = customer;
-
- if(customer != null) {
- this.requestMap.put(AuthNetField.X_FIRST_NAME.getFieldName(), customer.getFirstName()!=null?customer.getFirstName():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_LAST_NAME.getFieldName(), customer.getLastName()!=null?customer.getLastName():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_COMPANY.getFieldName(), customer.getCompany()!=null?customer.getCompany():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_ADDRESS.getFieldName(), customer.getAddress()!=null?customer.getAddress():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_CITY.getFieldName(), customer.getCity()!=null?customer.getCity():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_STATE.getFieldName(), customer.getState()!=null?customer.getState():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_ZIP.getFieldName(), customer.getZipPostalCode()!=null?customer.getZipPostalCode():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_COUNTRY.getFieldName(), customer.getCountry()!=null?customer.getCountry():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_PHONE.getFieldName(), customer.getPhone()!=null?customer.getPhone():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_FAX.getFieldName(), customer.getFax()!=null?customer.getFax():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_EMAIL.getFieldName(), customer.getEmail()!=null?customer.getEmail():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_CUST_ID.getFieldName(), customer.getCustomerId()!=null?customer.getCustomerId():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_CUSTOMER_IP.getFieldName(), customer.getCustomerIP()!=null?customer.getCustomerIP():EMPTY_STRING);
- }
- }
-
- /**
- * Get the Customer information associated with the transaction.
- *
- * @return The Customer
- */
- public Customer getCustomer() {
- return this.customer;
- }
-
- /**
- * Set the EmailReceipt information for the transaction request.
- *
- * @param emailReceipt
- */
- public void setEmailReceipt(EmailReceipt emailReceipt) {
- this.emailReceipt = emailReceipt;
-
- if(emailReceipt != null) {
- this.requestMap.put(AuthNetField.X_HEADER_EMAIL_RECEIPT.getFieldName(), emailReceipt.getHeaderEmailReceipt()!=null?emailReceipt.getHeaderEmailReceipt():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_FOOTER_EMAIL_RECEIPT.getFieldName(), emailReceipt.getFooterEmailReceipt()!=null?emailReceipt.getFooterEmailReceipt():EMPTY_STRING);
- }
- }
-
- /**
- * Get the EmailReceipt associated with the transaction.
- *
- * @return The EmailReceipt.
- */
- public EmailReceipt getEmailReceipt() {
- return this.emailReceipt;
- }
-
- /**
- * Set the Order (and OrderItems) for the transaction request.
- *
- * @param order
- */
- public void setOrder(Order order) {
- this.order = order;
-
- if(order != null) {
- this.requestMap.put(AuthNetField.X_INVOICE_NUM.getFieldName(), order.getInvoiceNumber()!=null?order.getInvoiceNumber():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_DESCRIPTION.getFieldName(), order.getDescription()!=null?order.getDescription():EMPTY_STRING);
-
- if(order.getOrderItems() != null) {
- StringBuilder orderItemBuffer = new StringBuilder();
- boolean firstOrderItem = true;
- for(OrderItem orderItem : order.getOrderItems()) {
- if(firstOrderItem) {
- firstOrderItem = false;
- } else {
- orderItemBuffer.append("&").append(AuthNetField.X_LINE_ITEM.getFieldName()).append("=");
- }
- try {
- orderItemBuffer.append(orderItem.getItemId()!=null?
- URLEncoder.encode(orderItem.getItemId(), HttpClient.ENCODING) :
- EMPTY_STRING).append(BRACKET_PIPE_DELIMITER);
- orderItemBuffer.append(orderItem.getItemName()!=null?
- URLEncoder.encode(orderItem.getItemName(), HttpClient.ENCODING):
- EMPTY_STRING).append(BRACKET_PIPE_DELIMITER);
- orderItemBuffer.append(orderItem.getItemDescription()!=null?
- URLEncoder.encode(orderItem.getItemDescription(), HttpClient.ENCODING):
- EMPTY_STRING).append(BRACKET_PIPE_DELIMITER);
- orderItemBuffer.append(orderItem.getItemQuantity()!=null?
- URLEncoder.encode(orderItem.getItemQuantity().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString(), HttpClient.ENCODING):
- ZERO_STRING).append(BRACKET_PIPE_DELIMITER);
- orderItemBuffer.append(orderItem.getItemPrice()!=null?
- URLEncoder.encode(orderItem.getItemPrice().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString(), HttpClient.ENCODING):
- ZERO_STRING).append(BRACKET_PIPE_DELIMITER);
- orderItemBuffer.append(orderItem.isItemTaxable()?TRUE:FALSE);
- } catch (UnsupportedEncodingException uee) {
- logger.log(Level.WARNING, "Failed encoding order items.", uee);
- }
- }
- this.requestMap.put(AuthNetField.X_LINE_ITEM.getFieldName(), orderItemBuffer.toString());
- }
- // set the shipping charges here.
- setShippingCharges(order.getShippingCharges());
- }
- }
-
- /**
- * Get the Order associated with the transaction.
- *
- * @return The Order.
- */
- public Order getOrder() {
- return this.order;
- }
-
- /**
- * Set the ShippingAddress for the transaction request.
- *
- * @param shippingAddress
- */
- public void setShippingAddress(ShippingAddress shippingAddress) {
- this.shippingAddress = shippingAddress;
-
- if(shippingAddress != null) {
- this.requestMap.put(AuthNetField.X_SHIP_TO_FIRST_NAME.getFieldName(),
- shippingAddress.getFirstName() != null?shippingAddress.getFirstName():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_SHIP_TO_LAST_NAME.getFieldName(),
- shippingAddress.getLastName() != null?shippingAddress.getLastName():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_SHIP_TO_COMPANY.getFieldName(),
- shippingAddress.getCompany() != null?shippingAddress.getCompany():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_SHIP_TO_ADDRESS.getFieldName(),
- shippingAddress.getAddress() != null?shippingAddress.getAddress():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_SHIP_TO_CITY.getFieldName(),
- shippingAddress.getCity() != null?shippingAddress.getCity():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_SHIP_TO_STATE.getFieldName(),
- shippingAddress.getState() != null?shippingAddress.getState():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_SHIP_TO_ZIP.getFieldName(),
- shippingAddress.getZipPostalCode() != null?shippingAddress.getZipPostalCode():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_SHIP_TO_COUNTRY.getFieldName(),
- shippingAddress.getCountry() != null?shippingAddress.getCountry():EMPTY_STRING);
- }
- }
-
- /**
- * Get the ShippingAddress for the transaction request.
- *
- * @return The ShippingAddress
- */
- public ShippingAddress getShippingAddress() {
- return this.shippingAddress;
- }
-
- /**
- * Set the ShippingCharges for the transaction request.
- *
- * @param shippingCharges
- */
- public void setShippingCharges(ShippingCharges shippingCharges) {
- this.shippingCharges = shippingCharges;
-
- if(shippingCharges != null) {
- try {
- // tax charges
- if(shippingCharges.getTaxAmount() != null &&
- !ZERO_AMOUNT.equals(shippingCharges.getTaxAmount())) {
- StringBuilder taxBuffer = new StringBuilder();
- taxBuffer.append(URLEncoder.encode(shippingCharges.getTaxItemName()!=null?
- shippingCharges.getTaxItemName():EMPTY_STRING, HttpClient.ENCODING)).append(BRACKET_PIPE_DELIMITER);
- taxBuffer.append(URLEncoder.encode(shippingCharges.getTaxDescription()!=null?
- shippingCharges.getTaxDescription():EMPTY_STRING, HttpClient.ENCODING)).append(BRACKET_PIPE_DELIMITER);
- taxBuffer.append(URLEncoder.encode(shippingCharges.getTaxAmount().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString(), HttpClient.ENCODING));
-
- this.requestMap.put(AuthNetField.X_TAX.getFieldName(), taxBuffer.toString());
- }
- // freight charges
- if(shippingCharges.getFreightAmount() != null &&
- !ZERO_AMOUNT.equals(shippingCharges.getFreightAmount())) {
- StringBuilder freightBuffer = new StringBuilder();
- freightBuffer.append(URLEncoder.encode(shippingCharges.getFreightItemName()!=null?
- shippingCharges.getFreightItemName():EMPTY_STRING, HttpClient.ENCODING)).append(BRACKET_PIPE_DELIMITER);
- freightBuffer.append(URLEncoder.encode(shippingCharges.getFreightDescription()!=null?
- shippingCharges.getFreightDescription():EMPTY_STRING, HttpClient.ENCODING)).append(BRACKET_PIPE_DELIMITER);
- freightBuffer.append(URLEncoder.encode(shippingCharges.getFreightAmount().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString(), HttpClient.ENCODING));
-
- this.requestMap.put(AuthNetField.X_FREIGHT.getFieldName(), freightBuffer.toString());
- }
- // duty charges
- if(shippingCharges.getDutyAmount() != null &&
- !ZERO_AMOUNT.equals(shippingCharges.getDutyAmount())) {
- StringBuilder dutyBuffer = new StringBuilder();
- dutyBuffer.append(URLEncoder.encode(shippingCharges.getDutyItemName()!=null?
- shippingCharges.getDutyItemName():EMPTY_STRING, HttpClient.ENCODING));
- dutyBuffer.append(URLEncoder.encode(shippingCharges.getDutyItemDescription()!=null?
- shippingCharges.getDutyItemDescription():EMPTY_STRING, HttpClient.ENCODING));
- dutyBuffer.append(URLEncoder.encode(shippingCharges.getDutyAmount().setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP).toPlainString(), HttpClient.ENCODING));
-
- this.requestMap.put(AuthNetField.X_DUTY.getFieldName(), dutyBuffer.toString());
- }
- } catch (UnsupportedEncodingException uee) {
- logger.log(Level.WARNING, "Failed encoding shipping charges.", uee);
- }
-
- this.requestMap.put(AuthNetField.X_TAX_EXEMPT.getFieldName(), shippingCharges.isTaxExempt()?TRUE:FALSE);
- this.requestMap.put(AuthNetField.X_PO_NUM.getFieldName(),
- shippingCharges.getPurchaseOrderNumber()!=null?shippingCharges.getPurchaseOrderNumber():EMPTY_STRING);
- }
-
- }
-
- /**
- * Get the ShippingCharges associated with the transaction.
- *
- * @return The ShippingCharges
- */
- public ShippingCharges getShippingCharges() {
- return this.shippingCharges;
- }
-
- /**
- * The window of time after the submission of a transaction that a duplicate transaction can not be submitted.
- *
- * @param seconds
- */
- public void setDuplicateWindow(int seconds) {
- this.requestMap.put(AuthNetField.X_DUPLICATE_WINDOW.getFieldName(), Integer.toString(seconds));
- }
-
- /**
- * Set the currency code for Card Present transactions.
- *
- * @param currencyCode
- */
- public void setCurrencyCode(String currencyCode) {
- this.requestMap.put(AuthNetField.X_CURRENCY_CODE.getFieldName(), currencyCode);
- }
-
- /**
- * Get the currency code for Card Present transactions.
- *
- * @return the currencyCode used in the transaction.
- */
- public String getCurrencyCode() {
- return this.requestMap.get(AuthNetField.X_CURRENCY_CODE.getFieldName());
- }
-
- /**
- * Indicating marker used by merchant account providers to identify transactions which originate from merchant
- * hosted recurring billing applications. This value is not affiliated with Automated Recurring Billing.
- *
- * @param recurringBillingStatus
- */
- public void setRecurringBilling(boolean recurringBillingStatus) {
- this.requestMap.put(AuthNetField.X_RECURRING_BILLING.getFieldName(), recurringBillingStatus?TRUE:FALSE);
- }
-
- /**
- * Set a merchant defined field.
- *
- * @param field
- * @param value
- */
- public void setMerchantDefinedField(String field, String value) {
- if(this.requestMap.get(field) == null) {
- this.merchantDefinedMap.put(field, value);
- }
- }
-
- /**
- * Get a merchant defined field.
- *
- * @param field
- *
- * @return Return the value found in the merchant defined hash by a field.
- */
- public String getMerchantDefinedField(String field) {
- return this.merchantDefinedMap.get(field);
- }
-
- /**
- * Get the merchant defined data map.
- *
- * @return a map of merchant defined data
- */
- public Map getMerchantDefinedMap() {
- return this.merchantDefinedMap;
- }
-
- /**
- * Returns the payment gateway response data for a specific ResponseField.
- *
- * @param responseField
- *
- * @return the value found in the map identified by the response field
- */
- public String getResponseField(ResponseField responseField) {
- return this.responseMap.get(responseField);
- }
-
- /**
- * Return a response XML doc if the transaction was a Card Present transaction.
- * @return the responseXml
- */
- public BasicXmlDocument getCurrentResponse() {
- return currentResponse;
- }
-
- /**
- * @return the mD5Value
- */
- public String getMD5Value() {
- return md5Value;
- }
-
- /**
- * @return the fingerprint
- */
- public Fingerprint getFingerprint() {
- return fingerprint;
- }
-
- /**
- * @return the environment
- */
- public Environment getEnvironment() {
- return environment;
- }
-
- /**
- * If true, will populate a field that indicates that the merchant would like to
- * use the payment gateway hosted payment form to collect payment data.
- *
- * @param showForm
- */
- public void setShowPaymentForm(boolean showForm) {
- if(showForm) {
- this.requestMap.put(AuthNetField.X_SHOW_FORM.getFieldName(), PAYMENT_FORM);
- } else {
- this.requestMap.remove(AuthNetField.X_SHOW_FORM.getFieldName());
- }
- }
-
- /**
- * Returns true if the payment data collection form should be displayed/used.
- *
- * @return boolean
- */
- public boolean isShowPaymentForm() {
-
- return this.requestMap.containsKey(AuthNetField.X_SHOW_FORM.getFieldName()) &&
- PAYMENT_FORM.equals(this.requestMap.get(AuthNetField.X_SHOW_FORM.getFieldName()));
- }
-
- /**
- * Get the field names that should not be auto populated
- * in the createForm method. The developer can then offer
- * these as customized input fields in the form.
- *
- * @return the fieldsToRemoveFromForm
- */
- public Map getFormInputs() {
- return this.formInputMap;
- }
-
- /**
- * Add an input name and replacement data to the list of fields that should
- * not be auto populated in the createForm method. If the optionsMap is
- * empty, then no input element will be created in the form for the
- * specified inputName.
- *
- * Example:
- *
- * If "notes" was passed in as the inputName, the htmlInputData provided
- * could look like
- *
- * "
- *
- *
- *
"
- *
- * @param inputName
- * @param htmlInputData
- */
- public void addFormInput(String inputName, String htmlInputData) {
- this.formInputMap.put(inputName, htmlInputData);
- }
-
- /**
- * @param formInputs the form input names and input options that should not
- * be auto populated in the createForm method.
- */
- public void setFormInputs(LinkedHashMap formInputs) {
- this.formInputMap = formInputs;
- }
-
- /**
- * @return the hostedPaymentFormSettings
- */
- public HostedPaymentFormSettings getHostedPaymentFormSettings() {
- return hostedPaymentFormSettings;
- }
-
- /**
- * @param hostedPaymentFormSettings the hostedPaymentFormSettings to set
- */
- public void setHostedPaymentFormSettings(
- HostedPaymentFormSettings hostedPaymentFormSettings) {
- this.hostedPaymentFormSettings = hostedPaymentFormSettings;
- if(hostedPaymentFormSettings != null) {
- this.requestMap.put(AuthNetField.X_HEADER_HTML_PAYMENT_FORM.getFieldName(),
- hostedPaymentFormSettings.getHeader() != null?hostedPaymentFormSettings.getHeader():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_FOOTER_HTML_PAYMENT_FORM.getFieldName(),
- hostedPaymentFormSettings.getFooter() != null?hostedPaymentFormSettings.getFooter():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_COLOR_BACKGROUND.getFieldName(),
- hostedPaymentFormSettings.getBackgroundColor() != null?hostedPaymentFormSettings.getBackgroundColor():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_COLOR_LINK.getFieldName(),
- hostedPaymentFormSettings.getLinkColor() != null?hostedPaymentFormSettings.getLinkColor():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_COLOR_TEXT.getFieldName(),
- hostedPaymentFormSettings.getTextColor() != null?hostedPaymentFormSettings.getTextColor():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_LOGO_URL.getFieldName(),
- hostedPaymentFormSettings.getMerchantLogoUrl() != null?hostedPaymentFormSettings.getMerchantLogoUrl():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_BACKGROUND_URL.getFieldName(),
- hostedPaymentFormSettings.getBackgroundUrl() != null?hostedPaymentFormSettings.getBackgroundUrl():EMPTY_STRING);
- }
- }
-
- /**
- * @return the fieldsToRename
- */
- public Map getFieldsToRename() {
- return fieldsToRename;
- }
-
- /**
- * @param fieldsToRename the fieldsToRename to set
- */
- public void setFieldsToRename(Map fieldsToRename) {
- this.fieldsToRename = fieldsToRename;
- this.requestMap.put(AuthNetField.X_RENAME.getFieldName(), EMPTY_STRING);
- }
-
- /**
- * Add a field to rename.
- *
- * @param fieldToRename
- * @param replacementName
- */
- public void addFieldToRename(String fieldToRename, String replacementName) {
- this.fieldsToRename.put(fieldToRename, replacementName);
- this.requestMap.put(AuthNetField.X_RENAME.getFieldName(), EMPTY_STRING);
- }
-
- /**
- * @return the hostedReceiptPageSettings
- */
- public HostedReceiptPageSettings getHostedReceiptPageSettings() {
- return hostedReceiptPageSettings;
- }
-
- /**
- * @param hostedReceiptPageSettings the hostedReceiptPageSettings to set
- */
- public void setHostedReceiptPageSettings(
- HostedReceiptPageSettings hostedReceiptPageSettings) {
- this.hostedReceiptPageSettings = hostedReceiptPageSettings;
-
- if(hostedReceiptPageSettings != null) {
-
- // set the link back method
- if(hostedReceiptPageSettings.getLinkMethod() != null) {
- this.requestMap.put(AuthNetField.X_RECEIPT_LINK_METHOD.getFieldName(),
- hostedReceiptPageSettings.getLinkMethod().name());
- }
- this.requestMap.put(AuthNetField.X_RECEIPT_LINK_TEXT.getFieldName(),
- hostedReceiptPageSettings.getLinkText() != null?hostedReceiptPageSettings.getLinkText():EMPTY_STRING);
- this.requestMap.put(AuthNetField.X_RECEIPT_LINK_URL.getFieldName(),
- hostedReceiptPageSettings.getLinkUrl() != null?hostedReceiptPageSettings.getLinkUrl():EMPTY_STRING);
- }
- }
-
- /**
- * SIM applications use relay response to redirect the user back to the merchant server.
- *
- * @param relayResponseUrl
- */
- public void setRelayResponseUrl(String relayResponseUrl) {
-
- if(relayResponseUrl == null || relayResponseUrl.equals(EMPTY_STRING)) {
- this.requestMap.put(AuthNetField.X_RELAY_RESPONSE.getFieldName(), FALSE);
- this.requestMap.remove(AuthNetField.X_RELAY_URL.getFieldName());
- } else {
- this.requestMap.put(AuthNetField.X_RELAY_RESPONSE.getFieldName(), TRUE);
- this.requestMap.put(AuthNetField.X_RELAY_URL.getFieldName(), relayResponseUrl);
- }
- }
-
- /**
- * SIM applications use relay response. Set this to false (default) if you are using AIM.
- *
- * @return the relayResponseUrl
- */
- public String getRelayResponseUrl() {
- return this.requestMap.get(AuthNetField.X_RELAY_URL.getFieldName());
- }
-
- /**
- * Filters the request mappings based on the formInputMap keys.
- *
- * @param requestMappings
- * @return a HashMap of filtered request map data.
- */
- private HashMap filterRequestMappings(Map... requestMappings) {
- HashMap filteredRequestMap = new HashMap();
-
- // loop through the rest and put on
- for(Map requestMap : requestMappings) {
- for(String key : requestMap.keySet()) {
- if(!filteredRequestMap.containsKey(key) &&
- !this.formInputMap.containsKey(key)) {
- filteredRequestMap.put(key, requestMap.get(key));
- }
- }
- }
-
- return filteredRequestMap;
- }
-
- /**
- * Prepare the form inputs based on the Map(s) provided.
- *
- * @param requestMappings
- *
- * @return a StringBuilder object
- */
- private StringBuilder prepareFormInputs(Map... requestMappings) {
- StringBuilder inputsBuilder = new StringBuilder();
-
- // loop on the formInputs
- for(String key : formInputMap.keySet()) {
- String htmlInputData = formInputMap.get(key);
- if(htmlInputData != null) {
- inputsBuilder.append(htmlInputData).append("\n");
- }
- }
-
- // loop on the request mappings
- HashMap requestMapping = filterRequestMappings(requestMappings);
- Set keys = requestMapping.keySet();
-
- for(String key : keys) {
- try {
- String value = requestMapping.get(key).toString();
- boolean addBreak = false;
-
- // used for renaming fields on the form
- if("x_rename".equals(key)) {
- Set renameKeys = this.fieldsToRename.keySet();
- for(String renameKey : renameKeys) {
- String renameValue = this.fieldsToRename.get(renameKey).toString();
-
- inputsBuilder.append("\n");
- }
- } else {
- inputsBuilder.append("\n").append(addBreak?" ":EMPTY_STRING);
- }
- } catch (Exception e) {
- logger.log(Level.WARNING, "NVP encoding failed: " + e.getMessage());
- }
- }
-
- return inputsBuilder;
- }
-
- /**
- * Return an HTML form with all inputs. All the data collected in the Transaction
- * will be added as inputs.
- *
- * @return A string containing the html FORM
- */
- @SuppressWarnings("unchecked")
- public String createForm(String formName, String formId, Button button) {
- StringBuilder htmlFormBuffer = new StringBuilder();
-
- if(formName == null) {
- formName = "order_form";
- }
- if(formId == null) {
- formId = formName;
- }
-
- htmlFormBuffer.append("\n");
-
- return htmlFormBuffer.toString();
- }
-
- /**
- * Build a relay response url for the relay response redirect.
- *
- * @param relayResponseUrl
- * @param requestParameterMap
- *
- * @return a string that is the relay response redirect url
- */
- public static String createRelayResponseRedirectUrl(String relayResponseUrl,
- Map requestParameterMap) {
-
- StringBuilder htmlFormBuffer = new StringBuilder();
-
- if(requestParameterMap != null) {
- htmlFormBuffer.append("?");
- for(String fieldName : requestParameterMap.keySet()) {
- String[] value = requestParameterMap.get(fieldName);
- htmlFormBuffer.append(fieldName).append("=").append(value.length>0?value[0]:EMPTY_STRING);
- htmlFormBuffer.append("&");
- }
- htmlFormBuffer.deleteCharAt(htmlFormBuffer.length()-1);
- }
-
- return htmlFormBuffer.toString();
- }
-
- /**
- * Prepare the name/value pair mapping based on the Map(s) provided.
- *
- * @return String
- */
- public String toAuthNetPOSTString() {
- StringBuilder nvpBuffer = new StringBuilder();
-
- // loop on the request mappings
- LinkedList