|
| 1 | +// File generated from our OpenAPI spec |
| 2 | +package com.stripe.model; |
| 3 | + |
| 4 | +import com.google.gson.annotations.SerializedName; |
| 5 | +import com.stripe.Stripe; |
| 6 | +import com.stripe.exception.StripeException; |
| 7 | +import com.stripe.net.ApiResource; |
| 8 | +import com.stripe.net.RequestOptions; |
| 9 | +import com.stripe.param.SetupAttemptListParams; |
| 10 | +import java.util.Map; |
| 11 | +import lombok.EqualsAndHashCode; |
| 12 | +import lombok.Getter; |
| 13 | +import lombok.Setter; |
| 14 | + |
| 15 | +@Getter |
| 16 | +@Setter |
| 17 | +@EqualsAndHashCode(callSuper = false) |
| 18 | +public class SetupAttempt extends ApiResource implements HasId { |
| 19 | + /** |
| 20 | + * The value of <a |
| 21 | + * href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-application">application</a> |
| 22 | + * on the SetupIntent at the time of this confirmation. |
| 23 | + */ |
| 24 | + @SerializedName("application") |
| 25 | + @Getter(lombok.AccessLevel.NONE) |
| 26 | + @Setter(lombok.AccessLevel.NONE) |
| 27 | + ExpandableField<Application> application; |
| 28 | + |
| 29 | + /** Time at which the object was created. Measured in seconds since the Unix epoch. */ |
| 30 | + @SerializedName("created") |
| 31 | + Long created; |
| 32 | + |
| 33 | + /** |
| 34 | + * The value of <a |
| 35 | + * href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-customer">customer</a> |
| 36 | + * on the SetupIntent at the time of this confirmation. |
| 37 | + */ |
| 38 | + @SerializedName("customer") |
| 39 | + @Getter(lombok.AccessLevel.NONE) |
| 40 | + @Setter(lombok.AccessLevel.NONE) |
| 41 | + ExpandableField<Customer> customer; |
| 42 | + |
| 43 | + /** Unique identifier for the object. */ |
| 44 | + @Getter(onMethod_ = {@Override}) |
| 45 | + @SerializedName("id") |
| 46 | + String id; |
| 47 | + |
| 48 | + /** |
| 49 | + * Has the value {@code true} if the object exists in live mode or the value {@code false} if the |
| 50 | + * object exists in test mode. |
| 51 | + */ |
| 52 | + @SerializedName("livemode") |
| 53 | + Boolean livemode; |
| 54 | + |
| 55 | + /** |
| 56 | + * String representing the object's type. Objects of the same type share the same value. |
| 57 | + * |
| 58 | + * <p>Equal to {@code setup_attempt}. |
| 59 | + */ |
| 60 | + @SerializedName("object") |
| 61 | + String object; |
| 62 | + |
| 63 | + /** |
| 64 | + * The value of <a |
| 65 | + * href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-on_behalf_of">on_behalf_of</a> |
| 66 | + * on the SetupIntent at the time of this confirmation. |
| 67 | + */ |
| 68 | + @SerializedName("on_behalf_of") |
| 69 | + @Getter(lombok.AccessLevel.NONE) |
| 70 | + @Setter(lombok.AccessLevel.NONE) |
| 71 | + ExpandableField<Account> onBehalfOf; |
| 72 | + |
| 73 | + /** ID of the payment method used with this SetupAttempt. */ |
| 74 | + @SerializedName("payment_method") |
| 75 | + @Getter(lombok.AccessLevel.NONE) |
| 76 | + @Setter(lombok.AccessLevel.NONE) |
| 77 | + ExpandableField<PaymentMethod> paymentMethod; |
| 78 | + |
| 79 | + @SerializedName("payment_method_details") |
| 80 | + PaymentMethodDetails paymentMethodDetails; |
| 81 | + |
| 82 | + /** The error encountered during this attempt to confirm the SetupIntent, if any. */ |
| 83 | + @SerializedName("setup_error") |
| 84 | + StripeError setupError; |
| 85 | + |
| 86 | + /** ID of the SetupIntent that this attempt belongs to. */ |
| 87 | + @SerializedName("setup_intent") |
| 88 | + @Getter(lombok.AccessLevel.NONE) |
| 89 | + @Setter(lombok.AccessLevel.NONE) |
| 90 | + ExpandableField<SetupIntent> setupIntent; |
| 91 | + |
| 92 | + /** |
| 93 | + * Status of this SetupAttempt, one of {@code requires_confirmation}, {@code requires_action}, |
| 94 | + * {@code processing}, {@code succeeded}, {@code failed}, or {@code abandoned}. |
| 95 | + */ |
| 96 | + @SerializedName("status") |
| 97 | + String status; |
| 98 | + |
| 99 | + /** |
| 100 | + * The value of <a |
| 101 | + * href="https://stripe.com/docs/api/setup_intents/object#setup_intent_object-usage">usage</a> on |
| 102 | + * the SetupIntent at the time of this confirmation, one of {@code off_session} or {@code |
| 103 | + * on_session}. |
| 104 | + */ |
| 105 | + @SerializedName("usage") |
| 106 | + String usage; |
| 107 | + |
| 108 | + /** Get ID of expandable {@code application} object. */ |
| 109 | + public String getApplication() { |
| 110 | + return (this.application != null) ? this.application.getId() : null; |
| 111 | + } |
| 112 | + |
| 113 | + public void setApplication(String id) { |
| 114 | + this.application = ApiResource.setExpandableFieldId(id, this.application); |
| 115 | + } |
| 116 | + |
| 117 | + /** Get expanded {@code application}. */ |
| 118 | + public Application getApplicationObject() { |
| 119 | + return (this.application != null) ? this.application.getExpanded() : null; |
| 120 | + } |
| 121 | + |
| 122 | + public void setApplicationObject(Application expandableObject) { |
| 123 | + this.application = new ExpandableField<Application>(expandableObject.getId(), expandableObject); |
| 124 | + } |
| 125 | + |
| 126 | + /** Get ID of expandable {@code customer} object. */ |
| 127 | + public String getCustomer() { |
| 128 | + return (this.customer != null) ? this.customer.getId() : null; |
| 129 | + } |
| 130 | + |
| 131 | + public void setCustomer(String id) { |
| 132 | + this.customer = ApiResource.setExpandableFieldId(id, this.customer); |
| 133 | + } |
| 134 | + |
| 135 | + /** Get expanded {@code customer}. */ |
| 136 | + public Customer getCustomerObject() { |
| 137 | + return (this.customer != null) ? this.customer.getExpanded() : null; |
| 138 | + } |
| 139 | + |
| 140 | + public void setCustomerObject(Customer expandableObject) { |
| 141 | + this.customer = new ExpandableField<Customer>(expandableObject.getId(), expandableObject); |
| 142 | + } |
| 143 | + |
| 144 | + /** Get ID of expandable {@code onBehalfOf} object. */ |
| 145 | + public String getOnBehalfOf() { |
| 146 | + return (this.onBehalfOf != null) ? this.onBehalfOf.getId() : null; |
| 147 | + } |
| 148 | + |
| 149 | + public void setOnBehalfOf(String id) { |
| 150 | + this.onBehalfOf = ApiResource.setExpandableFieldId(id, this.onBehalfOf); |
| 151 | + } |
| 152 | + |
| 153 | + /** Get expanded {@code onBehalfOf}. */ |
| 154 | + public Account getOnBehalfOfObject() { |
| 155 | + return (this.onBehalfOf != null) ? this.onBehalfOf.getExpanded() : null; |
| 156 | + } |
| 157 | + |
| 158 | + public void setOnBehalfOfObject(Account expandableObject) { |
| 159 | + this.onBehalfOf = new ExpandableField<Account>(expandableObject.getId(), expandableObject); |
| 160 | + } |
| 161 | + |
| 162 | + /** Get ID of expandable {@code paymentMethod} object. */ |
| 163 | + public String getPaymentMethod() { |
| 164 | + return (this.paymentMethod != null) ? this.paymentMethod.getId() : null; |
| 165 | + } |
| 166 | + |
| 167 | + public void setPaymentMethod(String id) { |
| 168 | + this.paymentMethod = ApiResource.setExpandableFieldId(id, this.paymentMethod); |
| 169 | + } |
| 170 | + |
| 171 | + /** Get expanded {@code paymentMethod}. */ |
| 172 | + public PaymentMethod getPaymentMethodObject() { |
| 173 | + return (this.paymentMethod != null) ? this.paymentMethod.getExpanded() : null; |
| 174 | + } |
| 175 | + |
| 176 | + public void setPaymentMethodObject(PaymentMethod expandableObject) { |
| 177 | + this.paymentMethod = |
| 178 | + new ExpandableField<PaymentMethod>(expandableObject.getId(), expandableObject); |
| 179 | + } |
| 180 | + |
| 181 | + /** Get ID of expandable {@code setupIntent} object. */ |
| 182 | + public String getSetupIntent() { |
| 183 | + return (this.setupIntent != null) ? this.setupIntent.getId() : null; |
| 184 | + } |
| 185 | + |
| 186 | + public void setSetupIntent(String id) { |
| 187 | + this.setupIntent = ApiResource.setExpandableFieldId(id, this.setupIntent); |
| 188 | + } |
| 189 | + |
| 190 | + /** Get expanded {@code setupIntent}. */ |
| 191 | + public SetupIntent getSetupIntentObject() { |
| 192 | + return (this.setupIntent != null) ? this.setupIntent.getExpanded() : null; |
| 193 | + } |
| 194 | + |
| 195 | + public void setSetupIntentObject(SetupIntent expandableObject) { |
| 196 | + this.setupIntent = new ExpandableField<SetupIntent>(expandableObject.getId(), expandableObject); |
| 197 | + } |
| 198 | + |
| 199 | + /** Returns a list of SetupAttempts associated with a provided SetupIntent. */ |
| 200 | + public static SetupAttemptCollection list(Map<String, Object> params) throws StripeException { |
| 201 | + return list(params, (RequestOptions) null); |
| 202 | + } |
| 203 | + |
| 204 | + /** Returns a list of SetupAttempts associated with a provided SetupIntent. */ |
| 205 | + public static SetupAttemptCollection list(Map<String, Object> params, RequestOptions options) |
| 206 | + throws StripeException { |
| 207 | + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/setup_attempts"); |
| 208 | + return ApiResource.requestCollection(url, params, SetupAttemptCollection.class, options); |
| 209 | + } |
| 210 | + |
| 211 | + /** Returns a list of SetupAttempts associated with a provided SetupIntent. */ |
| 212 | + public static SetupAttemptCollection list(SetupAttemptListParams params) throws StripeException { |
| 213 | + return list(params, (RequestOptions) null); |
| 214 | + } |
| 215 | + |
| 216 | + /** Returns a list of SetupAttempts associated with a provided SetupIntent. */ |
| 217 | + public static SetupAttemptCollection list(SetupAttemptListParams params, RequestOptions options) |
| 218 | + throws StripeException { |
| 219 | + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/setup_attempts"); |
| 220 | + return ApiResource.requestCollection(url, params, SetupAttemptCollection.class, options); |
| 221 | + } |
| 222 | + |
| 223 | + @Getter |
| 224 | + @Setter |
| 225 | + @EqualsAndHashCode(callSuper = false) |
| 226 | + public static class PaymentMethodDetails extends StripeObject { |
| 227 | + @SerializedName("card") |
| 228 | + Card card; |
| 229 | + |
| 230 | + /** |
| 231 | + * The type of the payment method used in the SetupIntent (e.g., {@code card}). An additional |
| 232 | + * hash is included on {@code payment_method_details} with a name matching this value. It |
| 233 | + * contains confirmation-specific information for the payment method. |
| 234 | + */ |
| 235 | + @SerializedName("type") |
| 236 | + String type; |
| 237 | + |
| 238 | + @Getter |
| 239 | + @Setter |
| 240 | + @EqualsAndHashCode(callSuper = false) |
| 241 | + public static class Card extends StripeObject { |
| 242 | + /** Populated if this authorization used 3D Secure authentication. */ |
| 243 | + @SerializedName("three_d_secure") |
| 244 | + Charge.PaymentMethodDetails.Card.ThreeDSecure threeDSecure; |
| 245 | + } |
| 246 | + } |
| 247 | +} |
0 commit comments