Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qa script changes #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/test/cybersource-rest-qascripts-java/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/AuthenticationSdk"/>
<classpathentry combineaccessrules="false" kind="src" path="/cybersource-rest-client-java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
1 change: 1 addition & 0 deletions src/test/cybersource-rest-qascripts-java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
23 changes: 23 additions & 0 deletions src/test/cybersource-rest-qascripts-java/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>SampleCode</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
84 changes: 84 additions & 0 deletions src/test/cybersource-rest-qascripts-java/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Java Sample Code for the CyberSource SDK

This repository contains working code samples which demonstrate Java integration with the CyberSource REST APIs through the [CyberSource Java SDK](https://github.com/CyberSource/cybersource-rest-client-java).

The samples are organized into categories and common usage examples.

## Using the Sample Code

The samples are all completely independent and self-contained. You can analyze them to get an understanding of how a particular method works, or you can use the snippets as a starting point for your own project.

### Clone (or download) this repository:
```
$ git clone https://github.com/CyberSource/cybersource-rest-samples-java
```
### Running the Samples using IntelliJ IDE
* Open the project/folder (rather than import or new).

* Build the project:
* From the Build menu, select Rebuild Project.

* Run any sample:
* For example, select ProcessPayment class from the class Explorer
* Right-click and select Run ProcessPayment.Main()

### Running the Samples using Eclipse IDE
* Import the project:
* From File menu,select Import.
* Expand Maven menu.
* And click Existing Maven Projects
* Click next and browse the location where you have the Maven project source code.
* Click next, Eclipse will recognize the Maven project and it will show you a list of all possible Maven projects located there.
* Just select the project and click next.
* Eclipse will show you a Maven Build message. Just click finish.
* The Maven project is successfully imported into Eclipse IDE.

* Run the project:
* Right-click the project folder.
* Select Run as Maven Build.
* In the Goals field, enter "clean install"
* Select the JRE tab and make sure it is pointing at a JRE associated with a JDK.
* Click Run.


## Setting Your API Credentials

To set your API credentials for an API request,Configure the following information in src/main/java/data/Configuration.java file:

* Http Signature

```java
authenticationType = http_Signature
merchantID = your_merchant_id
merchantKeyId = your_key_serial_number
merchantsecretKey = your_key_shared_secret
```
* Jwt

```java
authenticationType = Jwt
merchantID = your_merchant_id
keyAlias = your_merchant_id
keyPassword = your_merchant_id
keyFileName = your_merchant_id
keysDirectory = resources
```

## Switching between the sandbox environment and the production environment
CyberSource maintains a complete sandbox environment for testing and development purposes. This sandbox environment is an exact
duplicate of our production environment with the transaction authorization and settlement process simulated. By default, this SDK is
configured to communicate with the sandbox environment. To switch to the production environment, set the appropriate environment
constant in resources/cybersource.properties file. For example:

```java
// For TESTING use
runEnvironment = CyberSource.Environment.SANDBOX
// For PRODUCTION use
// runEnvironment = CyberSource.Environment.PRODUCTION
```


The [API Reference Guide](https://developer.cybersource.com/api/reference/api-reference.html) provides examples of what information is needed for a particular request and how that information would be formatted. Using those examples, you can easily determine what methods would be necessary to include that information in a request
using this SDK.


Loading