com.stripe.model.issuing.Authorization Maven / Gradle / Ivy
// File generated from our OpenAPI spec
package com.stripe.model.issuing;
import com.google.gson.annotations.SerializedName;
import com.stripe.exception.StripeException;
import com.stripe.model.BalanceTransaction;
import com.stripe.model.BalanceTransactionSource;
import com.stripe.model.ExpandableField;
import com.stripe.model.MetadataStore;
import com.stripe.model.StripeObject;
import com.stripe.net.ApiRequest;
import com.stripe.net.ApiRequestParams;
import com.stripe.net.ApiResource;
import com.stripe.net.BaseAddress;
import com.stripe.net.RequestOptions;
import com.stripe.net.StripeResponseGetter;
import com.stripe.param.issuing.AuthorizationApproveParams;
import com.stripe.param.issuing.AuthorizationCaptureParams;
import com.stripe.param.issuing.AuthorizationCreateParams;
import com.stripe.param.issuing.AuthorizationDeclineParams;
import com.stripe.param.issuing.AuthorizationExpireParams;
import com.stripe.param.issuing.AuthorizationFinalizeAmountParams;
import com.stripe.param.issuing.AuthorizationIncrementParams;
import com.stripe.param.issuing.AuthorizationListParams;
import com.stripe.param.issuing.AuthorizationRetrieveParams;
import com.stripe.param.issuing.AuthorizationReverseParams;
import com.stripe.param.issuing.AuthorizationUpdateParams;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* When an issued card is used to make a purchase, an
* Issuing {@code Authorization} object is created. Authorizations must be
* approved for the purchase to be completed successfully.
*
* Related guide: Issued card
* authorizations
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class Authorization extends ApiResource
implements MetadataStore, BalanceTransactionSource {
/**
* The total amount that was authorized or rejected. This amount is in {@code currency} and in the
* smallest currency unit. {@code
* amount} should be the same as {@code merchant_amount}, unless {@code currency} and {@code
* merchant_currency} are different.
*/
@SerializedName("amount")
Long amount;
/**
* Detailed breakdown of amount components. These amounts are denominated in {@code currency} and
* in the smallest currency unit.
*/
@SerializedName("amount_details")
AmountDetails amountDetails;
/** Whether the authorization has been approved. */
@SerializedName("approved")
Boolean approved;
/**
* How the card details were provided.
*
* One of {@code chip}, {@code contactless}, {@code keyed_in}, {@code online}, or {@code
* swipe}.
*/
@SerializedName("authorization_method")
String authorizationMethod;
/** List of balance transactions associated with this authorization. */
@SerializedName("balance_transactions")
List balanceTransactions;
/**
* You can create physical or virtual cards
* that are issued to cardholders.
*/
@SerializedName("card")
Card card;
/** The cardholder to whom this authorization belongs. */
@SerializedName("cardholder")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField cardholder;
/** Time at which the object was created. Measured in seconds since the Unix epoch. */
@SerializedName("created")
Long created;
/**
* The currency of the cardholder. This currency can be different from the currency presented at
* authorization and the {@code merchant_currency} field on this authorization. Three-letter ISO currency code, in lowercase.
* Must be a supported currency.
*/
@SerializedName("currency")
String currency;
/** Fleet-specific information for authorizations using Fleet cards. */
@SerializedName("fleet")
Fleet fleet;
/**
* Information about fuel that was purchased with this transaction. Typically this information is
* received from the merchant after the authorization has been approved and the fuel dispensed.
*/
@SerializedName("fuel")
Fuel fuel;
/** Unique identifier for the object. */
@Getter(onMethod_ = {@Override})
@SerializedName("id")
String id;
/**
* Has the value {@code true} if the object exists in live mode or the value {@code false} if the
* object exists in test mode.
*/
@SerializedName("livemode")
Boolean livemode;
/**
* The total amount that was authorized or rejected. This amount is in the {@code
* merchant_currency} and in the smallest currency unit. {@code
* merchant_amount} should be the same as {@code amount}, unless {@code merchant_currency} and
* {@code currency} are different.
*/
@SerializedName("merchant_amount")
Long merchantAmount;
/**
* The local currency that was presented to the cardholder for the authorization. This currency
* can be different from the cardholder currency and the {@code currency} field on this
* authorization. Three-letter ISO
* currency code, in lowercase. Must be a supported currency.
*/
@SerializedName("merchant_currency")
String merchantCurrency;
@SerializedName("merchant_data")
MerchantData merchantData;
/**
* Set of key-value pairs that you can attach
* to an object. This can be useful for storing additional information about the object in a
* structured format.
*/
@Getter(onMethod_ = {@Override})
@SerializedName("metadata")
Map metadata;
/** Details about the authorization, such as identifiers, set by the card network. */
@SerializedName("network_data")
NetworkData networkData;
/**
* String representing the object's type. Objects of the same type share the same value.
*
* Equal to {@code issuing.authorization}.
*/
@SerializedName("object")
String object;
/**
* The pending authorization request. This field will only be non-null during an {@code
* issuing_authorization.request} webhook.
*/
@SerializedName("pending_request")
PendingRequest pendingRequest;
/**
* History of every time a {@code pending_request} authorization was approved/declined, either by
* you directly or by Stripe (e.g. based on your spending_controls). If the merchant changes the
* authorization by performing an incremental authorization, you can look at this field to see the
* previous requests for the authorization. This field can be helpful in determining why a given
* authorization was approved/declined.
*/
@SerializedName("request_history")
List requestHistory;
/**
* The current status of the authorization in its lifecycle.
*
* One of {@code closed}, {@code pending}, or {@code reversed}.
*/
@SerializedName("status")
String status;
/**
* Token object used for this
* authorization. If a network token was not used for this authorization, this field will be null.
*/
@SerializedName("token")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField token;
/**
* List of transactions associated
* with this authorization.
*/
@SerializedName("transactions")
List transactions;
/**
* Treasury details related to this
* authorization if it was created on a FinancialAccount.
*/
@SerializedName("treasury")
Treasury treasury;
@SerializedName("verification_data")
VerificationData verificationData;
/**
* The digital wallet used for this transaction. One of {@code apple_pay}, {@code google_pay}, or
* {@code samsung_pay}. Will populate as {@code null} when no digital wallet was utilized.
*/
@SerializedName("wallet")
String wallet;
/** Get ID of expandable {@code cardholder} object. */
public String getCardholder() {
return (this.cardholder != null) ? this.cardholder.getId() : null;
}
public void setCardholder(String id) {
this.cardholder = ApiResource.setExpandableFieldId(id, this.cardholder);
}
/** Get expanded {@code cardholder}. */
public Cardholder getCardholderObject() {
return (this.cardholder != null) ? this.cardholder.getExpanded() : null;
}
public void setCardholderObject(Cardholder expandableObject) {
this.cardholder = new ExpandableField(expandableObject.getId(), expandableObject);
}
/** Get ID of expandable {@code token} object. */
public String getToken() {
return (this.token != null) ? this.token.getId() : null;
}
public void setToken(String id) {
this.token = ApiResource.setExpandableFieldId(id, this.token);
}
/** Get expanded {@code token}. */
public Token getTokenObject() {
return (this.token != null) ? this.token.getExpanded() : null;
}
public void setTokenObject(Token expandableObject) {
this.token = new ExpandableField(expandableObject.getId(), expandableObject);
}
/**
* [Deprecated] Approves a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real-time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to approve an authorization.
*/
@Deprecated
public Authorization approve() throws StripeException {
return approve((Map) null, (RequestOptions) null);
}
/**
* [Deprecated] Approves a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real-time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to approve an authorization.
*/
@Deprecated
public Authorization approve(RequestOptions options) throws StripeException {
return approve((Map) null, options);
}
/**
* [Deprecated] Approves a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real-time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to approve an authorization.
*/
@Deprecated
public Authorization approve(Map params) throws StripeException {
return approve(params, (RequestOptions) null);
}
/**
* [Deprecated] Approves a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real-time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to approve an authorization.
*/
@Deprecated
public Authorization approve(Map params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/issuing/authorizations/%s/approve", ApiResource.urlEncodeId(this.getId()));
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
return getResponseGetter().request(request, Authorization.class);
}
/**
* [Deprecated] Approves a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real-time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to approve an authorization.
*/
@Deprecated
public Authorization approve(AuthorizationApproveParams params) throws StripeException {
return approve(params, (RequestOptions) null);
}
/**
* [Deprecated] Approves a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real-time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to approve an authorization.
*/
@Deprecated
public Authorization approve(AuthorizationApproveParams params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/issuing/authorizations/%s/approve", ApiResource.urlEncodeId(this.getId()));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.POST,
path,
ApiRequestParams.paramsToMap(params),
options);
return getResponseGetter().request(request, Authorization.class);
}
/**
* [Deprecated] Declines a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to decline an authorization.
*/
@Deprecated
public Authorization decline() throws StripeException {
return decline((Map) null, (RequestOptions) null);
}
/**
* [Deprecated] Declines a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to decline an authorization.
*/
@Deprecated
public Authorization decline(RequestOptions options) throws StripeException {
return decline((Map) null, options);
}
/**
* [Deprecated] Declines a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to decline an authorization.
*/
@Deprecated
public Authorization decline(Map params) throws StripeException {
return decline(params, (RequestOptions) null);
}
/**
* [Deprecated] Declines a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to decline an authorization.
*/
@Deprecated
public Authorization decline(Map params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/issuing/authorizations/%s/decline", ApiResource.urlEncodeId(this.getId()));
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
return getResponseGetter().request(request, Authorization.class);
}
/**
* [Deprecated] Declines a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to decline an authorization.
*/
@Deprecated
public Authorization decline(AuthorizationDeclineParams params) throws StripeException {
return decline(params, (RequestOptions) null);
}
/**
* [Deprecated] Declines a pending Issuing {@code Authorization} object. This request should be
* made within the timeout window of the real time
* authorization flow. This method is deprecated. Instead, respond
* directly to the webhook request to decline an authorization.
*/
@Deprecated
public Authorization decline(AuthorizationDeclineParams params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/issuing/authorizations/%s/decline", ApiResource.urlEncodeId(this.getId()));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.POST,
path,
ApiRequestParams.paramsToMap(params),
options);
return getResponseGetter().request(request, Authorization.class);
}
/**
* Returns a list of Issuing {@code Authorization} objects. The objects are sorted in descending
* order by creation date, with the most recently created object appearing first.
*/
public static AuthorizationCollection list(Map params) throws StripeException {
return list(params, (RequestOptions) null);
}
/**
* Returns a list of Issuing {@code Authorization} objects. The objects are sorted in descending
* order by creation date, with the most recently created object appearing first.
*/
public static AuthorizationCollection list(Map params, RequestOptions options)
throws StripeException {
String path = "/v1/issuing/authorizations";
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
return getGlobalResponseGetter().request(request, AuthorizationCollection.class);
}
/**
* Returns a list of Issuing {@code Authorization} objects. The objects are sorted in descending
* order by creation date, with the most recently created object appearing first.
*/
public static AuthorizationCollection list(AuthorizationListParams params)
throws StripeException {
return list(params, (RequestOptions) null);
}
/**
* Returns a list of Issuing {@code Authorization} objects. The objects are sorted in descending
* order by creation date, with the most recently created object appearing first.
*/
public static AuthorizationCollection list(AuthorizationListParams params, RequestOptions options)
throws StripeException {
String path = "/v1/issuing/authorizations";
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.GET,
path,
ApiRequestParams.paramsToMap(params),
options);
return getGlobalResponseGetter().request(request, AuthorizationCollection.class);
}
/** Retrieves an Issuing {@code Authorization} object. */
public static Authorization retrieve(String authorization) throws StripeException {
return retrieve(authorization, (Map) null, (RequestOptions) null);
}
/** Retrieves an Issuing {@code Authorization} object. */
public static Authorization retrieve(String authorization, RequestOptions options)
throws StripeException {
return retrieve(authorization, (Map) null, options);
}
/** Retrieves an Issuing {@code Authorization} object. */
public static Authorization retrieve(
String authorization, Map params, RequestOptions options)
throws StripeException {
String path =
String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(authorization));
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
return getGlobalResponseGetter().request(request, Authorization.class);
}
/** Retrieves an Issuing {@code Authorization} object. */
public static Authorization retrieve(
String authorization, AuthorizationRetrieveParams params, RequestOptions options)
throws StripeException {
String path =
String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(authorization));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.GET,
path,
ApiRequestParams.paramsToMap(params),
options);
return getGlobalResponseGetter().request(request, Authorization.class);
}
/**
* Updates the specified Issuing {@code Authorization} object by setting the values of the
* parameters passed. Any parameters not provided will be left unchanged.
*/
@Override
public Authorization update(Map params) throws StripeException {
return update(params, (RequestOptions) null);
}
/**
* Updates the specified Issuing {@code Authorization} object by setting the values of the
* parameters passed. Any parameters not provided will be left unchanged.
*/
@Override
public Authorization update(Map params, RequestOptions options)
throws StripeException {
String path =
String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(this.getId()));
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
return getResponseGetter().request(request, Authorization.class);
}
/**
* Updates the specified Issuing {@code Authorization} object by setting the values of the
* parameters passed. Any parameters not provided will be left unchanged.
*/
public Authorization update(AuthorizationUpdateParams params) throws StripeException {
return update(params, (RequestOptions) null);
}
/**
* Updates the specified Issuing {@code Authorization} object by setting the values of the
* parameters passed. Any parameters not provided will be left unchanged.
*/
public Authorization update(AuthorizationUpdateParams params, RequestOptions options)
throws StripeException {
String path =
String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(this.getId()));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.POST,
path,
ApiRequestParams.paramsToMap(params),
options);
return getResponseGetter().request(request, Authorization.class);
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AmountDetails extends StripeObject {
/** The fee charged by the ATM for the cash withdrawal. */
@SerializedName("atm_fee")
Long atmFee;
/** The amount of cash requested by the cardholder. */
@SerializedName("cashback_amount")
Long cashbackAmount;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Fleet extends StripeObject {
/**
* Answers to prompts presented to the cardholder at the point of sale. Prompted fields vary
* depending on the configuration of your physical fleet cards. Typical points of sale support
* only numeric entry.
*/
@SerializedName("cardholder_prompt_data")
CardholderPromptData cardholderPromptData;
/**
* The type of purchase.
*
* One of {@code fuel_and_non_fuel_purchase}, {@code fuel_purchase}, or {@code
* non_fuel_purchase}.
*/
@SerializedName("purchase_type")
String purchaseType;
/**
* More information about the total amount. Typically this information is received from the
* merchant after the authorization has been approved and the fuel dispensed. This information
* is not guaranteed to be accurate as some merchants may provide unreliable data.
*/
@SerializedName("reported_breakdown")
ReportedBreakdown reportedBreakdown;
/**
* The type of fuel service.
*
*
One of {@code full_service}, {@code non_fuel_transaction}, or {@code self_service}.
*/
@SerializedName("service_type")
String serviceType;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class CardholderPromptData extends StripeObject {
/**
* [Deprecated] An alphanumeric ID, though typical point of sales only support numeric entry.
* The card program can be configured to prompt for a vehicle ID, driver ID, or generic ID.
*/
@SerializedName("alphanumeric_id")
@Deprecated
String alphanumericId;
/** Driver ID. */
@SerializedName("driver_id")
String driverId;
/** Odometer reading. */
@SerializedName("odometer")
Long odometer;
/**
* An alphanumeric ID. This field is used when a vehicle ID, driver ID, or generic ID is
* entered by the cardholder, but the merchant or card network did not specify the prompt
* type.
*/
@SerializedName("unspecified_id")
String unspecifiedId;
/** User ID. */
@SerializedName("user_id")
String userId;
/** Vehicle number. */
@SerializedName("vehicle_number")
String vehicleNumber;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class ReportedBreakdown extends StripeObject {
/** Breakdown of fuel portion of the purchase. */
@SerializedName("fuel")
Fuel fuel;
/** Breakdown of non-fuel portion of the purchase. */
@SerializedName("non_fuel")
NonFuel nonFuel;
/** Information about tax included in this transaction. */
@SerializedName("tax")
Tax tax;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Fuel extends StripeObject {
/**
* Gross fuel amount that should equal Fuel Quantity multiplied by Fuel Unit Cost, inclusive
* of taxes.
*/
@SerializedName("gross_amount_decimal")
BigDecimal grossAmountDecimal;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class NonFuel extends StripeObject {
/**
* Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes.
*/
@SerializedName("gross_amount_decimal")
BigDecimal grossAmountDecimal;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Tax extends StripeObject {
/**
* Amount of state or provincial Sales Tax included in the transaction amount. {@code null}
* if not reported by merchant or not subject to tax.
*/
@SerializedName("local_amount_decimal")
BigDecimal localAmountDecimal;
/**
* Amount of national Sales Tax or VAT included in the transaction amount. {@code null} if
* not reported by merchant or not subject to tax.
*/
@SerializedName("national_amount_decimal")
BigDecimal nationalAmountDecimal;
}
}
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Fuel extends StripeObject {
/**
* Conexxus Payment
* System Product Code identifying the primary fuel product purchased.
*/
@SerializedName("industry_product_code")
String industryProductCode;
/**
* The quantity of {@code unit}s of fuel that was dispensed, represented as a decimal string
* with at most 12 decimal places.
*/
@SerializedName("quantity_decimal")
BigDecimal quantityDecimal;
/**
* The type of fuel that was purchased.
*
*
One of {@code diesel}, {@code other}, {@code unleaded_plus}, {@code unleaded_regular}, or
* {@code unleaded_super}.
*/
@SerializedName("type")
String type;
/**
* The units for {@code quantity_decimal}.
*
*
One of {@code charging_minute}, {@code imperial_gallon}, {@code kilogram}, {@code
* kilowatt_hour}, {@code liter}, {@code other}, {@code pound}, or {@code us_gallon}.
*/
@SerializedName("unit")
String unit;
/**
* The cost in cents per each unit of fuel, represented as a decimal string with at most 12
* decimal places.
*/
@SerializedName("unit_cost_decimal")
BigDecimal unitCostDecimal;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class MerchantData extends StripeObject {
/**
* A categorization of the seller's type of business. See our merchant categories guide for
* a list of possible values.
*/
@SerializedName("category")
String category;
/** The merchant category code for the seller’s business. */
@SerializedName("category_code")
String categoryCode;
/** City where the seller is located. */
@SerializedName("city")
String city;
/** Country where the seller is located. */
@SerializedName("country")
String country;
/** Name of the seller. */
@SerializedName("name")
String name;
/**
* Identifier assigned to the seller by the card network. Different card networks may assign
* different network_id fields to the same merchant.
*/
@SerializedName("network_id")
String networkId;
/** Postal code where the seller is located. */
@SerializedName("postal_code")
String postalCode;
/** State where the seller is located. */
@SerializedName("state")
String state;
/** An ID assigned by the seller to the location of the sale. */
@SerializedName("terminal_id")
String terminalId;
/** URL provided by the merchant on a 3DS request. */
@SerializedName("url")
String url;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class NetworkData extends StripeObject {
/**
* Identifier assigned to the acquirer by the card network. Sometimes this value is not provided
* by the network; in this case, the value will be {@code null}.
*/
@SerializedName("acquiring_institution_id")
String acquiringInstitutionId;
/**
* The System Trace Audit Number (STAN) is a 6-digit identifier assigned by the acquirer. Prefer
* {@code network_data.transaction_id} if present, unless you have special requirements.
*/
@SerializedName("system_trace_audit_number")
String systemTraceAuditNumber;
/**
* Unique identifier for the authorization assigned by the card network used to match subsequent
* messages, disputes, and transactions.
*/
@SerializedName("transaction_id")
String transactionId;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class PendingRequest extends StripeObject {
/**
* The additional amount Stripe will hold if the authorization is approved, in the card's currency
* and in the smallest currency
* unit.
*/
@SerializedName("amount")
Long amount;
/**
* Detailed breakdown of amount components. These amounts are denominated in {@code currency}
* and in the smallest currency
* unit.
*/
@SerializedName("amount_details")
AmountDetails amountDetails;
/**
* Three-letter ISO currency
* code, in lowercase. Must be a supported
* currency.
*/
@SerializedName("currency")
String currency;
/**
* If set {@code true}, you may provide amount
* to control how much to hold for the authorization.
*/
@SerializedName("is_amount_controllable")
Boolean isAmountControllable;
/**
* The amount the merchant is requesting to be authorized in the {@code merchant_currency}. The
* amount is in the smallest currency
* unit.
*/
@SerializedName("merchant_amount")
Long merchantAmount;
/** The local currency the merchant is requesting to authorize. */
@SerializedName("merchant_currency")
String merchantCurrency;
/**
* The card network's estimate of the likelihood that an authorization is fraudulent. Takes on
* values between 1 and 99.
*/
@SerializedName("network_risk_score")
Long networkRiskScore;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AmountDetails extends StripeObject {
/** The fee charged by the ATM for the cash withdrawal. */
@SerializedName("atm_fee")
Long atmFee;
/** The amount of cash requested by the cardholder. */
@SerializedName("cashback_amount")
Long cashbackAmount;
}
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class RequestHistory extends StripeObject {
/**
* The {@code pending_request.amount} at the time of the request, presented in your card's
* currency and in the smallest
* currency unit. Stripe held this amount from your account to fund the authorization if the
* request was approved.
*/
@SerializedName("amount")
Long amount;
/**
* Detailed breakdown of amount components. These amounts are denominated in {@code currency}
* and in the smallest currency
* unit.
*/
@SerializedName("amount_details")
AmountDetails amountDetails;
/** Whether this request was approved. */
@SerializedName("approved")
Boolean approved;
/**
* A code created by Stripe which is shared with the merchant to validate the authorization.
* This field will be populated if the authorization message was approved. The code typically
* starts with the letter "S", followed by a six-digit number. For example,
* "S498162". Please note that the code is not guaranteed to be unique across
* authorizations.
*/
@SerializedName("authorization_code")
String authorizationCode;
/** Time at which the object was created. Measured in seconds since the Unix epoch. */
@SerializedName("created")
Long created;
/**
* Three-letter ISO currency
* code, in lowercase. Must be a supported
* currency.
*/
@SerializedName("currency")
String currency;
/**
* The {@code pending_request.merchant_amount} at the time of the request, presented in the
* {@code merchant_currency} and in the smallest currency unit.
*/
@SerializedName("merchant_amount")
Long merchantAmount;
/**
* The currency that was collected by the merchant and presented to the cardholder for the
* authorization. Three-letter ISO
* currency code, in lowercase. Must be a supported currency.
*/
@SerializedName("merchant_currency")
String merchantCurrency;
/**
* The card network's estimate of the likelihood that an authorization is fraudulent. Takes on
* values between 1 and 99.
*/
@SerializedName("network_risk_score")
Long networkRiskScore;
/**
* When an authorization is approved or declined by you or by Stripe, this field provides
* additional detail on the reason for the outcome.
*
*
One of {@code account_disabled}, {@code card_active}, {@code card_canceled}, {@code
* card_expired}, {@code card_inactive}, {@code cardholder_blocked}, {@code
* cardholder_inactive}, {@code cardholder_verification_required}, {@code
* insecure_authorization_method}, {@code insufficient_funds}, {@code not_allowed}, {@code
* pin_blocked}, {@code spending_controls}, {@code suspected_fraud}, {@code
* verification_failed}, {@code webhook_approved}, {@code webhook_declined}, {@code
* webhook_error}, or {@code webhook_timeout}.
*/
@SerializedName("reason")
String reason;
/**
* If the {@code request_history.reason} is {@code webhook_error} because the direct webhook
* response is invalid (for example, parsing errors or missing parameters), we surface a more
* detailed error message via this field.
*/
@SerializedName("reason_message")
String reasonMessage;
/**
* Time when the card network received an authorization request from the acquirer in UTC.
* Referred to by networks as transmission time.
*/
@SerializedName("requested_at")
Long requestedAt;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AmountDetails extends StripeObject {
/** The fee charged by the ATM for the cash withdrawal. */
@SerializedName("atm_fee")
Long atmFee;
/** The amount of cash requested by the cardholder. */
@SerializedName("cashback_amount")
Long cashbackAmount;
}
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Treasury extends StripeObject {
/**
* The array of ReceivedCredits associated
* with this authorization
*/
@SerializedName("received_credits")
List receivedCredits;
/**
* The array of ReceivedDebits associated
* with this authorization
*/
@SerializedName("received_debits")
List receivedDebits;
/**
* The Treasury Transaction
* associated with this authorization
*/
@SerializedName("transaction")
String transaction;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class VerificationData extends StripeObject {
/**
* Whether the cardholder provided an address first line and if it matched the cardholder’s
* {@code billing.address.line1}.
*
* One of {@code match}, {@code mismatch}, or {@code not_provided}.
*/
@SerializedName("address_line1_check")
String addressLine1Check;
/**
* Whether the cardholder provided a postal code and if it matched the cardholder’s {@code
* billing.address.postal_code}.
*
*
One of {@code match}, {@code mismatch}, or {@code not_provided}.
*/
@SerializedName("address_postal_code_check")
String addressPostalCodeCheck;
/** The exemption applied to this authorization. */
@SerializedName("authentication_exemption")
AuthenticationExemption authenticationExemption;
/**
* Whether the cardholder provided a CVC and if it matched Stripe’s record.
*
*
One of {@code match}, {@code mismatch}, or {@code not_provided}.
*/
@SerializedName("cvc_check")
String cvcCheck;
/**
* Whether the cardholder provided an expiry date and if it matched Stripe’s record.
*
*
One of {@code match}, {@code mismatch}, or {@code not_provided}.
*/
@SerializedName("expiry_check")
String expiryCheck;
/** The postal code submitted as part of the authorization used for postal code verification. */
@SerializedName("postal_code")
String postalCode;
/** 3D Secure details. */
@SerializedName("three_d_secure")
ThreeDSecure threeDSecure;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AuthenticationExemption extends StripeObject {
/**
* The entity that requested the exemption, either the acquiring merchant or the Issuing user.
*
*
One of {@code acquirer}, or {@code issuer}.
*/
@SerializedName("claimed_by")
String claimedBy;
/**
* The specific exemption claimed for this authorization.
*
*
One of {@code low_value_transaction}, {@code transaction_risk_analysis}, or {@code
* unknown}.
*/
@SerializedName("type")
String type;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class ThreeDSecure extends StripeObject {
/**
* The outcome of the 3D Secure authentication request.
*
*
One of {@code attempt_acknowledged}, {@code authenticated}, {@code failed}, or {@code
* required}.
*/
@SerializedName("result")
String result;
}
}
public TestHelpers getTestHelpers() {
return new TestHelpers(this);
}
public static class TestHelpers {
private final Authorization resource;
private TestHelpers(Authorization resource) {
this.resource = resource;
}
/** Create a test-mode authorization. */
public static Authorization create(Map params) throws StripeException {
return create(params, (RequestOptions) null);
}
/** Create a test-mode authorization. */
public static Authorization create(Map params, RequestOptions options)
throws StripeException {
String path = "/v1/test_helpers/issuing/authorizations";
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
return getGlobalResponseGetter().request(request, Authorization.class);
}
/** Create a test-mode authorization. */
public static Authorization create(AuthorizationCreateParams params) throws StripeException {
return create(params, (RequestOptions) null);
}
/** Create a test-mode authorization. */
public static Authorization create(AuthorizationCreateParams params, RequestOptions options)
throws StripeException {
String path = "/v1/test_helpers/issuing/authorizations";
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.POST,
path,
ApiRequestParams.paramsToMap(params),
options);
return getGlobalResponseGetter().request(request, Authorization.class);
}
/** Capture a test-mode authorization. */
public Authorization capture() throws StripeException {
return capture((Map) null, (RequestOptions) null);
}
/** Capture a test-mode authorization. */
public Authorization capture(RequestOptions options) throws StripeException {
return capture((Map) null, options);
}
/** Capture a test-mode authorization. */
public Authorization capture(Map params) throws StripeException {
return capture(params, (RequestOptions) null);
}
/** Capture a test-mode authorization. */
public Authorization capture(Map params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/test_helpers/issuing/authorizations/%s/capture",
ApiResource.urlEncodeId(this.resource.getId()));
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
return resource.getResponseGetter().request(request, Authorization.class);
}
/** Capture a test-mode authorization. */
public Authorization capture(AuthorizationCaptureParams params) throws StripeException {
return capture(params, (RequestOptions) null);
}
/** Capture a test-mode authorization. */
public Authorization capture(AuthorizationCaptureParams params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/test_helpers/issuing/authorizations/%s/capture",
ApiResource.urlEncodeId(this.resource.getId()));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.POST,
path,
ApiRequestParams.paramsToMap(params),
options);
return resource.getResponseGetter().request(request, Authorization.class);
}
/** Expire a test-mode Authorization. */
public Authorization expire() throws StripeException {
return expire((Map) null, (RequestOptions) null);
}
/** Expire a test-mode Authorization. */
public Authorization expire(RequestOptions options) throws StripeException {
return expire((Map) null, options);
}
/** Expire a test-mode Authorization. */
public Authorization expire(Map params) throws StripeException {
return expire(params, (RequestOptions) null);
}
/** Expire a test-mode Authorization. */
public Authorization expire(Map params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/test_helpers/issuing/authorizations/%s/expire",
ApiResource.urlEncodeId(this.resource.getId()));
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
return resource.getResponseGetter().request(request, Authorization.class);
}
/** Expire a test-mode Authorization. */
public Authorization expire(AuthorizationExpireParams params) throws StripeException {
return expire(params, (RequestOptions) null);
}
/** Expire a test-mode Authorization. */
public Authorization expire(AuthorizationExpireParams params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/test_helpers/issuing/authorizations/%s/expire",
ApiResource.urlEncodeId(this.resource.getId()));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.POST,
path,
ApiRequestParams.paramsToMap(params),
options);
return resource.getResponseGetter().request(request, Authorization.class);
}
/**
* Finalize the amount on an Authorization prior to capture, when the initial authorization was
* for an estimated amount.
*/
public Authorization finalizeAmount(Map params) throws StripeException {
return finalizeAmount(params, (RequestOptions) null);
}
/**
* Finalize the amount on an Authorization prior to capture, when the initial authorization was
* for an estimated amount.
*/
public Authorization finalizeAmount(Map params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/test_helpers/issuing/authorizations/%s/finalize_amount",
ApiResource.urlEncodeId(this.resource.getId()));
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
return resource.getResponseGetter().request(request, Authorization.class);
}
/**
* Finalize the amount on an Authorization prior to capture, when the initial authorization was
* for an estimated amount.
*/
public Authorization finalizeAmount(AuthorizationFinalizeAmountParams params)
throws StripeException {
return finalizeAmount(params, (RequestOptions) null);
}
/**
* Finalize the amount on an Authorization prior to capture, when the initial authorization was
* for an estimated amount.
*/
public Authorization finalizeAmount(
AuthorizationFinalizeAmountParams params, RequestOptions options) throws StripeException {
String path =
String.format(
"/v1/test_helpers/issuing/authorizations/%s/finalize_amount",
ApiResource.urlEncodeId(this.resource.getId()));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.POST,
path,
ApiRequestParams.paramsToMap(params),
options);
return resource.getResponseGetter().request(request, Authorization.class);
}
/** Increment a test-mode Authorization. */
public Authorization increment(Map params) throws StripeException {
return increment(params, (RequestOptions) null);
}
/** Increment a test-mode Authorization. */
public Authorization increment(Map params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/test_helpers/issuing/authorizations/%s/increment",
ApiResource.urlEncodeId(this.resource.getId()));
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
return resource.getResponseGetter().request(request, Authorization.class);
}
/** Increment a test-mode Authorization. */
public Authorization increment(AuthorizationIncrementParams params) throws StripeException {
return increment(params, (RequestOptions) null);
}
/** Increment a test-mode Authorization. */
public Authorization increment(AuthorizationIncrementParams params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/test_helpers/issuing/authorizations/%s/increment",
ApiResource.urlEncodeId(this.resource.getId()));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.POST,
path,
ApiRequestParams.paramsToMap(params),
options);
return resource.getResponseGetter().request(request, Authorization.class);
}
/** Reverse a test-mode Authorization. */
public Authorization reverse() throws StripeException {
return reverse((Map) null, (RequestOptions) null);
}
/** Reverse a test-mode Authorization. */
public Authorization reverse(RequestOptions options) throws StripeException {
return reverse((Map) null, options);
}
/** Reverse a test-mode Authorization. */
public Authorization reverse(Map params) throws StripeException {
return reverse(params, (RequestOptions) null);
}
/** Reverse a test-mode Authorization. */
public Authorization reverse(Map params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/test_helpers/issuing/authorizations/%s/reverse",
ApiResource.urlEncodeId(this.resource.getId()));
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
return resource.getResponseGetter().request(request, Authorization.class);
}
/** Reverse a test-mode Authorization. */
public Authorization reverse(AuthorizationReverseParams params) throws StripeException {
return reverse(params, (RequestOptions) null);
}
/** Reverse a test-mode Authorization. */
public Authorization reverse(AuthorizationReverseParams params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/test_helpers/issuing/authorizations/%s/reverse",
ApiResource.urlEncodeId(this.resource.getId()));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.POST,
path,
ApiRequestParams.paramsToMap(params),
options);
return resource.getResponseGetter().request(request, Authorization.class);
}
}
@Override
public void setResponseGetter(StripeResponseGetter responseGetter) {
super.setResponseGetter(responseGetter);
trySetResponseGetter(amountDetails, responseGetter);
trySetResponseGetter(card, responseGetter);
trySetResponseGetter(cardholder, responseGetter);
trySetResponseGetter(fleet, responseGetter);
trySetResponseGetter(fuel, responseGetter);
trySetResponseGetter(merchantData, responseGetter);
trySetResponseGetter(networkData, responseGetter);
trySetResponseGetter(pendingRequest, responseGetter);
trySetResponseGetter(token, responseGetter);
trySetResponseGetter(treasury, responseGetter);
trySetResponseGetter(verificationData, responseGetter);
}
}