fraudlabspro_ruby 3.1.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile +6 -6
- data/Gemfile.lock +17 -17
- data/LICENSE.txt +1 -1
- data/README.md +225 -223
- data/Rakefile +2 -2
- data/fraudlabspro_ruby.gemspec +37 -36
- data/lib/fraudlabspro_ruby/api/order.rb +1 -1
- data/lib/fraudlabspro_ruby/api/smsverification.rb +3 -0
- data/lib/fraudlabspro_ruby/configuration.rb +9 -9
- data/lib/fraudlabspro_ruby/version.rb +3 -3
- data/lib/fraudlabspro_ruby.rb +8 -8
- data/spec/fraudlabspro_ruby_fraudvalidation_spec.rb +65 -0
- data/spec/fraudlabspro_ruby_smsverification_spec.rb +34 -0
- data/spec/spec_helper.rb +15 -13
- metadata +8 -8
- data/spec/fraudlabspro_ruby_spec.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c39b62485c4d279227a862995de30a27026f2afc326518b39bdb2b038a6a6102
|
4
|
+
data.tar.gz: f00a218900ca763e2ed71df4aa3633097bf1ad72f0627dc55c90dc9dc97e8464
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77d775dce9da4c15ffdbb6beea005000efee5a436cfbbe333f276d75f3362868d0f002f90a606be6669f0d3eeb4c0b15ccba4eb7b7b972b06aa48e80afc21765
|
7
|
+
data.tar.gz: 1009cef0466e73f615c4cfedf9920a0eb1cb0114baa2eae805aadf090d32bbe8b755f6a445387932802bd88b18327b069f095035f608b558bf241a7678dada0d
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
4
|
-
|
5
|
-
# Specify your gem's dependencies in fraudlabspro_ruby.gemspec
|
6
|
-
gemspec
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in fraudlabspro_ruby.gemspec
|
6
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
fraudlabspro_ruby (3.1.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
|
10
|
-
PLATFORMS
|
11
|
-
x64-mingw32
|
12
|
-
|
13
|
-
DEPENDENCIES
|
14
|
-
fraudlabspro_ruby!
|
15
|
-
|
16
|
-
BUNDLED WITH
|
17
|
-
1.16.1
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fraudlabspro_ruby (3.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
|
10
|
+
PLATFORMS
|
11
|
+
x64-mingw32
|
12
|
+
|
13
|
+
DEPENDENCIES
|
14
|
+
fraudlabspro_ruby!
|
15
|
+
|
16
|
+
BUNDLED WITH
|
17
|
+
1.16.1
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,223 +1,225 @@
|
|
1
|
-
FraudLabs Pro Ruby SDK
|
2
|
-
========================
|
3
|
-
This Ruby 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
|
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
|
-
|
21
|
-
|
22
|
-
Usage Example
|
23
|
-
============
|
24
|
-
### Validate Order
|
25
|
-
|
26
|
-
#### Object Properties
|
27
|
-
|
28
|
-
| Property Name | Property Type | Description |
|
29
|
-
| ------------------- | ------------- | ------------------------------------------------------------ |
|
30
|
-
| ip | string | IP address of online transaction. It supports both IPv4 and IPv6 address format. |
|
31
|
-
| first_name | string | User's first name. |
|
32
|
-
| last_name | string | User's last name. |
|
33
|
-
| username | string | User's username. |
|
34
|
-
| password | string | User's password. |
|
35
|
-
| email | string | User's email address. |
|
36
|
-
| phone | string | User's phone number. |
|
37
|
-
| bill_addr | string | Street address of billing address. |
|
38
|
-
| bill_city | string | City of billing address. |
|
39
|
-
| bill_state | string | State of billing address. It supports state codes, e.g. NY (New York), for state or province of United States or Canada. Please refer to [State & Province Codes](https://www.fraudlabspro.com/developer/reference/state-and-province-codes) for complete list. |
|
40
|
-
| bill_zip_code | string | Postal or ZIP code of billing address. |
|
41
|
-
| bill_country | string | Country of billing address. It requires the input of ISO-3166 alpha-2 country code, e.g. US for United States. Please refer to [Country Codes](https://www.fraudlabspro.com/developer/reference/country-codes) for complete list. |
|
42
|
-
| user_order_id | string | Merchant identifier to uniquely identify a transaction. It supports maximum of 15 characters user order id input. |
|
43
|
-
| user_order_memo | string | Merchant description of an order transaction. It supports maximum of 200 characters. |
|
44
|
-
| amount | float | Amount of the transaction. |
|
45
|
-
| quantity | integer | Total quantity of the transaction. |
|
46
|
-
| currency | string | Currency code used in the transaction. It requires the input of ISO-4217 (3 characters) currency code, e.g. USD for US Dollar. Please refer to [Currency Codes](https://www.fraudlabspro.com/developer/reference/currency-codes) for complete list. |
|
47
|
-
| department | string | Merchant identifier to uniquely identify a product or service department. |
|
48
|
-
| payment_mode | string | Payment mode of transaction.
|
49
|
-
| card_number | string | Billing credit card number or BIN number. |
|
50
|
-
| card_avs | string | The single character AVS result returned by the credit card processor. Please refer to [AVS & CVV2 Response Codes](https://www.fraudlabspro.com/developer/reference/avs-and-cvv2-response-codes) for details. |
|
51
|
-
| card_cvv | string | The single character CVV2 result returned by the credit card processor. Please refer to [AVS & CVV2 Response Codes](https://www.fraudlabspro.com/developer/reference/avs-and-cvv2-response-codes) for details. |
|
52
|
-
| ship_addr | string | Street address of shipping address. |
|
53
|
-
| ship_city | string | City of shipping address. |
|
54
|
-
| ship_state | string | State of shipping address. It supports state codes, e.g. NY - New York, for state or province of United States or Canada. Please refer to [State & Province Codes](https://www.fraudlabspro.com/developer/reference/state-and-province-codes) for complete list. |
|
55
|
-
| ship_zip_code | string | Postal or ZIP code of shipping address. |
|
56
|
-
| ship_country | string | Country of shipping address. It requires the input of ISO-3166 alpha-2 country code, e.g. US for United States. Please refer to [Country Codes](https://www.fraudlabspro.com/developer/reference/country-codes) for complete list. |
|
57
|
-
|
58
|
-
|
59
|
-
```
|
60
|
-
require 'fraudlabspro_ruby'
|
61
|
-
|
62
|
-
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
|
63
|
-
|
64
|
-
result = FraudlabsproRuby::Api::Order.validate(
|
65
|
-
ip: '146.112.62.105',
|
66
|
-
first_name: 'Hector',
|
67
|
-
last_name: 'Henderson',
|
68
|
-
email: 'hh5566@gmail.com',
|
69
|
-
phone: '561-628-8674',
|
70
|
-
|
71
|
-
# Billing information
|
72
|
-
bill_addr: '1766 PowderHouse Road',
|
73
|
-
bill_city: 'West Palm Beach',
|
74
|
-
bill_state: 'FL',
|
75
|
-
bill_zip_code: '33401',
|
76
|
-
bill_country: 'US',
|
77
|
-
|
78
|
-
# Order information
|
79
|
-
user_order_id: '67398',
|
80
|
-
user_order_memo: 'Online Shop',
|
81
|
-
amount: '79.89',
|
82
|
-
quantity: '1',
|
83
|
-
currency: 'USD',
|
84
|
-
payment_mode: FraudlabsproRuby::Api::Order::CREDIT_CARD,
|
85
|
-
card_number: '4556553172971283',
|
86
|
-
|
87
|
-
# Shipping information
|
88
|
-
ship_addr: '4469 Chestnut Street',
|
89
|
-
ship_city: 'Tampa',
|
90
|
-
ship_state: 'FL',
|
91
|
-
ship_zip_code: '33602',
|
92
|
-
ship_country: 'US'
|
93
|
-
)
|
94
|
-
```
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
### Get Transaction
|
99
|
-
|
100
|
-
#### Parameter Properties
|
101
|
-
|
102
|
-
| Parameter Name | Parameter Type | Description |
|
103
|
-
| -------------- | -------------- | ------------------------------------------------------------ |
|
104
|
-
| transaction_id | string | FraudLabs Pro transaction ID or Order ID. |
|
105
|
-
| id_type | string | ID type. Either: **FraudlabsproRuby::Api::Order::FLP_ID** or **FraudlabsproRuby::Api::Order::ORDER_ID** |
|
106
|
-
|
107
|
-
```
|
108
|
-
require 'fraudlabspro_ruby'
|
109
|
-
|
110
|
-
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
|
111
|
-
|
112
|
-
result = FraudlabsproRuby::Api::Order.getTransaction(
|
113
|
-
transaction_id: '20180713-ZNVPV4',
|
114
|
-
id_type: FraudlabsproRuby::Api::Order::FLP_ID
|
115
|
-
)
|
116
|
-
```
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
### Feedback
|
121
|
-
|
122
|
-
#### Object Properties
|
123
|
-
|
124
|
-
| Property Name | Property Type | Description |
|
125
|
-
| --------------- | ------------- | ------------------------------------------------------------ |
|
126
|
-
| transaction_id | string | Unique transaction ID generated from **Validate** function. |
|
127
|
-
| status | string | Perform APPROVE, REJECT, or REJECT_BLACKLIST action to transaction. Refer to [reference section](#feedback-status) for status code. |
|
128
|
-
| note | string | Notes for the feedback request. |
|
129
|
-
|
130
|
-
```
|
131
|
-
require 'fraudlabspro_ruby'
|
132
|
-
|
133
|
-
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
|
134
|
-
|
135
|
-
result = FraudlabsproRuby::Api::Order.feedback(
|
136
|
-
transaction_id: '20180713-ZNVPV4',
|
137
|
-
status: FraudlabsproRuby::Api::Order::APPROVE
|
138
|
-
)
|
139
|
-
```
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
## SMS Verification
|
145
|
-
|
146
|
-
### Send SMS Verification
|
147
|
-
|
148
|
-
#### Object Properties
|
149
|
-
|
150
|
-
| Property Name | Property Type | Description |
|
151
|
-
| ------------- | ------------- | ------------------------------------------------------------ |
|
152
|
-
| tel | string | The recipient mobile phone number in E164 format which is a plus followed by just numbers with no spaces or parentheses. |
|
153
|
-
| mesg | string | The message template for the SMS. Add
|
154
|
-
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
|
199
|
-
|
|
200
|
-
| FraudlabsproRuby::Api::Order::
|
201
|
-
| FraudlabsproRuby::Api::Order::
|
202
|
-
| FraudlabsproRuby::Api::Order::
|
203
|
-
| FraudlabsproRuby::Api::Order::
|
204
|
-
| FraudlabsproRuby::Api::Order::
|
205
|
-
| FraudlabsproRuby::Api::Order::
|
206
|
-
| FraudlabsproRuby::Api::Order::
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
|
215
|
-
|
|
216
|
-
| FraudlabsproRuby::Api::Order::
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
1
|
+
FraudLabs Pro Ruby SDK
|
2
|
+
========================
|
3
|
+
This Ruby 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 Ruby 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
|
+
|
21
|
+
|
22
|
+
Usage Example
|
23
|
+
============
|
24
|
+
### Validate Order
|
25
|
+
|
26
|
+
#### Object Properties
|
27
|
+
|
28
|
+
| Property Name | Property Type | Description |
|
29
|
+
| ------------------- | ------------- | ------------------------------------------------------------ |
|
30
|
+
| ip | string | IP address of online transaction. It supports both IPv4 and IPv6 address format. |
|
31
|
+
| first_name | string | User's first name. |
|
32
|
+
| last_name | string | User's last name. |
|
33
|
+
| username | string | User's username. |
|
34
|
+
| password | string | User's password. |
|
35
|
+
| email | string | User's email address. |
|
36
|
+
| phone | string | User's phone number. |
|
37
|
+
| bill_addr | string | Street address of billing address. |
|
38
|
+
| bill_city | string | City of billing address. |
|
39
|
+
| bill_state | string | State of billing address. It supports state codes, e.g. NY (New York), for state or province of United States or Canada. Please refer to [State & Province Codes](https://www.fraudlabspro.com/developer/reference/state-and-province-codes) for complete list. |
|
40
|
+
| bill_zip_code | string | Postal or ZIP code of billing address. |
|
41
|
+
| bill_country | string | Country of billing address. It requires the input of ISO-3166 alpha-2 country code, e.g. US for United States. Please refer to [Country Codes](https://www.fraudlabspro.com/developer/reference/country-codes) for complete list. |
|
42
|
+
| user_order_id | string | Merchant identifier to uniquely identify a transaction. It supports maximum of 15 characters user order id input. |
|
43
|
+
| user_order_memo | string | Merchant description of an order transaction. It supports maximum of 200 characters. |
|
44
|
+
| amount | float | Amount of the transaction. |
|
45
|
+
| quantity | integer | Total quantity of the transaction. |
|
46
|
+
| currency | string | Currency code used in the transaction. It requires the input of ISO-4217 (3 characters) currency code, e.g. USD for US Dollar. Please refer to [Currency Codes](https://www.fraudlabspro.com/developer/reference/currency-codes) for complete list. |
|
47
|
+
| department | string | Merchant identifier to uniquely identify a product or service department. |
|
48
|
+
| payment_mode | string | Payment mode of transaction. Valid values: creditcard, affirm, paypal, googlecheckout, bitcoin, cod, moneyorder, wired, bankdeposit, elviauthorized, paymitco, cybersource, sezzle, viabill, amazonpay, pmnts_gateway, giftcard, others. |
|
49
|
+
| card_number | string | Billing credit card number or BIN number. |
|
50
|
+
| card_avs | string | The single character AVS result returned by the credit card processor. Please refer to [AVS & CVV2 Response Codes](https://www.fraudlabspro.com/developer/reference/avs-and-cvv2-response-codes) for details. |
|
51
|
+
| card_cvv | string | The single character CVV2 result returned by the credit card processor. Please refer to [AVS & CVV2 Response Codes](https://www.fraudlabspro.com/developer/reference/avs-and-cvv2-response-codes) for details. |
|
52
|
+
| ship_addr | string | Street address of shipping address. |
|
53
|
+
| ship_city | string | City of shipping address. |
|
54
|
+
| ship_state | string | State of shipping address. It supports state codes, e.g. NY - New York, for state or province of United States or Canada. Please refer to [State & Province Codes](https://www.fraudlabspro.com/developer/reference/state-and-province-codes) for complete list. |
|
55
|
+
| ship_zip_code | string | Postal or ZIP code of shipping address. |
|
56
|
+
| ship_country | string | Country of shipping address. It requires the input of ISO-3166 alpha-2 country code, e.g. US for United States. Please refer to [Country Codes](https://www.fraudlabspro.com/developer/reference/country-codes) for complete list. |
|
57
|
+
|
58
|
+
|
59
|
+
```
|
60
|
+
require 'fraudlabspro_ruby'
|
61
|
+
|
62
|
+
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
|
63
|
+
|
64
|
+
result = FraudlabsproRuby::Api::Order.validate(
|
65
|
+
ip: '146.112.62.105',
|
66
|
+
first_name: 'Hector',
|
67
|
+
last_name: 'Henderson',
|
68
|
+
email: 'hh5566@gmail.com',
|
69
|
+
phone: '561-628-8674',
|
70
|
+
|
71
|
+
# Billing information
|
72
|
+
bill_addr: '1766 PowderHouse Road',
|
73
|
+
bill_city: 'West Palm Beach',
|
74
|
+
bill_state: 'FL',
|
75
|
+
bill_zip_code: '33401',
|
76
|
+
bill_country: 'US',
|
77
|
+
|
78
|
+
# Order information
|
79
|
+
user_order_id: '67398',
|
80
|
+
user_order_memo: 'Online Shop',
|
81
|
+
amount: '79.89',
|
82
|
+
quantity: '1',
|
83
|
+
currency: 'USD',
|
84
|
+
payment_mode: FraudlabsproRuby::Api::Order::CREDIT_CARD,
|
85
|
+
card_number: '4556553172971283',
|
86
|
+
|
87
|
+
# Shipping information
|
88
|
+
ship_addr: '4469 Chestnut Street',
|
89
|
+
ship_city: 'Tampa',
|
90
|
+
ship_state: 'FL',
|
91
|
+
ship_zip_code: '33602',
|
92
|
+
ship_country: 'US'
|
93
|
+
)
|
94
|
+
```
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
### Get Transaction
|
99
|
+
|
100
|
+
#### Parameter Properties
|
101
|
+
|
102
|
+
| Parameter Name | Parameter Type | Description |
|
103
|
+
| -------------- | -------------- | ------------------------------------------------------------ |
|
104
|
+
| transaction_id | string | FraudLabs Pro transaction ID or Order ID. |
|
105
|
+
| id_type | string | ID type. Either: **FraudlabsproRuby::Api::Order::FLP_ID** or **FraudlabsproRuby::Api::Order::ORDER_ID** |
|
106
|
+
|
107
|
+
```
|
108
|
+
require 'fraudlabspro_ruby'
|
109
|
+
|
110
|
+
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
|
111
|
+
|
112
|
+
result = FraudlabsproRuby::Api::Order.getTransaction(
|
113
|
+
transaction_id: '20180713-ZNVPV4',
|
114
|
+
id_type: FraudlabsproRuby::Api::Order::FLP_ID
|
115
|
+
)
|
116
|
+
```
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
### Feedback
|
121
|
+
|
122
|
+
#### Object Properties
|
123
|
+
|
124
|
+
| Property Name | Property Type | Description |
|
125
|
+
| --------------- | ------------- | ------------------------------------------------------------ |
|
126
|
+
| transaction_id | string | Unique transaction ID generated from **Validate** function. |
|
127
|
+
| status | string | Perform APPROVE, REJECT, or REJECT_BLACKLIST action to transaction. Refer to [reference section](#feedback-status) for status code. |
|
128
|
+
| note | string | Notes for the feedback request. |
|
129
|
+
|
130
|
+
```
|
131
|
+
require 'fraudlabspro_ruby'
|
132
|
+
|
133
|
+
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
|
134
|
+
|
135
|
+
result = FraudlabsproRuby::Api::Order.feedback(
|
136
|
+
transaction_id: '20180713-ZNVPV4',
|
137
|
+
status: FraudlabsproRuby::Api::Order::APPROVE
|
138
|
+
)
|
139
|
+
```
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
## SMS Verification
|
145
|
+
|
146
|
+
### Send SMS Verification
|
147
|
+
|
148
|
+
#### Object Properties
|
149
|
+
|
150
|
+
| Property Name | Property Type | Description |
|
151
|
+
| ------------- | ------------- | ------------------------------------------------------------ |
|
152
|
+
| tel | string | The recipient mobile phone number in E164 format which is a plus followed by just numbers with no spaces or parentheses. |
|
153
|
+
| mesg | string | The message template for the SMS. Add <otp> as placeholder for the actual OTP to be generated. Max length is 140 characters. |
|
154
|
+
| otp_timeout | integer | Timeout feature for OTP value in seconds. Default is 3600 seconds(1 hour). Max timeout is 86400 seconds(24 hours). |
|
155
|
+
| country_code | string | ISO 3166 country code for the recipient mobile phone number. If parameter is supplied, then some basic telephone number validation is done. |
|
156
|
+
|
157
|
+
```
|
158
|
+
require 'fraudlabspro_ruby'
|
159
|
+
|
160
|
+
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
|
161
|
+
|
162
|
+
result = FraudlabsproRuby::Api::SMSVerification.sendSMS(
|
163
|
+
tel: '+123456789',
|
164
|
+
mesg: 'Hi, your OTP is <otp>.',
|
165
|
+
otp_timeout: 3600,
|
166
|
+
country_code: 'US'
|
167
|
+
)
|
168
|
+
```
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
### Get SMS Verification Result
|
173
|
+
|
174
|
+
#### Object Properties
|
175
|
+
|
176
|
+
| Property Name | Property Type | Description |
|
177
|
+
| ------------- | :-----------: | ------------------------------------------------------------ |
|
178
|
+
| tran_id | string | The unique ID that was returned by the Send SMS Verification that triggered the OTP sms. |
|
179
|
+
| otp | string | The OTP that was sent to the recipient’s phone. |
|
180
|
+
|
181
|
+
```
|
182
|
+
require 'fraudlabspro_ruby'
|
183
|
+
|
184
|
+
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
|
185
|
+
|
186
|
+
result = FraudlabsproRuby::Api::SMSVerification.verifySMS(
|
187
|
+
tran_id: 'UNIQUE_TRANS_ID',
|
188
|
+
otp: 'OTP_RECEIVED'
|
189
|
+
)
|
190
|
+
```
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
# Reference
|
195
|
+
|
196
|
+
#### Payment Method
|
197
|
+
|
198
|
+
| Payment Method |
|
199
|
+
| ---------------------------------------------- |
|
200
|
+
| FraudlabsproRuby::Api::Order::CREDIT_CARD |
|
201
|
+
| FraudlabsproRuby::Api::Order::PAYPAL |
|
202
|
+
| FraudlabsproRuby::Api::Order::GOOGLE_CHECKOUT |
|
203
|
+
| FraudlabsproRuby::Api::Order::CASH_ON_DELIVERY |
|
204
|
+
| FraudlabsproRuby::Api::Order::MONEY_ORDER |
|
205
|
+
| FraudlabsproRuby::Api::Order::WIRE_TRANSFER |
|
206
|
+
| FraudlabsproRuby::Api::Order::BANK_DEPOSIT |
|
207
|
+
| FraudlabsproRuby::Api::Order::BITCOIN |
|
208
|
+
| FraudlabsproRuby::Api::Order::OTHERS |
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
#### Feedback Status
|
213
|
+
|
214
|
+
| Feedback Status | Description |
|
215
|
+
| ---------------------------------------------- | ------------------------------------------- |
|
216
|
+
| FraudlabsproRuby::Api::Order::APPROVE | Approves an order that under review status. |
|
217
|
+
| FraudlabsproRuby::Api::Order::REJECT | Rejects an order than under review status. |
|
218
|
+
| FraudlabsproRuby::Api::Order::REJECT_BLACKLIST | Rejects and blacklists an order. |
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
LICENCE
|
224
|
+
=====================
|
225
|
+
See the LICENSE file.
|
data/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
task :default => :spec
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
task :default => :spec
|
data/fraudlabspro_ruby.gemspec
CHANGED
@@ -1,37 +1,38 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
lib = File.expand_path("../lib", __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require "fraudlabspro_ruby/version"
|
6
|
-
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = "fraudlabspro_ruby"
|
9
|
-
s.version = FraudlabsproRuby::VERSION
|
10
|
-
s.authors = ["fraudlabspro"]
|
11
|
-
s.email = ["support@fraudlabspro.com"]
|
12
|
-
s.summary = "FraudLabs Pro Ruby SDK"
|
13
|
-
s.description = "A Ruby SDK enables user to easily implement fraud detection feature into their solution using the API from www.fraudlabspro.com"
|
14
|
-
s.homepage = "https://github.com/fraudlabspro/fraudlabspro-ruby"
|
15
|
-
s.licenses = ["MIT"]
|
16
|
-
s.require_paths = ["lib"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE.txt",
|
19
|
-
"README.md"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
"Gemfile",
|
23
|
-
"Gemfile.lock",
|
24
|
-
"LICENSE.txt",
|
25
|
-
"README.md",
|
26
|
-
"Rakefile",
|
27
|
-
"fraudlabspro_ruby.gemspec",
|
28
|
-
"lib/fraudlabspro_ruby.rb",
|
29
|
-
"lib/fraudlabspro_ruby/api.rb",
|
30
|
-
"lib/fraudlabspro_ruby/api/order.rb",
|
31
|
-
"lib/fraudlabspro_ruby/api/smsverification.rb",
|
32
|
-
"lib/fraudlabspro_ruby/configuration.rb",
|
33
|
-
"lib/fraudlabspro_ruby/version.rb",
|
34
|
-
"spec/spec_helper.rb",
|
35
|
-
"spec/
|
36
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "fraudlabspro_ruby/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "fraudlabspro_ruby"
|
9
|
+
s.version = FraudlabsproRuby::VERSION
|
10
|
+
s.authors = ["fraudlabspro"]
|
11
|
+
s.email = ["support@fraudlabspro.com"]
|
12
|
+
s.summary = "FraudLabs Pro Ruby SDK"
|
13
|
+
s.description = "A Ruby SDK enables user to easily implement fraud detection feature into their solution using the API from www.fraudlabspro.com"
|
14
|
+
s.homepage = "https://github.com/fraudlabspro/fraudlabspro-ruby"
|
15
|
+
s.licenses = ["MIT"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.md"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"fraudlabspro_ruby.gemspec",
|
28
|
+
"lib/fraudlabspro_ruby.rb",
|
29
|
+
"lib/fraudlabspro_ruby/api.rb",
|
30
|
+
"lib/fraudlabspro_ruby/api/order.rb",
|
31
|
+
"lib/fraudlabspro_ruby/api/smsverification.rb",
|
32
|
+
"lib/fraudlabspro_ruby/configuration.rb",
|
33
|
+
"lib/fraudlabspro_ruby/version.rb",
|
34
|
+
"spec/spec_helper.rb",
|
35
|
+
"spec/fraudlabspro_ruby_fraudvalidation_spec.rb",
|
36
|
+
"spec/fraudlabspro_ruby_smsverification_spec.rb"
|
37
|
+
]
|
37
38
|
end
|
@@ -54,7 +54,7 @@ module FraudlabsproRuby
|
|
54
54
|
request.set_form_data({
|
55
55
|
'key' => FraudlabsproRuby::Configuration.api_key,
|
56
56
|
'format' => params[:format] || 'json',
|
57
|
-
'source' => '
|
57
|
+
'source' => 'sdk-ruby',
|
58
58
|
'source_version' => FraudlabsproRuby::VERSION,
|
59
59
|
'flp_checksum' => params[:flp_checksum] || '',
|
60
60
|
|
@@ -20,8 +20,11 @@ module FraudlabsproRuby
|
|
20
20
|
request.set_form_data({
|
21
21
|
'key' => FraudlabsproRuby::Configuration.api_key,
|
22
22
|
'format' => params[:format] || 'json',
|
23
|
+
'source' => 'sdk-ruby',
|
24
|
+
'source_version' => FraudlabsproRuby::VERSION,
|
23
25
|
'tel' => params[:tel],
|
24
26
|
'mesg' => params[:mesg] || '',
|
27
|
+
'otp_timeout' => params[:otp_timeout] || 3600,
|
25
28
|
'country_code' => params[:country_code] || ''
|
26
29
|
})
|
27
30
|
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module FraudlabsproRuby
|
2
|
-
class Configuration
|
3
|
-
@api_key = ''
|
4
|
-
|
5
|
-
class << self
|
6
|
-
attr_accessor :api_key
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module FraudlabsproRuby
|
2
|
+
class Configuration
|
3
|
+
@api_key = ''
|
4
|
+
|
5
|
+
class << self
|
6
|
+
attr_accessor :api_key
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module FraudlabsproRuby
|
2
|
-
VERSION = "3.1
|
3
|
-
end
|
1
|
+
module FraudlabsproRuby
|
2
|
+
VERSION = "3.2.1"
|
3
|
+
end
|
data/lib/fraudlabspro_ruby.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require "fraudlabspro_ruby/api"
|
2
|
-
require "fraudlabspro_ruby/api/order"
|
3
|
-
require "fraudlabspro_ruby/api/smsverification"
|
4
|
-
require "fraudlabspro_ruby/configuration"
|
5
|
-
require "fraudlabspro_ruby/version"
|
6
|
-
|
7
|
-
module FraudlabsproRuby
|
8
|
-
end
|
1
|
+
require "fraudlabspro_ruby/api"
|
2
|
+
require "fraudlabspro_ruby/api/order"
|
3
|
+
require "fraudlabspro_ruby/api/smsverification"
|
4
|
+
require "fraudlabspro_ruby/configuration"
|
5
|
+
require "fraudlabspro_ruby/version"
|
6
|
+
|
7
|
+
module FraudlabsproRuby
|
8
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "FraudlabsproRuby" do
|
4
|
+
it "work correctly with invalid Api Key" do
|
5
|
+
FraudlabsproRuby::Configuration.api_key = ''
|
6
|
+
result = FraudlabsproRuby::Api::Order.validate(
|
7
|
+
ip: '8.8.8.8'
|
8
|
+
)
|
9
|
+
data = JSON.parse(result.body)
|
10
|
+
expect(data['fraudlabspro_message']).to eq 'INVALID API KEY'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "work correctly with Api Key exist" do
|
14
|
+
if $test_api_key == 'YOUR_API_KEY'
|
15
|
+
print "/*
|
16
|
+
* You could enter a FraudLabs Pro API Key in spec/spec_helper.rb
|
17
|
+
* for real web service calling test.
|
18
|
+
*
|
19
|
+
* You could sign up for a free API key at https://www.fraudlabspro.com/pricing
|
20
|
+
* if you do not have one.
|
21
|
+
*/"
|
22
|
+
expect($test_api_key).to eq 'YOUR_API_KEY'
|
23
|
+
else
|
24
|
+
expect($test_api_key).to_not eq 'YOUR_API_KEY'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it "work correctly with validate order" do
|
29
|
+
FraudlabsproRuby::Configuration.api_key = $test_api_key
|
30
|
+
result = FraudlabsproRuby::Api::Order.validate(
|
31
|
+
ip: '8.8.8.8'
|
32
|
+
)
|
33
|
+
data = JSON.parse(result.body)
|
34
|
+
if $test_api_key == 'YOUR_API_KEY'
|
35
|
+
expect(data['fraudlabspro_id']).to eq 'NA'
|
36
|
+
else
|
37
|
+
expect(data['ip_country']).to eq 'US'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it "work correctly with get transaction" do
|
42
|
+
FraudlabsproRuby::Configuration.api_key = $test_api_key
|
43
|
+
result = FraudlabsproRuby::Api::Order.getTransaction(
|
44
|
+
transaction_id: '20180713-ZNVPV4',
|
45
|
+
id_type: FraudlabsproRuby::Api::Order::FLP_ID
|
46
|
+
)
|
47
|
+
data = JSON.parse(result.body)
|
48
|
+
expect(data['fraudlabspro_id']).to eq 'NA'
|
49
|
+
end
|
50
|
+
|
51
|
+
it "work correctly with validate order" do
|
52
|
+
FraudlabsproRuby::Configuration.api_key = $test_api_key
|
53
|
+
result = FraudlabsproRuby::Api::Order.feedback(
|
54
|
+
transaction_id: '20180713-ZNVPV4',
|
55
|
+
status: FraudlabsproRuby::Api::Order::APPROVE
|
56
|
+
)
|
57
|
+
data = JSON.parse(result.body)
|
58
|
+
if $test_api_key == 'YOUR_API_KEY'
|
59
|
+
expect(data['fraudlabspro_message']).to eq 'INVALID API KEY'
|
60
|
+
else
|
61
|
+
expect(data['fraudlabspro_message']).to eq 'INVALID TRANSACTION ID'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "FraudlabsproRuby" do
|
4
|
+
it "work correctly with send sms" do
|
5
|
+
FraudlabsproRuby::Configuration.api_key = $test_api_key
|
6
|
+
result = FraudlabsproRuby::Api::SMSVerification.sendSMS(
|
7
|
+
tel: '+123456789',
|
8
|
+
mesg: 'Hi, your OTP is <otp>.',
|
9
|
+
otp_timeout: 3600,
|
10
|
+
country_code: 'US'
|
11
|
+
)
|
12
|
+
data = JSON.parse(result.body)
|
13
|
+
if $test_api_key == 'YOUR_API_KEY'
|
14
|
+
expect(data['error']).to eq 'API key not found.'
|
15
|
+
else
|
16
|
+
expect(data['error']).to eq 'Invalid phone number.'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it "work correctly with verify otp" do
|
21
|
+
FraudlabsproRuby::Configuration.api_key = $test_api_key
|
22
|
+
result = FraudlabsproRuby::Api::SMSVerification.verifySMS(
|
23
|
+
tran_id: 'UNIQUE_TRANS_ID',
|
24
|
+
otp: 'OTP_RECEIVED'
|
25
|
+
)
|
26
|
+
data = JSON.parse(result.body)
|
27
|
+
if $test_api_key == 'YOUR_API_KEY'
|
28
|
+
expect(data['error']).to eq 'API key not found.'
|
29
|
+
else
|
30
|
+
expect(data['error']).to eq 'Invalid OTP.'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'fraudlabspro_ruby'
|
5
|
-
|
6
|
-
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'fraudlabspro_ruby'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
$test_api_key = 'YOUR_API_KEY'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fraudlabspro_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fraudlabspro
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Ruby SDK enables user to easily implement fraud detection feature into
|
14
14
|
their solution using the API from www.fraudlabspro.com
|
@@ -32,13 +32,14 @@ files:
|
|
32
32
|
- lib/fraudlabspro_ruby/api/smsverification.rb
|
33
33
|
- lib/fraudlabspro_ruby/configuration.rb
|
34
34
|
- lib/fraudlabspro_ruby/version.rb
|
35
|
-
- spec/
|
35
|
+
- spec/fraudlabspro_ruby_fraudvalidation_spec.rb
|
36
|
+
- spec/fraudlabspro_ruby_smsverification_spec.rb
|
36
37
|
- spec/spec_helper.rb
|
37
38
|
homepage: https://github.com/fraudlabspro/fraudlabspro-ruby
|
38
39
|
licenses:
|
39
40
|
- MIT
|
40
41
|
metadata: {}
|
41
|
-
post_install_message:
|
42
|
+
post_install_message:
|
42
43
|
rdoc_options: []
|
43
44
|
require_paths:
|
44
45
|
- lib
|
@@ -53,9 +54,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
54
|
- !ruby/object:Gem::Version
|
54
55
|
version: '0'
|
55
56
|
requirements: []
|
56
|
-
|
57
|
-
|
58
|
-
signing_key:
|
57
|
+
rubygems_version: 3.3.7
|
58
|
+
signing_key:
|
59
59
|
specification_version: 4
|
60
60
|
summary: FraudLabs Pro Ruby SDK
|
61
61
|
test_files: []
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "FraudlabsproRuby" do
|
4
|
-
it "work correctly with order validate" do
|
5
|
-
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
|
6
|
-
result = FraudlabsproRuby::Api::Order.validate(
|
7
|
-
ip: '146.112.62.105'
|
8
|
-
)
|
9
|
-
expect(result).not_to be nil
|
10
|
-
expect(result.code).to eq '200'
|
11
|
-
end
|
12
|
-
|
13
|
-
it "work correctly with get transaction" do
|
14
|
-
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
|
15
|
-
result = FraudlabsproRuby::Api::Order.getTransaction(
|
16
|
-
transaction_id: '20180713-ZNVPV4',
|
17
|
-
id_type: FraudlabsproRuby::Api::Order::FLP_ID
|
18
|
-
)
|
19
|
-
expect(result).not_to be nil
|
20
|
-
expect(result.code).to eq '200'
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|