summaryrefslogtreecommitdiff
path: root/src/main/java/com/p4square/ccbapi/model/GetIndividualProfilesRequest.java
blob: 589de3c2e84626d0e39afdb611eda29d2a4a81d6 (plain)
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
package com.p4square.ccbapi.model;

import java.time.LocalDate;

/**
 * GetIndividualProfilesRequest is the set of options for retrieving individual profiles.
 */
public class GetIndividualProfilesRequest {

    // Used with individual_profiles
    private LocalDate modifiedSince;
    private Boolean includeInactive;
    private int page;
    private int perPage;

    // Used with individual_profile_from_id
    private int id;

    // Used with individual_profile_from_login_password
    private String login;
    private String password;

    // Used with individual_profile_from_micr
    private String routingNumber;
    private String accountNumber;

    public int getId() {
        return id;
    }

    /**
     * Request the IndividualProfile for the given individual id.
     *
     * This option is mutually exclusive with {@link #withLoginPassword(String, String)}
     * and {@link #withMICR(String, String)}.
     *
     * @param id The id.
     * @return this.
     */
    public GetIndividualProfilesRequest withIndividualId(final int id) {
        this.id = id;
        this.login = this.password = this.accountNumber = this.routingNumber = null;
        return this;
    }

    public String getLogin() {
        return login;
    }

    public String getPassword() {
        return password;
    }

    /**
     * Request the IndividualProfile for the given login and password.
     *
     * This option is mutually exclusive with {@link #withIndividualId(int)}
     * and {@link #withMICR(String, String)}.
     *
     * @param login The individual's login.
     * @param password The individual's password.
     * @return this.
     */
    public GetIndividualProfilesRequest withLoginPassword(final String login, final String password) {
        this.login = login;
        this.password = password;
        this.id = 0;
        this.accountNumber = this.routingNumber = null;
        return this;
    }

    public String getRoutingNumber() {
        return routingNumber;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    /**
     * Request the IndividualProfile for the given bank account information.
     *
     * This option is mutually exclusive with {@link #withIndividualId(int)}
     * and {@link #withLoginPassword(String, String)}.
     *
     * @param routingNumber The individual's bank routing number.
     * @param accountNumber The individual's bank account number.
     * @return this.
     */
    public GetIndividualProfilesRequest withMICR(final String routingNumber, final String accountNumber) {
        this.routingNumber = routingNumber;
        this.accountNumber = accountNumber;
        return this;
    }

    public LocalDate getModifiedSince() {
        return modifiedSince;
    }

    /**
     * Request only IndividualProfiles modified since a given date.
     *
     * This option is only applicable when requesting all individuals.
     *
     * @param modifiedSince The date.
     * @return this.
     */
    public GetIndividualProfilesRequest withModifiedSince(final LocalDate modifiedSince) {
        this.modifiedSince = modifiedSince;
        return this;
    }

    public Boolean getIncludeInactive() {
        return includeInactive;
    }

    public GetIndividualProfilesRequest withIncludeInactive(final boolean includeInactive) {
        this.includeInactive = includeInactive;
        return this;
    }

    public int getPage() {
        return page;
    }

    /**
     * Select the page of results when perPage is also specified.
     *
     * This option is only applicable when requesting all individuals.
     *
     * Defaults to 1 if {@link #withPerPage(int)} is specified on the request.
     *
     * @param page The starting page number.
     * @return this.
     */
    public GetIndividualProfilesRequest withPage(final int page) {
        this.page = page;
        return this;
    }

    public int getPerPage() {
        return perPage;
    }

    /**
     * Limit the number of IndividualProfiles returned.
     *
     * This option is only applicable when requesting all individuals.
     *
     * Defaults to 25 if {@link #withPage(int)} is specified on the request.
     *
     * @param perPage The maximum number to return.
     * @return this.
     */
    public GetIndividualProfilesRequest withPerPage(int perPage) {
        this.perPage = perPage;
        return this;
    }
}