Skip to content

Commit 6ef2b90

Browse files
Add Readthedocs documentation.
1 parent a3cb8ee commit 6ef2b90

File tree

10 files changed

+603
-0
lines changed

10 files changed

+603
-0
lines changed

.readthedocs.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
# You can also specify other tool versions:
14+
# nodejs: "19"
15+
# rust: "1.64"
16+
# golang: "1.19"
17+
18+
# Build documentation in the "docs/" directory with Sphinx
19+
sphinx:
20+
configuration: docs/source/conf.py
21+
22+
# Optionally build your docs in additional formats such as PDF and ePub
23+
# formats:
24+
# - pdf
25+
# - epub
26+
27+
# Optional but recommended, declare the Python requirements required
28+
# to build your documentation
29+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
30+
python:
31+
install:
32+
- requirements: docs/requirements.txt

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Defining the exact version will make sure things don't break
2+
sphinx-book-theme==1.0.1
3+
# sphinx-pdj-theme==0.4.0
4+
myst-parser==2.0.0
5+
markdown-it-py==3.0.0
6+
sphinx-copybutton==0.5.2

docs/source/code.md

Lines changed: 243 additions & 0 deletions
Large diffs are not rendered by default.

docs/source/conf.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
# Read https://www.sphinx-doc.org/en/master/usage/configuration.html for more options available
3+
4+
# import sphinx_pdj_theme
5+
6+
# -- Project information
7+
8+
project = 'FraudLabs Pro Java'
9+
copyright = '2024, FraudLabs Pro'
10+
author = 'FraudLabs Pro'
11+
12+
release = '0.1.0'
13+
version = '0.1.0'
14+
15+
# -- General configuration
16+
17+
extensions = [
18+
'sphinx.ext.duration',
19+
'sphinx.ext.doctest',
20+
'myst_parser',
21+
'sphinx_copybutton',
22+
]
23+
24+
# https://myst-parser.readthedocs.io/en/latest/syntax/optional.html
25+
26+
myst_enable_extensions = [
27+
"colon_fence",
28+
"deflist",
29+
"fieldlist",
30+
]
31+
32+
# https://myst-parser.readthedocs.io/en/latest/configuration.html#setting-html-metadata
33+
myst_html_meta = {
34+
"description": "Use FraudLabs Pro Java SDK to screen the order transaction for payment fraud.",
35+
"keywords": "FraudLabs Pro, Fraud Prevention, Fraud Detection, Java",
36+
"google-site-verification": "DeW6mXDyMnMt4i61ZJBNuoADPimo5266DKob7Z7d6i4",
37+
}
38+
39+
# templates_path = ['_templates']
40+
41+
# -- Options for HTML output
42+
43+
html_theme = 'sphinx_book_theme'
44+
# html_theme_path = [sphinx_pdj_theme.get_html_theme_path()]
45+
46+
# PDJ theme options, see the list of available options here: https://github.com/jucacrispim/sphinx_pdj_theme/blob/master/sphinx_pdj_theme/theme.conf
47+
html_theme_options = {
48+
"use_edit_page_button": False,
49+
"use_source_button": False,
50+
"use_issues_button": False,
51+
"use_download_button": False,
52+
"use_sidenotes": False,
53+
}
54+
55+
# The name of an image file (relative to this directory) to place at the top
56+
# of the sidebar.
57+
html_logo = 'images/flp-logo-square-1200.png'
58+
59+
# Favicon
60+
html_favicon = 'images/favicon.ico'
61+
62+
html_title = "FraudLabs Pro Java"
63+
64+
# html_baseurl = "https://ip2proxy-php.readthedocs.io/en/latest/"

docs/source/images/favicon.ico

14.7 KB
Binary file not shown.
27.4 KB
Loading

docs/source/index.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FraudLabs Pro Java SDK
2+
========================
3+
This Java module enables user to easily implement fraud detection feature into their solution using the API from https://www.fraudlabspro.com.
4+
5+
Below are the features of this Java module:
6+
- Fraud analysis and scoring
7+
- IP address geolocation & proxy validation
8+
- Email address validation
9+
- Credit card issuing bank validation
10+
- Transaction velocity validation
11+
- Device transaction validation
12+
- Blacklist validation
13+
- Custom rules trigger
14+
- Email notification of fraud orders
15+
- Mobile app notification of fraud orders
16+
17+
This module requires API key to function. You may subscribe a free API key at https://www.fraudlabspro.com
18+
19+
20+
## Table of contents
21+
```{eval-rst}
22+
.. toctree::
23+
24+
self
25+
quickstart
26+
code
27+
```

docs/source/quickstart.md

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Quickstart
2+
3+
## Dependencies
4+
5+
This module requires API key to function. You may subscribe a free API key at [https://www.fraudlabspro.com](https://www.fraudlabspro.com)
6+
7+
## Installation
8+
9+
To use this module in your Java project, please visit [https://central.sonatype.com/artifact/com.fraudlabspro/fraudlabspro-java](https://central.sonatype.com/artifact/com.fraudlabspro/fraudlabspro-java) to copy the corrensponding code to your building tool.
10+
11+
## Sample Codes
12+
13+
### Validate Order
14+
15+
You can validate your order as below:
16+
17+
```java
18+
import com.fraudlabspro.*;
19+
import java.util.Hashtable;
20+
21+
public class Main {
22+
23+
public static void main(String[] args) {
24+
// Configures FraudLabs Pro API key
25+
FraudLabsPro.APIKEY = "YOUR_API_KEY";
26+
27+
// Screen Order API
28+
Order order = new Order();
29+
30+
// Sets order details
31+
Hashtable<String, String> data = new Hashtable<>();
32+
33+
data.put("ip", "146.112.62.105"); // IP parameter is mandatory
34+
data.put("first_name", "Hector");
35+
data.put("last_name", "Henderson");
36+
data.put("email", "hh5566@gmail.com");
37+
data.put("user_phone", "561-628-8674");
38+
39+
// Billing information
40+
data.put("bill_addr", "1766 PowderHouse Road");
41+
data.put("bill_city", "West Palm Beach");
42+
data.put("bill_state", "FL");
43+
data.put("bill_country", "US");
44+
data.put("bill_zip_code", "33401");
45+
data.put("number", "4556553172971283");
46+
47+
// Order information
48+
data.put("user_order_id", "67398");
49+
data.put("user_order_memo", "Online shop");
50+
data.put("amount", "79.89");
51+
data.put("quantity", "1");
52+
data.put("currency", "USD");
53+
data.put("payment_mode", order.CREDIT_CARD); // Please refer reference section for full list of payment methods
54+
55+
// Shipping information
56+
data.put("ship_addr", "4469 Chestnut Street");
57+
data.put("ship_city", "Tampa");
58+
data.put("ship_state", "FL");
59+
data.put("ship_zip_code", "33602");
60+
data.put("ship_country", "US");
61+
62+
String result = order.validate(data); // Sends order details to FraudLabs Pro
63+
}
64+
}
65+
```
66+
67+
### Get Transaction
68+
69+
You can get the details of a transaction as below:
70+
71+
```java
72+
import com.fraudlabspro.*;
73+
import java.util.Hashtable;
74+
75+
public class Main {
76+
77+
public static void main(String[] args) {
78+
// Configures FraudLabs Pro API key
79+
FraudLabsPro.APIKEY = "YOUR_API_KEY";
80+
81+
// Get Order Result API
82+
Order orderResults = new Order();
83+
84+
// Sets order ID to return all available information regarding the order
85+
Hashtable<String, String> data = new Hashtable<>();
86+
data.put("id", "20180709-NHAEUK");
87+
data.put("id_type", orderResults.FLP_ID);
88+
89+
String result = orderResults.getTransaction(data); // Obtains order results from FraudLabs Pro
90+
}
91+
}
92+
```
93+
94+
### Feedback
95+
96+
You can approve, reject or ignore a transaction as below:
97+
98+
```java
99+
import com.fraudlabspro.*;
100+
import java.util.Hashtable;
101+
102+
public class Main {
103+
104+
public static void main(String[] args) {
105+
// Configures FraudLabs Pro API key
106+
FraudLabsPro.APIKEY = "YOUR_API_KEY";
107+
108+
// Feedback Order API
109+
Order fb = new Order();
110+
111+
// Sets feedback details
112+
Hashtable<String, String> data = new Hashtable<>();
113+
data.put("id", "20180709-NHAEUK");
114+
data.put("action", fb.APPROVE); // Please refer to reference section for full list of feedback statuses
115+
data.put("note", "This customer made a valid purchase before.");
116+
117+
String result = fb.feedback(data); // Sends feedback details to FraudLabs Pro
118+
}
119+
}
120+
```
121+
122+
### Send SMS Verification
123+
124+
You can send SMS verification for authentication purpose as below:
125+
126+
```java
127+
import com.fraudlabspro.*;
128+
import java.util.Hashtable;
129+
130+
public class Main {
131+
132+
public static void main(String[] args) {
133+
// Configures FraudLabs Pro API key
134+
FraudLabsPro.APIKEY = "YOUR_API_KEY";
135+
136+
// Send SMS Verification API
137+
SMSVerification sms = new SMSVerification();
138+
139+
// Sets SMS details for authentication purpose
140+
Hashtable<String, String> data = new Hashtable<>();
141+
data.put("tel", "+123456789");
142+
data.put("country_code", "US");
143+
data.put("mesg", "Hi, your OTP is <otp>.");
144+
data.put("otp_timeout", 3600);
145+
146+
String result = sms.sendSMS(data);
147+
}
148+
}
149+
```
150+
151+
### Get SMS Verification Result
152+
153+
You can verify the OTP sent by Fraudlabs Pro SMS verification API as below:
154+
155+
```java
156+
import com.fraudlabspro.*;
157+
import java.util.Hashtable;
158+
159+
public class Main {
160+
161+
public static void main(String[] args) {
162+
// Configures FraudLabs Pro API key
163+
FraudLabsPro.APIKEY = "YOUR_API_KEY";
164+
165+
// Get Verification Result API
166+
SMSVerification verification = new SMSVerification();
167+
168+
// Sets transaction ID and otp details for verification purpose
169+
Hashtable<String, String> data = new Hashtable<>();
170+
data.put("tran_id", "UNIQUE_TRANS_ID");
171+
data.put("otp", "OTP_RECEIVED");
172+
173+
String result = verification.verifySMS(data);
174+
}
175+
}
176+
```

0 commit comments

Comments
 (0)