-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regenerate code for release #74
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ | |
|
||
import com.bunq.sdk.context.ApiContext; | ||
import com.bunq.sdk.model.generated.endpoint.CardDebit; | ||
import com.bunq.sdk.model.generated.object.CardPinAssignment; | ||
import com.bunq.sdk.model.generated.object.Pointer; | ||
|
||
import java.io.IOException; | ||
import java.math.BigInteger; | ||
import java.security.SecureRandom; | ||
|
@@ -20,19 +22,27 @@ public class CardDebitExample { | |
private static final String EMAIL_YOUR_COMPANY = "[email protected]"; // Put your user email here | ||
private static final String POINTER_NAME_TEST = "test pointer"; | ||
private static final int USER_ITEM_ID = 0; // Put your user ID here | ||
private static final int MONETARY_ACCOUNT_ID = 0; // Put your monetary account ID here | ||
private static final int NUM_BITS_20_DECIMAL_DIGITS = 66; | ||
private static final int RADIX_DIGITS_AND_LATIN_LETTERS = 36; | ||
private static final String CARD_PIN_ASSIGNMENT_TYPE_PRIMARY = "PRIMARY"; | ||
|
||
/** | ||
* @param args Command line arguments. | ||
*/ | ||
public static void main(String[] args) throws IOException { | ||
ApiContext apiContext = ApiContext.restore(API_CONTEXT_FILE_PATH); | ||
|
||
CardPinAssignment cardPinAssignment = new CardPinAssignment( | ||
CARD_PIN_ASSIGNMENT_TYPE_PRIMARY, | ||
PIN_CODE, | ||
MONETARY_ACCOUNT_ID | ||
); | ||
|
||
HashMap<String, Object> requestMap = new HashMap<>(); | ||
requestMap.put(CardDebit.FIELD_NAME_ON_CARD, NAME_YOUR_COMPANY); | ||
requestMap.put(CardDebit.FIELD_SECOND_LINE, generateRandomSecondLine()); | ||
requestMap.put(CardDebit.FIELD_PIN_CODE, PIN_CODE); | ||
requestMap.put(CardDebit.FIELD_PIN_CODE_ASSIGNMENT, new CardPinAssignment[]{cardPinAssignment}); | ||
Pointer pointer = new Pointer(POINTER_TYPE_EMAIL, EMAIL_YOUR_COMPANY); | ||
pointer.setName(POINTER_NAME_TEST); | ||
requestMap.put(CardDebit.FIELD_ALIAS, pointer); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/main/java/com/bunq/sdk/model/generated/endpoint/TokenQrRequestSofort.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
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; | ||
|
||
/** | ||
* Using this call you can create a SOFORT Request assigned to your User by providing the Token | ||
* of the request. | ||
*/ | ||
public class TokenQrRequestSofort extends BunqModel { | ||
|
||
/** | ||
* Endpoint constants. | ||
*/ | ||
private static final String ENDPOINT_URL_CREATE = "user/%s/token-qr-request-sofort"; | ||
|
||
/** | ||
* Field constants. | ||
*/ | ||
public static final String FIELD_TOKEN = "token"; | ||
|
||
/** | ||
* Object type. | ||
*/ | ||
private static final String OBJECT_TYPE_POST = "RequestResponse"; | ||
|
||
public static BunqResponse<TokenQrRequestSofort> create(ApiContext apiContext, Map<String, Object> requestMap, Integer userId) { | ||
return create(apiContext, requestMap, userId, new HashMap<>()); | ||
} | ||
|
||
/** | ||
* Create a request from an SOFORT transaction. | ||
*/ | ||
public static BunqResponse<TokenQrRequestSofort> create(ApiContext apiContext, Map<String, Object> requestMap, Integer userId, Map<String, String> customHeaders) { | ||
ApiClient apiClient = new ApiClient(apiContext); | ||
byte[] requestBytes = gson.toJson(requestMap).getBytes(); | ||
BunqResponseRaw responseRaw = apiClient.post(String.format(ENDPOINT_URL_CREATE, userId), requestBytes, customHeaders); | ||
|
||
return fromJson(TokenQrRequestSofort.class, responseRaw, OBJECT_TYPE_POST); | ||
} | ||
|
||
/** | ||
*/ | ||
public boolean isAllFieldNull() { | ||
return true; | ||
} | ||
|
||
/** | ||
*/ | ||
public static TokenQrRequestSofort fromJsonReader(JsonReader reader) { | ||
return fromJsonReader(TokenQrRequestSofort.class, reader); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why this is not an enum? Or is that impossible to generate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generating ENUMs is also on the list. But its kind of impossible however. Will PM you the details.