Skip to content

Commit

Permalink
Merge pull request #91 from bunq/fix_monetary_account_joint_retrieval…
Browse files Browse the repository at this point in the history
…_bunq/sdk_java#45

Fix monetary account joint retrieval #45
  • Loading branch information
OGKevin authored Jun 1, 2018
2 parents 159490d + 81935e7 commit ad655b1
Show file tree
Hide file tree
Showing 17 changed files with 616 additions and 156 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/bunq/sdk/http/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public class ApiClient {
* Prefix for bunq's own headers.
*/
private static final String USER_AGENT_BUNQ = "bunq-sdk-java/0.13.1";
private static final String LANGUAGE_EN_US = "en_US";
private static final String REGION_NL_NL = "nl_NL";
private static final String GEOLOCATION_ZERO = "0 0 0 0 000";
public static final String LANGUAGE_EN_US = "en_US";
public static final String REGION_NL_NL = "nl_NL";
public static final String GEOLOCATION_ZERO = "0 0 0 0 000";
private static final String SCHEME_HTTPS = "https";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ public class BillingContractSubscription extends BunqModel {
@SerializedName("subscription_type")
private String subscriptionType;

/**
* The subscription status.
*/
@Expose
@SerializedName("status")
private String status;

/**
* The subscription substatus.
*/
@Expose
@SerializedName("sub_status")
private String subStatus;

/**
* @param subscriptionType The subscription type of the user. Can be one of PERSON_LIGHT_V1,
* PERSON_MORE_V1, PERSON_FREE_V1, PERSON_PREMIUM_V1, COMPANY_V1, or COMPANY_V2.
Expand Down Expand Up @@ -207,6 +221,28 @@ public void setSubscriptionType(String subscriptionType) {
this.subscriptionType = subscriptionType;
}

/**
* The subscription status.
*/
public String getStatus() {
return this.status;
}

public void setStatus(String status) {
this.status = status;
}

/**
* The subscription substatus.
*/
public String getSubStatus() {
return this.subStatus;
}

public void setSubStatus(String subStatus) {
this.subStatus = subStatus;
}

/**
*/
public boolean isAllFieldNull() {
Expand Down Expand Up @@ -238,6 +274,14 @@ public boolean isAllFieldNull() {
return false;
}

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

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

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class CardReplace extends BunqModel {
/**
* Field constants.
*/
public static final String FIELD_NAME_ON_CARD = "name_on_card";
public static final String FIELD_PIN_CODE = "pin_code";
public static final String FIELD_SECOND_LINE = "second_line";

Expand All @@ -41,17 +42,20 @@ public class CardReplace extends BunqModel {

/**
* Request a card replacement.
* @param nameOnCard The user's name as it will be on the card. Check 'card-name' for the
* available card names for a user.
* @param pinCode The plaintext pin code. Requests require encryption to be enabled.
* @param secondLine The second line on the card.
*/
public static BunqResponse<Integer> create(Integer cardId, String pinCode, String secondLine, Map<String, String> customHeaders) {
public static BunqResponse<Integer> create(Integer cardId, String nameOnCard, String pinCode, String secondLine, Map<String, String> customHeaders) {
ApiClient apiClient = new ApiClient(getApiContext());

if (customHeaders == null) {
customHeaders = new HashMap<>();
}

HashMap<String, Object> requestMap = new HashMap<>();
requestMap.put(FIELD_NAME_ON_CARD, nameOnCard);
requestMap.put(FIELD_PIN_CODE, pinCode);
requestMap.put(FIELD_SECOND_LINE, secondLine);

Expand All @@ -63,19 +67,23 @@ public static BunqResponse<Integer> create(Integer cardId, String pinCode, Strin
}

public static BunqResponse<Integer> create() {
return create(null, null, null, null);
return create(null, null, null, null, null);
}

public static BunqResponse<Integer> create(Integer cardId) {
return create(cardId, null, null, null);
return create(cardId, null, null, null, null);
}

public static BunqResponse<Integer> create(Integer cardId, String pinCode) {
return create(cardId, pinCode, null, null);
public static BunqResponse<Integer> create(Integer cardId, String nameOnCard) {
return create(cardId, nameOnCard, null, null, null);
}

public static BunqResponse<Integer> create(Integer cardId, String pinCode, String secondLine) {
return create(cardId, pinCode, secondLine, null);
public static BunqResponse<Integer> create(Integer cardId, String nameOnCard, String pinCode) {
return create(cardId, nameOnCard, pinCode, null, null);
}

public static BunqResponse<Integer> create(Integer cardId, String nameOnCard, String pinCode, String secondLine) {
return create(cardId, nameOnCard, pinCode, secondLine, null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
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.bunq.sdk.model.generated.object.LabelUser;
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;

/**
* Used to create a draft share invite for a user with another bunq user. The user that accepts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
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;

/**
* This call returns the raw content of the QR code that links to this draft share invite. When
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class ExportAnnualOverview extends BunqModel {
*/
protected static final String ENDPOINT_URL_CREATE = "user/%s/export-annual-overview";
protected static final String ENDPOINT_URL_READ = "user/%s/export-annual-overview/%s";
protected static final String ENDPOINT_URL_DELETE = "user/%s/export-annual-overview/%s";
protected static final String ENDPOINT_URL_LISTING = "user/%s/export-annual-overview";

/**
Expand Down Expand Up @@ -123,6 +124,19 @@ public static BunqResponse<ExportAnnualOverview> get(Integer exportAnnualOvervie
return get(exportAnnualOverviewId, params, null);
}

/**
*/
public static BunqResponse<ExportAnnualOverview> delete(Integer exportAnnualOverviewId, Map<String, String> customHeaders) {
ApiClient apiClient = new ApiClient(getApiContext());
BunqResponseRaw responseRaw = apiClient.delete(String.format(ENDPOINT_URL_DELETE, determineUserId(), exportAnnualOverviewId), customHeaders);

return new BunqResponse<>(null, responseRaw.getHeaders());
}

public static BunqResponse<ExportAnnualOverview> delete(Integer exportAnnualOverviewId) {
return delete(exportAnnualOverviewId, null);
}

/**
* List all the annual overviews for a user.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class IdealMerchantTransaction extends BunqModel {
*/
public static final String FIELD_AMOUNT_REQUESTED = "amount_requested";
public static final String FIELD_ISSUER = "issuer";
public static final String FIELD_CALLBACK_TYPE = "callback_type";

/**
* Object type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ public class MasterCardAction extends BunqModel {
@SerializedName("secure_code_id")
private Integer secureCodeId;

/**
* The ID of the wallet provider as defined by MasterCard. 420 = bunq Android app with Tap&Pay;
* 103 = Apple Pay.
*/
@Expose
@SerializedName("wallet_provider_id")
private String walletProviderId;

/**
* The reference to the object used for split the bill. Can be RequestInquiry or
* RequestInquiryBatch
Expand Down Expand Up @@ -537,6 +545,18 @@ public void setSecureCodeId(Integer secureCodeId) {
this.secureCodeId = secureCodeId;
}

/**
* The ID of the wallet provider as defined by MasterCard. 420 = bunq Android app with Tap&Pay;
* 103 = Apple Pay.
*/
public String getWalletProviderId() {
return this.walletProviderId;
}

public void setWalletProviderId(String walletProviderId) {
this.walletProviderId = walletProviderId;
}

/**
* The reference to the object used for split the bill. Can be RequestInquiry or
* RequestInquiryBatch
Expand Down Expand Up @@ -652,6 +672,10 @@ public boolean isAllFieldNull() {
return false;
}

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

if (this.requestReferenceSplitTheBill != null) {
return false;
}
Expand Down
Loading

0 comments on commit ad655b1

Please sign in to comment.