fraudlabspro_ruby 3.2.1 → 4.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c39b62485c4d279227a862995de30a27026f2afc326518b39bdb2b038a6a6102
4
- data.tar.gz: f00a218900ca763e2ed71df4aa3633097bf1ad72f0627dc55c90dc9dc97e8464
3
+ metadata.gz: 486c924794b9bc2cbc50600be9217de8b4ca7e6a8e4d4e13e8c6ac0e2d399772
4
+ data.tar.gz: ffcfc769d26491207132e6f982a49b7c4ec2d566d95b8944579bc20b2f7e65ea
5
5
  SHA512:
6
- metadata.gz: 77d775dce9da4c15ffdbb6beea005000efee5a436cfbbe333f276d75f3362868d0f002f90a606be6669f0d3eeb4c0b15ccba4eb7b7b972b06aa48e80afc21765
7
- data.tar.gz: 1009cef0466e73f615c4cfedf9920a0eb1cb0114baa2eae805aadf090d32bbe8b755f6a445387932802bd88b18327b069f095035f608b558bf241a7678dada0d
6
+ metadata.gz: eca6230b61d98b13b69e9ff1e80d304e983bbcc9276a66ebfcf736a09ec5852f99fd403a0086896b79617ee7586c000f0ceb61a0a2e09bb26f837769b4576ed7
7
+ data.tar.gz: f1dc37493073b91b1f48b4e906279b3b85346bc05376688a53a87cce2bdcd101f9ab125f7abcfc42c64ea7b4f79d3991ce1724b0c71555e6f8e65c4ec5b0a441
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 FraudLabsPro.com
3
+ Copyright (c) 2024 FraudLabsPro.com
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -16,179 +16,8 @@ Below are the features of this Ruby module:
16
16
 
17
17
  This module requires API key to function. You may subscribe a free API key at https://www.fraudlabspro.com
18
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
-
19
+ # Developer Documentation
20
+ To learn more about installation, usage, and code examples, please visit the developer documentation at [https://fraudlabspro-ruby.readthedocs.io/en/latest/index.html.](https://fraudlabspro-ruby.readthedocs.io/en/latest/index.html)
192
21
 
193
22
 
194
23
  # Reference
@@ -199,12 +28,11 @@ result = FraudlabsproRuby::Api::SMSVerification.verifySMS(
199
28
  | ---------------------------------------------- |
200
29
  | FraudlabsproRuby::Api::Order::CREDIT_CARD |
201
30
  | FraudlabsproRuby::Api::Order::PAYPAL |
202
- | FraudlabsproRuby::Api::Order::GOOGLE_CHECKOUT |
203
31
  | FraudlabsproRuby::Api::Order::CASH_ON_DELIVERY |
204
- | FraudlabsproRuby::Api::Order::MONEY_ORDER |
205
- | FraudlabsproRuby::Api::Order::WIRE_TRANSFER |
206
32
  | FraudlabsproRuby::Api::Order::BANK_DEPOSIT |
207
- | FraudlabsproRuby::Api::Order::BITCOIN |
33
+ | FraudlabsproRuby::Api::Order::GIFT_CARD |
34
+ | FraudlabsproRuby::Api::Order::CRYPTO |
35
+ | FraudlabsproRuby::Api::Order::WIRE_TRANSFER |
208
36
  | FraudlabsproRuby::Api::Order::OTHERS |
209
37
 
210
38
 
@@ -16,12 +16,11 @@ module FraudlabsproRuby
16
16
  # Payment methods.
17
17
  CREDIT_CARD = 'CREDITCARD'
18
18
  PAYPAL = 'PAYPAL';
19
- GOOGLE_CHECKOUT = 'GOOGLECHECKOUT';
20
19
  CASH_ON_DELIVERY = 'COD';
21
- MONEY_ORDER = 'MONEYORDER';
22
- WIRE_TRANSFER = 'WIRED';
23
20
  BANK_DEPOSIT = 'BANKDEPOSIT';
24
- BITCOIN = 'BITCOIN';
21
+ GIFT_CARD = 'GIFTCARD';
22
+ CRYPTO = 'CRYPTO';
23
+ WIRE_TRANSFER = 'WIRED';
25
24
  OTHERS = 'OTHERS';
26
25
 
27
26
  # ID types.
@@ -47,13 +46,13 @@ module FraudlabsproRuby
47
46
  params[:card_number] = params[:card_number][0..5]
48
47
  end
49
48
 
50
- uri = URI.parse("https://api.fraudlabspro.com/v1/order/screen")
49
+ uri = URI.parse("https://api.fraudlabspro.com/v2/order/screen")
51
50
  http = Net::HTTP.new(uri.host, uri.port)
52
51
  http.use_ssl = true
53
52
  request = Net::HTTP::Post.new(uri.request_uri)
54
53
  request.set_form_data({
55
54
  'key' => FraudlabsproRuby::Configuration.api_key,
56
- 'format' => params[:format] || 'json',
55
+ 'format' => 'json',
57
56
  'source' => 'sdk-ruby',
58
57
  'source_version' => FraudlabsproRuby::VERSION,
59
58
  'flp_checksum' => params[:flp_checksum] || '',
@@ -63,7 +62,6 @@ module FraudlabsproRuby
63
62
  'first_name' => params[:first_name] || '',
64
63
  'last_name' => params[:last_name] || '',
65
64
  'username_hash' => do_hash(params[:username]) || '',
66
- 'password_hash' => do_hash(params[:password]) || '',
67
65
  'email' => params[:email] || '',
68
66
  'email_domain' => email_domain || '',
69
67
  'user_phone' => params[:phone] || '',
@@ -80,6 +78,7 @@ module FraudlabsproRuby
80
78
  'quantity' => params[:quantity] || 1,
81
79
  'currency' => params[:currency] || 'USD',
82
80
  'department' => params[:department] || '',
81
+ 'payment_gateway' => params[:payment_gateway] || '',
83
82
  'payment_mode' => params[:payment_mode] || '',
84
83
 
85
84
  # Credit card information.
@@ -89,6 +88,8 @@ module FraudlabsproRuby
89
88
  'cvv_result' => params[:card_cvv] || '',
90
89
 
91
90
  # Shipping information.
91
+ 'ship_first_name' => params[:ship_first_name] || '',
92
+ 'ship_last_name' => params[:ship_last_name] || '',
92
93
  'ship_addr' => params[:ship_addr] || '',
93
94
  'ship_city' => params[:ship_city] || '',
94
95
  'ship_state' => params[:ship_state] || '',
@@ -107,13 +108,13 @@ module FraudlabsproRuby
107
108
 
108
109
  # Sends feedback back to FraudLabs Pro.
109
110
  def self.feedback(params = {})
110
- uri = URI.parse("https://api.fraudlabspro.com/v1/order/feedback")
111
+ uri = URI.parse("https://api.fraudlabspro.com/v2/order/feedback")
111
112
  http = Net::HTTP.new(uri.host, uri.port)
112
113
  http.use_ssl = true
113
114
  request = Net::HTTP::Post.new(uri.request_uri)
114
115
  request.set_form_data({
115
116
  'key' => FraudlabsproRuby::Configuration.api_key,
116
- 'format' => params[:format] || 'xml',
117
+ 'format' => 'json',
117
118
  'id' => params[:transaction_id],
118
119
  'action' => params[:status] || '',
119
120
  'note' => params[:note] || ''
@@ -130,15 +131,11 @@ module FraudlabsproRuby
130
131
 
131
132
  # Gets transaction result.
132
133
  def self.getTransaction(params = {})
133
- if params[:format] == nil
134
- params[:format] = 'xml'
135
- end
136
-
137
134
  if params[:id_type] == nil
138
135
  params[:id_type] = ''
139
136
  end
140
137
 
141
- uri = URI.parse("https://api.fraudlabspro.com/v1/order/result?key=" + FraudlabsproRuby::Configuration.api_key + "&format=" + params[:format] + "&id=" + params[:transaction_id] + "&id_type=" + params[:id_type])
138
+ uri = URI.parse("https://api.fraudlabspro.com/v2/order/result?key=" + FraudlabsproRuby::Configuration.api_key + "&format=json&id=" + params[:transaction_id] + "&id_type=" + params[:id_type])
142
139
  http = Net::HTTP.new(uri.host, uri.port)
143
140
  http.use_ssl = true
144
141
  request = Net::HTTP::Get.new(uri.request_uri)
@@ -13,13 +13,13 @@ module FraudlabsproRuby
13
13
  params[:tel] = '+' + params[:tel]
14
14
  end
15
15
 
16
- uri = URI.parse("https://api.fraudlabspro.com/v1/verification/send")
16
+ uri = URI.parse("https://api.fraudlabspro.com/v2/verification/send")
17
17
  http = Net::HTTP.new(uri.host, uri.port)
18
18
  http.use_ssl = true
19
19
  request = Net::HTTP::Post.new(uri.request_uri)
20
20
  request.set_form_data({
21
21
  'key' => FraudlabsproRuby::Configuration.api_key,
22
- 'format' => params[:format] || 'json',
22
+ 'format' => 'json',
23
23
  'source' => 'sdk-ruby',
24
24
  'source_version' => FraudlabsproRuby::VERSION,
25
25
  'tel' => params[:tel],
@@ -39,11 +39,7 @@ module FraudlabsproRuby
39
39
 
40
40
  # Get Verification result.
41
41
  def self.verifySMS(params = {})
42
- if params[:format] == nil
43
- params[:format] = 'json'
44
- end
45
-
46
- uri = URI.parse("https://api.fraudlabspro.com/v1/verification/result?key=" + FraudlabsproRuby::Configuration.api_key + "&format=" + params[:format] + "&tran_id=" + params[:tran_id] + "&otp=" + params[:otp])
42
+ uri = URI.parse("https://api.fraudlabspro.com/v2/verification/result?key=" + FraudlabsproRuby::Configuration.api_key + "&format=json&tran_id=" + params[:tran_id] + "&otp=" + params[:otp])
47
43
  http = Net::HTTP.new(uri.host, uri.port)
48
44
  http.use_ssl = true
49
45
  request = Net::HTTP::Get.new(uri.request_uri)
@@ -1,3 +1,3 @@
1
1
  module FraudlabsproRuby
2
- VERSION = "3.2.1"
2
+ VERSION = "4.0.1"
3
3
  end
@@ -7,7 +7,7 @@ describe "FraudlabsproRuby" do
7
7
  ip: '8.8.8.8'
8
8
  )
9
9
  data = JSON.parse(result.body)
10
- expect(data['fraudlabspro_message']).to eq 'INVALID API KEY'
10
+ expect(data['error']['error_message']).to eq 'INVALID API KEY'
11
11
  end
12
12
 
13
13
  it "work correctly with Api Key exist" do
@@ -32,9 +32,9 @@ describe "FraudlabsproRuby" do
32
32
  )
33
33
  data = JSON.parse(result.body)
34
34
  if $test_api_key == 'YOUR_API_KEY'
35
- expect(data['fraudlabspro_id']).to eq 'NA'
35
+ expect(data['error']['error_message']).to eq 'INVALID API KEY'
36
36
  else
37
- expect(data['ip_country']).to eq 'US'
37
+ expect(data['ip_geolocation']['country_code']).to eq 'US'
38
38
  end
39
39
  end
40
40
 
@@ -45,7 +45,11 @@ describe "FraudlabsproRuby" do
45
45
  id_type: FraudlabsproRuby::Api::Order::FLP_ID
46
46
  )
47
47
  data = JSON.parse(result.body)
48
- expect(data['fraudlabspro_id']).to eq 'NA'
48
+ if $test_api_key == 'YOUR_API_KEY'
49
+ expect(data['error']['error_message']).to eq 'INVALID API KEY'
50
+ else
51
+ expect(data['error']['error_message']).to eq 'TRANSACTION NOT FOUND'
52
+ end
49
53
  end
50
54
 
51
55
  it "work correctly with validate order" do
@@ -56,9 +60,9 @@ describe "FraudlabsproRuby" do
56
60
  )
57
61
  data = JSON.parse(result.body)
58
62
  if $test_api_key == 'YOUR_API_KEY'
59
- expect(data['fraudlabspro_message']).to eq 'INVALID API KEY'
63
+ expect(data['error']['error_message']).to eq 'INVALID API KEY'
60
64
  else
61
- expect(data['fraudlabspro_message']).to eq 'INVALID TRANSACTION ID'
65
+ expect(data['error']['error_message']).to eq 'TRANSACTION NOT FOUND'
62
66
  end
63
67
  end
64
68
 
@@ -11,9 +11,9 @@ describe "FraudlabsproRuby" do
11
11
  )
12
12
  data = JSON.parse(result.body)
13
13
  if $test_api_key == 'YOUR_API_KEY'
14
- expect(data['error']).to eq 'API key not found.'
14
+ expect(data['error']['error_message']).to eq 'INVALID API KEY'
15
15
  else
16
- expect(data['error']).to eq 'Invalid phone number.'
16
+ expect(data['error']['error_message']).to eq 'INVALID PHONE NUMBER'
17
17
  end
18
18
  end
19
19
 
@@ -25,9 +25,9 @@ describe "FraudlabsproRuby" do
25
25
  )
26
26
  data = JSON.parse(result.body)
27
27
  if $test_api_key == 'YOUR_API_KEY'
28
- expect(data['error']).to eq 'API key not found.'
28
+ expect(data['error']['error_message']).to eq 'INVALID API KEY'
29
29
  else
30
- expect(data['error']).to eq 'Invalid OTP.'
30
+ expect(data['error']['error_message']).to eq 'INVALID OTP'
31
31
  end
32
32
  end
33
33
 
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.1
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - fraudlabspro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-21 00:00:00.000000000 Z
11
+ date: 2024-08-30 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
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  requirements: []
57
- rubygems_version: 3.3.7
57
+ rubygems_version: 3.5.9
58
58
  signing_key:
59
59
  specification_version: 4
60
60
  summary: FraudLabs Pro Ruby SDK