Skip to content

Commit fdb9d4b

Browse files
author
Kevin Hellemun
committed
Merge branch 'release/1.0.1'
2 parents b18a099 + de0464a commit fdb9d4b

36 files changed

+9513
-124
lines changed

build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ apply plugin: 'java'
55
apply plugin: 'maven'
66
sourceCompatibility = 1.7
77

8+
9+
sourceSets {
10+
main {
11+
java {
12+
srcDir 'src/main/java'
13+
exclude '**/examples/**'
14+
exclude '**/test/**'
15+
}
16+
}
17+
}
18+
819
repositories {
920
mavenCentral()
1021
}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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.model.generated.object.BunqId;
10+
import com.bunq.sdk.model.generated.object.CardBatchEntry;
11+
import com.google.gson.annotations.Expose;
12+
import com.google.gson.annotations.SerializedName;
13+
import com.google.gson.stream.JsonReader;
14+
import java.math.BigDecimal;
15+
import java.util.ArrayList;
16+
import java.util.HashMap;
17+
import java.util.List;
18+
import java.util.Map;
19+
import javax.lang.model.type.NullType;
20+
21+
/**
22+
* Used to update multiple cards in a batch.
23+
*/
24+
public class CardBatch extends BunqModel {
25+
26+
/**
27+
* Endpoint constants.
28+
*/
29+
protected static final String ENDPOINT_URL_CREATE = "user/%s/card-batch";
30+
31+
/**
32+
* Field constants.
33+
*/
34+
public static final String FIELD_CARDS = "cards";
35+
36+
/**
37+
* Object type.
38+
*/
39+
protected static final String OBJECT_TYPE_POST = "CardBatch";
40+
41+
/**
42+
* The ids of the cards that have been updated.
43+
*/
44+
@Expose
45+
@SerializedName("updated_card_ids")
46+
private List<BunqId> updatedCardIds;
47+
48+
/**
49+
* The cards that need to be updated.
50+
*/
51+
@Expose
52+
@SerializedName("cards_field_for_request")
53+
private List<CardBatchEntry> cardsFieldForRequest;
54+
55+
public CardBatch() {
56+
this(null);
57+
}
58+
59+
public CardBatch(List<CardBatchEntry> cards) {
60+
this.cardsFieldForRequest = cards;
61+
} /**
62+
* @param cards The cards that need to be updated.
63+
*/
64+
public static BunqResponse<CardBatch> create(List<CardBatchEntry> cards, Map<String, String> customHeaders) {
65+
ApiClient apiClient = new ApiClient(getApiContext());
66+
67+
if (customHeaders == null) {
68+
customHeaders = new HashMap<>();
69+
}
70+
71+
HashMap<String, Object> requestMap = new HashMap<>();
72+
requestMap.put(FIELD_CARDS, cards);
73+
74+
byte[] requestBytes = determineAllRequestByte(requestMap);
75+
BunqResponseRaw responseRaw = apiClient.post(String.format(ENDPOINT_URL_CREATE, determineUserId()), requestBytes, customHeaders);
76+
77+
return fromJson(CardBatch.class, responseRaw, OBJECT_TYPE_POST);
78+
}
79+
80+
public static BunqResponse<CardBatch> create() {
81+
return create(null, null);
82+
}
83+
84+
public static BunqResponse<CardBatch> create(List<CardBatchEntry> cards) {
85+
return create(cards, null);
86+
}
87+
88+
/**
89+
* The ids of the cards that have been updated.
90+
*/
91+
public List<BunqId> getUpdatedCardIds() {
92+
return this.updatedCardIds;
93+
}
94+
95+
public void setUpdatedCardIds(List<BunqId> updatedCardIds) {
96+
this.updatedCardIds = updatedCardIds;
97+
}
98+
99+
/**
100+
*/
101+
public boolean isAllFieldNull() {
102+
if (this.updatedCardIds != null) {
103+
return false;
104+
}
105+
106+
return true;
107+
}
108+
109+
/**
110+
*/
111+
public static CardBatch fromJsonReader(JsonReader reader) {
112+
return fromJsonReader(CardBatch.class, reader);
113+
}
114+
115+
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ public class CardGeneratedCvc2 extends BunqModel {
2323
*/
2424
protected static final String ENDPOINT_URL_CREATE = "user/%s/card/%s/generated-cvc2";
2525
protected static final String ENDPOINT_URL_READ = "user/%s/card/%s/generated-cvc2/%s";
26+
protected static final String ENDPOINT_URL_UPDATE = "user/%s/card/%s/generated-cvc2/%s";
27+
protected static final String ENDPOINT_URL_LISTING = "user/%s/card/%s/generated-cvc2";
28+
2629
/**
2730
* Field constants.
2831
*/
2932
public static final String FIELD_TYPE = "type";
30-
protected static final String ENDPOINT_URL_LISTING = "user/%s/card/%s/generated-cvc2";
31-
protected static final String ENDPOINT_URL_UPDATE = "user/%s/card/%s/generated-cvc2/%s";
3233

3334
/**
3435
* Object type.
@@ -55,6 +56,7 @@ public class CardGeneratedCvc2 extends BunqModel {
5556
@Expose
5657
@SerializedName("updated")
5758
private String updated;
59+
5860
/**
5961
* The type of generated cvc2. Can be STATIC or GENERATED.
6062
*/

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ public class Customer extends BunqModel {
6363
@SerializedName("billing_account_id")
6464
private String billingAccountId;
6565

66+
/**
67+
* The preferred notification type for invoices.
68+
*/
69+
@Expose
70+
@SerializedName("invoice_notification_preference")
71+
private String invoiceNotificationPreference;
72+
6673
/**
6774
* The primary billing account account's id.
6875
*/
@@ -205,6 +212,17 @@ public void setBillingAccountId(String billingAccountId) {
205212
this.billingAccountId = billingAccountId;
206213
}
207214

215+
/**
216+
* The preferred notification type for invoices.
217+
*/
218+
public String getInvoiceNotificationPreference() {
219+
return this.invoiceNotificationPreference;
220+
}
221+
222+
public void setInvoiceNotificationPreference(String invoiceNotificationPreference) {
223+
this.invoiceNotificationPreference = invoiceNotificationPreference;
224+
}
225+
208226
/**
209227
*/
210228
public boolean isAllFieldNull() {
@@ -224,6 +242,10 @@ public boolean isAllFieldNull() {
224242
return false;
225243
}
226244

245+
if (this.invoiceNotificationPreference != null) {
246+
return false;
247+
}
248+
227249
return true;
228250
}
229251

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ public class MasterCardAction extends BunqModel {
8787
@SerializedName("amount_fee")
8888
private Amount amountFee;
8989

90+
/**
91+
* The response code by which authorised transaction can be identified as authorised by bunq.
92+
*/
93+
@Expose
94+
@SerializedName("card_authorisation_id_response")
95+
private String cardAuthorisationIdResponse;
96+
9097
/**
9198
* Why the transaction was denied, if it was denied, or just ALLOWED.
9299
*/
@@ -357,6 +364,17 @@ public void setAmountFee(Amount amountFee) {
357364
this.amountFee = amountFee;
358365
}
359366

367+
/**
368+
* The response code by which authorised transaction can be identified as authorised by bunq.
369+
*/
370+
public String getCardAuthorisationIdResponse() {
371+
return this.cardAuthorisationIdResponse;
372+
}
373+
374+
public void setCardAuthorisationIdResponse(String cardAuthorisationIdResponse) {
375+
this.cardAuthorisationIdResponse = cardAuthorisationIdResponse;
376+
}
377+
360378
/**
361379
* Why the transaction was denied, if it was denied, or just ALLOWED.
362380
*/
@@ -604,6 +622,10 @@ public boolean isAllFieldNull() {
604622
return false;
605623
}
606624

625+
if (this.cardAuthorisationIdResponse != null) {
626+
return false;
627+
}
628+
607629
if (this.decision != null) {
608630
return false;
609631
}

0 commit comments

Comments
 (0)