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

https://github.com/stripe/stripe-java · Java · 300 lines · 160 code · 38 blank · 102 comment · 16 complexity · b147c165ae4edfb3a04474a4be4a4343 MD5 · raw file

  1. // File generated from our OpenAPI spec
  2. package com.stripe.param;
  3. import com.google.gson.annotations.SerializedName;
  4. import com.stripe.net.ApiRequestParams;
  5. import java.util.ArrayList;
  6. import java.util.HashMap;
  7. import java.util.List;
  8. import java.util.Map;
  9. import lombok.Getter;
  10. @Getter
  11. public class PaymentIntentIncrementAuthorizationParams extends ApiRequestParams {
  12. /**
  13. * The updated total amount you intend to collect from the cardholder. This amount must be greater
  14. * than the currently authorized amount.
  15. */
  16. @SerializedName("amount")
  17. Long amount;
  18. /**
  19. * The amount of the application fee (if any) that will be requested to be applied to the payment
  20. * and transferred to the application owner's Stripe account. The amount of the application fee
  21. * collected will be capped at the total payment amount. For more information, see the
  22. * PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case for
  23. * connected accounts</a>.
  24. */
  25. @SerializedName("application_fee_amount")
  26. Long applicationFeeAmount;
  27. /** An arbitrary string attached to the object. Often useful for displaying to users. */
  28. @SerializedName("description")
  29. String description;
  30. /** Specifies which fields in the response should be expanded. */
  31. @SerializedName("expand")
  32. List<String> expand;
  33. /**
  34. * Map of extra parameters for custom features not available in this client library. The content
  35. * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
  36. * key/value pair is serialized as if the key is a root-level field (serialized) name in this
  37. * param object. Effectively, this map is flattened to its parent instance.
  38. */
  39. @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
  40. Map<String, Object> extraParams;
  41. /**
  42. * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
  43. * to an object. This can be useful for storing additional information about the object in a
  44. * structured format. Individual keys can be unset by posting an empty value to them. All keys can
  45. * be unset by posting an empty value to {@code metadata}.
  46. */
  47. @SerializedName("metadata")
  48. Map<String, String> metadata;
  49. /**
  50. * The parameters used to automatically create a Transfer when the payment is captured. For more
  51. * information, see the PaymentIntents <a
  52. * href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a>.
  53. */
  54. @SerializedName("transfer_data")
  55. TransferData transferData;
  56. private PaymentIntentIncrementAuthorizationParams(
  57. Long amount,
  58. Long applicationFeeAmount,
  59. String description,
  60. List<String> expand,
  61. Map<String, Object> extraParams,
  62. Map<String, String> metadata,
  63. TransferData transferData) {
  64. this.amount = amount;
  65. this.applicationFeeAmount = applicationFeeAmount;
  66. this.description = description;
  67. this.expand = expand;
  68. this.extraParams = extraParams;
  69. this.metadata = metadata;
  70. this.transferData = transferData;
  71. }
  72. public static Builder builder() {
  73. return new Builder();
  74. }
  75. public static class Builder {
  76. private Long amount;
  77. private Long applicationFeeAmount;
  78. private String description;
  79. private List<String> expand;
  80. private Map<String, Object> extraParams;
  81. private Map<String, String> metadata;
  82. private TransferData transferData;
  83. /** Finalize and obtain parameter instance from this builder. */
  84. public PaymentIntentIncrementAuthorizationParams build() {
  85. return new PaymentIntentIncrementAuthorizationParams(
  86. this.amount,
  87. this.applicationFeeAmount,
  88. this.description,
  89. this.expand,
  90. this.extraParams,
  91. this.metadata,
  92. this.transferData);
  93. }
  94. /**
  95. * The updated total amount you intend to collect from the cardholder. This amount must be
  96. * greater than the currently authorized amount.
  97. */
  98. public Builder setAmount(Long amount) {
  99. this.amount = amount;
  100. return this;
  101. }
  102. /**
  103. * The amount of the application fee (if any) that will be requested to be applied to the
  104. * payment and transferred to the application owner's Stripe account. The amount of the
  105. * application fee collected will be capped at the total payment amount. For more information,
  106. * see the PaymentIntents <a href="https://stripe.com/docs/payments/connected-accounts">use case
  107. * for connected accounts</a>.
  108. */
  109. public Builder setApplicationFeeAmount(Long applicationFeeAmount) {
  110. this.applicationFeeAmount = applicationFeeAmount;
  111. return this;
  112. }
  113. /** An arbitrary string attached to the object. Often useful for displaying to users. */
  114. public Builder setDescription(String description) {
  115. this.description = description;
  116. return this;
  117. }
  118. /**
  119. * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
  120. * subsequent calls adds additional elements to the original list. See {@link
  121. * PaymentIntentIncrementAuthorizationParams#expand} for the field documentation.
  122. */
  123. public Builder addExpand(String element) {
  124. if (this.expand == null) {
  125. this.expand = new ArrayList<>();
  126. }
  127. this.expand.add(element);
  128. return this;
  129. }
  130. /**
  131. * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
  132. * subsequent calls adds additional elements to the original list. See {@link
  133. * PaymentIntentIncrementAuthorizationParams#expand} for the field documentation.
  134. */
  135. public Builder addAllExpand(List<String> elements) {
  136. if (this.expand == null) {
  137. this.expand = new ArrayList<>();
  138. }
  139. this.expand.addAll(elements);
  140. return this;
  141. }
  142. /**
  143. * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
  144. * call, and subsequent calls add additional key/value pairs to the original map. See {@link
  145. * PaymentIntentIncrementAuthorizationParams#extraParams} for the field documentation.
  146. */
  147. public Builder putExtraParam(String key, Object value) {
  148. if (this.extraParams == null) {
  149. this.extraParams = new HashMap<>();
  150. }
  151. this.extraParams.put(key, value);
  152. return this;
  153. }
  154. /**
  155. * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
  156. * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
  157. * See {@link PaymentIntentIncrementAuthorizationParams#extraParams} for the field
  158. * documentation.
  159. */
  160. public Builder putAllExtraParam(Map<String, Object> map) {
  161. if (this.extraParams == null) {
  162. this.extraParams = new HashMap<>();
  163. }
  164. this.extraParams.putAll(map);
  165. return this;
  166. }
  167. /**
  168. * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` call,
  169. * and subsequent calls add additional key/value pairs to the original map. See {@link
  170. * PaymentIntentIncrementAuthorizationParams#metadata} for the field documentation.
  171. */
  172. public Builder putMetadata(String key, String value) {
  173. if (this.metadata == null) {
  174. this.metadata = new HashMap<>();
  175. }
  176. this.metadata.put(key, value);
  177. return this;
  178. }
  179. /**
  180. * Add all map key/value pairs to `metadata` map. A map is initialized for the first
  181. * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
  182. * See {@link PaymentIntentIncrementAuthorizationParams#metadata} for the field documentation.
  183. */
  184. public Builder putAllMetadata(Map<String, String> map) {
  185. if (this.metadata == null) {
  186. this.metadata = new HashMap<>();
  187. }
  188. this.metadata.putAll(map);
  189. return this;
  190. }
  191. /**
  192. * The parameters used to automatically create a Transfer when the payment is captured. For more
  193. * information, see the PaymentIntents <a
  194. * href="https://stripe.com/docs/payments/connected-accounts">use case for connected
  195. * accounts</a>.
  196. */
  197. public Builder setTransferData(TransferData transferData) {
  198. this.transferData = transferData;
  199. return this;
  200. }
  201. }
  202. @Getter
  203. public static class TransferData {
  204. /** The amount that will be transferred automatically when a charge succeeds. */
  205. @SerializedName("amount")
  206. Long amount;
  207. /**
  208. * Map of extra parameters for custom features not available in this client library. The content
  209. * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
  210. * key/value pair is serialized as if the key is a root-level field (serialized) name in this
  211. * param object. Effectively, this map is flattened to its parent instance.
  212. */
  213. @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
  214. Map<String, Object> extraParams;
  215. private TransferData(Long amount, Map<String, Object> extraParams) {
  216. this.amount = amount;
  217. this.extraParams = extraParams;
  218. }
  219. public static Builder builder() {
  220. return new Builder();
  221. }
  222. public static class Builder {
  223. private Long amount;
  224. private Map<String, Object> extraParams;
  225. /** Finalize and obtain parameter instance from this builder. */
  226. public TransferData build() {
  227. return new TransferData(this.amount, this.extraParams);
  228. }
  229. /** The amount that will be transferred automatically when a charge succeeds. */
  230. public Builder setAmount(Long amount) {
  231. this.amount = amount;
  232. return this;
  233. }
  234. /**
  235. * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
  236. * call, and subsequent calls add additional key/value pairs to the original map. See {@link
  237. * PaymentIntentIncrementAuthorizationParams.TransferData#extraParams} for the field
  238. * documentation.
  239. */
  240. public Builder putExtraParam(String key, Object value) {
  241. if (this.extraParams == null) {
  242. this.extraParams = new HashMap<>();
  243. }
  244. this.extraParams.put(key, value);
  245. return this;
  246. }
  247. /**
  248. * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
  249. * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
  250. * See {@link PaymentIntentIncrementAuthorizationParams.TransferData#extraParams} for the
  251. * field documentation.
  252. */
  253. public Builder putAllExtraParam(Map<String, Object> map) {
  254. if (this.extraParams == null) {
  255. this.extraParams = new HashMap<>();
  256. }
  257. this.extraParams.putAll(map);
  258. return this;
  259. }
  260. }
  261. }
  262. }