001/* 002 * Copyright 2020 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.verify; 017 018import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 019import com.fasterxml.jackson.annotation.JsonProperty; 020import com.fasterxml.jackson.annotation.JsonValue; 021 022import java.math.BigDecimal; 023import java.util.*; 024 025@JsonIgnoreProperties(ignoreUnknown = true) 026public class VerifyDetails { 027 028 private String requestId; 029 private String accountId; 030 private String number; 031 private String senderId; 032 private Date dateSubmitted; 033 private Date dateFinalized; 034 private Date firstEventDate; 035 private Date lastEventDate; 036 private Status status; 037 private BigDecimal price; 038 private String currency; 039 private List<VerifyCheck> checks = new ArrayList<>(); 040 041 @JsonProperty("request_id") 042 public String getRequestId() { 043 return this.requestId; 044 } 045 046 @JsonProperty("account_id") 047 public String getAccountId() { 048 return this.accountId; 049 } 050 051 public String getNumber() { 052 return this.number; 053 } 054 055 @JsonProperty("sender_id") 056 public String getSenderId() { 057 return this.senderId; 058 } 059 060 @JsonProperty("date_submitted") 061 public Date getDateSubmitted() { 062 return this.dateSubmitted; 063 } 064 065 @JsonProperty("date_finalized") 066 public Date getDateFinalized() { 067 return this.dateFinalized; 068 } 069 070 @JsonProperty("first_event_date") 071 public Date getFirstEventDate() { 072 return this.firstEventDate; 073 } 074 075 @JsonProperty("last_event_date") 076 public Date getLastEventDate() { 077 return this.lastEventDate; 078 } 079 080 public Status getStatus() { 081 return this.status; 082 } 083 084 public BigDecimal getPrice() { 085 return this.price; 086 } 087 088 public String getCurrency() { 089 return this.currency; 090 } 091 092 public List<VerifyCheck> getChecks() { 093 return this.checks; 094 } 095 096 public enum Status { 097 IN_PROGRESS("IN PROGRESS"), 098 SUCCESS("SUCCESS"), 099 FAILED("FAILED"), 100 EXPIRED("EXPIRED"), 101 CANCELLED("CANCELLED"), 102 INVALID("101"); 103 104 private String status; 105 106 private static Map<String, Status> stringStatusValues = new HashMap<>(); 107 108 static { 109 for (Status status : Status.values()) { 110 stringStatusValues.put(status.status, status); 111 } 112 } 113 114 /** 115 * Look up the {@link Status} based on the string value. 116 * 117 * @param status the status value to lookup. 118 * @return VerifyStatus based on the int value given. 119 */ 120 public static Status fromString(String status) { 121 return stringStatusValues.get(status); 122 } 123 124 Status(String status) { 125 this.status = status; 126 } 127 128 @JsonValue 129 public String getStatus() { 130 return this.status; 131 } 132 } 133}