コード例 #1
0
ファイル: SiftClient.php プロジェクト: caomw/sift-php
 /**
  * Retrieves a user's fraud score from the Sift Science API.
  *
  * @param $userId A user's id. This id should be the same as the user_id used in event calls.
  * This parameter is required.
  * @param $timeout (optional) The number of seconds to wait before failing the request. By default this is
  * configured to 2 seconds (see above).
  * @return null|SiftResponse
  */
 public function score($userId, $timeout = self::DEFAULT_TIMEOUT)
 {
     $this->validateArgument($userId, 'user id', 'string');
     $properties = array('api_key' => $this->api_key);
     try {
         $request = new SiftRequest(self::userScoreApiUrl($userId), SiftRequest::GET, $properties, $timeout);
         return $request->send();
     } catch (Exception $e) {
         return null;
     }
 }
コード例 #2
0
 /** Updates the configuration which controls http notifications for all merchant
  * accounts under this partner.
  *
  * == Parameters
  * httpNotificationUrl
  * A url to send POST notifications to.  The value of the notification_url will be a url containing the string '%s' exactly once.
  *
  * httpNotificationThreshold
  *  The notification threshold should be a double between 0.0 and 1.0
  */
 public function updateNotificationConfig($httpNotificationUrl = null, $httpNotificationThreshold = null)
 {
     $this->validateArgument($httpNotificationUrl, 'notification url', 'string');
     $this->validateArgument($httpNotificationThreshold, 'notification threshold', 'double');
     $body = array();
     $body['http_notification_url'] = $httpNotificationUrl;
     $body['http_notification_threshold'] = $httpNotificationThreshold;
     try {
         $request = new SiftRequest(self::notificationConfigUrl(), SiftRequest::PUT, $body, $this->apiKey, $this->timeout);
         return $request->send();
     } catch (Exception $e) {
         return null;
     }
 }
コード例 #3
0
ファイル: SiftClient.php プロジェクト: siftscience/sift-php
 /**
  * Gets the latest decision for a user for each abuse type.
  *
  * @param string $user_id  The ID of a user.
  *
  * @param array $opts  Array of optional parameters for this request:
  *     - string 'account_id': by default, this client's account ID is used.
  *     - int 'timeout': By default, this client's timeout is used.
  */
 public function getOrderDecisions($order_id, $opts = array())
 {
     $this->mergeArguments($opts, array('account_id' => $this->account_id, 'timeout' => $this->timeout));
     $this->validateArgument($order_id, 'order id', 'string');
     $url = self::API3_ENDPOINT . '/v3/accounts/' . $opts['account_id'] . '/orders/' . $order_id . '/decisions';
     try {
         $request = new SiftRequest($url, SiftRequest::GET, $opts['timeout'], self::API3_VERSION, array('auth' => $this->api_key . ':'));
         return $request->send();
     } catch (Exception $e) {
         return null;
     }
 }
コード例 #4
0
ファイル: SiftClient.php プロジェクト: rsteiner/sift-php
 /**
  * Retrieve Device
  *
  * @param $userId A device's id.
  * This parameter is required.
  * @param $accountId A device's id.
  * This parameter is required.
  * @param $timeout (optional) The number of seconds to wait before failing the request. By default this is
  * configured to 2 seconds (see above).
  * @return null|SiftResponse
  */
 public function getUserDevices($userId, $accountId, $timeout = self::DEFAULT_TIMEOUT)
 {
     $this->validateArgument($userId, 'user id', 'string');
     $this->validateArgument($accountId, 'account id', 'string');
     $properties = array('api_key' => $this->api_key);
     try {
         $request = new SiftRequest(self::userDevicesApiUrl($userId, $accountId), SiftRequest::GET, $properties, $timeout);
         return $request->send();
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }