forked from stripe/stripe-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[generated] source: spec3.sdk.yaml@spec-8935914 in master (stripe#777)
- Loading branch information
1 parent
967c646
commit d872635
Showing
25 changed files
with
1,008 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
// Generated by com.stripe.generator.entity.SdkBuilder | ||
|
||
package com.stripe.model; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import com.stripe.Stripe; | ||
import com.stripe.exception.InvalidRequestException; | ||
import com.stripe.exception.StripeException; | ||
import com.stripe.net.ApiResource; | ||
import com.stripe.net.RequestOptions; | ||
import com.stripe.param.CapabilityUpdateParams; | ||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@EqualsAndHashCode(callSuper = false) | ||
public class Capability extends ApiResource implements HasId { | ||
/** The account for which the capability enables functionality. */ | ||
@SerializedName("account") | ||
@Getter(lombok.AccessLevel.NONE) | ||
@Setter(lombok.AccessLevel.NONE) | ||
ExpandableField<Account> account; | ||
|
||
/** Unique identifier for the object. */ | ||
@Getter(onMethod_ = {@Override}) | ||
@SerializedName("id") | ||
String id; | ||
|
||
/** String representing the object's type. Objects of the same type share the same value. */ | ||
@SerializedName("object") | ||
String object; | ||
|
||
/** Whether the capability has been requested. */ | ||
@SerializedName("requested") | ||
Boolean requested; | ||
|
||
/** Time at which the capability was requested. Measured in seconds since the Unix epoch. */ | ||
@SerializedName("requested_at") | ||
Long requestedAt; | ||
|
||
@SerializedName("requirements") | ||
Requirements requirements; | ||
|
||
/** The status of the capability. Can be `active`, `inactive`, `pending`, or `unrequested`. */ | ||
@SerializedName("status") | ||
String status; | ||
|
||
/** Get id of expandable `account` object. */ | ||
public String getAccount() { | ||
return (this.account != null) ? this.account.getId() : null; | ||
} | ||
|
||
public void setAccount(String id) { | ||
this.account = ApiResource.setExpandableFieldId(id, this.account); | ||
} | ||
|
||
/** Get expanded `account`. */ | ||
public Account getAccountObject() { | ||
return (this.account != null) ? this.account.getExpanded() : null; | ||
} | ||
|
||
public void setAccountObject(Account expandableObject) { | ||
this.account = new ExpandableField<Account>(expandableObject.getId(), expandableObject); | ||
} | ||
|
||
/** Updates an existing Account Capability. */ | ||
public Capability update(Map<String, Object> params) throws StripeException { | ||
return update(params, (RequestOptions) null); | ||
} | ||
|
||
/** Updates an existing Account Capability. */ | ||
public Capability update(Map<String, Object> params, RequestOptions options) | ||
throws StripeException { | ||
String url; | ||
if (this.getAccount() != null) { | ||
url = | ||
String.format( | ||
"%s%s", | ||
Stripe.getApiBase(), | ||
String.format( | ||
"/v1/accounts/%s/capabilities/%s", | ||
ApiResource.urlEncodeId(this.getAccount()), | ||
ApiResource.urlEncodeId(this.getId()))); | ||
} else { | ||
throw new InvalidRequestException( | ||
"Unable to construct url because [account] field(s) are all null", | ||
null, | ||
null, | ||
null, | ||
0, | ||
null); | ||
} | ||
return request(ApiResource.RequestMethod.POST, url, params, Capability.class, options); | ||
} | ||
|
||
/** Updates an existing Account Capability. */ | ||
public Capability update(CapabilityUpdateParams params) throws StripeException { | ||
return update(params, (RequestOptions) null); | ||
} | ||
|
||
/** Updates an existing Account Capability. */ | ||
public Capability update(CapabilityUpdateParams params, RequestOptions options) | ||
throws StripeException { | ||
String url; | ||
if (this.getAccount() != null) { | ||
url = | ||
String.format( | ||
"%s%s", | ||
Stripe.getApiBase(), | ||
String.format( | ||
"/v1/accounts/%s/capabilities/%s", | ||
ApiResource.urlEncodeId(this.getAccount()), | ||
ApiResource.urlEncodeId(this.getId()))); | ||
} else { | ||
throw new InvalidRequestException( | ||
"Unable to construct url because [account] field(s) are all null", | ||
null, | ||
null, | ||
null, | ||
0, | ||
null); | ||
} | ||
return request(ApiResource.RequestMethod.POST, url, params, Capability.class, options); | ||
} | ||
|
||
@Getter | ||
@Setter | ||
@EqualsAndHashCode(callSuper = false) | ||
public static class Requirements extends StripeObject { | ||
/** | ||
* The date the fields in `currently_due` must be collected by to keep the capability enabled | ||
* for the account. | ||
*/ | ||
@SerializedName("current_deadline") | ||
Long currentDeadline; | ||
|
||
/** | ||
* The fields that need to be collected to keep the capability enabled. If not collected by the | ||
* `current_deadline`, these fields appear in `past_due` as well, and the capability is | ||
* disabled. | ||
*/ | ||
@SerializedName("currently_due") | ||
List<String> currentlyDue; | ||
|
||
/** | ||
* If the capability is disabled, this string describes why. Possible values are | ||
* `requirement.fields_needed`, `pending.onboarding`, `pending.review`, `rejected_fraud`, or | ||
* `rejected.other`. | ||
*/ | ||
@SerializedName("disabled_reason") | ||
String disabledReason; | ||
|
||
/** | ||
* The fields that need to be collected assuming all volume thresholds are reached. As they | ||
* become required, these fields appear in `currently_due` as well, and the `current_deadline` | ||
* is set. | ||
*/ | ||
@SerializedName("eventually_due") | ||
List<String> eventuallyDue; | ||
|
||
/** | ||
* The fields that weren't collected by the `current_deadline`. These fields need to be | ||
* collected to enable the capability for the account. | ||
*/ | ||
@SerializedName("past_due") | ||
List<String> pastDue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Generated by com.stripe.generator.entity.SdkBuilder | ||
|
||
package com.stripe.model; | ||
|
||
import com.stripe.Stripe; | ||
import com.stripe.exception.StripeException; | ||
import com.stripe.net.ApiResource; | ||
import com.stripe.net.RequestOptions; | ||
import com.stripe.param.CapabilityCollectionListParams; | ||
import com.stripe.param.CapabilityCollectionRetrieveParams; | ||
import java.util.Map; | ||
|
||
public class CapabilityCollection extends StripeCollection<Capability> { | ||
/** | ||
* Returns a list of capabilities associated with the account. The capabilities are returned | ||
* sorted by creation date, with the most recent capability appearing first. | ||
*/ | ||
public CapabilityCollection list(Map<String, Object> params) throws StripeException { | ||
return list(params, (RequestOptions) null); | ||
} | ||
|
||
/** | ||
* Returns a list of capabilities associated with the account. The capabilities are returned | ||
* sorted by creation date, with the most recent capability appearing first. | ||
*/ | ||
public CapabilityCollection list(Map<String, Object> params, RequestOptions options) | ||
throws StripeException { | ||
String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); | ||
return ApiResource.requestCollection(url, params, CapabilityCollection.class, options); | ||
} | ||
|
||
/** | ||
* Returns a list of capabilities associated with the account. The capabilities are returned | ||
* sorted by creation date, with the most recent capability appearing first. | ||
*/ | ||
public CapabilityCollection list(CapabilityCollectionListParams params) throws StripeException { | ||
return list(params, (RequestOptions) null); | ||
} | ||
|
||
/** | ||
* Returns a list of capabilities associated with the account. The capabilities are returned | ||
* sorted by creation date, with the most recent capability appearing first. | ||
*/ | ||
public CapabilityCollection list(CapabilityCollectionListParams params, RequestOptions options) | ||
throws StripeException { | ||
String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); | ||
return ApiResource.requestCollection(url, params, CapabilityCollection.class, options); | ||
} | ||
|
||
/** Retrieves an existing Account Capability. */ | ||
public Capability retrieve(String id) throws StripeException { | ||
return retrieve(id, (Map<String, Object>) null, (RequestOptions) null); | ||
} | ||
|
||
/** Retrieves an existing Account Capability. */ | ||
public Capability retrieve(String id, RequestOptions options) throws StripeException { | ||
return retrieve(id, (Map<String, Object>) null, options); | ||
} | ||
|
||
/** Retrieves an existing Account Capability. */ | ||
public Capability retrieve(String id, Map<String, Object> params, RequestOptions options) | ||
throws StripeException { | ||
String url = | ||
String.format( | ||
"%s%s", | ||
Stripe.getApiBase(), | ||
String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id))); | ||
return ApiResource.request( | ||
ApiResource.RequestMethod.GET, url, params, Capability.class, options); | ||
} | ||
|
||
/** Retrieves an existing Account Capability. */ | ||
public Capability retrieve( | ||
String id, CapabilityCollectionRetrieveParams params, RequestOptions options) | ||
throws StripeException { | ||
String url = | ||
String.format( | ||
"%s%s", | ||
Stripe.getApiBase(), | ||
String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id))); | ||
return ApiResource.request( | ||
ApiResource.RequestMethod.GET, url, params, Capability.class, options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.