@@ -75,99 +75,161 @@ public class Account extends APIResource implements HasId, MetadataStore<Account
75
75
@ Deprecated
76
76
List <String > currenciesSupported ;
77
77
78
+ // <editor-fold desc="all">
79
+ /**
80
+ * List all connected accounts.
81
+ *
82
+ * @deprecated Use the {@link #list(Map)} method instead.
83
+ * This method will be removed in the next major version.
84
+ */
78
85
@ Deprecated
79
86
public static AccountCollection all (Map <String , Object > params )
80
87
throws AuthenticationException , InvalidRequestException ,
81
88
APIConnectionException , CardException , APIException {
82
89
return list (params , null );
83
90
}
84
91
92
+ /**
93
+ * List all connected accounts.
94
+ *
95
+ * @deprecated Use the {@link #list(Map, RequestOptions)} method instead.
96
+ * This method will be removed in the next major version.
97
+ */
85
98
@ Deprecated
86
99
public static AccountCollection all (Map <String , Object > params , RequestOptions options )
87
100
throws AuthenticationException , InvalidRequestException ,
88
101
APIConnectionException , CardException , APIException {
89
102
return list (params , options );
90
103
}
104
+ // </editor-fold>
91
105
106
+ // <editor-fold desc="create">
107
+ /**
108
+ * Create an account.
109
+ */
92
110
public static Account create (Map <String , Object > params )
93
111
throws AuthenticationException , InvalidRequestException ,
94
112
APIConnectionException , CardException , APIException {
95
113
return create (params , null );
96
114
}
97
115
116
+ /**
117
+ * Create an account.
118
+ */
98
119
public static Account create (Map <String , Object > params , RequestOptions options )
99
120
throws AuthenticationException , InvalidRequestException ,
100
121
APIConnectionException , CardException , APIException {
101
122
return request (RequestMethod .POST , classURL (Account .class ), params , Account .class , options );
102
123
}
124
+ // </editor-fold>
103
125
126
+ // <editor-fold desc="delete">
127
+ /**
128
+ * Delete an account.
129
+ */
104
130
public DeletedAccount delete ()
105
131
throws AuthenticationException , InvalidRequestException ,
106
132
APIConnectionException , CardException , APIException {
107
133
return delete (null , (RequestOptions ) null );
108
134
}
109
135
136
+ /**
137
+ * Delete an account.
138
+ */
110
139
public DeletedAccount delete (RequestOptions options )
111
140
throws AuthenticationException , InvalidRequestException ,
112
141
APIConnectionException , CardException , APIException {
113
142
return delete (null , options );
114
143
}
115
144
145
+ /**
146
+ * Delete an account.
147
+ */
116
148
public DeletedAccount delete (Map <String , Object > params )
117
149
throws AuthenticationException , InvalidRequestException ,
118
150
APIConnectionException , CardException , APIException {
119
151
return delete (params , null );
120
152
}
121
153
154
+ /**
155
+ * Delete an account.
156
+ */
122
157
public DeletedAccount delete (Map <String , Object > params , RequestOptions options )
123
158
throws AuthenticationException , InvalidRequestException ,
124
159
APIConnectionException , CardException , APIException {
125
160
return request (RequestMethod .DELETE , instanceURL (Account .class , this .id ), params ,
126
161
DeletedAccount .class , options );
127
162
}
163
+ // </editor-fold>
128
164
165
+ // <editor-fold desc="list">
166
+ /**
167
+ * List all connected accounts.
168
+ */
129
169
public static AccountCollection list (Map <String , Object > params )
130
170
throws AuthenticationException , InvalidRequestException ,
131
171
APIConnectionException , CardException , APIException {
132
172
return list (params , null );
133
173
}
134
174
175
+ /**
176
+ * List all connected accounts.
177
+ */
135
178
public static AccountCollection list (Map <String , Object > params , RequestOptions options )
136
179
throws AuthenticationException , InvalidRequestException ,
137
180
APIConnectionException , CardException , APIException {
138
181
return requestCollection (classURL (Account .class ), params , AccountCollection .class , options );
139
182
}
183
+ // </editor-fold>
140
184
185
+ // <editor-fold desc="reject">
186
+ /**
187
+ * Reject an account.
188
+ */
141
189
public Account reject (Map <String , Object > params )
142
190
throws AuthenticationException , InvalidRequestException ,
143
191
APIConnectionException , CardException , APIException {
144
192
return reject (params , null );
145
193
}
146
194
195
+ /**
196
+ * Reject an account.
197
+ */
147
198
public Account reject (Map <String , Object > params , RequestOptions options )
148
199
throws AuthenticationException , InvalidRequestException ,
149
200
APIConnectionException , CardException , APIException {
150
201
return request (RequestMethod .POST , String .format ("%s/reject" ,
151
202
instanceURL (Account .class , this .getId ())), params , Account .class , options );
152
203
}
204
+ // </editor-fold>
153
205
206
+ // <editor-fold desc="retrieve">
207
+ /**
208
+ * Retrieve account details.
209
+ */
154
210
public static Account retrieve ()
155
211
throws AuthenticationException , InvalidRequestException ,
156
212
APIConnectionException , CardException , APIException {
157
213
return retrieve ((RequestOptions ) null );
158
214
}
159
215
216
+ /**
217
+ * Retrieve account details.
218
+ */
160
219
public static Account retrieve (RequestOptions options )
161
220
throws AuthenticationException , InvalidRequestException ,
162
221
APIConnectionException , CardException , APIException {
163
222
return request (RequestMethod .GET , singleClassURL (Account .class ), null , Account .class , options );
164
223
}
165
224
166
225
/**
167
- * In order to preserve backwards-compatibility, this method does two things.
168
- * If the parameter looks like an API key (starts with sk_), retrieve the
169
- * account resource with no ID parameter set. Otherwise, use the String
170
- * parameter as the account ID.
226
+ * Retrieve account details.
227
+ *
228
+ * @param apiKeyOrAccountId If the parameter looks like an API key (starts with "sk_"), retrieve
229
+ * the account resource with no ID parameter set. Otherwise, use the String parameter as the
230
+ * account ID.
231
+ * @deprecated This method will only accept account IDs in the next major version. If you call
232
+ * this method with API keys, use the {@link #retrieve(RequestOptions)} method instead.
171
233
*/
172
234
@ Deprecated
173
235
public static Account retrieve (String apiKeyOrAccountId )
@@ -180,33 +242,48 @@ public static Account retrieve(String apiKeyOrAccountId)
180
242
}
181
243
}
182
244
245
+ /**
246
+ * Retrieve account details.
247
+ */
183
248
public static Account retrieve (String id , RequestOptions options )
184
249
throws AuthenticationException , InvalidRequestException ,
185
250
APIConnectionException , CardException , APIException {
186
251
return request (RequestMethod .GET , instanceURL (Account .class , id ), null , Account .class , options );
187
252
}
188
253
254
+ /**
255
+ * Retrieve account details.
256
+ */
189
257
public static Account retrieve (String id , Map <String , Object > params , RequestOptions options )
190
258
throws AuthenticationException , InvalidRequestException ,
191
259
APIConnectionException , CardException , APIException {
192
260
return request (RequestMethod .GET , instanceURL (Account .class , id ), params , Account .class ,
193
261
options );
194
262
}
263
+ // </editor-fold>
195
264
265
+ // <editor-fold desc="update">
266
+ /**
267
+ * Update an account.
268
+ */
196
269
@ Override
197
270
public Account update (Map <String , Object > params )
198
271
throws AuthenticationException , InvalidRequestException ,
199
272
APIConnectionException , CardException , APIException {
200
273
return update (params , null );
201
274
}
202
275
276
+ /**
277
+ * Update an account.
278
+ */
203
279
@ Override
204
280
public Account update (Map <String , Object > params , RequestOptions options )
205
281
throws AuthenticationException , InvalidRequestException ,
206
282
APIConnectionException , CardException , APIException {
207
283
return request (RequestMethod .POST , instanceURL (Account .class , this .id ), params , Account .class ,
208
284
options );
209
285
}
286
+ // </editor-fold>
210
287
211
288
@ Getter
212
289
@ Setter
0 commit comments