Skip to content

Commit 9ac4d01

Browse files
authored
Merge pull request #1036 from stripe/remi/codegen-7a853ce
Add support for BACS Debit as a `PaymentMethod`
2 parents 48db409 + 3a95386 commit 9ac4d01

12 files changed

+217
-28
lines changed

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

+15
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,9 @@ public static class Errors extends StripeObject {
10251025
@Setter
10261026
@EqualsAndHashCode(callSuper = false)
10271027
public static class Settings extends StripeObject {
1028+
@SerializedName("bacs_debit_payments")
1029+
BacsDebitPayments bacsDebitPayments;
1030+
10281031
@SerializedName("branding")
10291032
SettingsBranding branding;
10301033

@@ -1039,6 +1042,18 @@ public static class Settings extends StripeObject {
10391042

10401043
@SerializedName("payouts")
10411044
SettingsPayouts payouts;
1045+
1046+
@Getter
1047+
@Setter
1048+
@EqualsAndHashCode(callSuper = false)
1049+
public static class BacsDebitPayments extends StripeObject {
1050+
/**
1051+
* The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct
1052+
* Debit, this will appear on the mandate, and as the statement descriptor.
1053+
*/
1054+
@SerializedName("display_name")
1055+
String displayName;
1056+
}
10421057
}
10431058

10441059
@Getter

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

+30-3
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,9 @@ public static class PaymentMethodDetails extends StripeObject {
10081008
@SerializedName("au_becs_debit")
10091009
AuBecsDebit auBecsDebit;
10101010

1011+
@SerializedName("bacs_debit")
1012+
BacsDebit bacsDebit;
1013+
10111014
@SerializedName("bancontact")
10121015
Bancontact bancontact;
10131016

@@ -1193,6 +1196,30 @@ public static class AuBecsDebit extends StripeObject {
11931196
String mandate;
11941197
}
11951198

1199+
@Getter
1200+
@Setter
1201+
@EqualsAndHashCode(callSuper = false)
1202+
public static class BacsDebit extends StripeObject {
1203+
/**
1204+
* Uniquely identifies this particular bank account. You can use this attribute to check
1205+
* whether two bank accounts are the same.
1206+
*/
1207+
@SerializedName("fingerprint")
1208+
String fingerprint;
1209+
1210+
/** Last four digits of the bank account number. */
1211+
@SerializedName("last4")
1212+
String last4;
1213+
1214+
/** ID of the mandate used to make this payment. */
1215+
@SerializedName("mandate")
1216+
String mandate;
1217+
1218+
/** Sort code of the bank account. (e.g., {@code 10-20-30}) */
1219+
@SerializedName("sort_code")
1220+
String sortCode;
1221+
}
1222+
11961223
@Getter
11971224
@Setter
11981225
@EqualsAndHashCode(callSuper = false)
@@ -1398,8 +1425,7 @@ public static class ThreeDSecure extends StripeObject {
13981425
Boolean authenticated;
13991426

14001427
/**
1401-
* For authenticated transactions: whether issuing bank authenticated the cardholder with a
1402-
* traditional challenge screen, or with device data via the 3DS2 frictionless flow.
1428+
* For authenticated transactions: how the customer was authenticated by the issuing bank.
14031429
*
14041430
* <p>One of {@code challenge}, or {@code frictionless}.
14051431
*/
@@ -1416,7 +1442,8 @@ public static class ThreeDSecure extends StripeObject {
14161442
String result;
14171443

14181444
/**
1419-
* Additional information about why 3D Secure succeeded or failed.
1445+
* Additional information about why 3D Secure succeeded or failed based on the {@code
1446+
* result}.
14201447
*
14211448
* <p>One of {@code abandoned}, {@code bypassed}, {@code canceled}, {@code
14221449
* card_not_enrolled}, {@code network_not_supported}, {@code protocol_error}, or {@code

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

+17
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,20 @@ public static class AuBecsDebit extends StripeObject {
132132
String url;
133133
}
134134

135+
@Getter
136+
@Setter
137+
@EqualsAndHashCode(callSuper = false)
138+
public static class BacsDebit extends StripeObject {
139+
@SerializedName("network_status")
140+
String networkStatus;
141+
142+
@SerializedName("reference")
143+
String reference;
144+
145+
@SerializedName("url")
146+
String url;
147+
}
148+
135149
@Getter
136150
@Setter
137151
@EqualsAndHashCode(callSuper = false)
@@ -184,6 +198,9 @@ public static class PaymentMethodDetails extends StripeObject {
184198
@SerializedName("au_becs_debit")
185199
AuBecsDebit auBecsDebit;
186200

201+
@SerializedName("bacs_debit")
202+
BacsDebit bacsDebit;
203+
187204
@SerializedName("card")
188205
Card card;
189206

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

+25-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public class PaymentMethod extends ApiResource implements HasId, MetadataStore<P
2323
@SerializedName("au_becs_debit")
2424
AuBecsDebit auBecsDebit;
2525

26+
@SerializedName("bacs_debit")
27+
BacsDebit bacsDebit;
28+
2629
@SerializedName("billing_details")
2730
BillingDetails billingDetails;
2831

@@ -89,8 +92,8 @@ public class PaymentMethod extends ApiResource implements HasId, MetadataStore<P
8992
* The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name
9093
* matching this value. It contains additional information specific to the PaymentMethod type.
9194
*
92-
* <p>One of {@code au_becs_debit}, {@code card}, {@code card_present}, {@code fpx}, {@code
93-
* ideal}, or {@code sepa_debit}.
95+
* <p>One of {@code au_becs_debit}, {@code bacs_debit}, {@code card}, {@code card_present}, {@code
96+
* fpx}, {@code ideal}, or {@code sepa_debit}.
9497
*/
9598
@SerializedName("type")
9699
String type;
@@ -415,6 +418,26 @@ public static class AuBecsDebit extends StripeObject {
415418
String last4;
416419
}
417420

421+
@Getter
422+
@Setter
423+
@EqualsAndHashCode(callSuper = false)
424+
public static class BacsDebit extends StripeObject {
425+
/**
426+
* Uniquely identifies this particular bank account. You can use this attribute to check whether
427+
* two bank accounts are the same.
428+
*/
429+
@SerializedName("fingerprint")
430+
String fingerprint;
431+
432+
/** Last four digits of the bank account number. */
433+
@SerializedName("last4")
434+
String last4;
435+
436+
/** Sort code of the bank account. (e.g., {@code 10-20-30}) */
437+
@SerializedName("sort_code")
438+
String sortCode;
439+
}
440+
418441
@Getter
419442
@Setter
420443
@EqualsAndHashCode(callSuper = false)

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ public class Person extends ApiResource implements HasId, MetadataStore<Person>
121121
@SerializedName("requirements")
122122
Requirements requirements;
123123

124-
/** Whether the last 4 digits of this person's SSN have been provided. */
124+
/**
125+
* Whether the last four digits of the person's Social Security number have been provided (U.S.
126+
* only).
127+
*/
125128
@SerializedName("ssn_last_4_provided")
126129
Boolean ssnLast4Provided;
127130

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,15 @@ public static PlanCollection list(PlanListParams params, RequestOptions options)
213213

214214
/**
215215
* You can create plans using the API, or in the Stripe <a
216-
* href="https://dashboard.stripe.com/subscriptions/products">Dashboard</a>.
216+
* href="https://dashboard.stripe.com/products">Dashboard</a>.
217217
*/
218218
public static Plan create(Map<String, Object> params) throws StripeException {
219219
return create(params, (RequestOptions) null);
220220
}
221221

222222
/**
223223
* You can create plans using the API, or in the Stripe <a
224-
* href="https://dashboard.stripe.com/subscriptions/products">Dashboard</a>.
224+
* href="https://dashboard.stripe.com/products">Dashboard</a>.
225225
*/
226226
public static Plan create(Map<String, Object> params, RequestOptions options)
227227
throws StripeException {
@@ -231,15 +231,15 @@ public static Plan create(Map<String, Object> params, RequestOptions options)
231231

232232
/**
233233
* You can create plans using the API, or in the Stripe <a
234-
* href="https://dashboard.stripe.com/subscriptions/products">Dashboard</a>.
234+
* href="https://dashboard.stripe.com/products">Dashboard</a>.
235235
*/
236236
public static Plan create(PlanCreateParams params) throws StripeException {
237237
return create(params, (RequestOptions) null);
238238
}
239239

240240
/**
241241
* You can create plans using the API, or in the Stripe <a
242-
* href="https://dashboard.stripe.com/subscriptions/products">Dashboard</a>.
242+
* href="https://dashboard.stripe.com/products">Dashboard</a>.
243243
*/
244244
public static Plan create(PlanCreateParams params, RequestOptions options)
245245
throws StripeException {

src/main/java/com/stripe/model/checkout/Session.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ public class Session extends ApiResource implements HasId {
6565
* If provided, this value will be used when the Customer object is created. If not provided,
6666
* customers will be asked to enter their email address. Use this parameter to prefill customer
6767
* data if you already have an email on file. To access information about the customer once a
68-
* session is complete, use the {@code customer} field.
68+
* session is complete, use the {@code customer} attribute.
6969
*/
7070
@SerializedName("customer_email")
7171
String customerEmail;
7272

73-
/** The line items, plans, or SKUs purchased by the customer. */
73+
/** The line items, plans, or SKUs purchased by the customer. Prefer using {@code line_items}. */
7474
@SerializedName("display_items")
7575
List<Session.DisplayItem> displayItems;
7676

src/main/java/com/stripe/param/PaymentMethodCreateParams.java

+105
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ public class PaymentMethodCreateParams extends ApiRequestParams {
1717
@SerializedName("au_becs_debit")
1818
AuBecsDebit auBecsDebit;
1919

20+
/**
21+
* If this is a {@code bacs_debit} PaymentMethod, this hash contains details about the Bacs Direct
22+
* Debit bank account.
23+
*/
24+
@SerializedName("bacs_debit")
25+
BacsDebit bacsDebit;
26+
2027
/**
2128
* Billing information associated with the PaymentMethod that may be used or required by
2229
* particular types of payment methods.
@@ -105,6 +112,7 @@ public class PaymentMethodCreateParams extends ApiRequestParams {
105112

106113
private PaymentMethodCreateParams(
107114
AuBecsDebit auBecsDebit,
115+
BacsDebit bacsDebit,
108116
BillingDetails billingDetails,
109117
Object card,
110118
String customer,
@@ -118,6 +126,7 @@ private PaymentMethodCreateParams(
118126
SepaDebit sepaDebit,
119127
Type type) {
120128
this.auBecsDebit = auBecsDebit;
129+
this.bacsDebit = bacsDebit;
121130
this.billingDetails = billingDetails;
122131
this.card = card;
123132
this.customer = customer;
@@ -139,6 +148,8 @@ public static Builder builder() {
139148
public static class Builder {
140149
private AuBecsDebit auBecsDebit;
141150

151+
private BacsDebit bacsDebit;
152+
142153
private BillingDetails billingDetails;
143154

144155
private Object card;
@@ -167,6 +178,7 @@ public static class Builder {
167178
public PaymentMethodCreateParams build() {
168179
return new PaymentMethodCreateParams(
169180
this.auBecsDebit,
181+
this.bacsDebit,
170182
this.billingDetails,
171183
this.card,
172184
this.customer,
@@ -190,6 +202,15 @@ public Builder setAuBecsDebit(AuBecsDebit auBecsDebit) {
190202
return this;
191203
}
192204

205+
/**
206+
* If this is a {@code bacs_debit} PaymentMethod, this hash contains details about the Bacs
207+
* Direct Debit bank account.
208+
*/
209+
public Builder setBacsDebit(BacsDebit bacsDebit) {
210+
this.bacsDebit = bacsDebit;
211+
return this;
212+
}
213+
193214
/**
194215
* Billing information associated with the PaymentMethod that may be used or required by
195216
* particular types of payment methods.
@@ -445,6 +466,87 @@ public Builder putAllExtraParam(Map<String, Object> map) {
445466
}
446467
}
447468

469+
@Getter
470+
public static class BacsDebit {
471+
/** Account number of the bank account that the funds will be debited from. */
472+
@SerializedName("account_number")
473+
String accountNumber;
474+
475+
/**
476+
* Map of extra parameters for custom features not available in this client library. The content
477+
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
478+
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
479+
* param object. Effectively, this map is flattened to its parent instance.
480+
*/
481+
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
482+
Map<String, Object> extraParams;
483+
484+
/** Sort code of the bank account. (e.g., {@code 10-20-30}) */
485+
@SerializedName("sort_code")
486+
String sortCode;
487+
488+
private BacsDebit(String accountNumber, Map<String, Object> extraParams, String sortCode) {
489+
this.accountNumber = accountNumber;
490+
this.extraParams = extraParams;
491+
this.sortCode = sortCode;
492+
}
493+
494+
public static Builder builder() {
495+
return new Builder();
496+
}
497+
498+
public static class Builder {
499+
private String accountNumber;
500+
501+
private Map<String, Object> extraParams;
502+
503+
private String sortCode;
504+
505+
/** Finalize and obtain parameter instance from this builder. */
506+
public BacsDebit build() {
507+
return new BacsDebit(this.accountNumber, this.extraParams, this.sortCode);
508+
}
509+
510+
/** Account number of the bank account that the funds will be debited from. */
511+
public Builder setAccountNumber(String accountNumber) {
512+
this.accountNumber = accountNumber;
513+
return this;
514+
}
515+
516+
/**
517+
* Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
518+
* call, and subsequent calls add additional key/value pairs to the original map. See {@link
519+
* PaymentMethodCreateParams.BacsDebit#extraParams} for the field documentation.
520+
*/
521+
public Builder putExtraParam(String key, Object value) {
522+
if (this.extraParams == null) {
523+
this.extraParams = new HashMap<>();
524+
}
525+
this.extraParams.put(key, value);
526+
return this;
527+
}
528+
529+
/**
530+
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
531+
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
532+
* See {@link PaymentMethodCreateParams.BacsDebit#extraParams} for the field documentation.
533+
*/
534+
public Builder putAllExtraParam(Map<String, Object> map) {
535+
if (this.extraParams == null) {
536+
this.extraParams = new HashMap<>();
537+
}
538+
this.extraParams.putAll(map);
539+
return this;
540+
}
541+
542+
/** Sort code of the bank account. (e.g., {@code 10-20-30}) */
543+
public Builder setSortCode(String sortCode) {
544+
this.sortCode = sortCode;
545+
return this;
546+
}
547+
}
548+
}
549+
448550
@Getter
449551
public static class BillingDetails {
450552
/** Billing address. */
@@ -1291,6 +1393,9 @@ public enum Type implements ApiRequestParams.EnumParam {
12911393
@SerializedName("au_becs_debit")
12921394
AU_BECS_DEBIT("au_becs_debit"),
12931395

1396+
@SerializedName("bacs_debit")
1397+
BACS_DEBIT("bacs_debit"),
1398+
12941399
@SerializedName("card")
12951400
CARD("card"),
12961401

0 commit comments

Comments
 (0)