@@ -131,11 +131,13 @@ $client = new MinFraud(10, 'LICENSEKEY');
131131```
132132
133133``` python
134+ from minfraud import Client, AsyncClient
135+
134136# If you want to use synchronous requests
135- client = Client(10 , ' LICENSEKEY' );
137+ client = Client(10 , ' LICENSEKEY' )
136138
137139# Or if you want to use asynchronous requests
138- async_client = AsyncClient(10 , ' LICENSEKEY' );
140+ async_client = AsyncClient(10 , ' LICENSEKEY' )
139141```
140142
141143``` ruby
@@ -418,24 +420,24 @@ Insights, or Factors service.
418420{{< codeset >}}
419421
420422``` csharp
421- # minFraud Score
423+ // minFraud Score
422424var score = await client .ScoreAsync (transaction );
423425
424- # minFraud Insights
426+ // minFraud Insights
425427var insights = await client .InsightsAsync (transaction );
426428
427- # minFraud Factors
429+ // minFraud Factors
428430var factors = await client .FactorsAsync (transaction );
429431```
430432
431433``` java
432- # minFraud Score
434+ // minFraud Score
433435ScoreResponse score = client. score(transaction);
434436
435- # minFraud Insights
437+ // minFraud Insights
436438InsightsResponse insights = client. insights(transaction);
437439
438- # minFraud Factors
440+ // minFraud Factors
439441FactorsResponse factors = client. factors(transaction);
440442```
441443
@@ -451,13 +453,13 @@ client.factors(transaction).then(factorsResponse => ...);
451453```
452454
453455``` php
454- # minFraud Score
456+ // minFraud Score
455457$scoreResponse = $request->score();
456458
457- # minFraud Insights
459+ // minFraud Insights
458460$insightsResponse = $request->insights();
459461
460- # minFraud Factors
462+ // minFraud Factors
461463$factorsResponse = $request->factors();
462464```
463465
@@ -989,118 +991,118 @@ foreach ($scoreResponse->warnings as $warning) {
989991```
990992
991993``` python
992- import asyncio # Only import asyncio if you are playing to do an asynchronous request
993- from minfraud import AsyncClient, Client
994-
995- request = {
996- ' device' : {
997- ' ip_address' : ' 1.1.1.1' ,
998- ' accept_language' : ' en-US,en;q=0.8' ,
999- ' session_age' : 3600 ,
1000- ' session_id' : ' a333a4e127f880d8820e56a66f40717c' ,
1001- ' user_agent' : ' Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36'
1002- },
1003- ' event' : {
1004- ' shop_id' : ' s2123' ,
1005- ' type' : ' purchase' ,
1006- ' transaction_id' : ' txn3134133' ,
1007- ' time' : ' 2014-04-12T23:20:50.052+00:00'
1008- },
1009- ' account' : {
1010- ' user_id' : ' 3132' ,
1011- ' username_md5' : ' 570a90bfbf8c7eab5dc5d4e26832d5b1'
1012- },
1013- ' email' : {
1014- ' address' : ' 977577b140bfb7c516e4746204fbdb01' ,
1015- ' domain' : ' maxmind.com'
1016- },
1017- ' billing' : {
1018- ' first_name' : ' First' ,
1019- ' last_name' : ' Last' ,
1020- ' company' : ' Company, Inc.' ,
1021- ' address' : ' 1 Billing Address St.' ,
1022- ' address_2' : ' Unit 1' ,
1023- ' city' : ' Waltham' ,
1024- ' region' : ' MA' ,
1025- ' country' : ' US' ,
1026- ' postal' : ' 02451' ,
1027- ' phone_country_code' : ' 1' ,
1028- ' phone_number' : ' 555-555-5555' ,
1029- },
1030- ' shipping' : {
1031- ' first_name' : ' First' ,
1032- ' last_name' : ' Last' ,
1033- ' company' : ' Company, Inc.' ,
1034- ' address' : ' 1 Shipping Address St.' ,
1035- ' address_2' : ' Unit 1' ,
1036- ' city' : ' Waltham' ,
1037- ' region' : ' MA' ,
1038- ' country' : ' US' ,
1039- ' postal' : ' 02451' ,
1040- ' phone_country_code' : ' 1' ,
1041- ' phone_number' : ' 555-555-5555' ,
1042- ' delivery_speed' : ' same_day' ,
1043- },
1044- ' credit_card' : {
1045- ' bank_phone_country_code' : ' 1' ,
1046- ' avs_result' : ' Y' ,
1047- ' bank_phone_number' : ' 555-555-5555' ,
1048- ' last_digits' : ' 1234' ,
1049- ' cvv_result' : ' N' ,
1050- ' bank_name' : ' Test Bank' ,
1051- ' issuer_id_number' : ' 411111'
1052- },
1053- ' payment' : {
1054- ' decline_code' : ' invalid number' ,
1055- ' was_authorized' : False ,
1056- ' processor' : ' stripe'
1057- },
1058- ' shopping_cart' : [{
1059- ' category' : ' pets' ,
1060- ' quantity' : 2 ,
1061- ' price' : 20.43 ,
1062- ' item_id' : ' lsh12'
1063- }, {
1064- ' category' : ' beauty' ,
1065- ' quantity' : 1 ,
1066- ' price' : 100.0 ,
1067- ' item_id' : ' ms12'
1068- }],
1069- ' order' : {
1070- ' affiliate_id' : ' af12' ,
1071- ' referrer_uri' : ' http://www.amazon.com/' ,
1072- ' subaffiliate_id' : ' saf42' ,
1073- ' discount_code' : ' FIRST' ,
1074- ' currency' : ' USD' ,
1075- ' amount' : 323.21
1076- },
1077- ' custom_inputs' : {
1078- ' section' : ' news' ,
1079- ' num_of_previous_purchases' : 19 ,
1080- ' discount' : 3.2 ,
1081- ' previous_user' : True
1082- }
1083- }
1084-
1085- # This example function uses a synchronous Client object. The object
1086- # can be used across multiple requests.
1087- def client (account_id , license_key ):
1088- with Client(account_id, license_key) as client:
1089- print (client.score(request))
1090- print (client.insights(request))
1091- print (client.factors(request))
1092-
1093- client (42 , ' license_key' )
1094-
1095- # This example function uses an asynchronous AsyncClient object. The
1096- # object can be used across multiple requests.
1097- async def async_client (account_id , license_key ):
1098- with Client (account_id, license_key) as client:
1099- print (client.score(request))
1100- print (client.insights(request))
1101- print (client.factors(request))
1102-
1103- asyncio.run(async_client (42 , ' license_key' ))
994+ import asyncio # Only needed for asynchronous requests
995+ from minfraud import AsyncClient, Client
996+
997+ request = {
998+ ' device' : {
999+ ' ip_address' : ' 1.1.1.1' ,
1000+ ' accept_language' : ' en-US,en;q=0.8' ,
1001+ ' session_age' : 3600 ,
1002+ ' session_id' : ' a333a4e127f880d8820e56a66f40717c' ,
1003+ ' user_agent' : ' Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36'
1004+ },
1005+ ' event' : {
1006+ ' shop_id' : ' s2123' ,
1007+ ' type' : ' purchase' ,
1008+ ' transaction_id' : ' txn3134133' ,
1009+ ' time' : ' 2014-04-12T23:20:50.052+00:00'
1010+ },
1011+ ' account' : {
1012+ ' user_id' : ' 3132' ,
1013+ ' username_md5' : ' 570a90bfbf8c7eab5dc5d4e26832d5b1'
1014+ },
1015+ ' email' : {
1016+ ' address' : ' 977577b140bfb7c516e4746204fbdb01' ,
1017+ ' domain' : ' maxmind.com'
1018+ },
1019+ ' billing' : {
1020+ ' first_name' : ' First' ,
1021+ ' last_name' : ' Last' ,
1022+ ' company' : ' Company, Inc.' ,
1023+ ' address' : ' 1 Billing Address St.' ,
1024+ ' address_2' : ' Unit 1' ,
1025+ ' city' : ' Waltham' ,
1026+ ' region' : ' MA' ,
1027+ ' country' : ' US' ,
1028+ ' postal' : ' 02451' ,
1029+ ' phone_country_code' : ' 1' ,
1030+ ' phone_number' : ' 555-555-5555' ,
1031+ },
1032+ ' shipping' : {
1033+ ' first_name' : ' First' ,
1034+ ' last_name' : ' Last' ,
1035+ ' company' : ' Company, Inc.' ,
1036+ ' address' : ' 1 Shipping Address St.' ,
1037+ ' address_2' : ' Unit 1' ,
1038+ ' city' : ' Waltham' ,
1039+ ' region' : ' MA' ,
1040+ ' country' : ' US' ,
1041+ ' postal' : ' 02451' ,
1042+ ' phone_country_code' : ' 1' ,
1043+ ' phone_number' : ' 555-555-5555' ,
1044+ ' delivery_speed' : ' same_day' ,
1045+ },
1046+ ' credit_card' : {
1047+ ' bank_phone_country_code' : ' 1' ,
1048+ ' avs_result' : ' Y' ,
1049+ ' bank_phone_number' : ' 555-555-5555' ,
1050+ ' last_digits' : ' 1234' ,
1051+ ' cvv_result' : ' N' ,
1052+ ' bank_name' : ' Test Bank' ,
1053+ ' issuer_id_number' : ' 411111'
1054+ },
1055+ ' payment' : {
1056+ ' decline_code' : ' invalid number' ,
1057+ ' was_authorized' : False ,
1058+ ' processor' : ' stripe'
1059+ },
1060+ ' shopping_cart' : [{
1061+ ' category' : ' pets' ,
1062+ ' quantity' : 2 ,
1063+ ' price' : 20.43 ,
1064+ ' item_id' : ' lsh12'
1065+ }, {
1066+ ' category' : ' beauty' ,
1067+ ' quantity' : 1 ,
1068+ ' price' : 100.0 ,
1069+ ' item_id' : ' ms12'
1070+ }],
1071+ ' order' : {
1072+ ' affiliate_id' : ' af12' ,
1073+ ' referrer_uri' : ' http://www.amazon.com/' ,
1074+ ' subaffiliate_id' : ' saf42' ,
1075+ ' discount_code' : ' FIRST' ,
1076+ ' currency' : ' USD' ,
1077+ ' amount' : 323.21
1078+ },
1079+ ' custom_inputs' : {
1080+ ' section' : ' news' ,
1081+ ' num_of_previous_purchases' : 19 ,
1082+ ' discount' : 3.2 ,
1083+ ' previous_user' : True
1084+ }
1085+ }
1086+
1087+ # This example function uses a synchronous Client object. The object
1088+ # can be used across multiple requests.
1089+ def sync_example (account_id , license_key ):
1090+ with Client(account_id, license_key) as client:
1091+ print (client.score(request))
1092+ print (client.insights(request))
1093+ print (client.factors(request))
1094+
1095+ sync_example (42 , ' license_key' )
1096+
1097+ # This example function uses an asynchronous AsyncClient object. The
1098+ # object can be used across multiple requests.
1099+ async def async_example (account_id , license_key ):
1100+ async with AsyncClient (account_id, license_key) as client:
1101+ print (await client.score(request))
1102+ print (await client.insights(request))
1103+ print (await client.factors(request))
1104+
1105+ asyncio.run(async_example (42 , ' license_key' ))
11041106```
11051107
11061108``` ruby
0 commit comments