• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-java / #16517

08 Oct 2024 06:27PM UTC coverage: 12.74% (-0.2%) from 12.899%
#16517

push

github

web-flow
Merge pull request #1872 from stripe/latest-codegen-beta

Update generated code for beta

53 of 2404 new or added lines in 50 files covered. (2.2%)

91 existing lines in 27 files now uncovered.

18753 of 147196 relevant lines covered (12.74%)

0.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

42.22
/src/main/java/com/stripe/model/Mandate.java
1
// File generated from our OpenAPI spec
2
package com.stripe.model;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.exception.StripeException;
6
import com.stripe.net.ApiRequest;
7
import com.stripe.net.ApiRequestParams;
8
import com.stripe.net.ApiResource;
9
import com.stripe.net.BaseAddress;
10
import com.stripe.net.RequestOptions;
11
import com.stripe.net.StripeResponseGetter;
12
import com.stripe.param.MandateRetrieveParams;
13
import java.util.List;
14
import java.util.Map;
15
import lombok.EqualsAndHashCode;
16
import lombok.Getter;
17
import lombok.Setter;
18

19
/**
20
 * A Mandate is a record of the permission that your customer gives you to debit their payment
21
 * method.
22
 */
23
@Getter
24
@Setter
25
@EqualsAndHashCode(callSuper = false)
26
public class Mandate extends ApiResource implements HasId {
1✔
27
  @SerializedName("customer_acceptance")
28
  CustomerAcceptance customerAcceptance;
29

30
  /** Unique identifier for the object. */
31
  @Getter(onMethod_ = {@Override})
32
  @SerializedName("id")
33
  String id;
34

35
  /**
36
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
37
   * object exists in test mode.
38
   */
39
  @SerializedName("livemode")
40
  Boolean livemode;
41

42
  @SerializedName("multi_use")
43
  MultiUse multiUse;
44

45
  /**
46
   * String representing the object's type. Objects of the same type share the same value.
47
   *
48
   * <p>Equal to {@code mandate}.
49
   */
50
  @SerializedName("object")
51
  String object;
52

53
  /** The account (if any) that the mandate is intended for. */
54
  @SerializedName("on_behalf_of")
55
  String onBehalfOf;
56

57
  /** ID of the payment method associated with this mandate. */
58
  @SerializedName("payment_method")
59
  @Getter(lombok.AccessLevel.NONE)
60
  @Setter(lombok.AccessLevel.NONE)
61
  ExpandableField<PaymentMethod> paymentMethod;
62

63
  @SerializedName("payment_method_details")
64
  PaymentMethodDetails paymentMethodDetails;
65

66
  @SerializedName("single_use")
67
  SingleUse singleUse;
68

69
  /**
70
   * The mandate status indicates whether or not you can use it to initiate a payment.
71
   *
72
   * <p>One of {@code active}, {@code inactive}, or {@code pending}.
73
   */
74
  @SerializedName("status")
75
  String status;
76

77
  /**
78
   * The type of the mandate.
79
   *
80
   * <p>One of {@code multi_use}, or {@code single_use}.
81
   */
82
  @SerializedName("type")
83
  String type;
84

85
  /** Get ID of expandable {@code paymentMethod} object. */
86
  public String getPaymentMethod() {
87
    return (this.paymentMethod != null) ? this.paymentMethod.getId() : null;
1✔
88
  }
89

90
  public void setPaymentMethod(String id) {
91
    this.paymentMethod = ApiResource.setExpandableFieldId(id, this.paymentMethod);
×
92
  }
×
93

94
  /** Get expanded {@code paymentMethod}. */
95
  public PaymentMethod getPaymentMethodObject() {
96
    return (this.paymentMethod != null) ? this.paymentMethod.getExpanded() : null;
1✔
97
  }
98

99
  public void setPaymentMethodObject(PaymentMethod expandableObject) {
100
    this.paymentMethod =
×
101
        new ExpandableField<PaymentMethod>(expandableObject.getId(), expandableObject);
×
102
  }
×
103

104
  /** Retrieves a Mandate object. */
105
  public static Mandate retrieve(String mandate) throws StripeException {
106
    return retrieve(mandate, (Map<String, Object>) null, (RequestOptions) null);
1✔
107
  }
108

109
  /** Retrieves a Mandate object. */
110
  public static Mandate retrieve(String mandate, RequestOptions options) throws StripeException {
111
    return retrieve(mandate, (Map<String, Object>) null, options);
×
112
  }
113

114
  /** Retrieves a Mandate object. */
115
  public static Mandate retrieve(String mandate, Map<String, Object> params, RequestOptions options)
116
      throws StripeException {
117
    String path = String.format("/v1/mandates/%s", ApiResource.urlEncodeId(mandate));
1✔
118
    ApiRequest request =
1✔
119
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
120
    return getGlobalResponseGetter().request(request, Mandate.class);
1✔
121
  }
122

123
  /** Retrieves a Mandate object. */
124
  public static Mandate retrieve(
125
      String mandate, MandateRetrieveParams params, RequestOptions options) throws StripeException {
126
    String path = String.format("/v1/mandates/%s", ApiResource.urlEncodeId(mandate));
×
127
    ApiResource.checkNullTypedParams(path, params);
×
128
    ApiRequest request =
×
129
        new ApiRequest(
130
            BaseAddress.API,
131
            ApiResource.RequestMethod.GET,
132
            path,
133
            ApiRequestParams.paramsToMap(params),
×
134
            options);
135
    return getGlobalResponseGetter().request(request, Mandate.class);
×
136
  }
137

138
  @Getter
139
  @Setter
140
  @EqualsAndHashCode(callSuper = false)
141
  public static class CustomerAcceptance extends StripeObject {
1✔
142
    /** The time that the customer accepts the mandate. */
143
    @SerializedName("accepted_at")
144
    Long acceptedAt;
145

146
    @SerializedName("offline")
147
    Offline offline;
148

149
    @SerializedName("online")
150
    Online online;
151

152
    /**
153
     * The mandate includes the type of customer acceptance information, such as: {@code online} or
154
     * {@code offline}.
155
     *
156
     * <p>One of {@code offline}, or {@code online}.
157
     */
158
    @SerializedName("type")
159
    String type;
160

161
    @Getter
162
    @Setter
163
    @EqualsAndHashCode(callSuper = false)
164
    public static class Offline extends StripeObject {}
×
165

166
    @Getter
167
    @Setter
168
    @EqualsAndHashCode(callSuper = false)
169
    public static class Online extends StripeObject {
1✔
170
      /** The customer accepts the mandate from this IP address. */
171
      @SerializedName("ip_address")
172
      String ipAddress;
173

174
      /** The customer accepts the mandate using the user agent of the browser. */
175
      @SerializedName("user_agent")
176
      String userAgent;
177
    }
178
  }
179

180
  @Getter
181
  @Setter
182
  @EqualsAndHashCode(callSuper = false)
183
  public static class MultiUse extends StripeObject {}
1✔
184

185
  @Getter
186
  @Setter
187
  @EqualsAndHashCode(callSuper = false)
188
  public static class PaymentMethodDetails extends StripeObject {
1✔
189
    @SerializedName("acss_debit")
190
    AcssDebit acssDebit;
191

192
    @SerializedName("amazon_pay")
193
    AmazonPay amazonPay;
194

195
    @SerializedName("au_becs_debit")
196
    AuBecsDebit auBecsDebit;
197

198
    @SerializedName("bacs_debit")
199
    BacsDebit bacsDebit;
200

201
    @SerializedName("card")
202
    Card card;
203

204
    @SerializedName("cashapp")
205
    Cashapp cashapp;
206

207
    @SerializedName("kakao_pay")
208
    KakaoPay kakaoPay;
209

210
    @SerializedName("kr_card")
211
    KrCard krCard;
212

213
    @SerializedName("link")
214
    Link link;
215

216
    @SerializedName("paypal")
217
    Paypal paypal;
218

219
    @SerializedName("payto")
220
    Payto payto;
221

222
    @SerializedName("revolut_pay")
223
    RevolutPay revolutPay;
224

225
    @SerializedName("sepa_debit")
226
    SepaDebit sepaDebit;
227

228
    /**
229
     * This mandate corresponds with a specific payment method type. The {@code
230
     * payment_method_details} includes an additional hash with the same name and contains mandate
231
     * information that's specific to that payment method.
232
     */
233
    @SerializedName("type")
234
    String type;
235

236
    @SerializedName("us_bank_account")
237
    UsBankAccount usBankAccount;
238

239
    @Getter
240
    @Setter
241
    @EqualsAndHashCode(callSuper = false)
242
    public static class AcssDebit extends StripeObject {
×
243
      /** List of Stripe products where this mandate can be selected automatically. */
244
      @SerializedName("default_for")
245
      List<String> defaultFor;
246

247
      /**
248
       * Description of the interval. Only required if the 'payment_schedule' parameter is
249
       * 'interval' or 'combined'.
250
       */
251
      @SerializedName("interval_description")
252
      String intervalDescription;
253

254
      /**
255
       * Payment schedule for the mandate.
256
       *
257
       * <p>One of {@code combined}, {@code interval}, or {@code sporadic}.
258
       */
259
      @SerializedName("payment_schedule")
260
      String paymentSchedule;
261

262
      /**
263
       * Transaction type of the mandate.
264
       *
265
       * <p>One of {@code business}, or {@code personal}.
266
       */
267
      @SerializedName("transaction_type")
268
      String transactionType;
269
    }
270

271
    @Getter
272
    @Setter
273
    @EqualsAndHashCode(callSuper = false)
274
    public static class AmazonPay extends StripeObject {}
×
275

276
    @Getter
277
    @Setter
278
    @EqualsAndHashCode(callSuper = false)
279
    public static class AuBecsDebit extends StripeObject {
×
280
      /**
281
       * The URL of the mandate. This URL generally contains sensitive information about the
282
       * customer and should be shared with them exclusively.
283
       */
284
      @SerializedName("url")
285
      String url;
286
    }
287

288
    @Getter
289
    @Setter
290
    @EqualsAndHashCode(callSuper = false)
291
    public static class BacsDebit extends StripeObject {
×
292
      /**
293
       * The status of the mandate on the Bacs network. Can be one of {@code pending}, {@code
294
       * revoked}, {@code refused}, or {@code accepted}.
295
       */
296
      @SerializedName("network_status")
297
      String networkStatus;
298

299
      /** The unique reference identifying the mandate on the Bacs network. */
300
      @SerializedName("reference")
301
      String reference;
302

303
      /**
304
       * When the mandate is revoked on the Bacs network this field displays the reason for the
305
       * revocation.
306
       *
307
       * <p>One of {@code account_closed}, {@code bank_account_restricted}, {@code
308
       * bank_ownership_changed}, {@code could_not_process}, or {@code debit_not_authorized}.
309
       */
310
      @SerializedName("revocation_reason")
311
      String revocationReason;
312

313
      /** The URL that will contain the mandate that the customer has signed. */
314
      @SerializedName("url")
315
      String url;
316
    }
317

318
    @Getter
319
    @Setter
320
    @EqualsAndHashCode(callSuper = false)
321
    public static class Card extends StripeObject {}
×
322

323
    @Getter
324
    @Setter
325
    @EqualsAndHashCode(callSuper = false)
326
    public static class Cashapp extends StripeObject {}
×
327

328
    @Getter
329
    @Setter
330
    @EqualsAndHashCode(callSuper = false)
NEW
331
    public static class KakaoPay extends StripeObject {}
×
332

333
    @Getter
334
    @Setter
335
    @EqualsAndHashCode(callSuper = false)
NEW
336
    public static class KrCard extends StripeObject {}
×
337

338
    @Getter
339
    @Setter
340
    @EqualsAndHashCode(callSuper = false)
341
    public static class Link extends StripeObject {}
×
342

343
    @Getter
344
    @Setter
345
    @EqualsAndHashCode(callSuper = false)
346
    public static class Paypal extends StripeObject {
×
347
      /**
348
       * The PayPal Billing Agreement ID (BAID). This is an ID generated by PayPal which represents
349
       * the mandate between the merchant and the customer.
350
       */
351
      @SerializedName("billing_agreement_id")
352
      String billingAgreementId;
353

354
      /**
355
       * Uniquely identifies this particular PayPal account. You can use this attribute to check
356
       * whether two PayPal accounts are the same.
357
       */
358
      @SerializedName("fingerprint")
359
      String fingerprint;
360

361
      /** PayPal account PayerID. This identifier uniquely identifies the PayPal customer. */
362
      @SerializedName("payer_id")
363
      String payerId;
364

365
      /**
366
       * Owner's verified email. Values are verified or provided by PayPal directly (if supported)
367
       * at the time of authorization or settlement. They cannot be set or mutated.
368
       */
369
      @SerializedName("verified_email")
370
      String verifiedEmail;
371
    }
372

373
    @Getter
374
    @Setter
375
    @EqualsAndHashCode(callSuper = false)
376
    public static class Payto extends StripeObject {
×
377
      /**
378
       * Amount that will be collected. It is required when {@code amount_type} is {@code fixed}.
379
       */
380
      @SerializedName("amount")
381
      Long amount;
382

383
      /**
384
       * The type of amount that will be collected. The amount charged must be exact or up to the
385
       * value of {@code amount} param for {@code fixed} or {@code maximum} type respectively.
386
       *
387
       * <p>One of {@code fixed}, or {@code maximum}.
388
       */
389
      @SerializedName("amount_type")
390
      String amountType;
391

392
      /**
393
       * Date, in YYYY-MM-DD format, after which payments will not be collected. Defaults to no end
394
       * date.
395
       */
396
      @SerializedName("end_date")
397
      String endDate;
398

399
      /**
400
       * The periodicity at which payments will be collected.
401
       *
402
       * <p>One of {@code adhoc}, {@code annual}, {@code daily}, {@code fortnightly}, {@code
403
       * monthly}, {@code quarterly}, {@code semi_annual}, or {@code weekly}.
404
       */
405
      @SerializedName("payment_schedule")
406
      String paymentSchedule;
407

408
      /**
409
       * The number of payments that will be made during a payment period. Defaults to 1 except for
410
       * when {@code payment_schedule} is {@code adhoc}. In that case, it defaults to no limit.
411
       */
412
      @SerializedName("payments_per_period")
413
      Long paymentsPerPeriod;
414

415
      /**
416
       * The purpose for which payments are made. Defaults to retail.
417
       *
418
       * <p>One of {@code dependant_support}, {@code government}, {@code loan}, {@code mortgage},
419
       * {@code other}, {@code pension}, {@code personal}, {@code retail}, {@code salary}, {@code
420
       * tax}, or {@code utility}.
421
       */
422
      @SerializedName("purpose")
423
      String purpose;
424

425
      /**
426
       * Date, in YYYY-MM-DD format, from which payments will be collected. Defaults to confirmation
427
       * time.
428
       */
429
      @SerializedName("start_date")
430
      String startDate;
431
    }
432

433
    @Getter
434
    @Setter
435
    @EqualsAndHashCode(callSuper = false)
436
    public static class RevolutPay extends StripeObject {}
×
437

438
    @Getter
439
    @Setter
440
    @EqualsAndHashCode(callSuper = false)
441
    public static class SepaDebit extends StripeObject {
1✔
442
      /** The unique reference of the mandate. */
443
      @SerializedName("reference")
444
      String reference;
445

446
      /**
447
       * The URL of the mandate. This URL generally contains sensitive information about the
448
       * customer and should be shared with them exclusively.
449
       */
450
      @SerializedName("url")
451
      String url;
452
    }
453

454
    @Getter
455
    @Setter
456
    @EqualsAndHashCode(callSuper = false)
457
    public static class UsBankAccount extends StripeObject {
×
458
      /**
459
       * Mandate collection method
460
       *
461
       * <p>Equal to {@code paper}.
462
       */
463
      @SerializedName("collection_method")
464
      String collectionMethod;
465
    }
466
  }
467

468
  @Getter
469
  @Setter
470
  @EqualsAndHashCode(callSuper = false)
471
  public static class SingleUse extends StripeObject {
×
472
    /** The amount of the payment on a single use mandate. */
473
    @SerializedName("amount")
474
    Long amount;
475

476
    /** The currency of the payment on a single use mandate. */
477
    @SerializedName("currency")
478
    String currency;
479
  }
480

481
  @Override
482
  public void setResponseGetter(StripeResponseGetter responseGetter) {
483
    super.setResponseGetter(responseGetter);
1✔
484
    trySetResponseGetter(customerAcceptance, responseGetter);
1✔
485
    trySetResponseGetter(multiUse, responseGetter);
1✔
486
    trySetResponseGetter(paymentMethod, responseGetter);
1✔
487
    trySetResponseGetter(paymentMethodDetails, responseGetter);
1✔
488
    trySetResponseGetter(singleUse, responseGetter);
1✔
489
  }
1✔
490
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc