diff --git a/samples/add_card_fingerprint_to_fraud_value_list.php b/samples/add_card_fingerprint_to_fraud_value_list.php new file mode 100644 index 0000000..72e16cd --- /dev/null +++ b/samples/add_card_fingerprint_to_fraud_value_list.php @@ -0,0 +1,14 @@ +fraud()->addValueToValueList(array( + 'listName' => "cardList", + 'type' => FraudValueType::CARD, + 'label' => "John Doe's Card", + 'paymentId' => 11675, +)); + +print_r($response); diff --git a/samples/add_temporary_value_to_fraud_value_list.php b/samples/add_temporary_value_to_fraud_value_list.php index 8eeafb9..7f74a89 100644 --- a/samples/add_temporary_value_to_fraud_value_list.php +++ b/samples/add_temporary_value_to_fraud_value_list.php @@ -1,7 +1,15 @@ fraud()->addValueToValueList("ipList", "127.0.0.2", 60); +$response = SampleConfig::craftgate()->fraud()->addValueToValueList(array( + 'listName' => "ipList", + 'label' => "local ip 2", + 'type' => FraudValueType::IP, + 'value' => "127.0.0.2", + 'durationInSeconds' => 60 +)); print_r($response); diff --git a/samples/add_value_to_fraud_value_list.php b/samples/add_value_to_fraud_value_list.php index f68df8f..c98f980 100644 --- a/samples/add_value_to_fraud_value_list.php +++ b/samples/add_value_to_fraud_value_list.php @@ -1,7 +1,14 @@ fraud()->addValueToValueList("ipList", "127.0.0.1"); +$response = SampleConfig::craftgate()->fraud()->addValueToValueList(array( + 'listName' => "ipList", + 'type' => FraudValueType::IP, + 'label' => "local ip 1", + 'value' => "127.0.0.1", +)); print_r($response); diff --git a/samples/create_fraud_value_list.php b/samples/create_fraud_value_list.php index 2e60d4a..a17f428 100644 --- a/samples/create_fraud_value_list.php +++ b/samples/create_fraud_value_list.php @@ -1,7 +1,9 @@ fraud()->createValueList("ipList"); +$response = SampleConfig::craftgate()->fraud()->createValueList("ipList", FraudValueType::IP); print_r($response); diff --git a/samples/remove_value_from_fraud_value_list.php b/samples/remove_value_from_fraud_value_list.php index bfe99b4..efc24bf 100644 --- a/samples/remove_value_from_fraud_value_list.php +++ b/samples/remove_value_from_fraud_value_list.php @@ -2,6 +2,6 @@ require_once('config/sample_config.php'); -$response = SampleConfig::craftgate()->fraud()->removeValueFromValueList("ipList", "127.0.0.1"); +$response = SampleConfig::craftgate()->fraud()->removeValueFromValueList("ipList", "16d85c18-459d-4e44-820f-18ec7a4ed3a5"); print_r($response); diff --git a/src/Adapter/FraudAdapter.php b/src/Adapter/FraudAdapter.php index bfb481a..9246daa 100644 --- a/src/Adapter/FraudAdapter.php +++ b/src/Adapter/FraudAdapter.php @@ -33,11 +33,12 @@ public function retrieveValueList($listName) return $this->httpGet($path); } - public function createValueList($listName) + public function createValueList($listName, $type) { $path = "/fraud/v1/value-lists"; $request = array( - 'listName' => $listName + 'listName' => $listName, + 'type' => $type ); return $this->httpPost($path, $request); } @@ -48,20 +49,15 @@ public function deleteValueList($listName) return $this->httpDelete($path); } - public function addValueToValueList($listName, $value, $expireInSeconds = null) + public function addValueToValueList($request) { $path = "/fraud/v1/value-lists"; - $request = array( - 'listName' => $listName, - 'value' => $value, - 'durationInSeconds' => $expireInSeconds - ); return $this->httpPost($path, $request); } - public function removeValueFromValueList($listName, $value) + public function removeValueFromValueList($listName, $valueId) { - $path = "/fraud/v1/value-lists/" . $listName . "/values/" . $value; + $path = "/fraud/v1/value-lists/" . $listName . "/values/" . $valueId; return $this->httpDelete($path); } } diff --git a/src/Model/FraudValueType.php b/src/Model/FraudValueType.php new file mode 100644 index 0000000..5627ab7 --- /dev/null +++ b/src/Model/FraudValueType.php @@ -0,0 +1,12 @@ +