Skip to content

Commit 7ec56d6

Browse files
authored
Merge pull request #526 from stripe/ob-reorg-methods
Alphabetize methods
2 parents 58df26a + d43f75c commit 7ec56d6

34 files changed

+1287
-1321
lines changed

src/main/java/com/stripe/model/Account.java

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@ public class Account extends APIResource implements HasId, MetadataStore<Account
7575
@Deprecated
7676
List<String> currenciesSupported;
7777

78+
@Deprecated
79+
public static AccountCollection all(Map<String, Object> params)
80+
throws AuthenticationException, InvalidRequestException,
81+
APIConnectionException, CardException, APIException {
82+
return list(params, null);
83+
}
84+
85+
@Deprecated
86+
public static AccountCollection all(Map<String, Object> params, RequestOptions options)
87+
throws AuthenticationException, InvalidRequestException,
88+
APIConnectionException, CardException, APIException {
89+
return list(params, options);
90+
}
91+
7892
public static Account create(Map<String, Object> params)
7993
throws AuthenticationException, InvalidRequestException,
8094
APIConnectionException, CardException, APIException {
@@ -87,6 +101,31 @@ public static Account create(Map<String, Object> params, RequestOptions options)
87101
return request(RequestMethod.POST, classURL(Account.class), params, Account.class, options);
88102
}
89103

104+
public DeletedAccount delete()
105+
throws AuthenticationException, InvalidRequestException,
106+
APIConnectionException, CardException, APIException {
107+
return delete(null, (RequestOptions) null);
108+
}
109+
110+
public DeletedAccount delete(RequestOptions options)
111+
throws AuthenticationException, InvalidRequestException,
112+
APIConnectionException, CardException, APIException {
113+
return delete(null, options);
114+
}
115+
116+
public DeletedAccount delete(Map<String, Object> params)
117+
throws AuthenticationException, InvalidRequestException,
118+
APIConnectionException, CardException, APIException {
119+
return delete(params, null);
120+
}
121+
122+
public DeletedAccount delete(Map<String, Object> params, RequestOptions options)
123+
throws AuthenticationException, InvalidRequestException,
124+
APIConnectionException, CardException, APIException {
125+
return request(RequestMethod.DELETE, instanceURL(Account.class, this.id), params,
126+
DeletedAccount.class, options);
127+
}
128+
90129
public static AccountCollection list(Map<String, Object> params)
91130
throws AuthenticationException, InvalidRequestException,
92131
APIConnectionException, CardException, APIException {
@@ -99,18 +138,17 @@ public static AccountCollection list(Map<String, Object> params, RequestOptions
99138
return requestCollection(classURL(Account.class), params, AccountCollection.class, options);
100139
}
101140

102-
@Deprecated
103-
public static AccountCollection all(Map<String, Object> params)
141+
public Account reject(Map<String, Object> params)
104142
throws AuthenticationException, InvalidRequestException,
105143
APIConnectionException, CardException, APIException {
106-
return list(params, null);
144+
return reject(params, null);
107145
}
108146

109-
@Deprecated
110-
public static AccountCollection all(Map<String, Object> params, RequestOptions options)
147+
public Account reject(Map<String, Object> params, RequestOptions options)
111148
throws AuthenticationException, InvalidRequestException,
112149
APIConnectionException, CardException, APIException {
113-
return list(params, options);
150+
return request(RequestMethod.POST, String.format("%s/reject",
151+
instanceURL(Account.class, this.getId())), params, Account.class, options);
114152
}
115153

116154
public static Account retrieve()
@@ -119,6 +157,12 @@ public static Account retrieve()
119157
return retrieve((RequestOptions) null);
120158
}
121159

160+
public static Account retrieve(RequestOptions options)
161+
throws AuthenticationException, InvalidRequestException,
162+
APIConnectionException, CardException, APIException {
163+
return request(RequestMethod.GET, singleClassURL(Account.class), null, Account.class, options);
164+
}
165+
122166
/**
123167
* In order to preserve backwards-compatibility, this method does two things.
124168
* If the parameter looks like an API key (starts with sk_), retrieve the
@@ -136,12 +180,6 @@ public static Account retrieve(String apiKeyOrAccountId)
136180
}
137181
}
138182

139-
public static Account retrieve(RequestOptions options)
140-
throws AuthenticationException, InvalidRequestException,
141-
APIConnectionException, CardException, APIException {
142-
return request(RequestMethod.GET, singleClassURL(Account.class), null, Account.class, options);
143-
}
144-
145183
public static Account retrieve(String id, RequestOptions options)
146184
throws AuthenticationException, InvalidRequestException,
147185
APIConnectionException, CardException, APIException {
@@ -170,44 +208,6 @@ public Account update(Map<String, Object> params, RequestOptions options)
170208
options);
171209
}
172210

173-
public DeletedAccount delete()
174-
throws AuthenticationException, InvalidRequestException,
175-
APIConnectionException, CardException, APIException {
176-
return delete(null, (RequestOptions) null);
177-
}
178-
179-
public DeletedAccount delete(RequestOptions options)
180-
throws AuthenticationException, InvalidRequestException,
181-
APIConnectionException, CardException, APIException {
182-
return delete(null, options);
183-
}
184-
185-
public DeletedAccount delete(Map<String, Object> params)
186-
throws AuthenticationException, InvalidRequestException,
187-
APIConnectionException, CardException, APIException {
188-
return delete(params, null);
189-
}
190-
191-
public DeletedAccount delete(Map<String, Object> params, RequestOptions options)
192-
throws AuthenticationException, InvalidRequestException,
193-
APIConnectionException, CardException, APIException {
194-
return request(RequestMethod.DELETE, instanceURL(Account.class, this.id), params,
195-
DeletedAccount.class, options);
196-
}
197-
198-
public Account reject(Map<String, Object> params)
199-
throws AuthenticationException, InvalidRequestException,
200-
APIConnectionException, CardException, APIException {
201-
return reject(params, null);
202-
}
203-
204-
public Account reject(Map<String, Object> params, RequestOptions options)
205-
throws AuthenticationException, InvalidRequestException,
206-
APIConnectionException, CardException, APIException {
207-
return request(RequestMethod.POST, String.format("%s/reject",
208-
instanceURL(Account.class, this.getId())), params, Account.class, options);
209-
}
210-
211211
@Getter
212212
@Setter
213213
@EqualsAndHashCode(callSuper = false)

src/main/java/com/stripe/model/AlipayAccount.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,6 @@ public class AlipayAccount extends ExternalAccount {
2727
String username;
2828
String status;
2929

30-
@Override
31-
public AlipayAccount update(Map<String, Object> params)
32-
throws AuthenticationException, InvalidRequestException,
33-
APIConnectionException, CardException, APIException {
34-
return update(params, null);
35-
}
36-
37-
@Override
38-
public AlipayAccount update(Map<String, Object> params, RequestOptions options)
39-
throws AuthenticationException, InvalidRequestException,
40-
APIConnectionException, CardException, APIException {
41-
return request(RequestMethod.POST, this.getInstanceURL(), params, AlipayAccount.class, options);
42-
}
43-
4430
@Override
4531
public DeletedAlipayAccount delete() throws AuthenticationException,
4632
InvalidRequestException, APIConnectionException, CardException,
@@ -55,4 +41,18 @@ public DeletedAlipayAccount delete(RequestOptions options) throws Authentication
5541
return request(RequestMethod.DELETE, this.getInstanceURL(), null, DeletedAlipayAccount.class,
5642
options);
5743
}
44+
45+
@Override
46+
public AlipayAccount update(Map<String, Object> params)
47+
throws AuthenticationException, InvalidRequestException,
48+
APIConnectionException, CardException, APIException {
49+
return update(params, null);
50+
}
51+
52+
@Override
53+
public AlipayAccount update(Map<String, Object> params, RequestOptions options)
54+
throws AuthenticationException, InvalidRequestException,
55+
APIConnectionException, CardException, APIException {
56+
return request(RequestMethod.POST, this.getInstanceURL(), params, AlipayAccount.class, options);
57+
}
5858
}

src/main/java/com/stripe/model/ApplePayDomain.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ public static ApplePayDomain create(Map<String, Object> params, RequestOptions o
3737
return request(RequestMethod.POST, getClassURL(), params, ApplePayDomain.class, options);
3838
}
3939

40-
public static ApplePayDomain retrieve(String id) throws AuthenticationException,
41-
InvalidRequestException, APIConnectionException, CardException,
42-
APIException {
43-
return retrieve(id, null);
44-
}
45-
46-
public static ApplePayDomain retrieve(String id, RequestOptions options)
47-
throws AuthenticationException, InvalidRequestException,
48-
APIConnectionException, CardException, APIException {
49-
return request(RequestMethod.GET, getInstanceURL(id), null, ApplePayDomain.class, options);
50-
}
51-
5240
public DeletedApplePayDomain delete() throws AuthenticationException,
5341
InvalidRequestException, APIConnectionException, CardException,
5442
APIException {
@@ -74,6 +62,18 @@ public static ApplePayDomainCollection list(Map<String, Object> params, RequestO
7462
return requestCollection(getClassURL(), params, ApplePayDomainCollection.class, options);
7563
}
7664

65+
public static ApplePayDomain retrieve(String id) throws AuthenticationException,
66+
InvalidRequestException, APIConnectionException, CardException,
67+
APIException {
68+
return retrieve(id, null);
69+
}
70+
71+
public static ApplePayDomain retrieve(String id, RequestOptions options)
72+
throws AuthenticationException, InvalidRequestException,
73+
APIConnectionException, CardException, APIException {
74+
return request(RequestMethod.GET, getInstanceURL(id), null, ApplePayDomain.class, options);
75+
}
76+
7777
private static String getClassURL() {
7878
return String.format("%s/v1/%s", Stripe.getApiBase(), "apple_pay/domains");
7979
}

src/main/java/com/stripe/model/Balance.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ public static Balance retrieve() throws AuthenticationException,
2929
return retrieve((RequestOptions) null);
3030
}
3131

32-
@Deprecated
33-
public static Balance retrieve(String apiKey)
32+
public static Balance retrieve(RequestOptions options)
3433
throws AuthenticationException, InvalidRequestException,
3534
APIConnectionException, CardException, APIException {
36-
return retrieve(RequestOptions.builder().setApiKey(apiKey).build());
35+
return request(RequestMethod.GET, singleClassURL(Balance.class), null, Balance.class, options);
3736
}
3837

39-
public static Balance retrieve(RequestOptions options)
38+
@Deprecated
39+
public static Balance retrieve(String apiKey)
4040
throws AuthenticationException, InvalidRequestException,
4141
APIConnectionException, CardException, APIException {
42-
return request(RequestMethod.GET, singleClassURL(Balance.class), null, Balance.class, options);
42+
return retrieve(RequestOptions.builder().setApiKey(apiKey).build());
4343
}
4444
}

src/main/java/com/stripe/model/BalanceTransaction.java

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,25 @@ public <O extends HasId> O getSourceObjectAs() {
6868
}
6969
// </editor-fold>
7070

71-
public static BalanceTransaction retrieve(String id) throws AuthenticationException,
72-
InvalidRequestException, APIConnectionException, CardException,
73-
APIException {
74-
return retrieve(id, (RequestOptions) null);
71+
@Deprecated
72+
public static BalanceTransactionCollection all(Map<String, Object> params)
73+
throws AuthenticationException, InvalidRequestException,
74+
APIConnectionException, CardException, APIException {
75+
return list(params, null);
7576
}
7677

7778
@Deprecated
78-
public static BalanceTransaction retrieve(String id, String apiKey)
79+
public static BalanceTransactionCollection all(Map<String, Object> params, String apiKey)
7980
throws AuthenticationException, InvalidRequestException,
8081
APIConnectionException, CardException, APIException {
81-
return retrieve(id, RequestOptions.builder().setApiKey(apiKey).build());
82+
return list(params, RequestOptions.builder().setApiKey(apiKey).build());
8283
}
8384

84-
public static BalanceTransaction retrieve(String id, RequestOptions options)
85+
@Deprecated
86+
public static BalanceTransactionCollection all(Map<String, Object> params, RequestOptions options)
8587
throws AuthenticationException, InvalidRequestException,
8688
APIConnectionException, CardException, APIException {
87-
String url = String.format("%s/%s/%s", Stripe.getApiBase(), "v1/balance/history", id);
88-
return request(RequestMethod.GET, url, null, BalanceTransaction.class, options);
89+
return list(params, options);
8990
}
9091

9192
public static BalanceTransactionCollection list(Map<String, Object> params)
@@ -102,25 +103,23 @@ public static BalanceTransactionCollection list(Map<String, Object> params,
102103
return requestCollection(url, params, BalanceTransactionCollection.class, options);
103104
}
104105

105-
@Deprecated
106-
public static BalanceTransactionCollection all(Map<String, Object> params)
107-
throws AuthenticationException, InvalidRequestException,
108-
APIConnectionException, CardException, APIException {
109-
return list(params, null);
106+
public static BalanceTransaction retrieve(String id) throws AuthenticationException,
107+
InvalidRequestException, APIConnectionException, CardException,
108+
APIException {
109+
return retrieve(id, (RequestOptions) null);
110110
}
111111

112-
@Deprecated
113-
public static BalanceTransactionCollection all(Map<String, Object> params, String apiKey)
112+
public static BalanceTransaction retrieve(String id, RequestOptions options)
114113
throws AuthenticationException, InvalidRequestException,
115114
APIConnectionException, CardException, APIException {
116-
return list(params, RequestOptions.builder().setApiKey(apiKey).build());
115+
String url = String.format("%s/%s/%s", Stripe.getApiBase(), "v1/balance/history", id);
116+
return request(RequestMethod.GET, url, null, BalanceTransaction.class, options);
117117
}
118118

119119
@Deprecated
120-
public static BalanceTransactionCollection all(Map<String, Object> params, RequestOptions options)
120+
public static BalanceTransaction retrieve(String id, String apiKey)
121121
throws AuthenticationException, InvalidRequestException,
122122
APIConnectionException, CardException, APIException {
123-
return list(params, options);
123+
return retrieve(id, RequestOptions.builder().setApiKey(apiKey).build());
124124
}
125-
126125
}

src/main/java/com/stripe/model/BankAccount.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,31 @@ public class BankAccount extends ExternalAccount {
3030
Boolean validated;
3131

3232
@Override
33-
public BankAccount update(Map<String, Object> params)
33+
public DeletedBankAccount delete()
3434
throws AuthenticationException, InvalidRequestException, APIConnectionException,
3535
CardException, APIException {
36-
return update(params, null);
36+
return delete(null);
3737
}
3838

3939
@Override
40-
public BankAccount update(Map<String, Object> params, RequestOptions options)
40+
public DeletedBankAccount delete(RequestOptions options)
4141
throws AuthenticationException, InvalidRequestException, APIConnectionException,
4242
CardException, APIException {
43-
return request(RequestMethod.POST, this.getInstanceURL(), params, BankAccount.class, options);
43+
return request(RequestMethod.DELETE, this.getInstanceURL(), null, DeletedBankAccount.class,
44+
options);
4445
}
4546

4647
@Override
47-
public DeletedBankAccount delete()
48+
public BankAccount update(Map<String, Object> params)
4849
throws AuthenticationException, InvalidRequestException, APIConnectionException,
4950
CardException, APIException {
50-
return delete(null);
51+
return update(params, null);
5152
}
5253

5354
@Override
54-
public DeletedBankAccount delete(RequestOptions options)
55+
public BankAccount update(Map<String, Object> params, RequestOptions options)
5556
throws AuthenticationException, InvalidRequestException, APIConnectionException,
5657
CardException, APIException {
57-
return request(RequestMethod.DELETE, this.getInstanceURL(), null, DeletedBankAccount.class,
58-
options);
58+
return request(RequestMethod.POST, this.getInstanceURL(), params, BankAccount.class, options);
5959
}
6060
}

0 commit comments

Comments
 (0)