|
2 | 2 | package com.stripe.service; |
3 | 3 |
|
4 | 4 | import com.google.gson.reflect.TypeToken; |
| 5 | +import com.stripe.Stripe; |
5 | 6 | import com.stripe.exception.StripeException; |
6 | 7 | import com.stripe.model.Invoice; |
7 | 8 | import com.stripe.model.StripeCollection; |
@@ -806,6 +807,53 @@ public Invoice createPreview(InvoiceCreatePreviewParams params, RequestOptions o |
806 | 807 | options); |
807 | 808 | return this.request(request, Invoice.class); |
808 | 809 | } |
| 810 | + /** Serializes an Invoice update request into a batch job JSONL line. */ |
| 811 | + public String serializeBatchUpdate(String invoice, InvoiceUpdateParams params) |
| 812 | + throws StripeException { |
| 813 | + return serializeBatchUpdate(invoice, params, (RequestOptions) null); |
| 814 | + } |
| 815 | + /** Serializes an Invoice update request into a batch job JSONL line. */ |
| 816 | + public String serializeBatchUpdate( |
| 817 | + String invoice, InvoiceUpdateParams params, RequestOptions options) throws StripeException { |
| 818 | + String itemId = java.util.UUID.randomUUID().toString(); |
| 819 | + String stripeVersion = Stripe.API_VERSION; |
| 820 | + String stripeContext = (options != null) ? options.getStripeContext() : null; |
| 821 | + |
| 822 | + java.util.Map<String, String> pathParams = new java.util.LinkedHashMap<String, String>(); |
| 823 | + pathParams.put("invoice", invoice); |
| 824 | + java.util.Map<String, Object> item = new java.util.LinkedHashMap<>(); |
| 825 | + item.put("id", itemId); |
| 826 | + item.put("path_params", pathParams); |
| 827 | + item.put("params", (params != null) ? params.toMap() : null); |
| 828 | + item.put("stripe_version", stripeVersion); |
| 829 | + if (stripeContext != null) { |
| 830 | + item.put("context", stripeContext); |
| 831 | + } |
| 832 | + return ApiResource.GSON.toJson(item); |
| 833 | + } |
| 834 | + /** Serializes an Invoice pay request into a batch job JSONL line. */ |
| 835 | + public String serializeBatchPay(String invoice, InvoicePayParams params) throws StripeException { |
| 836 | + return serializeBatchPay(invoice, params, (RequestOptions) null); |
| 837 | + } |
| 838 | + /** Serializes an Invoice pay request into a batch job JSONL line. */ |
| 839 | + public String serializeBatchPay(String invoice, InvoicePayParams params, RequestOptions options) |
| 840 | + throws StripeException { |
| 841 | + String itemId = java.util.UUID.randomUUID().toString(); |
| 842 | + String stripeVersion = Stripe.API_VERSION; |
| 843 | + String stripeContext = (options != null) ? options.getStripeContext() : null; |
| 844 | + |
| 845 | + java.util.Map<String, String> pathParams = new java.util.LinkedHashMap<String, String>(); |
| 846 | + pathParams.put("invoice", invoice); |
| 847 | + java.util.Map<String, Object> item = new java.util.LinkedHashMap<>(); |
| 848 | + item.put("id", itemId); |
| 849 | + item.put("path_params", pathParams); |
| 850 | + item.put("params", (params != null) ? params.toMap() : null); |
| 851 | + item.put("stripe_version", stripeVersion); |
| 852 | + if (stripeContext != null) { |
| 853 | + item.put("context", stripeContext); |
| 854 | + } |
| 855 | + return ApiResource.GSON.toJson(item); |
| 856 | + } |
809 | 857 |
|
810 | 858 | public com.stripe.service.InvoiceLineItemService lineItems() { |
811 | 859 | return new com.stripe.service.InvoiceLineItemService(this.getResponseGetter()); |
|
0 commit comments