/
TokenQrRequestSofort.java
93 lines (76 loc) · 2.54 KB
/
TokenQrRequestSofort.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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.
*/
protected static final String ENDPOINT_URL_CREATE = "user/%s/token-qr-request-sofort";
/**
* Field constants.
*/
public static final String FIELD_TOKEN = "token";
/**
* Object type.
*/
protected static final String OBJECT_TYPE_POST = "RequestResponse";
/**
* The token passed from a site or read from a QR code.
*/
@Expose
@SerializedName("token_field_for_request")
private String tokenFieldForRequest;
public TokenQrRequestSofort() {
this(null);
}
public TokenQrRequestSofort(String token) {
this.tokenFieldForRequest = token;
} /**
* Create a request from an SOFORT transaction.
* @param token The token passed from a site or read from a QR code.
*/
public static BunqResponse<TokenQrRequestSofort> create(String token, Map<String, String> customHeaders) {
ApiClient apiClient = new ApiClient(getApiContext());
if (customHeaders == null) {
customHeaders = new HashMap<>();
}
HashMap<String, Object> requestMap = new HashMap<>();
requestMap.put(FIELD_TOKEN, token);
byte[] requestBytes = determineAllRequestByte(requestMap);
BunqResponseRaw responseRaw = apiClient.post(String.format(ENDPOINT_URL_CREATE, determineUserId()), requestBytes, customHeaders);
return fromJson(TokenQrRequestSofort.class, responseRaw, OBJECT_TYPE_POST);
}
public static BunqResponse<TokenQrRequestSofort> create() {
return create(null, null);
}
public static BunqResponse<TokenQrRequestSofort> create(String token) {
return create(token, null);
}
/**
*/
public boolean isAllFieldNull() {
return true;
}
/**
*/
public static TokenQrRequestSofort fromJsonReader(JsonReader reader) {
return fromJsonReader(TokenQrRequestSofort.class, reader);
}
}