|
| 1 | +// Generated by com.stripe.generator.entity.SdkBuilder |
| 2 | + |
| 3 | +package com.stripe.model.radar; |
| 4 | + |
| 5 | +import com.google.gson.annotations.SerializedName; |
| 6 | +import com.stripe.Stripe; |
| 7 | +import com.stripe.exception.StripeException; |
| 8 | +import com.stripe.model.Charge; |
| 9 | +import com.stripe.model.ExpandableField; |
| 10 | +import com.stripe.model.HasId; |
| 11 | +import com.stripe.net.ApiResource; |
| 12 | +import com.stripe.net.RequestOptions; |
| 13 | +import com.stripe.param.radar.EarlyFraudWarningListParams; |
| 14 | +import com.stripe.param.radar.EarlyFraudWarningRetrieveParams; |
| 15 | +import java.util.Map; |
| 16 | +import lombok.EqualsAndHashCode; |
| 17 | +import lombok.Getter; |
| 18 | +import lombok.Setter; |
| 19 | + |
| 20 | +@Getter |
| 21 | +@Setter |
| 22 | +@EqualsAndHashCode(callSuper = false) |
| 23 | +public class EarlyFraudWarning extends ApiResource implements HasId { |
| 24 | + /** |
| 25 | + * An EFW is actionable if it has not received a dispute and has not been fully refunded. You may |
| 26 | + * wish to proactively refund a charge that receives an EFW, in order to avoid receiving a dispute |
| 27 | + * later. |
| 28 | + */ |
| 29 | + @SerializedName("actionable") |
| 30 | + Boolean actionable; |
| 31 | + |
| 32 | + /** ID of the charge this early fraud warning is for, optionally expanded. */ |
| 33 | + @SerializedName("charge") |
| 34 | + @Getter(lombok.AccessLevel.NONE) |
| 35 | + @Setter(lombok.AccessLevel.NONE) |
| 36 | + ExpandableField<Charge> charge; |
| 37 | + |
| 38 | + /** Time at which the object was created. Measured in seconds since the Unix epoch. */ |
| 39 | + @SerializedName("created") |
| 40 | + Long created; |
| 41 | + |
| 42 | + /** |
| 43 | + * The type of fraud labelled by the issuer. One of `card_never_received`, |
| 44 | + * `fraudulent_card_application`, `made_with_counterfeit_card`, `made_with_lost_card`, |
| 45 | + * `made_with_stolen_card`, `misc`, `unauthorized_use_of_card`. |
| 46 | + */ |
| 47 | + @SerializedName("fraud_type") |
| 48 | + String fraudType; |
| 49 | + |
| 50 | + /** Unique identifier for the object. */ |
| 51 | + @Getter(onMethod_ = {@Override}) |
| 52 | + @SerializedName("id") |
| 53 | + String id; |
| 54 | + |
| 55 | + /** |
| 56 | + * Has the value `true` if the object exists in live mode or the value `false` if the object |
| 57 | + * exists in test mode. |
| 58 | + */ |
| 59 | + @SerializedName("livemode") |
| 60 | + Boolean livemode; |
| 61 | + |
| 62 | + /** String representing the object's type. Objects of the same type share the same value. */ |
| 63 | + @SerializedName("object") |
| 64 | + String object; |
| 65 | + |
| 66 | + /** Get id of expandable `charge` object. */ |
| 67 | + public String getCharge() { |
| 68 | + return (this.charge != null) ? this.charge.getId() : null; |
| 69 | + } |
| 70 | + |
| 71 | + public void setCharge(String id) { |
| 72 | + this.charge = ApiResource.setExpandableFieldId(id, this.charge); |
| 73 | + } |
| 74 | + |
| 75 | + /** Get expanded `charge`. */ |
| 76 | + public Charge getChargeObject() { |
| 77 | + return (this.charge != null) ? this.charge.getExpanded() : null; |
| 78 | + } |
| 79 | + |
| 80 | + public void setChargeObject(Charge expandableObject) { |
| 81 | + this.charge = new ExpandableField<Charge>(expandableObject.getId(), expandableObject); |
| 82 | + } |
| 83 | + |
| 84 | + /** Returns a list of early fraud warnings. */ |
| 85 | + public static EarlyFraudWarningCollection list(Map<String, Object> params) |
| 86 | + throws StripeException { |
| 87 | + return list(params, (RequestOptions) null); |
| 88 | + } |
| 89 | + |
| 90 | + /** Returns a list of early fraud warnings. */ |
| 91 | + public static EarlyFraudWarningCollection list(Map<String, Object> params, RequestOptions options) |
| 92 | + throws StripeException { |
| 93 | + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/radar/early_fraud_warnings"); |
| 94 | + return requestCollection(url, params, EarlyFraudWarningCollection.class, options); |
| 95 | + } |
| 96 | + |
| 97 | + /** Returns a list of early fraud warnings. */ |
| 98 | + public static EarlyFraudWarningCollection list(EarlyFraudWarningListParams params) |
| 99 | + throws StripeException { |
| 100 | + return list(params, (RequestOptions) null); |
| 101 | + } |
| 102 | + |
| 103 | + /** Returns a list of early fraud warnings. */ |
| 104 | + public static EarlyFraudWarningCollection list( |
| 105 | + EarlyFraudWarningListParams params, RequestOptions options) throws StripeException { |
| 106 | + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/radar/early_fraud_warnings"); |
| 107 | + return requestCollection(url, params, EarlyFraudWarningCollection.class, options); |
| 108 | + } |
| 109 | + |
| 110 | + /** |
| 111 | + * Retrieves the details of an early fraud warning that has previously been created. |
| 112 | + * |
| 113 | + * <p>Please refer to the <a href="#early_fraud_warning_object">early fraud warning</a> object |
| 114 | + * reference for more details. |
| 115 | + */ |
| 116 | + public static EarlyFraudWarning retrieve(String earlyFraudWarning) throws StripeException { |
| 117 | + return retrieve(earlyFraudWarning, (Map<String, Object>) null, (RequestOptions) null); |
| 118 | + } |
| 119 | + |
| 120 | + /** |
| 121 | + * Retrieves the details of an early fraud warning that has previously been created. |
| 122 | + * |
| 123 | + * <p>Please refer to the <a href="#early_fraud_warning_object">early fraud warning</a> object |
| 124 | + * reference for more details. |
| 125 | + */ |
| 126 | + public static EarlyFraudWarning retrieve(String earlyFraudWarning, RequestOptions options) |
| 127 | + throws StripeException { |
| 128 | + return retrieve(earlyFraudWarning, (Map<String, Object>) null, options); |
| 129 | + } |
| 130 | + |
| 131 | + /** |
| 132 | + * Retrieves the details of an early fraud warning that has previously been created. |
| 133 | + * |
| 134 | + * <p>Please refer to the <a href="#early_fraud_warning_object">early fraud warning</a> object |
| 135 | + * reference for more details. |
| 136 | + */ |
| 137 | + public static EarlyFraudWarning retrieve( |
| 138 | + String earlyFraudWarning, Map<String, Object> params, RequestOptions options) |
| 139 | + throws StripeException { |
| 140 | + String url = |
| 141 | + String.format( |
| 142 | + "%s%s", |
| 143 | + Stripe.getApiBase(), |
| 144 | + String.format( |
| 145 | + "/v1/radar/early_fraud_warnings/%s", ApiResource.urlEncodeId(earlyFraudWarning))); |
| 146 | + return request(ApiResource.RequestMethod.GET, url, params, EarlyFraudWarning.class, options); |
| 147 | + } |
| 148 | + |
| 149 | + /** |
| 150 | + * Retrieves the details of an early fraud warning that has previously been created. |
| 151 | + * |
| 152 | + * <p>Please refer to the <a href="#early_fraud_warning_object">early fraud warning</a> object |
| 153 | + * reference for more details. |
| 154 | + */ |
| 155 | + public static EarlyFraudWarning retrieve( |
| 156 | + String earlyFraudWarning, EarlyFraudWarningRetrieveParams params, RequestOptions options) |
| 157 | + throws StripeException { |
| 158 | + String url = |
| 159 | + String.format( |
| 160 | + "%s%s", |
| 161 | + Stripe.getApiBase(), |
| 162 | + String.format( |
| 163 | + "/v1/radar/early_fraud_warnings/%s", ApiResource.urlEncodeId(earlyFraudWarning))); |
| 164 | + return request(ApiResource.RequestMethod.GET, url, params, EarlyFraudWarning.class, options); |
| 165 | + } |
| 166 | +} |
0 commit comments