Skip to content

Commit ed51772

Browse files
author
Kevin Hellemun
committed
Added cvc_endpoint. #26
1 parent 2387111 commit ed51772

File tree

7 files changed

+189
-6
lines changed

7 files changed

+189
-6
lines changed

src/main/java/com/bunq/sdk/model/generated/endpoint/Card.java

+18
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ public class Card extends BunqModel {
7979
@SerializedName("public_uuid")
8080
private String publicUuid;
8181

82+
/**
83+
* The type of the card. Can be MAESTRO, MASTERCARD.
84+
*/
85+
@Expose
86+
@SerializedName("type")
87+
private String type;
88+
8289
/**
8390
* The second line of text on the card
8491
*/
@@ -275,6 +282,17 @@ public void setPublicUuid(String publicUuid) {
275282
this.publicUuid = publicUuid;
276283
}
277284

285+
/**
286+
* The type of the card. Can be MAESTRO, MASTERCARD.
287+
*/
288+
public String getType() {
289+
return this.type;
290+
}
291+
292+
public void setType(String type) {
293+
this.type = type;
294+
}
295+
278296
/**
279297
* The second line of text on the card
280298
*/

src/main/java/com/bunq/sdk/model/generated/endpoint/CardDebit.java

+18
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ public class CardDebit extends BunqModel {
7676
@SerializedName("public_uuid")
7777
private String publicUuid;
7878

79+
/**
80+
* The type of the card. Can be MAESTRO, MASTERCARD.
81+
*/
82+
@Expose
83+
@SerializedName("type")
84+
private String type;
85+
7986
/**
8087
* The second line of text on the card
8188
*/
@@ -228,6 +235,17 @@ public void setPublicUuid(String publicUuid) {
228235
this.publicUuid = publicUuid;
229236
}
230237

238+
/**
239+
* The type of the card. Can be MAESTRO, MASTERCARD.
240+
*/
241+
public String getType() {
242+
return this.type;
243+
}
244+
245+
public void setType(String type) {
246+
this.type = type;
247+
}
248+
231249
/**
232250
* The second line of text on the card
233251
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
package com.bunq.sdk.model.generated.endpoint;
2+
3+
import com.bunq.sdk.context.ApiContext;
4+
import com.bunq.sdk.http.ApiClient;
5+
import com.bunq.sdk.http.BunqResponse;
6+
import com.bunq.sdk.http.BunqResponseRaw;
7+
import com.bunq.sdk.model.core.BunqModel;
8+
import com.bunq.sdk.model.core.MonetaryAccountReference;
9+
import com.bunq.sdk.security.SecurityUtils;
10+
import com.google.gson.annotations.Expose;
11+
import com.google.gson.annotations.SerializedName;
12+
import java.math.BigDecimal;
13+
import java.util.ArrayList;
14+
import java.util.HashMap;
15+
import java.util.List;
16+
import java.util.Map;
17+
import javax.lang.model.type.NullType;
18+
19+
/**
20+
* Endpoint for generating and retrieving a new CVC2 code.
21+
*/
22+
public class CardGeneratedCvc2 extends BunqModel {
23+
24+
/**
25+
* Endpoint constants.
26+
*/
27+
private static final String ENDPOINT_URL_CREATE = "user/%s/card/%s/generated-cvc2";
28+
private static final String ENDPOINT_URL_READ = "user/%s/card/%s/generated-cvc2/%s";
29+
private static final String ENDPOINT_URL_LISTING = "user/%s/card/%s/generated-cvc2";
30+
31+
/**
32+
* Object type.
33+
*/
34+
private static final String OBJECT_TYPE = "CardGeneratedCvc2";
35+
36+
/**
37+
* The cvc2 code.
38+
*/
39+
@Expose
40+
@SerializedName("cvc2")
41+
private String cvc2;
42+
43+
/**
44+
* The status of the cvc2. Can be AVAILABLE, USED, EXPIRED, BLOCKED.
45+
*/
46+
@Expose
47+
@SerializedName("status")
48+
private String status;
49+
50+
/**
51+
* Expiry time of the cvc2.
52+
*/
53+
@Expose
54+
@SerializedName("expiry_time")
55+
private String expiryTime;
56+
57+
public static BunqResponse<CardGeneratedCvc2> create(ApiContext apiContext, Map<String, Object> requestMap, Integer userId, Integer cardId) {
58+
return create(apiContext, requestMap, userId, cardId, new HashMap<>());
59+
}
60+
61+
/**
62+
* Generate a new CVC2 code for a card.
63+
*/
64+
public static BunqResponse<CardGeneratedCvc2> create(ApiContext apiContext, Map<String, Object> requestMap, Integer userId, Integer cardId, Map<String, String> customHeaders) {
65+
ApiClient apiClient = new ApiClient(apiContext);
66+
byte[] requestBytes = gson.toJson(requestMap).getBytes();
67+
requestBytes = SecurityUtils.encrypt(apiContext, requestBytes, customHeaders);
68+
BunqResponseRaw responseRaw = apiClient.post(String.format(ENDPOINT_URL_CREATE, userId, cardId), requestBytes, customHeaders);
69+
70+
return fromJson(CardGeneratedCvc2.class, responseRaw, OBJECT_TYPE);
71+
}
72+
73+
public static BunqResponse<CardGeneratedCvc2> get(ApiContext apiContext, Integer userId, Integer cardId, Integer cardGeneratedCvc2Id) {
74+
return get(apiContext, userId, cardId, cardGeneratedCvc2Id, new HashMap<>());
75+
}
76+
77+
/**
78+
* Get the details for a specific generated CVC2 code.
79+
*/
80+
public static BunqResponse<CardGeneratedCvc2> get(ApiContext apiContext, Integer userId, Integer cardId, Integer cardGeneratedCvc2Id, Map<String, String> customHeaders) {
81+
ApiClient apiClient = new ApiClient(apiContext);
82+
BunqResponseRaw responseRaw = apiClient.get(String.format(ENDPOINT_URL_READ, userId, cardId, cardGeneratedCvc2Id), new HashMap<>(), customHeaders);
83+
84+
return fromJson(CardGeneratedCvc2.class, responseRaw, OBJECT_TYPE);
85+
}
86+
87+
public static BunqResponse<List<CardGeneratedCvc2>> list(ApiContext apiContext, Integer userId, Integer cardId) {
88+
return list(apiContext, userId, cardId, new HashMap<>());
89+
}
90+
91+
public static BunqResponse<List<CardGeneratedCvc2>> list(ApiContext apiContext, Integer userId, Integer cardId, Map<String, String> params) {
92+
return list(apiContext, userId, cardId, params, new HashMap<>());
93+
}
94+
95+
/**
96+
* Get all generated CVC2 codes for a card.
97+
*/
98+
public static BunqResponse<List<CardGeneratedCvc2>> list(ApiContext apiContext, Integer userId, Integer cardId, Map<String, String> params, Map<String, String> customHeaders) {
99+
ApiClient apiClient = new ApiClient(apiContext);
100+
BunqResponseRaw responseRaw = apiClient.get(String.format(ENDPOINT_URL_LISTING, userId, cardId), params, customHeaders);
101+
102+
return fromJsonList(CardGeneratedCvc2.class, responseRaw, OBJECT_TYPE);
103+
}
104+
105+
/**
106+
* The cvc2 code.
107+
*/
108+
public String getCvc2() {
109+
return this.cvc2;
110+
}
111+
112+
public void setCvc2(String cvc2) {
113+
this.cvc2 = cvc2;
114+
}
115+
116+
/**
117+
* The status of the cvc2. Can be AVAILABLE, USED, EXPIRED, BLOCKED.
118+
*/
119+
public String getStatus() {
120+
return this.status;
121+
}
122+
123+
public void setStatus(String status) {
124+
this.status = status;
125+
}
126+
127+
/**
128+
* Expiry time of the cvc2.
129+
*/
130+
public String getExpiryTime() {
131+
return this.expiryTime;
132+
}
133+
134+
public void setExpiryTime(String expiryTime) {
135+
this.expiryTime = expiryTime;
136+
}
137+
138+
}

src/main/java/com/bunq/sdk/model/generated/endpoint/CashRegister.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020
import javax.lang.model.type.NullType;
2121

2222
/**
23-
* CashRegisters act as an point of sale. They have a specific name and avatar, and optionally a
24-
* location. A CashRegister is used to create Tabs. A CashRegister can have an QR code that
25-
* links to one of its Tabs.
23+
* CashRegisters are virtual points of sale. They have a specific name and avatar, and
24+
* optionally, a location.<br/>With a CashRegister you can create a Tab and then use a QR code
25+
* to receive payments.<br/>Check out our Quickstart example to learn how you can easily <a
26+
* href="/api/1/page/usecase-tab-payment">create Tab payments</a>.<br/><br/>Notification filters
27+
* can be set on a CashRegister to receive callbacks. For more information check the <a
28+
* href="/api/1/page/callbacks">dedicated callbacks page</a>.
2629
*/
2730
public class CashRegister extends BunqModel {
2831

src/main/java/com/bunq/sdk/model/generated/endpoint/MonetaryAccountBank.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* MonetaryAccountBank. Examples of fields that can be updated are the description, the daily
2727
* limit and the avatar of the account.<br/><br/>Notification filters can be set on a monetary
2828
* account level to receive callbacks. For more information check the <a
29-
* href="/api/2/page/callbacks">dedicated callbacks page</a>.
29+
* href="/api/1/page/callbacks">dedicated callbacks page</a>.
3030
*/
3131
public class MonetaryAccountBank extends BunqModel {
3232

src/main/java/com/bunq/sdk/model/generated/endpoint/UserCompany.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
import javax.lang.model.type.NullType;
2424

2525
/**
26-
* Show the authenticated user, if it is a company.
26+
* With UserCompany you can retrieve information regarding the authenticated UserCompany and
27+
* update specific fields.<br/><br/>Notification filters can be set on a UserCompany level to
28+
* receive callbacks. For more information check the <a href="/api/1/page/callbacks">dedicated
29+
* callbacks page</a>.
2730
*/
2831
public class UserCompany extends BunqModel {
2932

src/main/java/com/bunq/sdk/model/generated/endpoint/UserPerson.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
import javax.lang.model.type.NullType;
2323

2424
/**
25-
* Show the authenticated user, if it is a person.
25+
* With UserPerson you can retrieve information regarding the authenticated UserPerson and
26+
* update specific fields.<br/><br/>Notification filters can be set on a UserPerson level to
27+
* receive callbacks. For more information check the <a href="/api/1/page/callbacks">dedicated
28+
* callbacks page</a>.
2629
*/
2730
public class UserPerson extends BunqModel {
2831

0 commit comments

Comments
 (0)