com.stripe.model.CountrySpec Maven / Gradle / Ivy
// File generated from our OpenAPI spec
package com.stripe.model;
import com.google.gson.annotations.SerializedName;
import com.stripe.exception.StripeException;
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.CountrySpecListParams;
import com.stripe.param.CountrySpecRetrieveParams;
import java.util.List;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* Stripe needs to collect certain pieces of information about each account created. These
* requirements can differ depending on the account's country. The Country Specs API makes these
* rules available to your integration.
*
* You can also view the information from this API call as an online guide.
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class CountrySpec extends ApiResource implements HasId {
/**
* The default currency for this country. This applies to both payment methods and bank accounts.
*/
@SerializedName("default_currency")
String defaultCurrency;
/** Unique identifier for the object. Represented as the ISO country code for this country. */
@Getter(onMethod_ = {@Override})
@SerializedName("id")
String id;
/**
* String representing the object's type. Objects of the same type share the same value.
*
*
Equal to {@code country_spec}.
*/
@SerializedName("object")
String object;
/** Currencies that can be accepted in the specific country (for transfers). */
@SerializedName("supported_bank_account_currencies")
Map> supportedBankAccountCurrencies;
/** Currencies that can be accepted in the specified country (for payments). */
@SerializedName("supported_payment_currencies")
List supportedPaymentCurrencies;
/**
* Payment methods available in the specified country. You may need to enable some payment methods
* (e.g., ACH) on your account before they appear in
* this list. The {@code stripe} payment method refers to charging through your platform.
*/
@SerializedName("supported_payment_methods")
List supportedPaymentMethods;
/** Countries that can accept transfers from the specified country. */
@SerializedName("supported_transfer_countries")
List supportedTransferCountries;
@SerializedName("verification_fields")
VerificationFields verificationFields;
/** Lists all Country Spec objects available in the API. */
public static CountrySpecCollection list(Map params) throws StripeException {
return list(params, (RequestOptions) null);
}
/** Lists all Country Spec objects available in the API. */
public static CountrySpecCollection list(Map params, RequestOptions options)
throws StripeException {
String path = "/v1/country_specs";
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
return getGlobalResponseGetter().request(request, CountrySpecCollection.class);
}
/** Lists all Country Spec objects available in the API. */
public static CountrySpecCollection list(CountrySpecListParams params) throws StripeException {
return list(params, (RequestOptions) null);
}
/** Lists all Country Spec objects available in the API. */
public static CountrySpecCollection list(CountrySpecListParams params, RequestOptions options)
throws StripeException {
String path = "/v1/country_specs";
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.GET,
path,
ApiRequestParams.paramsToMap(params),
options);
return getGlobalResponseGetter().request(request, CountrySpecCollection.class);
}
/** Returns a Country Spec for a given Country code. */
public static CountrySpec retrieve(String country) throws StripeException {
return retrieve(country, (Map) null, (RequestOptions) null);
}
/** Returns a Country Spec for a given Country code. */
public static CountrySpec retrieve(String country, RequestOptions options)
throws StripeException {
return retrieve(country, (Map) null, options);
}
/** Returns a Country Spec for a given Country code. */
public static CountrySpec retrieve(
String country, Map params, RequestOptions options) throws StripeException {
String path = String.format("/v1/country_specs/%s", ApiResource.urlEncodeId(country));
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
return getGlobalResponseGetter().request(request, CountrySpec.class);
}
/** Returns a Country Spec for a given Country code. */
public static CountrySpec retrieve(
String country, CountrySpecRetrieveParams params, RequestOptions options)
throws StripeException {
String path = String.format("/v1/country_specs/%s", ApiResource.urlEncodeId(country));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.GET,
path,
ApiRequestParams.paramsToMap(params),
options);
return getGlobalResponseGetter().request(request, CountrySpec.class);
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class VerificationFields extends StripeObject {
@SerializedName("company")
Company company;
@SerializedName("individual")
Individual individual;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Company extends StripeObject {
/** Additional fields which are only required for some users. */
@SerializedName("additional")
List additional;
/** Fields which every account must eventually provide. */
@SerializedName("minimum")
List minimum;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Individual extends StripeObject {
/** Additional fields which are only required for some users. */
@SerializedName("additional")
List additional;
/** Fields which every account must eventually provide. */
@SerializedName("minimum")
List minimum;
}
}
@Override
public void setResponseGetter(StripeResponseGetter responseGetter) {
super.setResponseGetter(responseGetter);
trySetResponseGetter(verificationFields, responseGetter);
}
}