001/* 002 * Copyright 2024 Vonage 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.vonage.client.numberinsight2; 017 018import com.fasterxml.jackson.annotation.JsonProperty; 019import com.vonage.client.Jsonable; 020import com.vonage.client.JsonableBaseObject; 021import java.util.UUID; 022 023/** 024 * Fraud check results as obtained from {@link NumberInsight2Client#fraudCheck(String, Insight, Insight...)}. 025 */ 026public class FraudCheckResponse extends JsonableBaseObject { 027 private String type; 028 private UUID requestId; 029 private Phone phone; 030 private FraudScore fraudScore; 031 private SimSwap simSwap; 032 033 protected FraudCheckResponse() { 034 } 035 036 /** 037 * The type of lookup used in the request. Currently always "phone". 038 * 039 * @return The lookup type as a string. 040 */ 041 @JsonProperty("type") 042 protected String getType() { 043 return type; 044 } 045 046 /** 047 * Unique ID for this request for reference. 048 * 049 * @return The request reference UUID. 050 */ 051 @JsonProperty("request_id") 052 public UUID getRequestId() { 053 return requestId; 054 } 055 056 /** 057 * An object containing at least the phone number that was used in the fraud check. If {@linkplain Insight#FRAUD_SCORE} was also requested and successful, other phone information (carrier and type) will be returned. 058 * 059 * @return Information about the phone number. 060 */ 061 @JsonProperty("phone") 062 public Phone getPhone() { 063 return phone; 064 } 065 066 /** 067 * Result of the fraud score insight operation. Only returned if {@linkplain Insight#FRAUD_SCORE} was requested. 068 * 069 * @return The fraud score details, or {@code null} if not applicable. 070 */ 071 @JsonProperty("fraud_score") 072 public FraudScore getFraudScore() { 073 return fraudScore; 074 } 075 076 /** 077 * Result of the SIM swap insight operation. Only returned if {@linkplain Insight#SIM_SWAP} was requested. 078 * 079 * @return The SIM swap details, or {@code null} if not applicable. 080 */ 081 @JsonProperty("sim_swap") 082 public SimSwap getSimSwap() { 083 return simSwap; 084 } 085 086 /** 087 * Creates an instance of this class from a JSON payload. 088 * 089 * @param json The JSON string to parse. 090 * @return An instance of this class with the fields populated, if present. 091 */ 092 public static FraudCheckResponse fromJson(String json) { 093 return Jsonable.fromJson(json); 094 } 095}