コード例 #1
0
 public function testSuccessfulUnlabelWithAllUserIdCharacters()
 {
     $this->client = new SiftClient(array('api_key' => SiftClient203Test::$API_KEY, 'version' => '203'));
     $mockUrl = 'https://api.siftscience.com/v203/users/54321' . urlencode('=.-_+@:&^%!$') . '/labels?api_key=agreatsuccess';
     $mockResponse = new SiftResponse('', 204, null);
     SiftRequest::setMockResponse($mockUrl, SiftRequest::DELETE, $mockResponse);
     $response = $this->client->unlabel("54321=.-_+@:&^%!\$");
     $this->assertTrue($response->isOk());
 }
コード例 #2
0
 public function testGetOrderDecisions()
 {
     $mockUrl = 'https://api3.siftscience.com/v3/accounts/90201c25e39320c45b3da37b/orders/example_order/decisions';
     $mockResponse = new SiftResponse('{"decisions":{"payment_abuse":{"decision":{"id":"order_decisionz"},"time":1468599638005,"webhook_succeeded":false},"account_abuse":{"decision":{"id":"good_order"},"time":1468517407135,"webhook_succeeded":true}}}', 200, null);
     SiftRequest::setMockResponse($mockUrl, SiftRequest::GET, $mockResponse);
     $response = $this->client->getOrderDecisions('example_order', array('timeout' => 4));
     $this->assertTrue($response->isOk());
 }
コード例 #3
0
 public function testSuccessfulUpdateNotificationConfig()
 {
     $mockUrl = 'https://partner.siftscience.com/v3/accounts/' . SiftClientTest::$PARTNER_ID . '/config';
     $mockResponse = new SiftResponse($this->validConfigNotificationUrlResponseJson(), 200, null);
     SiftRequest::setMockResponse($mockUrl, SiftRequest::PUT, $mockResponse);
     $response = $this->client->updateNotificationConfig($this->validConfigNotificationUrl, $this->validConfigNotificationThreshold);
     $this->assertTrue($response->isOk());
     $this->assertEquals($response->body['http_notification_url'], $this->validConfigNotificationUrl);
     $this->assertEquals($response->body['http_notification_threshold'], $this->validConfigNotificationThreshold);
 }
コード例 #4
0
ファイル: SiftClientTest.php プロジェクト: caomw/sift-php
 public function testSuccessfulLabelUser()
 {
     $mockUrl = 'https://api.siftscience.com/v203/users/54321/labels';
     $mockResponse = new SiftResponse('{"status": 0, "error_message": "OK"}', 200, null);
     SiftRequest::setMockResponse($mockUrl, SiftRequest::POST, $mockResponse);
     $response = $this->client->label("54321", $this->label_properties);
     $this->assertTrue($response->isOk());
     $this->assertEquals($response->apiErrorMessage, 'OK');
 }