fraudlabspro_ruby 3.2.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 +4 -4
- data/README.md +3 -3
- data/fraudlabspro_ruby.gemspec +2 -1
- data/lib/fraudlabspro_ruby/api/order.rb +1 -1
- data/lib/fraudlabspro_ruby/api/smsverification.rb +2 -0
- data/lib/fraudlabspro_ruby/version.rb +1 -1
- data/spec/fraudlabspro_ruby_fraudvalidation_spec.rb +65 -0
- data/spec/fraudlabspro_ruby_smsverification_spec.rb +34 -0
- data/spec/spec_helper.rb +3 -1
- metadata +8 -8
- data/spec/fraudlabspro_ruby_spec.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
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/README.md
CHANGED
@@ -2,7 +2,7 @@ FraudLabs Pro Ruby SDK
|
|
2
2
|
========================
|
3
3
|
This Ruby module enables user to easily implement fraud detection feature into their solution using the API from https://www.fraudlabspro.com.
|
4
4
|
|
5
|
-
Below are the features of this
|
5
|
+
Below are the features of this Ruby module:
|
6
6
|
- Fraud analysis and scoring
|
7
7
|
- IP address geolocation & proxy validation
|
8
8
|
- Email address validation
|
@@ -45,7 +45,7 @@ Usage Example
|
|
45
45
|
| quantity | integer | Total quantity of the transaction. |
|
46
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
47
|
| department | string | Merchant identifier to uniquely identify a product or service department. |
|
48
|
-
| payment_mode | string | Payment mode of transaction.
|
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
49
|
| card_number | string | Billing credit card number or BIN number. |
|
50
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
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. |
|
@@ -160,7 +160,7 @@ require 'fraudlabspro_ruby'
|
|
160
160
|
FraudlabsproRuby::Configuration.api_key = 'YOUR_API_KEY'
|
161
161
|
|
162
162
|
result = FraudlabsproRuby::Api::SMSVerification.sendSMS(
|
163
|
-
tel: '+
|
163
|
+
tel: '+123456789',
|
164
164
|
mesg: 'Hi, your OTP is <otp>.',
|
165
165
|
otp_timeout: 3600,
|
166
166
|
country_code: 'US'
|
data/fraudlabspro_ruby.gemspec
CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/fraudlabspro_ruby/configuration.rb",
|
33
33
|
"lib/fraudlabspro_ruby/version.rb",
|
34
34
|
"spec/spec_helper.rb",
|
35
|
-
"spec/
|
35
|
+
"spec/fraudlabspro_ruby_fraudvalidation_spec.rb",
|
36
|
+
"spec/fraudlabspro_ruby_smsverification_spec.rb"
|
36
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,6 +20,8 @@ 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] || '',
|
25
27
|
'otp_timeout' => params[:otp_timeout] || 3600,
|
@@ -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
@@ -2,6 +2,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
require 'rspec'
|
4
4
|
require 'fraudlabspro_ruby'
|
5
|
+
require 'json'
|
5
6
|
|
6
7
|
# Requires supporting files with custom matchers and macros, etc,
|
7
8
|
# in ./support/ and its subdirectories.
|
@@ -10,4 +11,5 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
10
11
|
RSpec.configure do |config|
|
11
12
|
|
12
13
|
end
|
13
|
-
|
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.2.
|
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
|