-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest.php
More file actions
52 lines (42 loc) · 1.26 KB
/
test.php
File metadata and controls
52 lines (42 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* This file shows a minimal example on how to integrate with orders API
*/
require_once "vendor/autoload.php";
use \Konduto\Core\Konduto;
use \Konduto\Models;
Konduto::setApiKey(getenv("KONDUTO_SANDBOX_API_KEY"));
$orderId = uniqid();
$order = new Models\Order(array(
"id" => $orderId,
"visitor" => "4738d516f09cab3a2c1ee973bec88a5a367a59e4",
"total_amount" => 100.10,
"shipping_amount" => 20.00,
"tax_amount" => 3.45,
"currency" => "USD",
"installments" => 1,
"ip" => "170.149.100.10",
"purchased_at" => "2015-04-25T22:29:14Z",
"customer" => array(
"id" => "28372",
"name" => "Júlia da Silva",
"tax_id" => "12345678909",
"dob" => "1970-12-25",
"phone1" => "11-1234-5678",
"phone2" => "21-2143-6578",
"email" => "jsilva@exemplo.com.br",
"created_at" => "2010-12-25",
"new" => false,
"vip" => false
)
));
try {
$order = Konduto::analyze($order);
echo "\nRecommendation: {$order->getRecommendation()}\n";
$order = Konduto::getOrder($orderId);
var_dump($order->getProperties());
$order = Konduto::updateOrderStatus($orderId, "fraud", "DAMN FRAUDSTER");
}
catch (Exception $e) {
echo "\nException: {$e->getMessage()}\n";
}