NPS SDK Java


License

License

Categories

Categories

Java Languages
GroupId

GroupId

com.github.ingenico-nps-latam
ArtifactId

ArtifactId

nps-sdk-java
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

NPS SDK Java
NPS SDK Java
Project URL

Project URL

https://github.com/Ingenico-NPS-Latam/nps-sdk-java
Source Code Management

Source Code Management

http://github.com/Ingenico-NPS-Latam/nps-sdk-java/tree/master

Download nps-sdk-java

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.ingenico-nps-latam/nps-sdk-java/ -->
<dependency>
    <groupId>com.github.ingenico-nps-latam</groupId>
    <artifactId>nps-sdk-java</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.ingenico-nps-latam/nps-sdk-java/
implementation 'com.github.ingenico-nps-latam:nps-sdk-java:1.1.0'
// https://jarcasting.com/artifacts/com.github.ingenico-nps-latam/nps-sdk-java/
implementation ("com.github.ingenico-nps-latam:nps-sdk-java:1.1.0")
'com.github.ingenico-nps-latam:nps-sdk-java:jar:1.1.0'
<dependency org="com.github.ingenico-nps-latam" name="nps-sdk-java" rev="1.1.0">
  <artifact name="nps-sdk-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.ingenico-nps-latam', module='nps-sdk-java', version='1.1.0')
)
libraryDependencies += "com.github.ingenico-nps-latam" % "nps-sdk-java" % "1.1.0"
[com.github.ingenico-nps-latam/nps-sdk-java "1.1.0"]

Dependencies

compile (8)

Group / Artifact Type Version
org.codehaus.groovy : groovy jar 2.3.9
org.codehaus.groovy : groovy-xml jar 2.3.9
org.apache.httpcomponents : httpclient jar 4.5.3
org.apache.httpcomponents : httpcore jar 4.4.6
com.predic8 : soa-model-core jar 1.5.1
commons-logging : commons-logging jar 1.2
commons-codec : commons-codec jar 1.9
org.bouncycastle : bcprov-jdk15on jar 1.54

runtime (3)

Group / Artifact Type Version
org.slf4j : jcl-over-slf4j jar 1.7.9
org.slf4j : slf4j-api jar 1.7.9
org.slf4j : slf4j-jdk14 jar 1.7.9

Project Modules

There are no modules declared in this project.

Java SDK

Availability

Supports java 6, 7 and 8

How to install

Add this dependency to your project's POM:

<dependency>
    <groupId>com.github.ingenico-nps-latam</groupId>
    <artifactId>nps-sdk-java</artifactId>
    <version>1.1.0</version>
</dependency>

or add this line to your build.gradle

compile 'com.github.ingenico-nps-latam:nps-sdk-java:1.1.0'

Configuration

It's a basic configuration of the SDK

import NpsSDK.ConsoleLogger;
import NpsSDK.ILogger;
import NpsSDK.NpsSdk;
import NpsSDK.WsdlHandlerConfiguration;
import NpsSDK.ILogger.LogLevel;
import NpsSDK.WsdlHandlerConfiguration.NpsEnvironment;
import NpsSDK.WsdlHandlerException;

ILogger consoleLogger = new ConsoleLogger();
WsdlHandlerConfiguration wsdlHandlerConfiguration = new WsdlHandlerConfiguration(LogLevel.DEBUG, NpsEnvironment.sandbox, "_YOUR_SECRET_KEY_", consoleLogger);      
NpsSdk npsSdk = null;
try {
	npsSdk = new NpsSdk(wsdlHandlerConfiguration);
} 
catch (WsdlHandlerException ex) {	
	//Code to handle error
}  

Here is an simple example request:

import NpsSDK.ComplexElement;
import NpsSDK.ComplexElementArray;
import NpsSDK.ComplexElementArrayItem;
import NpsSDK.WsdlHandlerException;

RootElement data = null;
RootElement response = null;

try {
	data = new RootElement();
	data.add("psp_Version", "2.2" );
	data.add("psp_MerchantId", PSPMERCHANTID );
	data.add("psp_TxSource", "WEB" );
	data.add("psp_MerchTxRef", "ORDER69461-3" );
	data.add("psp_MerchOrderId", "ORDER69461" );
	data.add("psp_Amount", "15050" );
	data.add("psp_NumPayments", "1" );
	data.add("psp_Currency", "032" );
	data.add("psp_Country", "ARG" );
	data.add("psp_Product", "14" );
	data.add("psp_CardNumber", "4507990000000010" );
	data.add("psp_CardExpDate", "1612" );
	data.add("psp_PosDateTime", "2016-12-01 12:00:00");
	data.add("psp_CardSecurityCode", "325" );	

	response = npsSdk.payOnLine_2p(data);
} 
catch (WsdlHandlerException ex) {	
	//Code to handle error
}  

Environments

import NpsSDK.WsdlHandlerConfiguration.NpsEnvironment;

NpsEnvironment.sandbox
NpsEnvironment.staging
NpsEnvironment.production

Error handling

WsdlHandlerException: This exception is thrown when occurs any error.

import NpsSDK.WsdlHandlerException;

//Code
try {
	//code or sdk call
} 
catch (WsdlHandlerException ex) {	
	//Code to handle error
}  

Advanced configurations

Nps SDK allows you to log what’s happening with you request inside of our SDK, it logs by default to the java console

import NpsSDK.ConsoleLogger;
import NpsSDK.ILogger;
import NpsSDK.WsdlHandlerConfiguration;
import NpsSDK.ILogger.LogLevel;
import NpsSDK.WsdlHandlerConfiguration.NpsEnvironment;

ILogger consoleLogger = new ConsoleLogger();
WsdlHandlerConfiguration wsdlHandlerConfiguration = new WsdlHandlerConfiguration(LogLevel.DEBUG, NpsEnvironment.sandbox, "_YOUR_SECRET_KEY_", consoleLogger);      

If you prefer the sdk can write the output generated from the logger to the file you provided.

import NpsSDK.FileLogger;
import NpsSDK.ILogger;
import NpsSDK.WsdlHandlerConfiguration;
import NpsSDK.ILogger.LogLevel;
import NpsSDK.WsdlHandlerConfiguration.NpsEnvironment;

ILogger fileLogger = new FileLogger("path/to/your/file.log");
WsdlHandlerConfiguration wsdlHandlerConfiguration = new WsdlHandlerConfiguration(LogLevel.DEBUG, NpsEnvironment.sandbox, "_YOUR_SECRET_KEY_", fileLogger);      

The LogLevel.Info level will write concise information of the request and will mask sensitive data of the request. The LogLevel.Debug level will write information about the request to let developers debug it in a more detailed way.


you can change the open timeout and the read timeout of the request.

```java
import NpsSDK.ConsoleLogger;
import NpsSDK.ILogger;
import NpsSDK.WsdlHandlerConfiguration;
import NpsSDK.ILogger.LogLevel;
import NpsSDK.WsdlHandlerConfiguration.NpsEnvironment;

ILogger consoleLogger = new ConsoleLogger();

int openTimeOut = 10;
int readTimeOut = 60;
WsdlHandlerConfiguration wsdlHandlerConfiguration = new WsdlHandlerConfiguration(LogLevel.DEBUG, NpsEnvironment.sandbox, "_YOUR_SECRET_KEY_", consoleLogger,openTimeOut,readTimeOut);      

Proxy configuration

import NpsSDK.ConsoleLogger;
import NpsSDK.ILogger;
import NpsSDK.WsdlHandlerConfiguration;
import NpsSDK.ILogger.LogLevel;
import NpsSDK.WsdlHandlerConfiguration.NpsEnvironment;

ILogger consoleLogger = new ConsoleLogger();

int openTimeOut = 10;
int readTimeOut = 60;
HttpHost proxy = new HttpHost("PROXY HOST", 8080);
WsdlHandlerConfiguration wsdlHandlerConfiguration = new WsdlHandlerConfiguration(LogLevel.DEBUG, NpsEnvironment.sandbox, "_YOUR_SECRET_KEY_", consoleLogger,openTimeOut,readTimeOut,proxy);      
com.github.ingenico-nps-latam

Ingenico NPS Latam Platform

NPS Integration Stack Tools, such as SDKs & Cart Plugins

Versions

Version
1.1.0
1.0.34
1.0.33
1.0.32
1.0.30
1.0.28
1.0.26
1.0.25
1.0.22
1.0.21
1.0.20
1.0.19
1.0.18
1.0.17
1.0.16
1.0.15
1.0.14
1.0.11
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3