Skip to content

Commit c4ef3de

Browse files
Update Readthedocs documentation.
1 parent c2f8b18 commit c4ef3de

4 files changed

Lines changed: 119 additions & 145 deletions

File tree

docs/source/code.md

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# FraudLabs Pro PHP API
1+
# FraudLabs Pro Ruby API
22

33
## Configuration Class
44
```{py:class} Configuration(api_key)
@@ -7,18 +7,22 @@ Configure FraudLabs Pro API key.
77
:param str api_key: (Required) FraudLabs Pro API key.
88
```
99

10-
## FraudValidation Class
11-
```{py:class} FraudValidation(config_object)
12-
Initiate FraudValidation class.
10+
## Order Class
11+
```{py:class} Order(config_object)
12+
Initiate Order class.
1313
1414
:param object config_object: (Required) The configuration object returned by Configuration Class.
1515
```
1616

17-
```{py:function} getTransaction(id, type)
17+
```{py:function} getTransaction(params)
1818
Retrieve an existing transaction from FraudLabs Pro fraud detection system.
1919
20-
:param str id: (Required) FraudLabs Pro transaction ID or Order ID.
21-
:param str type: (Required) ID type. Either: **FraudLabsPro\FraudValidation::FLP_ID** or **FraudLabsPro\FraudValidation::ORDER_ID**
20+
:param array params: (Required) The parameters of the transaction details.
21+
22+
| Parameter Name | Parameter Type | Description |
23+
| -------------- | -------------- | ------------------------------------------------------------ |
24+
| transaction_id | string | FraudLabs Pro transaction ID or Order ID. |
25+
| id_type | string | ID type. Either: **FraudlabsproRuby::Api::Order::FLP_ID** or **FraudlabsproRuby::Api::Order::ORDER_ID** |
2226
2327
:return: Returns the details about the transaction in JSON object.
2428
:rtype: Object
@@ -89,8 +93,8 @@ Approve, reject or ignore a transaction.
8993
9094
| Parameter | Type | Description |
9195
|--------------|---------|---------------------|
92-
| id | string | (required) Unique transaction Id generated by Fraud Check API. |
93-
| action | string | (required) Perform APPROVE, REJECT, or REJECT_BLACKLIST action to transaction.<br/>• APPROVE: Approve a transaction<br/>• REJECT: Reject a transaction<br/>• REJECT_BLACKLIST: Reject and blacklist the transaction<br/>When a transaction was blacklisted, the information will be recorded into the system for future blacklist validation check. |
96+
| transaction_id | string | (required) Unique transaction Id generated by Fraud Check API. |
97+
| status | string | (required) Perform APPROVE, REJECT, or REJECT_BLACKLIST action to transaction.<br/>• APPROVE: Approve a transaction<br/>• REJECT: Reject a transaction<br/>• REJECT_BLACKLIST: Reject and blacklist the transaction<br/>When a transaction was blacklisted, the information will be recorded into the system for future blacklist validation check. |
9498
| note | integer | (optional) Notes for the feedback request. |
9599
```
96100

@@ -102,32 +106,32 @@ Retrieve geolocation information for an IP address.
102106
| Parameter | Type | Description |
103107
|-----------------|---------|-----------------|
104108
| ip | string | (required) IP address of online transaction. It supports both IPv4 and IPv6 address format. |
105-
| billing->lastName | string | (optional) User's last name. |
106-
| billing->firstName | string | (optional) User's first name. |
107-
| billing->username | string | (optional) User's username. |
108-
| billing->password | string | (optional) User's password. |
109-
| billing->email | string | (optional) User's email address. |
110-
| billing->phone | string | (optional) User's phone number. |
111-
| billing->address | string | (optional) Street address of billing address. |
112-
| billing->city | string | (optional) City of billing address. |
113-
| billing->state | string | (optional) State of billing address. It supports state codes, e.g. NY (New York), for state or province of United States or Canada.|
114-
| billing->country | string | (optional) Country of billing address. It requires the input of ISO-3166 alpha-2 country code, e.g. US for United States.|
115-
| billing->postcode | string | (optional) Postal or ZIP code of billing address. |
116-
| shipping->address | string | (optional) Street address of shipping address. |
117-
| shipping->city | string | (optional) City of shipping address. |
118-
| shipping->state | string | (optional) State of shipping address. It supports state codes, e.g. NY - New York, for state or province of United States or Canada. |
119-
| shipping->country | string | (optional) Country of shipping address. It requires the input of ISO-3166 alpha-2 country code, e.g. US for United States. |
120-
| shipping->postcode | string | (optional) Postal or ZIP code of shipping address. |
121-
| card->number | string | Billing credit card number or BIN number. |
122-
| card->avs | string | (optional) The single character AVS result returned by the credit card processor. |
123-
| card->cvv | string | (optional) The single character CVV2 result returned by the credit card processor.<br/> This is not for the input of the actual CVV code from the back of the credit card. |
124-
| order->orderId | string | (optional) Merchant identifier to uniquely identify a transaction. It supports<br/> maximum of 15 characters user order id input. |
125-
| order->note | string | (optional) Merchant description of an order transaction. It supports maximum of 200 characters. |
126-
| order->amount | decimal | (optional) Amount of the transaction. |
127-
| order->quantity | integer | (optional) Total quantity of the transaction. |
128-
| order->currency | string | (optional) Currency code used in the transaction. It requires the input of<br/> ISO-4217 (3 characters) currency code, e.g. USD for US Dollar. |
129-
| order->department | string | (optional) Merchant identifier to uniquely identify a product or service department. |
130-
| order->paymentMethod | string | (optional) Payment mode of transaction. Valid values: creditcard \| affirm \| paypal \| googlecheckout \| bitcoin \| cod \| moneyorder \| wired \|<br/> bankdeposit \| elviauthorized \| paymitco \| cybersource \| sezzle \| viabill \| amazonpay \| pmnts_gateway \| giftcard \| ewayrapid \| others. |
109+
| last_name | string | (optional) User's last name. |
110+
| first_name | string | (optional) User's first name. |
111+
| username | string | (optional) User's username. |
112+
| password | string | (optional) User's password. |
113+
| email | string | (optional) User's email address. |
114+
| phone | string | (optional) User's phone number. |
115+
| bill_addr | string | (optional) Street address of billing address. |
116+
| bill_city | string | (optional) City of billing address. |
117+
| bill_state | string | (optional) State of billing address. It supports state codes, e.g. NY (New York), for state or province of United States or Canada.|
118+
| bill_country | string | (optional) Country of billing address. It requires the input of ISO-3166 alpha-2 country code, e.g. US for United States.|
119+
| bill_zip_code | string | (optional) Postal or ZIP code of billing address. |
120+
| ship_addr | string | (optional) Street address of shipping address. |
121+
| ship_city | string | (optional) City of shipping address. |
122+
| ship_state | string | (optional) State of shipping address. It supports state codes, e.g. NY - New York, for state or province of United States or Canada. |
123+
| ship_country | string | (optional) Country of shipping address. It requires the input of ISO-3166 alpha-2 country code, e.g. US for United States. |
124+
| ship_zip_code | string | (optional) Postal or ZIP code of shipping address. |
125+
| card_number | string | Billing credit card number or BIN number. |
126+
| card_avs | string | (optional) The single character AVS result returned by the credit card processor. |
127+
| card_cvv | string | (optional) The single character CVV2 result returned by the credit card processor.<br/> This is not for the input of the actual CVV code from the back of the credit card. |
128+
| user_order_id | string | (optional) Merchant identifier to uniquely identify a transaction. It supports<br/> maximum of 15 characters user order id input. |
129+
| user_order_memo | string | (optional) Merchant description of an order transaction. It supports maximum of 200 characters. |
130+
| amount | decimal | (optional) Amount of the transaction. |
131+
| quantity | integer | (optional) Total quantity of the transaction. |
132+
| currency | string | (optional) Currency code used in the transaction. It requires the input of<br/> ISO-4217 (3 characters) currency code, e.g. USD for US Dollar. |
133+
| department | string | (optional) Merchant identifier to uniquely identify a product or service department. |
134+
| payment_mode | string | (optional) Payment mode of transaction. Valid values: creditcard \| affirm \| paypal \| googlecheckout \| bitcoin \| cod \| moneyorder \| wired \|<br/> bankdeposit \| elviauthorized \| paymitco \| cybersource \| sezzle \| viabill \| amazonpay \| pmnts_gateway \| giftcard \| ewayrapid \| others. |
131135
132136
:return: Returns the geolocation information in array. Refer below table for the fields avaliable in the array
133137
:rtype: array
@@ -194,14 +198,14 @@ Retrieve geolocation information for an IP address.
194198
| remaining_credits | integer | Balance of queries in your account after this transaction. |
195199
```
196200

197-
## SmsVerification Class
198-
```{py:class} SmsVerification(config_object)
199-
Initiate SmsVerification class.
201+
## SMSVerification Class
202+
```{py:class} SMSVerification(config_object)
203+
Initiate SMSVerification class.
200204
201205
:param object config_object: (Required) The configuration object returned by Configuration Class.
202206
```
203207

204-
```{py:function} sendSms(params)
208+
```{py:function} sendSMS(params)
205209
Send SMS Verification for authentication.
206210
207211
:param str params: (Required) Parameters of sms details.
@@ -224,7 +228,7 @@ Send SMS Verification for authentication.
224228
225229
```
226230

227-
```{py:function} verifyOtp(id, type)
231+
```{py:function} verifySMS(id, type)
228232
Get SMS Verification result.
229233
230234
:param str params: (Required) Parameters of sms details.

docs/source/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# -- Project information
77

8-
project = 'FraudLabs Pro PHP'
8+
project = 'FraudLabs Pro Ruby'
99
copyright = '2024, FraudLabs Pro'
1010
author = 'FraudLabs Pro'
1111

@@ -31,8 +31,8 @@
3131

3232
# https://myst-parser.readthedocs.io/en/latest/configuration.html#setting-html-metadata
3333
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",
34+
"description": "FraudLabs Pro Ruby SDK to screen the order transaction for payment fraud.",
35+
"keywords": "FraudLabs Pro, Fraud Prevention, Fraud Detection, Ruby",
3636
"google-site-verification": "DeW6mXDyMnMt4i61ZJBNuoADPimo5266DKob7Z7d6i4",
3737
}
3838

@@ -59,6 +59,6 @@
5959
# Favicon
6060
html_favicon = 'images/favicon.ico'
6161

62-
html_title = "FraudLabs Pro PHP"
62+
html_title = "FraudLabs Pro Ruby"
6363

6464
# html_baseurl = "https://ip2proxy-php.readthedocs.io/en/latest/"

docs/source/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FraudLabs Pro PHP SDK
1+
FraudLabs Pro Ruby SDK
22
========================
3-
This PHP module enables user to easily implement fraud detection feature into their solution using the API from https://www.fraudlabspro.com.
3+
This Ruby module enables user to easily implement fraud detection feature into their solution using the API from https://www.fraudlabspro.com.
44

5-
Below are the features of this PHP module:
5+
Below are the features of this Ruby module:
66
- Fraud analysis and scoring
77
- IP address geolocation & proxy validation
88
- Email address validation

docs/source/quickstart.md

Lines changed: 68 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This module requires API key to function. You may subscribe a free API key at ht
99
Install this package using the command as below:
1010

1111
```
12-
composer require fraudlabspro/fraudlabspro-php
12+
gem install fraudlabspro_ruby
1313
```
1414

1515
## Sample Codes
@@ -18,132 +18,102 @@ composer require fraudlabspro/fraudlabspro-php
1818

1919
You can validate your order as below:
2020

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);
21+
```ruby
22+
require 'fraudlabspro_ruby'
23+
24+
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
25+
26+
result = FraudlabsproRuby::Api::Order.validate(
27+
ip: '146.112.62.105',
28+
first_name: 'Hector',
29+
last_name: 'Henderson',
30+
31+
phone: '561-628-8674',
32+
33+
# Billing information
34+
bill_addr: '1766 PowderHouse Road',
35+
bill_city: 'West Palm Beach',
36+
bill_state: 'FL',
37+
bill_zip_code: '33401',
38+
bill_country: 'US',
39+
40+
# Order information
41+
user_order_id: '67398',
42+
user_order_memo: 'Online Shop',
43+
amount: '79.89',
44+
quantity: '1',
45+
currency: 'USD',
46+
payment_mode: FraudlabsproRuby::Api::Order::CREDIT_CARD,
47+
card_number: '4556553172971283',
48+
49+
# Shipping information
50+
ship_addr: '4469 Chestnut Street',
51+
ship_city: 'Tampa',
52+
ship_state: 'FL',
53+
ship_zip_code: '33602',
54+
ship_country: 'US'
55+
)
7356
```
7457

7558
### Get Transaction
7659

7760
You can get the details of a transaction as below:
7861

79-
```php
80-
<?php
81-
require_once __DIR__.'/vendor/autoload.php';
62+
```ruby
63+
require 'fraudlabspro_ruby'
8264

83-
// Configures FraudLabs Pro API key
84-
$config = new FraudLabsPro\Configuration('YOUR_API_KEY');
85-
$fraudlabspro = new FraudLabsPro\FraudValidation($config);
65+
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
8666

87-
$result = $fraudlabspro->getTransaction('20170906MXFHSTRF', FraudLabsPro\FraudValidation::FLP_ID);
67+
result = FraudlabsproRuby::Api::Order.getTransaction(
68+
transaction_id: '20180713-ZNVPV4',
69+
id_type: FraudlabsproRuby::Api::Order::FLP_ID
70+
)
8871
```
8972

9073
### Feedback
9174

9275
You can approve, reject or ignore a transaction as below:
9376

94-
```php
95-
<?php
96-
require_once __DIR__.'/vendor/autoload.php';
77+
```ruby
78+
require 'fraudlabspro_ruby'
9779

98-
// Configures FraudLabs Pro API key
99-
$config = new FraudLabsPro\Configuration('YOUR_API_KEY');
100-
$fraudlabspro = new FraudLabsPro\FraudValidation($config);
80+
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
10181

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-
]);
82+
result = FraudlabsproRuby::Api::Order.feedback(
83+
transaction_id: '20180713-ZNVPV4',
84+
status: FraudlabsproRuby::Api::Order::APPROVE
85+
)
10886

10987
```
11088

11189
### Send SMS Verification
11290

11391
You can send SMS verification for authentication purpose as below:
11492

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-
]);
93+
```ruby
94+
require 'fraudlabspro_ruby'
95+
96+
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
97+
98+
result = FraudlabsproRuby::Api::SMSVerification.sendSMS(
99+
tel: '+123456789',
100+
mesg: 'Hi, your OTP is <otp>.',
101+
otp_timeout: 3600,
102+
country_code: 'US'
103+
)
130104
```
131105

132106
### Get SMS Verification Result
133107

134108
You can verify the OTP sent by Fraudlabs Pro SMS verification API as below:
135109

136-
```php
137-
<?php
138-
require_once __DIR__.'/vendor/autoload.php';
110+
```ruby
111+
require 'fraudlabspro_ruby'
139112

140-
// Configures FraudLabs Pro API key
141-
$config = new FraudLabsPro\Configuration('YOUR_API_KEY');
142-
$fraudlabsproSms = new \FraudLabsPro\SmsVerification($config);
113+
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
143114

144-
// Get SMS Verification result
145-
$fraudlabsproSms->verifyOtp([
146-
'tran_id' => 'UNIQUE_TRANS_ID',
147-
'otp' => 'OTP_RECEIVED',
148-
]);
115+
result = FraudlabsproRuby::Api::SMSVerification.verifySMS(
116+
tran_id: 'UNIQUE_TRANS_ID',
117+
otp: 'OTP_RECEIVED'
118+
)
149119
```

0 commit comments

Comments
 (0)