Skip to content

Commit

Permalink
make SDK work again. (bunq#148)
Browse files Browse the repository at this point in the history
To me it's somewhat unclear why it doesn't work, seems that generated objects have changed and actually break some things?
With these changes, at least everything compiles, and all test pass

Applied the changed related to `ShareInviteBankInquiry` and `ShareDraftInquiry`
  • Loading branch information
ZzAve committed Dec 31, 2022
1 parent cd852f9 commit 3015def
Show file tree
Hide file tree
Showing 26 changed files with 643 additions and 839 deletions.
21 changes: 19 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
group 'com.bunq.sdk'
version '1.14.1'
version '1.20.22.74-zzave'

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: "maven-publish"
sourceCompatibility = 1.8


Expand All @@ -16,8 +16,25 @@ sourceSets {
}
}

task sourceJar(type: Jar) {
from sourceSets.main.allJava
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java

artifact sourceJar {
classifier "sources"
}
}
}
}

repositories {
mavenCentral()
mavenLocal()
}

dependencies {
Expand Down
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kotlin.code.style=official
kotlin.js.generate.executable.default=false
org.gradle.jvmargs=-Xmx3g
org.gradle.caching=true
kotlin.mpp.stability.nowarn=true
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
import com.bunq.sdk.http.ApiClient;
import com.bunq.sdk.http.BunqResponse;
import com.bunq.sdk.http.BunqResponseRaw;
import com.bunq.sdk.model.generated.endpoint.NotificationFilterPushUser;
import com.bunq.sdk.model.generated.object.NotificationFilterPush;
import com.bunq.sdk.model.generated.object.NotificationFilterUrl;
import com.bunq.sdk.model.generated.endpoint.NotificationFilterPush;
import com.bunq.sdk.model.generated.object.NotificationFilterPushObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class NotificationFilterPushUserInternal extends NotificationFilterPushUser {
public class NotificationFilterPushUserInternal extends NotificationFilterPush {
/**
* Field constants.
*/
Expand All @@ -21,24 +20,24 @@ public class NotificationFilterPushUserInternal extends NotificationFilterPushUs
/**
* Create notification filters with list response type.
*/
public static BunqResponse<List<NotificationFilterPush>> createWithListResponse() {
return createWithListResponse(new ArrayList<NotificationFilterPush>(), null);
public static BunqResponse<List<NotificationFilterPushObject>> createWithListResponse() {
return createWithListResponse(new ArrayList<NotificationFilterPushObject>(), null);
}

/**
* Create notification filters with list response type.
*/
public static BunqResponse<List<NotificationFilterPush>> createWithListResponse(
List<NotificationFilterPush> allNotificationFilter
public static BunqResponse<List<NotificationFilterPushObject>> createWithListResponse(
List<NotificationFilterPushObject> allNotificationFilter
) {
return createWithListResponse(allNotificationFilter, null);
}

/**
* Create notification filters with list response type.
*/
public static BunqResponse<List<NotificationFilterPush>> createWithListResponse(
List<NotificationFilterPush> allNotificationFilter,
public static BunqResponse<List<NotificationFilterPushObject>> createWithListResponse(
List<NotificationFilterPushObject> allNotificationFilter,
Map<String, String> customHeaders
) {
ApiClient apiClient = new ApiClient(getApiContext());
Expand All @@ -53,6 +52,6 @@ public static BunqResponse<List<NotificationFilterPush>> createWithListResponse(
byte[] requestBytes = determineAllRequestByte(requestMap);
BunqResponseRaw responseRaw = apiClient.post(String.format(ENDPOINT_URL_CREATE, determineUserId()), requestBytes, customHeaders);

return NotificationFilterUrl.fromJsonList(NotificationFilterPush.class, responseRaw, OBJECT_TYPE);
return NotificationFilterPushObject.fromJsonList(NotificationFilterPushObject.class, responseRaw, OBJECT_TYPE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.bunq.sdk.http.BunqResponse;
import com.bunq.sdk.http.BunqResponseRaw;
import com.bunq.sdk.model.generated.endpoint.NotificationFilterUrlMonetaryAccount;
import com.bunq.sdk.model.generated.object.NotificationFilterUrl;
import com.bunq.sdk.model.generated.object.NotificationFilterUrlObject;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -20,26 +20,26 @@ public class NotificationFilterUrlMonetaryAccountInternal extends NotificationFi
/**
* Create notification filters with list response type.
*/
public static BunqResponse<List<NotificationFilterUrl>> createWithListResponse() {
return createWithListResponse(null, new ArrayList<NotificationFilterUrl>());
public static BunqResponse<List<NotificationFilterUrlObject>> createWithListResponse() {
return createWithListResponse(null, new ArrayList<NotificationFilterUrlObject>());
}

/**
* Create notification filters with list response type.
*/
public static BunqResponse<List<NotificationFilterUrl>> createWithListResponse(
public static BunqResponse<List<NotificationFilterUrlObject>> createWithListResponse(
Integer monetaryAccountId,
List<NotificationFilterUrl> allNotificationFilter
List<NotificationFilterUrlObject> allNotificationFilter
) {
return createWithListResponse(monetaryAccountId, allNotificationFilter, null);
}

/**
* Create notification filters with list response type.
*/
public static BunqResponse<List<NotificationFilterUrl>> createWithListResponse(
public static BunqResponse<List<NotificationFilterUrlObject>> createWithListResponse(
Integer monetaryAccountId,
List<NotificationFilterUrl> allNotificationFilter,
List<NotificationFilterUrlObject> allNotificationFilter,
Map<String, String> customHeaders
) {
ApiClient apiClient = new ApiClient(getApiContext());
Expand All @@ -54,6 +54,6 @@ public static BunqResponse<List<NotificationFilterUrl>> createWithListResponse(
byte[] requestBytes = determineAllRequestByte(requestMap);
BunqResponseRaw responseRaw = apiClient.post(String.format(ENDPOINT_URL_CREATE, determineUserId(), determineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders);

return NotificationFilterUrl.fromJsonList(NotificationFilterUrl.class, responseRaw, OBJECT_TYPE);
return NotificationFilterUrlObject.fromJsonList(NotificationFilterUrlObject.class, responseRaw, OBJECT_TYPE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import com.bunq.sdk.http.ApiClient;
import com.bunq.sdk.http.BunqResponse;
import com.bunq.sdk.http.BunqResponseRaw;
import com.bunq.sdk.model.generated.endpoint.NotificationFilterUrlUser;
import com.bunq.sdk.model.generated.object.NotificationFilterUrl;
import com.bunq.sdk.model.generated.endpoint.NotificationFilterUrl;
import com.bunq.sdk.model.generated.object.NotificationFilterUrlObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class NotificationFilterUrlUserInternal extends NotificationFilterUrlUser {
public class NotificationFilterUrlUserInternal extends NotificationFilterUrl {
/**
* Field constants.
*/
Expand All @@ -20,24 +20,24 @@ public class NotificationFilterUrlUserInternal extends NotificationFilterUrlUser
/**
* Create notification filters with list response type.
*/
public static BunqResponse<List<NotificationFilterUrl>> createWithListResponse() {
return createWithListResponse(new ArrayList<NotificationFilterUrl>(), null);
public static BunqResponse<List<NotificationFilterUrlObject>> createWithListResponse() {
return createWithListResponse(new ArrayList<NotificationFilterUrlObject>(), null);
}

/**
* Create notification filters with list response type.
*/
public static BunqResponse<List<NotificationFilterUrl>> createWithListResponse(
List<NotificationFilterUrl> allNotificationFilter
public static BunqResponse<List<NotificationFilterUrlObject>> createWithListResponse(
List<NotificationFilterUrlObject> allNotificationFilter
) {
return createWithListResponse(allNotificationFilter, null);
}

/**
* Create notification filters with list response type.
*/
public static BunqResponse<List<NotificationFilterUrl>> createWithListResponse(
List<NotificationFilterUrl> allNotificationFilter,
public static BunqResponse<List<NotificationFilterUrlObject>> createWithListResponse(
List<NotificationFilterUrlObject> allNotificationFilter,
Map<String, String> customHeaders
) {
ApiClient apiClient = new ApiClient(getApiContext());
Expand All @@ -52,6 +52,6 @@ public static BunqResponse<List<NotificationFilterUrl>> createWithListResponse(
byte[] requestBytes = determineAllRequestByte(requestMap);
BunqResponseRaw responseRaw = apiClient.post(String.format(ENDPOINT_URL_CREATE, determineUserId()), requestBytes, customHeaders);

return NotificationFilterUrl.fromJsonList(NotificationFilterUrl.class, responseRaw, OBJECT_TYPE);
return NotificationFilterUrlObject.fromJsonList(NotificationFilterUrlObject.class, responseRaw, OBJECT_TYPE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
package com.bunq.sdk.model.generated.endpoint;

import com.bunq.sdk.context.ApiContext;
import com.bunq.sdk.http.ApiClient;
import com.bunq.sdk.http.BunqResponse;
import com.bunq.sdk.http.BunqResponseRaw;
import com.bunq.sdk.model.core.BunqModel;
import com.bunq.sdk.model.core.MonetaryAccountReference;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.lang.model.type.NullType;

/**
* View for getting the dPAN of the card.
*/
public class CardDigitalPrimaryAccountNumber extends BunqModel {

/**
* Endpoint constants.
*/
protected static final String ENDPOINT_URL_LISTING = "user/%s/card/%s/digital-primary-account-number";

/**
* Object type.
*/
protected static final String OBJECT_TYPE_GET = "CardDigitalPrimaryAccountNumber";

/**
* The digital PAN of the card.
*/
@Expose
@SerializedName("digital_primary_account_number")
private String digitalPrimaryAccountNumber;

/**
* The expiry date.
*/
@Expose
@SerializedName("expiry_date")
private String expiryDate;

/**
* The sequence number.
*/
@Expose
@SerializedName("sequence_number")
private String sequenceNumber;

/**
* Unique reference given by MDES.
*/
@Expose
@SerializedName("token_unique_reference")
private String tokenUniqueReference;

/**
* Status code of the token given by MDES.
*/
@Expose
@SerializedName("token_status_code")
private String tokenStatusCode;

/**
*/
public static BunqResponse<List<CardDigitalPrimaryAccountNumber>> list(Integer cardId, Map<String, String> params, Map<String, String> customHeaders) {
ApiClient apiClient = new ApiClient(getApiContext());
BunqResponseRaw responseRaw = apiClient.get(String.format(ENDPOINT_URL_LISTING, determineUserId(), cardId), params, customHeaders);

return fromJsonList(CardDigitalPrimaryAccountNumber.class, responseRaw, OBJECT_TYPE_GET);
}

public static BunqResponse<List<CardDigitalPrimaryAccountNumber>> list() {
return list(null, null, null);
}

public static BunqResponse<List<CardDigitalPrimaryAccountNumber>> list(Integer cardId) {
return list(cardId, null, null);
}

public static BunqResponse<List<CardDigitalPrimaryAccountNumber>> list(Integer cardId, Map<String, String> params) {
return list(cardId, params, null);
}

/**
* The digital PAN of the card.
*/
public String getDigitalPrimaryAccountNumber() {
return this.digitalPrimaryAccountNumber;
}

public void setDigitalPrimaryAccountNumber(String digitalPrimaryAccountNumber) {
this.digitalPrimaryAccountNumber = digitalPrimaryAccountNumber;
}

/**
* The expiry date.
*/
public String getExpiryDate() {
return this.expiryDate;
}

public void setExpiryDate(String expiryDate) {
this.expiryDate = expiryDate;
}

/**
* The sequence number.
*/
public String getSequenceNumber() {
return this.sequenceNumber;
}

public void setSequenceNumber(String sequenceNumber) {
this.sequenceNumber = sequenceNumber;
}

/**
* Unique reference given by MDES.
*/
public String getTokenUniqueReference() {
return this.tokenUniqueReference;
}

public void setTokenUniqueReference(String tokenUniqueReference) {
this.tokenUniqueReference = tokenUniqueReference;
}

/**
* Status code of the token given by MDES.
*/
public String getTokenStatusCode() {
return this.tokenStatusCode;
}

public void setTokenStatusCode(String tokenStatusCode) {
this.tokenStatusCode = tokenStatusCode;
}

/**
*/
public boolean isAllFieldNull() {
if (this.digitalPrimaryAccountNumber != null) {
return false;
}

if (this.expiryDate != null) {
return false;
}

if (this.sequenceNumber != null) {
return false;
}

if (this.tokenUniqueReference != null) {
return false;
}

if (this.tokenStatusCode != null) {
return false;
}

return true;
}

/**
*/
public static CardDigitalPrimaryAccountNumber fromJsonReader(JsonReader reader) {
return fromJsonReader(CardDigitalPrimaryAccountNumber.class, reader);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.bunq.sdk.http.BunqResponseRaw;
import com.bunq.sdk.model.core.BunqModel;
import com.bunq.sdk.model.core.MonetaryAccountReference;
import com.bunq.sdk.model.generated.object.CurrencyCloudBeneficiaryRequirementField;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
Expand Down
Loading

0 comments on commit 3015def

Please sign in to comment.