Skip to content

Commit dea38c1

Browse files
committed
Standardize the class name.
1 parent c3b9e20 commit dea38c1

9 files changed

Lines changed: 444 additions & 420 deletions

File tree

docs/source/code.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# FraudLabs Pro Python API
22

3-
## FraudValidation Class
4-
```{py:class} FraudValidation(api_key)
5-
Initiate FraudValidation class with FraudLabs Pro API key.
3+
## Order Class
4+
```{py:class} Order(api_key)
5+
Initiate Order class with FraudLabs Pro API key.
66
77
:param str api_key: (Required) FraudLabs Pro API key.
88
```

docs/source/quickstart.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ You can validate your order as below:
2020

2121
```python
2222
# import SDK to use the function
23-
from fraudlabspro.fraudvalidation import FraudValidation
23+
from fraudlabspro.order import Order
2424

2525
# Configure your API key
2626
api_key = 'YOUR_API_KEY'
27-
fraud_validation = FraudValidation(api_key)
27+
order = Order(api_key)
2828

2929
# Order Details
3030
dict1 = {
@@ -34,7 +34,7 @@ dict1 = {
3434
'currency': 'USD',
3535
'amount': '42',
3636
'quantity': 1,
37-
'paymentGateway': 'stripe'
37+
'paymentGateway': 'stripe',
3838
'paymentMethod': 'creditcard'
3939
},
4040
'card': {
@@ -49,7 +49,7 @@ dict1 = {
4949
'city': 'West Palm Beach',
5050
'state': 'FL',
5151
'postcode': '33401',
52-
'country': 'US',
52+
'country': 'US'
5353
},
5454
'shipping': {
5555
'firstName': 'Hector',
@@ -58,12 +58,13 @@ dict1 = {
5858
'city' : 'Tampa',
5959
'state' : 'FL',
6060
'postcode': '33602',
61-
'country': 'US',
61+
'country': 'US'
6262
}
6363
}
6464

6565
# Sends the order details to FraudLabs Pro
66-
result = fraud_validation.validate(dict1)
66+
result = order.validate(dict1)
67+
print(result)
6768
```
6869

6970
### Get Transaction
@@ -72,19 +73,19 @@ You can get the details of a transaction as below:
7273

7374
```python
7475
# import SDK to use the function
75-
from fraudlabspro.fraudvalidation import FraudValidation
76+
from fraudlabspro.order import Order
7677

7778
# Configure your API key
7879
api_key = 'YOUR_API_KEY'
79-
fraud_validation = FraudValidation(api_key)
80+
order = Order(api_key)
8081

8182
# Values to get transaction details
8283
get_transaction_variables = {
83-
'id': '20180705-WISXW2',
84+
'id': <fraudlabspro_id>
8485
}
8586

8687
# Send the values to FraudLabs Pro
87-
result = fraud_validation.get_transaction(get_transaction_variables)
88+
result = order.get_transaction(get_transaction_variables)
8889
```
8990

9091
### Feedback an order
@@ -93,21 +94,21 @@ You can approve, reject or ignore a transaction as below:
9394

9495
```python
9596
# import SDK to use the function
96-
from fraudlabspro.fraudvalidation import FraudValidation
97+
from fraudlabspro.order import Order
9798

9899
# Configure your API key
99100
api_key = 'YOUR_API_KEY'
100-
fraud_validation = FraudValidation(api_key)
101+
order = Order(api_key)
101102

102103
# Set feedback of the particular order
103104
feedback_variables = {
104-
'id': '20180705-WISXW2',
105+
'id': <fraudlabspro_id>,
105106
# Three actions available: APPROVE, REJECT, REJECT_BLACKLIST
106107
'action': 'APPROVE',
107-
'notes': 'This is for testing purpose.',
108+
'notes': 'This is for testing purpose.'
108109
}
109110

110-
result = fraud_validation.feedback(feedback_variables)
111+
result = order.feedback(feedback_variables)
111112
```
112113

113114
### Send SMS Verification

example.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# import SDK to use the function
2-
from fraudlabspro.fraudvalidation import FraudValidation
2+
from fraudlabspro.order import Order
33
from fraudlabspro.smsverification import SMSVerification
44
from fraudlabspro.payment import Payment
55

66
# Configure your API key
77
api_key = 'YOUR_API_KEY'
88

9-
fraud_validation = FraudValidation(api_key)
9+
order = Order(api_key)
1010

1111
"""
1212
# Here is an example to validate order details.
@@ -34,7 +34,7 @@
3434
'city': 'West Palm Beach',
3535
'state': 'FL',
3636
'postcode': '33401',
37-
'country': 'US',
37+
'country': 'US'
3838
},
3939
'shipping': {
4040
'firstName': 'Hector',
@@ -43,10 +43,10 @@
4343
'city' : 'Tampa',
4444
'state' : 'FL',
4545
'postcode': '33602',
46-
'country': 'US',
46+
'country': 'US'
4747
}
4848
}
49-
print(fraud_validation.validate(order_details_variables))
49+
print(order.validate(order_details_variables))
5050

5151
"""
5252
# Here is an example to get transaction details.
@@ -55,29 +55,29 @@
5555
# type is id type, which define either the id is FraudLabsPrp::FLP_ID or FraudLabsPro::ORDER_ID.
5656
"""
5757
get_transaction_variables = {
58-
'id': '20180705-WISXW2',
58+
'id': 'THE_FRAUDLABSPRO_ID',
5959
# 'id_type': 'FraudLabsPro::FLP_ID' # No longer supported in v2
6060
}
61-
print(fraud_validation.get_transaction(get_transaction_variables))
61+
print(order.get_transaction(get_transaction_variables))
6262

6363
"""
6464
# Here is example of send feecback of either approve or reject this particular order.
6565
"""
6666
feedback_variables = {
67-
'id': '20180705-WISXW2',
67+
'id': 'THE_FRAUDLABSPRO_ID',
6868
# Three actions available: APPROVE, REJECT, REJECT_BLACKLIST
6969
'action': 'APPROVE',
7070
'notes': 'This is for testing purpose.',
7171
}
72-
print(fraud_validation.feedback(feedback_variables))
72+
print(order.feedback(feedback_variables))
7373

7474
sms_validation = SMSVerification(api_key)
7575

7676
"""
7777
# Here is example of verify the valid order by send the SMS to customer.
7878
"""
7979
sms_verification_variables = {
80-
'tel': '+15616288674',
80+
'tel': '+123456789',
8181
'country_code': 'US',
8282
'mesg': 'Your OTP for the transaction is <otp>.',
8383
'otp_timeout': 3600,

fraudlabspro/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .order import Order
2+
3+
# Silent alias at the package level as well
4+
FraudValidation = Order

fraudlabspro/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Constants that will be use across various classes
22

33
BASE_URL = 'https://api.fraudlabspro.com/v2/'
4-
MODULE_VERSION = '3.1.0'
4+
MODULE_VERSION = '3.2.0'

0 commit comments

Comments
 (0)