-
Notifications
You must be signed in to change notification settings - Fork 355
/
Order.java
1664 lines (1470 loc) · 64.3 KB
/
Order.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// File generated from our OpenAPI spec
package com.stripe.model;
import com.google.gson.annotations.SerializedName;
import com.stripe.Stripe;
import com.stripe.exception.StripeException;
import com.stripe.net.ApiResource;
import com.stripe.net.RequestOptions;
import com.stripe.param.OrderCancelParams;
import com.stripe.param.OrderCreateParams;
import com.stripe.param.OrderListLineItemsParams;
import com.stripe.param.OrderListParams;
import com.stripe.param.OrderReopenParams;
import com.stripe.param.OrderRetrieveParams;
import com.stripe.param.OrderSubmitParams;
import com.stripe.param.OrderUpdateParams;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* An Order describes a purchase being made by a customer, including the products & quantities
* being purchased, the order status, the payment information, and the billing/shipping details.
*
* <p>Related guide: <a href="https://stripe.com/docs/orders">Orders overview</a>
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class Order extends ApiResource implements HasId, MetadataStore<Order> {
@SerializedName("amount_remaining")
Long amountRemaining;
/**
* Order cost before any discounts or taxes are applied. A positive integer representing the
* subtotal of the order in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest
* currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal
* currency).
*/
@SerializedName("amount_subtotal")
Long amountSubtotal;
/**
* Total order cost after discounts and taxes are applied. A positive integer representing the
* cost of the order in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest
* currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal
* currency). To submit an order, the total must be either 0 or at least $0.50 USD or <a
* href="https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts">equivalent in
* charge currency</a>.
*/
@SerializedName("amount_total")
Long amountTotal;
/** ID of the Connect application that created the Order, if any. */
@SerializedName("application")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<Application> application;
@SerializedName("automatic_tax")
AutomaticTax automaticTax;
/** Customer billing details associated with the order. */
@SerializedName("billing_details")
BillingDetails billingDetails;
/**
* The client secret of this Order. Used for client-side retrieval using a publishable key.
*
* <p>The client secret can be used to complete a payment for an Order from your frontend. It
* should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer.
* Make sure that you have TLS enabled on any page that includes the client secret.
*
* <p>Refer to our docs for <a
* href="https://stripe.com/docs/orders-beta/create-and-process">creating and processing an
* order</a> to learn about how client_secret should be handled.
*/
@SerializedName("client_secret")
String clientSecret;
/** Time at which the object was created. Measured in seconds since the Unix epoch. */
@SerializedName("created")
Long created;
/** The credits applied to the Order. At most 10 credits can be applied to an Order. */
@SerializedName("credits")
List<Order.Credit> credits;
/**
* Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>,
* in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
*/
@SerializedName("currency")
String currency;
/** The customer which this orders belongs to. */
@SerializedName("customer")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<Customer> customer;
/** An arbitrary string attached to the object. Often useful for displaying to users. */
@SerializedName("description")
String description;
/** The discounts applied to the order. Use {@code expand[]=discounts} to expand each discount. */
@SerializedName("discounts")
List<ExpandableField<Discount>> discounts;
/** Unique identifier for the object. */
@Getter(onMethod_ = {@Override})
@SerializedName("id")
String id;
/** A recent IP address of the purchaser used for tax reporting and tax location inference. */
@SerializedName("ip_address")
String ipAddress;
/**
* A list of line items the customer is ordering. Each line item includes information about the
* product, the quantity, and the resulting cost. There is a maximum of 100 line items.
*/
@SerializedName("line_items")
LineItemCollection lineItems;
/**
* Has the value {@code true} if the object exists in live mode or the value {@code false} if the
* object exists in test mode.
*/
@SerializedName("livemode")
Boolean livemode;
/**
* Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
* to an object. This can be useful for storing additional information about the object in a
* structured format.
*/
@Getter(onMethod_ = {@Override})
@SerializedName("metadata")
Map<String, String> metadata;
/**
* String representing the object's type. Objects of the same type share the same value.
*
* <p>Equal to {@code order}.
*/
@SerializedName("object")
String object;
@SerializedName("payment")
Payment payment;
/** The details of the customer cost of shipping, including the customer chosen ShippingRate. */
@SerializedName("shipping_cost")
ShippingCost shippingCost;
/** Customer shipping information associated with the order. */
@SerializedName("shipping_details")
ShippingDetails shippingDetails;
/**
* The overall status of the order.
*
* <p>One of {@code canceled}, {@code complete}, {@code open}, {@code processing}, or {@code
* submitted}.
*/
@SerializedName("status")
String status;
@SerializedName("tax_details")
TaxDetails taxDetails;
@SerializedName("total_details")
TotalDetails totalDetails;
/** Get ID of expandable {@code application} object. */
public String getApplication() {
return (this.application != null) ? this.application.getId() : null;
}
public void setApplication(String id) {
this.application = ApiResource.setExpandableFieldId(id, this.application);
}
/** Get expanded {@code application}. */
public Application getApplicationObject() {
return (this.application != null) ? this.application.getExpanded() : null;
}
public void setApplicationObject(Application expandableObject) {
this.application = new ExpandableField<Application>(expandableObject.getId(), expandableObject);
}
/** Get ID of expandable {@code customer} object. */
public String getCustomer() {
return (this.customer != null) ? this.customer.getId() : null;
}
public void setCustomer(String id) {
this.customer = ApiResource.setExpandableFieldId(id, this.customer);
}
/** Get expanded {@code customer}. */
public Customer getCustomerObject() {
return (this.customer != null) ? this.customer.getExpanded() : null;
}
public void setCustomerObject(Customer expandableObject) {
this.customer = new ExpandableField<Customer>(expandableObject.getId(), expandableObject);
}
/** Get IDs of expandable {@code discounts} object list. */
public List<String> getDiscounts() {
return (this.discounts != null)
? this.discounts.stream().map(x -> x.getId()).collect(Collectors.toList())
: null;
}
public void setDiscounts(List<String> ids) {
if (ids == null) {
this.discounts = null;
return;
}
if (this.discounts != null
&& this.discounts.stream().map(x -> x.getId()).collect(Collectors.toList()).equals(ids)) {
// noop if the ids are equal to what are already present
return;
}
this.discounts =
(ids != null)
? ids.stream()
.map(id -> new ExpandableField<Discount>(id, null))
.collect(Collectors.toList())
: null;
}
/** Get expanded {@code discounts}. */
public List<Discount> getDiscountObjects() {
return (this.discounts != null)
? this.discounts.stream().map(x -> x.getExpanded()).collect(Collectors.toList())
: null;
}
public void setDiscountObjects(List<Discount> objs) {
this.discounts =
objs != null
? objs.stream()
.map(x -> new ExpandableField<Discount>(x.getId(), x))
.collect(Collectors.toList())
: null;
}
/** Cancels the order as well as the payment intent if one is attached. */
public Order cancel() throws StripeException {
return cancel((Map<String, Object>) null, (RequestOptions) null);
}
/** Cancels the order as well as the payment intent if one is attached. */
public Order cancel(RequestOptions options) throws StripeException {
return cancel((Map<String, Object>) null, options);
}
/** Cancels the order as well as the payment intent if one is attached. */
public Order cancel(Map<String, Object> params) throws StripeException {
return cancel(params, (RequestOptions) null);
}
/** Cancels the order as well as the payment intent if one is attached. */
public Order cancel(Map<String, Object> params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/orders/%s/cancel", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Order.class, options);
}
/** Cancels the order as well as the payment intent if one is attached. */
public Order cancel(OrderCancelParams params) throws StripeException {
return cancel(params, (RequestOptions) null);
}
/** Cancels the order as well as the payment intent if one is attached. */
public Order cancel(OrderCancelParams params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/orders/%s/cancel", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Order.class, options);
}
/** Creates a new <code>open</code> order object. */
public static Order create(Map<String, Object> params) throws StripeException {
return create(params, (RequestOptions) null);
}
/** Creates a new <code>open</code> order object. */
public static Order create(Map<String, Object> params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/orders");
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Order.class, options);
}
/** Creates a new <code>open</code> order object. */
public static Order create(OrderCreateParams params) throws StripeException {
return create(params, (RequestOptions) null);
}
/** Creates a new <code>open</code> order object. */
public static Order create(OrderCreateParams params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/orders");
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Order.class, options);
}
/**
* Returns a list of your orders. The orders are returned sorted by creation date, with the most
* recently created orders appearing first.
*/
public static OrderCollection list(Map<String, Object> params) throws StripeException {
return list(params, (RequestOptions) null);
}
/**
* Returns a list of your orders. The orders are returned sorted by creation date, with the most
* recently created orders appearing first.
*/
public static OrderCollection list(Map<String, Object> params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/orders");
return ApiResource.requestCollection(url, params, OrderCollection.class, options);
}
/**
* Returns a list of your orders. The orders are returned sorted by creation date, with the most
* recently created orders appearing first.
*/
public static OrderCollection list(OrderListParams params) throws StripeException {
return list(params, (RequestOptions) null);
}
/**
* Returns a list of your orders. The orders are returned sorted by creation date, with the most
* recently created orders appearing first.
*/
public static OrderCollection list(OrderListParams params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/orders");
return ApiResource.requestCollection(url, params, OrderCollection.class, options);
}
/**
* When retrieving an order, there is an includable <strong>line_items</strong> property
* containing the first handful of those items. There is also a URL where you can retrieve the
* full (paginated) list of line items.
*/
public LineItemCollection listLineItems() throws StripeException {
return listLineItems((Map<String, Object>) null, (RequestOptions) null);
}
/**
* When retrieving an order, there is an includable <strong>line_items</strong> property
* containing the first handful of those items. There is also a URL where you can retrieve the
* full (paginated) list of line items.
*/
public LineItemCollection listLineItems(Map<String, Object> params) throws StripeException {
return listLineItems(params, (RequestOptions) null);
}
/**
* When retrieving an order, there is an includable <strong>line_items</strong> property
* containing the first handful of those items. There is also a URL where you can retrieve the
* full (paginated) list of line items.
*/
public LineItemCollection listLineItems(Map<String, Object> params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/orders/%s/line_items", ApiResource.urlEncodeId(this.getId())));
return ApiResource.requestCollection(url, params, LineItemCollection.class, options);
}
/**
* When retrieving an order, there is an includable <strong>line_items</strong> property
* containing the first handful of those items. There is also a URL where you can retrieve the
* full (paginated) list of line items.
*/
public LineItemCollection listLineItems(OrderListLineItemsParams params) throws StripeException {
return listLineItems(params, (RequestOptions) null);
}
/**
* When retrieving an order, there is an includable <strong>line_items</strong> property
* containing the first handful of those items. There is also a URL where you can retrieve the
* full (paginated) list of line items.
*/
public LineItemCollection listLineItems(OrderListLineItemsParams params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/orders/%s/line_items", ApiResource.urlEncodeId(this.getId())));
return ApiResource.requestCollection(url, params, LineItemCollection.class, options);
}
/** Reopens a <code>submitted</code> order. */
public Order reopen() throws StripeException {
return reopen((Map<String, Object>) null, (RequestOptions) null);
}
/** Reopens a <code>submitted</code> order. */
public Order reopen(RequestOptions options) throws StripeException {
return reopen((Map<String, Object>) null, options);
}
/** Reopens a <code>submitted</code> order. */
public Order reopen(Map<String, Object> params) throws StripeException {
return reopen(params, (RequestOptions) null);
}
/** Reopens a <code>submitted</code> order. */
public Order reopen(Map<String, Object> params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/orders/%s/reopen", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Order.class, options);
}
/** Reopens a <code>submitted</code> order. */
public Order reopen(OrderReopenParams params) throws StripeException {
return reopen(params, (RequestOptions) null);
}
/** Reopens a <code>submitted</code> order. */
public Order reopen(OrderReopenParams params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/orders/%s/reopen", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Order.class, options);
}
/**
* Retrieves the details of an existing order. Supply the unique order ID from either an order
* creation request or the order list, and Stripe will return the corresponding order information.
*/
public static Order retrieve(String id) throws StripeException {
return retrieve(id, (Map<String, Object>) null, (RequestOptions) null);
}
/**
* Retrieves the details of an existing order. Supply the unique order ID from either an order
* creation request or the order list, and Stripe will return the corresponding order information.
*/
public static Order retrieve(String id, RequestOptions options) throws StripeException {
return retrieve(id, (Map<String, Object>) null, options);
}
/**
* Retrieves the details of an existing order. Supply the unique order ID from either an order
* creation request or the order list, and Stripe will return the corresponding order information.
*/
public static Order retrieve(String id, Map<String, Object> params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(), String.format("/v1/orders/%s", ApiResource.urlEncodeId(id)));
return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Order.class, options);
}
/**
* Retrieves the details of an existing order. Supply the unique order ID from either an order
* creation request or the order list, and Stripe will return the corresponding order information.
*/
public static Order retrieve(String id, OrderRetrieveParams params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(), String.format("/v1/orders/%s", ApiResource.urlEncodeId(id)));
return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Order.class, options);
}
/**
* Submitting an Order transitions the status to <code>processing</code> and creates a
* PaymentIntent object so the order can be paid. If the Order has an <code>amount_total</code> of
* 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be
* changed, unless the <a href="https://stripe.com/docs/api#reopen_order">reopen</a> method is
* called.
*/
public Order submit(Map<String, Object> params) throws StripeException {
return submit(params, (RequestOptions) null);
}
/**
* Submitting an Order transitions the status to <code>processing</code> and creates a
* PaymentIntent object so the order can be paid. If the Order has an <code>amount_total</code> of
* 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be
* changed, unless the <a href="https://stripe.com/docs/api#reopen_order">reopen</a> method is
* called.
*/
public Order submit(Map<String, Object> params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/orders/%s/submit", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Order.class, options);
}
/**
* Submitting an Order transitions the status to <code>processing</code> and creates a
* PaymentIntent object so the order can be paid. If the Order has an <code>amount_total</code> of
* 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be
* changed, unless the <a href="https://stripe.com/docs/api#reopen_order">reopen</a> method is
* called.
*/
public Order submit(OrderSubmitParams params) throws StripeException {
return submit(params, (RequestOptions) null);
}
/**
* Submitting an Order transitions the status to <code>processing</code> and creates a
* PaymentIntent object so the order can be paid. If the Order has an <code>amount_total</code> of
* 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be
* changed, unless the <a href="https://stripe.com/docs/api#reopen_order">reopen</a> method is
* called.
*/
public Order submit(OrderSubmitParams params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/orders/%s/submit", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Order.class, options);
}
/**
* Updates the specific order by setting the values of the parameters passed. Any parameters not
* provided will be left unchanged.
*/
@Override
public Order update(Map<String, Object> params) throws StripeException {
return update(params, (RequestOptions) null);
}
/**
* Updates the specific order by setting the values of the parameters passed. Any parameters not
* provided will be left unchanged.
*/
@Override
public Order update(Map<String, Object> params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/orders/%s", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Order.class, options);
}
/**
* Updates the specific order by setting the values of the parameters passed. Any parameters not
* provided will be left unchanged.
*/
public Order update(OrderUpdateParams params) throws StripeException {
return update(params, (RequestOptions) null);
}
/**
* Updates the specific order by setting the values of the parameters passed. Any parameters not
* provided will be left unchanged.
*/
public Order update(OrderUpdateParams params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/orders/%s", ApiResource.urlEncodeId(this.getId())));
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Order.class, options);
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AutomaticTax extends StripeObject {
/** Whether Stripe automatically computes tax on this Order. */
@SerializedName("enabled")
Boolean enabled;
/**
* The status of the most recent automated tax calculation for this Order.
*
* <p>One of {@code complete}, {@code failed}, or {@code requires_location_inputs}.
*/
@SerializedName("status")
String status;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class BillingDetails extends StripeObject {
/** Billing address for the order. */
@SerializedName("address")
Address address;
/** Email address for the order. */
@SerializedName("email")
String email;
/** Full name for the order. */
@SerializedName("name")
String name;
/** Billing phone number for the order (including extension). */
@SerializedName("phone")
String phone;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Credit extends StripeObject {
/** The amount of this credit to apply to the order. */
@SerializedName("amount")
Long amount;
/** Details for a gift card. */
@SerializedName("gift_card")
GiftCard giftCard;
/** Line items on this order that are ineligible for this credit. */
@SerializedName("ineligible_line_items")
List<String> ineligibleLineItems;
/**
* The type of credit to apply to the order, only {@code gift_card} currently supported.
*
* <p>Equal to {@code gift_card}.
*/
@SerializedName("type")
String type;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class GiftCard extends StripeObject {
/** The token of the gift card applied to the order. */
@SerializedName("card")
String card;
}
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Payment extends StripeObject {
/** ID of the payment intent associated with this order. Null when the order is {@code open}. */
@SerializedName("payment_intent")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<PaymentIntent> paymentIntent;
/** Settings describing how the order should configure generated PaymentIntents. */
@SerializedName("settings")
Settings settings;
/**
* The status of the underlying payment associated with this order, if any. Null when the order
* is {@code open}.
*
* <p>One of {@code canceled}, {@code complete}, {@code not_required}, {@code processing},
* {@code requires_action}, {@code requires_capture}, {@code requires_confirmation}, or {@code
* requires_payment_method}.
*/
@SerializedName("status")
String status;
/** Get ID of expandable {@code paymentIntent} object. */
public String getPaymentIntent() {
return (this.paymentIntent != null) ? this.paymentIntent.getId() : null;
}
public void setPaymentIntent(String id) {
this.paymentIntent = ApiResource.setExpandableFieldId(id, this.paymentIntent);
}
/** Get expanded {@code paymentIntent}. */
public PaymentIntent getPaymentIntentObject() {
return (this.paymentIntent != null) ? this.paymentIntent.getExpanded() : null;
}
public void setPaymentIntentObject(PaymentIntent expandableObject) {
this.paymentIntent =
new ExpandableField<PaymentIntent>(expandableObject.getId(), expandableObject);
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Settings extends StripeObject {
/**
* The amount of the application fee (if any) that will be requested to be applied to the
* payment and transferred to the application owner's Stripe account.
*/
@SerializedName("application_fee_amount")
Long applicationFeeAmount;
/**
* Indicates whether order has been opted into using <a
* href="https://dashboard.stripe.com/settings/payment_methods">Stripe Dashboard</a> to manage
* payment method types.
*/
@SerializedName("automatic_payment_methods")
AutomaticPaymentMethods automaticPaymentMethods;
/** PaymentMethod-specific configuration to provide to the order's PaymentIntent. */
@SerializedName("payment_method_options")
PaymentMethodOptions paymentMethodOptions;
/**
* The list of <a href="https://stripe.com/docs/payments/payment-methods/overview">payment
* method types</a> to provide to the order's PaymentIntent. Do not include this attribute if
* you prefer to manage your payment methods from the <a
* href="https://dashboard.stripe.com/settings/payment_methods">Stripe Dashboard</a>.
*/
@SerializedName("payment_method_types")
List<String> paymentMethodTypes;
/** The URL to redirect the customer to after they authenticate their payment. */
@SerializedName("return_url")
String returnUrl;
/**
* For non-card charges, you can use this value as the complete description that appears on
* your customers' statements. Must contain at least one letter, maximum 22 characters.
*/
@SerializedName("statement_descriptor")
String statementDescriptor;
/**
* Provides information about a card payment that customers see on their statements.
* Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on
* the account to form the complete statement descriptor. Maximum 22 characters for the
* concatenated descriptor.
*/
@SerializedName("statement_descriptor_suffix")
String statementDescriptorSuffix;
/** Provides configuration for completing a transfer for the order after it is paid. */
@SerializedName("transfer_data")
TransferData transferData;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AutomaticPaymentMethods extends StripeObject {
/**
* Whether this Order has been opted into managing payment method types via the <a
* href="https://dashboard.stripe.com/settings/payment_methods">Stripe Dashboard</a>.
*/
@SerializedName("enabled")
Boolean enabled;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class PaymentMethodOptions extends StripeObject {
@SerializedName("acss_debit")
AcssDebit acssDebit;
@SerializedName("afterpay_clearpay")
AfterpayClearpay afterpayClearpay;
@SerializedName("alipay")
Alipay alipay;
@SerializedName("bancontact")
Bancontact bancontact;
@SerializedName("card")
Card card;
@SerializedName("customer_balance")
CustomerBalance customerBalance;
@SerializedName("ideal")
Ideal ideal;
@SerializedName("klarna")
Klarna klarna;
@SerializedName("link")
Link link;
@SerializedName("oxxo")
Oxxo oxxo;
@SerializedName("p24")
P24 p24;
@SerializedName("paypal")
Paypal paypal;
@SerializedName("sepa_debit")
SepaDebit sepaDebit;
@SerializedName("sofort")
Sofort sofort;
@SerializedName("wechat_pay")
WechatPay wechatPay;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AcssDebit extends StripeObject {
@SerializedName("mandate_options")
MandateOptions mandateOptions;
/**
* Indicates that you intend to make future payments with this PaymentIntent's payment
* method.
*
* <p>Providing this parameter will <a
* href="https://stripe.com/docs/payments/save-during-payment">attach the payment
* method</a> to the PaymentIntent's Customer, if present, after the PaymentIntent is
* confirmed and any required actions from the user are complete. If no Customer was
* provided, the payment method can still be <a
* href="https://stripe.com/docs/api/payment_methods/attach">attached</a> to a Customer
* after the transaction completes.
*
* <p>When processing card payments, Stripe also uses {@code setup_future_usage} to
* dynamically optimize your payment flow and comply with regional legislation and network
* rules, such as <a
* href="https://stripe.com/docs/strong-customer-authentication">SCA</a>.
*
* <p>One of {@code none}, {@code off_session}, or {@code on_session}.
*/
@SerializedName("setup_future_usage")
String setupFutureUsage;
/**
* Bank account verification method.
*
* <p>One of {@code automatic}, {@code instant}, or {@code microdeposits}.
*/
@SerializedName("verification_method")
String verificationMethod;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class MandateOptions extends StripeObject {
/** A URL for custom mandate text. */
@SerializedName("custom_mandate_url")
String customMandateUrl;
/**
* Description of the interval. Only required if the 'payment_schedule' parameter is
* 'interval' or 'combined'.
*/
@SerializedName("interval_description")
String intervalDescription;
/**
* Payment schedule for the mandate.
*
* <p>One of {@code combined}, {@code interval}, or {@code sporadic}.
*/
@SerializedName("payment_schedule")
String paymentSchedule;
/**
* Transaction type of the mandate.
*
* <p>One of {@code business}, or {@code personal}.
*/
@SerializedName("transaction_type")
String transactionType;
}
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class AfterpayClearpay extends StripeObject {
/**
* Controls when the funds will be captured from the customer's account.
*
* <p>One of {@code automatic}, or {@code manual}.
*/
@SerializedName("capture_method")
String captureMethod;
/**
* Order identifier shown to the user in Afterpay's online portal. We recommend using a
* value that helps you answer any questions a customer might have about the payment. The
* identifier is limited to 128 characters and may contain only letters, digits,
* underscores, backslashes and dashes.
*/
@SerializedName("reference")
String reference;
/**
* Indicates that you intend to make future payments with the payment method.
*
* <p>Providing this parameter will <a
* href="https://stripe.com/docs/payments/save-during-payment">attach the payment
* method</a> to the order's Customer, if present, after the order's PaymentIntent is
* confirmed and any required actions from the user are complete. If no Customer was
* provided, the payment method can still be <a
* href="https://stripe.com/docs/api/payment_methods/attach">attached</a> to a Customer
* after the transaction completes.
*
* <p>When processing card payments, Stripe also uses {@code setup_future_usage} to
* dynamically optimize your payment flow and comply with regional legislation and network
* rules, such as <a
* href="https://stripe.com/docs/strong-customer-authentication">SCA</a>.
*
* <p>If {@code setup_future_usage} is already set and you are performing a request using
* a publishable key, you may only update the value from {@code on_session} to {@code
* off_session}.
*
* <p>Equal to {@code none}.
*/
@SerializedName("setup_future_usage")
String setupFutureUsage;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Alipay extends StripeObject {
/**
* Indicates that you intend to make future payments with this PaymentIntent's payment
* method.
*
* <p>Providing this parameter will <a
* href="https://stripe.com/docs/payments/save-during-payment">attach the payment
* method</a> to the PaymentIntent's Customer, if present, after the PaymentIntent is
* confirmed and any required actions from the user are complete. If no Customer was
* provided, the payment method can still be <a
* href="https://stripe.com/docs/api/payment_methods/attach">attached</a> to a Customer
* after the transaction completes.
*
* <p>When processing card payments, Stripe also uses {@code setup_future_usage} to
* dynamically optimize your payment flow and comply with regional legislation and network
* rules, such as <a
* href="https://stripe.com/docs/strong-customer-authentication">SCA</a>.
*
* <p>One of {@code none}, or {@code off_session}.
*/
@SerializedName("setup_future_usage")
String setupFutureUsage;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Bancontact extends StripeObject {
/**
* Preferred language of the Bancontact authorization page that the customer is redirected
* to.
*
* <p>One of {@code de}, {@code en}, {@code fr}, or {@code nl}.
*/
@SerializedName("preferred_language")
String preferredLanguage;
/**
* Indicates that you intend to make future payments with this PaymentIntent's payment
* method.
*
* <p>Providing this parameter will <a
* href="https://stripe.com/docs/payments/save-during-payment">attach the payment
* method</a> to the PaymentIntent's Customer, if present, after the PaymentIntent is
* confirmed and any required actions from the user are complete. If no Customer was
* provided, the payment method can still be <a
* href="https://stripe.com/docs/api/payment_methods/attach">attached</a> to a Customer
* after the transaction completes.
*
* <p>When processing card payments, Stripe also uses {@code setup_future_usage} to
* dynamically optimize your payment flow and comply with regional legislation and network
* rules, such as <a
* href="https://stripe.com/docs/strong-customer-authentication">SCA</a>.
*
* <p>One of {@code none}, or {@code off_session}.