Skip to content

Commit c2f8b18

Browse files
Add Readthedocs documentation.
1 parent 70ac105 commit c2f8b18

10 files changed

Lines changed: 576 additions & 0 deletions

File tree

.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 PHP'
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": "FraudLabs Pro PHP SDK to screen the order transaction for payment fraud.",
35+
"keywords": "FraudLabs Pro, Fraud Prevention, Fraud Detection, PHP",
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 PHP"
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 PHP SDK
2+
========================
3+
This PHP 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 PHP 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: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
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
6+
7+
## Installation
8+
9+
Install this package using the command as below:
10+
11+
```
12+
composer require fraudlabspro/fraudlabspro-php
13+
```
14+
15+
## Sample Codes
16+
17+
### Validate Order
18+
19+
You can validate your order as below:
20+
21+
```php
22+
<?php
23+
require_once __DIR__.'/vendor/autoload.php';
24+
25+
// Configures FraudLabs Pro API key
26+
$config = new FraudLabsPro\Configuration('YOUR_API_KEY');
27+
$fraudlabspro = new FraudLabsPro\FraudValidation($config);
28+
29+
// Order details
30+
$orderDetails = [
31+
// IP parameter is optional, this library can detects IP address automatically
32+
'ip' => '146.112.62.105',
33+
34+
'order' => [
35+
'orderId' => '67398',
36+
'note' => 'Online shop',
37+
'currency' => 'USD',
38+
'amount' => '79.89',
39+
'quantity' => 1,
40+
41+
// Please refer reference section for full list of payment methods
42+
'paymentMethod' => FraudLabsPro\FraudValidation::CREDIT_CARD,
43+
],
44+
45+
'card' => [
46+
'number' => '4556553172971283',
47+
],
48+
49+
'billing' => [
50+
'firstName' => 'Hector',
51+
'lastName' => 'Henderson',
52+
'email' => '[email protected]',
53+
'phone' => '561-628-8674',
54+
55+
'address' => '1766 Powder House Road',
56+
'city' => 'West Palm Beach',
57+
'state' => 'FL',
58+
'postcode' => '33401',
59+
'country' => 'US',
60+
],
61+
62+
'shipping' => [
63+
'address' => '4469 Chestnut Street',
64+
'city' => 'Tampa',
65+
'state' => 'FL',
66+
'postcode' => '33602',
67+
'country' => 'US',
68+
],
69+
];
70+
71+
// Sends the order details to FraudLabs Pro
72+
$result = $fraudlabspro->validate($orderDetails);
73+
```
74+
75+
### Get Transaction
76+
77+
You can get the details of a transaction as below:
78+
79+
```php
80+
<?php
81+
require_once __DIR__.'/vendor/autoload.php';
82+
83+
// Configures FraudLabs Pro API key
84+
$config = new FraudLabsPro\Configuration('YOUR_API_KEY');
85+
$fraudlabspro = new FraudLabsPro\FraudValidation($config);
86+
87+
$result = $fraudlabspro->getTransaction('20170906MXFHSTRF', FraudLabsPro\FraudValidation::FLP_ID);
88+
```
89+
90+
### Feedback
91+
92+
You can approve, reject or ignore a transaction as below:
93+
94+
```php
95+
<?php
96+
require_once __DIR__.'/vendor/autoload.php';
97+
98+
// Configures FraudLabs Pro API key
99+
$config = new FraudLabsPro\Configuration('YOUR_API_KEY');
100+
$fraudlabspro = new FraudLabsPro\FraudValidation($config);
101+
102+
$fraudlabspro->feedback([
103+
'id' => '20170906MXFHSTRF',
104+
// Please refer to reference section for full list of feedback statuses
105+
'status' => FraudLabsPro\FraudValidation::APPROVE,
106+
'note' => 'This customer made a valid purchase before.',
107+
]);
108+
109+
```
110+
111+
### Send SMS Verification
112+
113+
You can send SMS verification for authentication purpose as below:
114+
115+
```php
116+
<?php
117+
require_once __DIR__.'/vendor/autoload.php';
118+
119+
// Configures FraudLabs Pro API key
120+
$config = new FraudLabsPro\Configuration('YOUR_API_KEY');
121+
$fraudlabsproSms = new \FraudLabsPro\SmsVerification($config);
122+
123+
// Send SMS Verification
124+
$fraudlabsproSms->sendSms([
125+
'tel' => '+123456789',
126+
'mesg' => 'Hi, your OTP is <otp>.',
127+
'otp_timeout' => 3600,
128+
'country_code' => 'US',
129+
]);
130+
```
131+
132+
### Get SMS Verification Result
133+
134+
You can verify the OTP sent by Fraudlabs Pro SMS verification API as below:
135+
136+
```php
137+
<?php
138+
require_once __DIR__.'/vendor/autoload.php';
139+
140+
// Configures FraudLabs Pro API key
141+
$config = new FraudLabsPro\Configuration('YOUR_API_KEY');
142+
$fraudlabsproSms = new \FraudLabsPro\SmsVerification($config);
143+
144+
// Get SMS Verification result
145+
$fraudlabsproSms->verifyOtp([
146+
'tran_id' => 'UNIQUE_TRANS_ID',
147+
'otp' => 'OTP_RECEIVED',
148+
]);
149+
```

0 commit comments

Comments
 (0)