11package com .gocardless .resources ;
22
33import com .google .gson .annotations .SerializedName ;
4+ import java .util .List ;
45import java .util .Map ;
56
67/**
@@ -25,6 +26,7 @@ private BillingRequestTemplate() {
2526 private String authorisationUrl ;
2627 private String createdAt ;
2728 private String id ;
29+ private MandateRequestConstraints mandateRequestConstraints ;
2830 private String mandateRequestCurrency ;
2931 private String mandateRequestDescription ;
3032 private Map <String , Object > mandateRequestMetadata ;
@@ -62,6 +64,14 @@ public String getId() {
6264 return id ;
6365 }
6466
67+ /**
68+ * Constraints that will apply to the mandate_request. (Optional) Specifically required for
69+ * PayTo and VRP.
70+ */
71+ public MandateRequestConstraints getMandateRequestConstraints () {
72+ return mandateRequestConstraints ;
73+ }
74+
6575 /**
6676 * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code.
6777 */
@@ -208,4 +218,136 @@ public enum MandateRequestVerify {
208218 ALWAYS , @ SerializedName ("unknown" )
209219 UNKNOWN
210220 }
221+
222+ /**
223+ * Represents a mandate request constraint resource returned from the API.
224+ *
225+ * Constraints that will apply to the mandate_request. (Optional) Specifically required for
226+ * PayTo and VRP.
227+ */
228+ public static class MandateRequestConstraints {
229+ private MandateRequestConstraints () {
230+ // blank to prevent instantiation
231+ }
232+
233+ private String endDate ;
234+ private Integer maxAmountPerPayment ;
235+ private String paymentMethod ;
236+ private List <PeriodicLimit > periodicLimits ;
237+ private String startDate ;
238+
239+ /**
240+ * The latest date at which payments can be taken, must occur after start_date if present
241+ *
242+ * This is an optional field and if it is not supplied the agreement will be considered open
243+ * and will not have an end date. Keep in mind the end date must take into account how long
244+ * it will take the user to set up this agreement via the Billing Request.
245+ *
246+ */
247+ public String getEndDate () {
248+ return endDate ;
249+ }
250+
251+ /**
252+ * The maximum amount that can be charged for a single payment. Required for PayTo and VRP.
253+ */
254+ public Integer getMaxAmountPerPayment () {
255+ return maxAmountPerPayment ;
256+ }
257+
258+ /**
259+ * A constraint where you can specify info (free text string) about how payments are
260+ * calculated. _Note:_ This is only supported for ACH and PAD schemes.
261+ *
262+ */
263+ public String getPaymentMethod () {
264+ return paymentMethod ;
265+ }
266+
267+ /**
268+ * List of periodic limits and constraints which apply to them
269+ */
270+ public List <PeriodicLimit > getPeriodicLimits () {
271+ return periodicLimits ;
272+ }
273+
274+ /**
275+ * The date from which payments can be taken.
276+ *
277+ * This is an optional field and if it is not supplied the start date will be set to the day
278+ * authorisation happens.
279+ *
280+ */
281+ public String getStartDate () {
282+ return startDate ;
283+ }
284+
285+ public static class PeriodicLimit {
286+ private PeriodicLimit () {
287+ // blank to prevent instantiation
288+ }
289+
290+ private Alignment alignment ;
291+ private Integer maxPayments ;
292+ private Integer maxTotalAmount ;
293+ private Period period ;
294+
295+ /**
296+ * The alignment of the period.
297+ *
298+ * `calendar` - this will finish on the end of the current period. For example this will
299+ * expire on the Monday for the current week or the January for the next year.
300+ *
301+ * `creation_date` - this will finish on the next instance of the current period. For
302+ * example Monthly it will expire on the same day of the next month, or yearly the same
303+ * day of the next year.
304+ *
305+ */
306+ public Alignment getAlignment () {
307+ return alignment ;
308+ }
309+
310+ /**
311+ * (Optional) The maximum number of payments that can be collected in this periodic
312+ * limit.
313+ */
314+ public Integer getMaxPayments () {
315+ return maxPayments ;
316+ }
317+
318+ /**
319+ * The maximum total amount that can be charged for all payments in this periodic limit.
320+ * Required for VRP.
321+ *
322+ */
323+ public Integer getMaxTotalAmount () {
324+ return maxTotalAmount ;
325+ }
326+
327+ /**
328+ * The repeating period for this mandate. Defaults to flexible for PayTo if not
329+ * specified.
330+ */
331+ public Period getPeriod () {
332+ return period ;
333+ }
334+
335+ public enum Alignment {
336+ @ SerializedName ("calendar" )
337+ CALENDAR , @ SerializedName ("creation_date" )
338+ CREATION_DATE , @ SerializedName ("unknown" )
339+ UNKNOWN
340+ }
341+
342+ public enum Period {
343+ @ SerializedName ("day" )
344+ DAY , @ SerializedName ("week" )
345+ WEEK , @ SerializedName ("month" )
346+ MONTH , @ SerializedName ("year" )
347+ YEAR , @ SerializedName ("flexible" )
348+ FLEXIBLE , @ SerializedName ("unknown" )
349+ UNKNOWN
350+ }
351+ }
352+ }
211353}
0 commit comments