Skip to content

Commit 970f063

Browse files
committed
Added Payment Feedback API
1 parent e37b9ac commit 970f063

File tree

10 files changed

+585
-6
lines changed

10 files changed

+585
-6
lines changed

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
6+
### IntelliJ IDEA ###
7+
# Ignore the entire IntelliJ settings directory
8+
.idea/
9+
10+
# Ignore individual module files (sometimes generated in the root)
11+
*.iml
12+
*.iws
13+
*.ipr
14+
15+
16+
### Eclipse ###
17+
.apt_generated
18+
.classpath
19+
.factorypath
20+
.project
21+
.settings
22+
.springBeans
23+
.sts4-cache
24+
25+
### NetBeans ###
26+
/nbproject/private/
27+
/nbbuild/
28+
/dist/
29+
/nbdist/
30+
/.nb-gradle/
31+
build/
32+
!**/src/main/**/build/
33+
!**/src/test/**/build/
34+
35+
### VS Code ###
36+
.vscode/
37+
38+
### Mac OS ###
39+
.DS_Store

docs/source/code.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,4 +243,31 @@ Get SMS Verification result.
243243
| Parameter | Type | Description |
244244
|-------------------|--------|-------------|
245245
| result | string | Indicates if the input parameters matched a valid OTP. Y if a valid OTP is found and N if no valid OTP found. |
246-
```
246+
```
247+
248+
## Payment Class
249+
```{py:class} Payment()
250+
Initiate Payment class.
251+
```
252+
253+
```{py:function} feedback(data)
254+
Report the final payment status back to the system, helping improve fraud detection and risk assessment.
255+
256+
:param Hashtable data: (Required) Parameters of feedback details.
257+
258+
| Parameter | Type | Description |
259+
|--------------|---------|---------------------|
260+
| email | string | (required) Email address of the payment order. |
261+
| status | string | (required) Status of the payment order. |
262+
| message | string | (required) Message returned from the payment gateway for the payment order. |
263+
| fraudlabspro_id | string | (optional) Unique transaction Id generated by Fraud Check API. |
264+
265+
266+
:return: Returns the details about the transaction in JSON object.
267+
:rtype: Object
268+
269+
| Parameter | Type | Description |
270+
|-------------------|--------|-------------|
271+
| result | string | Indicates if submission is successful. |
272+
273+
```

docs/source/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
# -- Project information
77

88
project = 'FraudLabs Pro Java'
9-
copyright = '2024, FraudLabs Pro'
9+
copyright = '2026, FraudLabs Pro'
1010
author = 'FraudLabs Pro'
1111

12-
release = '0.1.0'
13-
version = '0.1.0'
12+
release = '4.1.0'
13+
version = '4.1.0'
1414

1515
# -- General configuration
1616

@@ -61,4 +61,4 @@
6161

6262
html_title = "FraudLabs Pro Java"
6363

64-
# html_baseurl = "https://ip2proxy-php.readthedocs.io/en/latest/"
64+
# html_baseurl = "https://fraudlabspro-java.readthedocs.io/en/latest/"

docs/source/quickstart.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,33 @@ public class Main {
176176
String result = verification.verifySMS(data);
177177
}
178178
}
179-
```
179+
```
180+
181+
### Report Payment Gateway Feedback
182+
183+
You can report payment gateway feedback as below:
184+
185+
```java
186+
import com.fraudlabspro.*;
187+
import java.util.Hashtable;
188+
189+
public class Main {
190+
191+
public static void main(String[] args) {
192+
// Configures FraudLabs Pro API key
193+
FraudLabsPro.APIKEY = "YOUR_API_KEY";
194+
195+
// Payment Feedback API
196+
Payment pay = new Payment();
197+
198+
// Set Payment Feedback parameter
199+
Hashtable<String, String> data = new Hashtable<>();
200+
data.put("email", "hh5566@gmail.com");
201+
data.put("status", "declined");
202+
data.put("message", "Call Issuer. Pick Up Card. (2047)");
203+
data.put("fraudlabspro_id", "20260131-O263CR");
204+
205+
String result = pay.feedback(data);
206+
}
207+
}
208+
```

pom.xml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>com.fraudlabspro</groupId>
7+
<artifactId>fraudlabspro-java</artifactId>
8+
<packaging>jar</packaging>
9+
<version>4.1.0</version>
10+
<name>FraudLabs Pro Java SDK</name>
11+
<description>A Java SDK to enable users to easily implement fraud detection feature into their solution using the API from https://www.fraudlabspro.com</description>
12+
<url>https://github.com/fraudlabspro/fraudlabspro-java</url>
13+
<inceptionYear>2018</inceptionYear>
14+
<licenses>
15+
<license>
16+
<name>MIT License</name>
17+
<url>https://github.com/fraudlabspro/fraudlabspro-java/blob/master/LICENSE</url>
18+
<distribution>repo</distribution>
19+
</license>
20+
</licenses>
21+
<scm>
22+
<url>https://github.com/fraudlabspro/fraudlabspro-java</url>
23+
</scm>
24+
<developers>
25+
<developer>
26+
<id>fraudlabspro</id>
27+
<name>FraudLabs Pro</name>
28+
<email>support@fraudlabspro.com</email>
29+
</developer>
30+
</developers>
31+
<properties>
32+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
33+
</properties>
34+
<build>
35+
<plugins>
36+
<plugin>
37+
<groupId>org.apache.maven.plugins</groupId>
38+
<artifactId>maven-compiler-plugin</artifactId>
39+
<version>3.15.0</version>
40+
<configuration>
41+
<source>1.8</source>
42+
<target>1.8</target>
43+
</configuration>
44+
</plugin>
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<artifactId>maven-surefire-plugin</artifactId>
48+
<version>3.5.5</version>
49+
</plugin>
50+
<plugin>
51+
<groupId>org.apache.maven.plugins</groupId>
52+
<artifactId>maven-failsafe-plugin</artifactId>
53+
<version>3.5.5</version>
54+
</plugin>
55+
<plugin>
56+
<groupId>org.apache.maven.plugins</groupId>
57+
<artifactId>maven-source-plugin</artifactId>
58+
<version>3.4.0</version>
59+
<executions>
60+
<execution>
61+
<id>attach-sources</id>
62+
<goals>
63+
<goal>jar-no-fork</goal>
64+
</goals>
65+
</execution>
66+
</executions>
67+
</plugin>
68+
<plugin>
69+
<groupId>org.apache.maven.plugins</groupId>
70+
<artifactId>maven-javadoc-plugin</artifactId>
71+
<version>3.12.0</version>
72+
<executions>
73+
<execution>
74+
<id>attach-javadocs</id>
75+
<goals>
76+
<goal>jar</goal>
77+
</goals>
78+
</execution>
79+
</executions>
80+
</plugin>
81+
<plugin>
82+
<groupId>org.apache.maven.plugins</groupId>
83+
<artifactId>maven-gpg-plugin</artifactId>
84+
<version>3.2.8</version>
85+
<executions>
86+
<execution>
87+
<id>sign-artifacts</id>
88+
<phase>verify</phase>
89+
<goals>
90+
<goal>sign</goal>
91+
</goals>
92+
<configuration>
93+
<keyname>FraudLabs Pro</keyname>
94+
</configuration>
95+
</execution>
96+
</executions>
97+
</plugin>
98+
<plugin>
99+
<groupId>org.sonatype.central</groupId>
100+
<artifactId>central-publishing-maven-plugin</artifactId>
101+
<version>0.10.0</version>
102+
<extensions>true</extensions>
103+
<configuration>
104+
<publishingServerId>central</publishingServerId>
105+
</configuration>
106+
</plugin>
107+
</plugins>
108+
</build>
109+
</project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.fraudlabspro;
2+
3+
public class FraudLabsPro {
4+
/**
5+
* Version of this library.
6+
*
7+
* string
8+
*/
9+
public static final String VERSION = "4.1.0";
10+
11+
/**
12+
* API KEY From Merchant
13+
*/
14+
public static String APIKEY = "";
15+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package com.fraudlabspro;
2+
3+
import java.io.BufferedReader;
4+
import java.io.DataOutputStream;
5+
import java.io.InputStreamReader;
6+
import java.net.HttpURLConnection;
7+
import java.net.URL;
8+
9+
class Http {
10+
public static String get(URL url) {
11+
try {
12+
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
13+
conn.setRequestMethod("GET");
14+
conn.setRequestProperty("Accept", "application/json");
15+
16+
if (conn.getResponseCode() != 200) {
17+
return ("Failed : HTTP error code : " + conn.getResponseCode());
18+
}
19+
BufferedReader br = new BufferedReader(new InputStreamReader(
20+
(conn.getInputStream())));
21+
22+
String output;
23+
StringBuilder resultFromHttp = new StringBuilder();
24+
while ((output = br.readLine()) != null) {
25+
resultFromHttp.append(output).append("\n");
26+
}
27+
28+
br.close();
29+
conn.disconnect();
30+
return resultFromHttp.toString();
31+
} catch (Exception e) {
32+
throw new RuntimeException(e);
33+
}
34+
}
35+
36+
public static String post(URL url, String post) {
37+
try {
38+
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
39+
conn.setRequestMethod("POST");
40+
conn.setRequestProperty("Accept", "application/json");
41+
42+
String urlParameters = post;
43+
44+
conn.setDoOutput(true);
45+
DataOutputStream dos = new DataOutputStream(conn.getOutputStream());
46+
dos.writeBytes(urlParameters);
47+
dos.flush();
48+
dos.close();
49+
50+
if (conn.getResponseCode() != 200) {
51+
return ("Failed : HTTP error code : " + conn.getResponseCode());
52+
}
53+
54+
BufferedReader br = new BufferedReader(new InputStreamReader(
55+
(conn.getInputStream())));
56+
57+
String output;
58+
StringBuilder resultFromHttp = new StringBuilder();
59+
while ((output = br.readLine()) != null) {
60+
resultFromHttp.append(output).append("\n");
61+
}
62+
63+
br.close();
64+
conn.disconnect();
65+
return resultFromHttp.toString();
66+
} catch (Exception e) {
67+
throw new RuntimeException(e);
68+
}
69+
}
70+
}

0 commit comments

Comments
 (0)