Skip to content

Commit 7a5d762

Browse files
authored
Removed unwanted id field for create check payment (#29)
* fix: removed unwanted id field for create check payment and fixed improper attributes
1 parent e6d5757 commit 7a5d762

27 files changed

+2699
-51
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ spotless {
169169
}
170170

171171
test {
172+
environment "access_token", "v2.public.eyJyb2xlIjoiYWRtaW4iLCJ1c2VySWQiOiI0MTQ4Iiwic3ViIjoic29sb21paWFAY29kaWZ5LmlvIiwiZXhwIjoiMjAyNS0wMy0xM1QwODo1MToyNC42ODNaIiwianRpIjoiMzAzMTMzIiwib3JnSWQiOiIxMjYiLCJzY29wZSI6ImFwcGxpY2F0aW9ucyBhcHBsaWNhdGlvbnMtd3JpdGUgY3VzdG9tZXJzIGN1c3RvbWVycy13cml0ZSBjdXN0b21lci10YWdzLXdyaXRlIGN1c3RvbWVyLXRva2VuLXdyaXRlIGFjY291bnRzIGFjY291bnRzLXdyaXRlIGNhcmRzIGNhcmRzLXdyaXRlIGNhcmRzLXNlbnNpdGl2ZSBjYXJkcy1zZW5zaXRpdmUtd3JpdGUgdHJhbnNhY3Rpb25zIHRyYW5zYWN0aW9ucy13cml0ZSBhdXRob3JpemF0aW9ucyBzdGF0ZW1lbnRzIHBheW1lbnRzIHBheW1lbnRzLXdyaXRlIHBheW1lbnRzLXdyaXRlLWNvdW50ZXJwYXJ0eSBwYXltZW50cy13cml0ZS1saW5rZWQtYWNjb3VudCBhY2gtcGF5bWVudHMtd3JpdGUgd2lyZS1wYXltZW50cy13cml0ZSByZXBheW1lbnRzIHJlcGF5bWVudHMtd3JpdGUgcGF5bWVudHMtd3JpdGUtYWNoLWRlYml0IGNvdW50ZXJwYXJ0aWVzIGNvdW50ZXJwYXJ0aWVzLXdyaXRlIGJhdGNoLXJlbGVhc2VzIGJhdGNoLXJlbGVhc2VzLXdyaXRlIGxpbmtlZC1hY2NvdW50cyBsaW5rZWQtYWNjb3VudHMtd3JpdGUgd2ViaG9va3Mgd2ViaG9va3Mtd3JpdGUgZXZlbnRzIGV2ZW50cy13cml0ZSBhdXRob3JpemF0aW9uLXJlcXVlc3RzIGF1dGhvcml6YXRpb24tcmVxdWVzdHMtd3JpdGUgY2FzaC1kZXBvc2l0cyBjYXNoLWRlcG9zaXRzLXdyaXRlIGNoZWNrLWRlcG9zaXRzIGNoZWNrLWRlcG9zaXRzLXdyaXRlIHJlY2VpdmVkLXBheW1lbnRzIHJlY2VpdmVkLXBheW1lbnRzLXdyaXRlIGRpc3B1dGVzIGNoYXJnZWJhY2tzIGNoYXJnZWJhY2tzLXdyaXRlIHJld2FyZHMgcmV3YXJkcy13cml0ZSBjaGVjay1wYXltZW50cyBjaGVjay1wYXltZW50cy13cml0ZSBjcmVkaXQtZGVjaXNpb25zIGNyZWRpdC1kZWNpc2lvbnMtd3JpdGUgbGVuZGluZy1wcm9ncmFtcyBsZW5kaW5nLXByb2dyYW1zLXdyaXRlIGNyZWRpdC1hcHBsaWNhdGlvbnMgY3JlZGl0LWFwcGxpY2F0aW9ucy13cml0ZSIsIm9yZyI6IlNESyIsInNvdXJjZUlwIjoiIiwidXNlclR5cGUiOiJvcmciLCJpc1VuaXRQaWxvdCI6ZmFsc2V9uHGOiLd2BlGfSlsERcvW9xfdtA7iKuU1d-ZPf2z1Xdi8OaG8zPfPqjDatYSpMvm1GNpo6_mHMuv7cADa-GfRCg"
172173
useJUnit()
173174
}
174175
// // Enable JUnit 5 (Gradle 4.6+).

src/main/java/unit/java/sdk/api/CreateCheckPaymentApi.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import unit.java.sdk.ApiResponse;
1818
import unit.java.sdk.Pair;
1919

20-
import unit.java.sdk.model.CreateCheckPayment;
20+
import unit.java.sdk.model.CreateCheckPaymentRequest;
2121
import unit.java.sdk.model.UnitCheckPaymentResponse;
2222

2323
import com.fasterxml.jackson.core.type.TypeReference;
@@ -85,24 +85,24 @@ private String formatExceptionMessage(String operationId, int statusCode, String
8585
/**
8686
* Create Check Payment
8787
* Create Check Payment via API
88-
* @param createCheckPayment Create Check Payment Request (required)
88+
* @param createCheckPaymentRequest Create Check Payment Request (required)
8989
* @return UnitCheckPaymentResponse
9090
* @throws ApiException if fails to make API call
9191
*/
92-
public UnitCheckPaymentResponse execute(CreateCheckPayment createCheckPayment) throws ApiException {
93-
ApiResponse<UnitCheckPaymentResponse> localVarResponse = executeWithHttpInfo(createCheckPayment);
92+
public UnitCheckPaymentResponse execute(CreateCheckPaymentRequest createCheckPaymentRequest) throws ApiException {
93+
ApiResponse<UnitCheckPaymentResponse> localVarResponse = executeWithHttpInfo(createCheckPaymentRequest);
9494
return localVarResponse.getData();
9595
}
9696

9797
/**
9898
* Create Check Payment
9999
* Create Check Payment via API
100-
* @param createCheckPayment Create Check Payment Request (required)
100+
* @param createCheckPaymentRequest Create Check Payment Request (required)
101101
* @return ApiResponse&lt;UnitCheckPaymentResponse&gt;
102102
* @throws ApiException if fails to make API call
103103
*/
104-
public ApiResponse<UnitCheckPaymentResponse> executeWithHttpInfo(CreateCheckPayment createCheckPayment) throws ApiException {
105-
HttpRequest.Builder localVarRequestBuilder = executeRequestBuilder(createCheckPayment);
104+
public ApiResponse<UnitCheckPaymentResponse> executeWithHttpInfo(CreateCheckPaymentRequest createCheckPaymentRequest) throws ApiException {
105+
HttpRequest.Builder localVarRequestBuilder = executeRequestBuilder(createCheckPaymentRequest);
106106
try {
107107
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
108108
localVarRequestBuilder.build(),
@@ -130,10 +130,10 @@ public ApiResponse<UnitCheckPaymentResponse> executeWithHttpInfo(CreateCheckPaym
130130
}
131131
}
132132

133-
private HttpRequest.Builder executeRequestBuilder(CreateCheckPayment createCheckPayment) throws ApiException {
134-
// verify the required parameter 'createCheckPayment' is set
135-
if (createCheckPayment == null) {
136-
throw new ApiException(400, "Missing the required parameter 'createCheckPayment' when calling execute");
133+
private HttpRequest.Builder executeRequestBuilder(CreateCheckPaymentRequest createCheckPaymentRequest) throws ApiException {
134+
// verify the required parameter 'createCheckPaymentRequest' is set
135+
if (createCheckPaymentRequest == null) {
136+
throw new ApiException(400, "Missing the required parameter 'createCheckPaymentRequest' when calling execute");
137137
}
138138

139139
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -146,7 +146,7 @@ private HttpRequest.Builder executeRequestBuilder(CreateCheckPayment createCheck
146146
localVarRequestBuilder.header("Accept", "application/vnd.api+json");
147147

148148
try {
149-
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(createCheckPayment);
149+
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(createCheckPaymentRequest);
150150
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
151151
} catch (IOException e) {
152152
throw new ApiException(e);

src/main/java/unit/java/sdk/model/CreateCheckPayment.java

Lines changed: 93 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,46 +25,105 @@
2525
import com.fasterxml.jackson.annotation.JsonTypeName;
2626
import com.fasterxml.jackson.annotation.JsonValue;
2727
import java.util.Arrays;
28-
import unit.java.sdk.model.CheckPayment;
28+
import unit.java.sdk.model.CreateCheckPaymentAttributes;
29+
import unit.java.sdk.model.CreateCheckPaymentRelationships;
2930
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
3031

3132

3233
/**
3334
* CreateCheckPayment
3435
*/
3536
@JsonPropertyOrder({
36-
CreateCheckPayment.JSON_PROPERTY_DATA
37+
CreateCheckPayment.JSON_PROPERTY_TYPE,
38+
CreateCheckPayment.JSON_PROPERTY_ATTRIBUTES,
39+
CreateCheckPayment.JSON_PROPERTY_RELATIONSHIPS
3740
})
3841
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
3942
public class CreateCheckPayment {
40-
public static final String JSON_PROPERTY_DATA = "data";
41-
private CheckPayment data;
43+
public static final String JSON_PROPERTY_TYPE = "type";
44+
private String type = "checkPayment";
45+
46+
public static final String JSON_PROPERTY_ATTRIBUTES = "attributes";
47+
private CreateCheckPaymentAttributes attributes;
48+
49+
public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships";
50+
private CreateCheckPaymentRelationships relationships;
4251

4352
public CreateCheckPayment() {
4453
}
4554

46-
public CreateCheckPayment data(CheckPayment data) {
47-
this.data = data;
55+
public CreateCheckPayment type(String type) {
56+
this.type = type;
57+
return this;
58+
}
59+
60+
/**
61+
* Get type
62+
* @return type
63+
**/
64+
@jakarta.annotation.Nonnull
65+
@JsonProperty(JSON_PROPERTY_TYPE)
66+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
67+
68+
public String getType() {
69+
return type;
70+
}
71+
72+
73+
@JsonProperty(JSON_PROPERTY_TYPE)
74+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
75+
public void setType(String type) {
76+
this.type = type;
77+
}
78+
79+
80+
public CreateCheckPayment attributes(CreateCheckPaymentAttributes attributes) {
81+
this.attributes = attributes;
82+
return this;
83+
}
84+
85+
/**
86+
* Get attributes
87+
* @return attributes
88+
**/
89+
@jakarta.annotation.Nonnull
90+
@JsonProperty(JSON_PROPERTY_ATTRIBUTES)
91+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
92+
93+
public CreateCheckPaymentAttributes getAttributes() {
94+
return attributes;
95+
}
96+
97+
98+
@JsonProperty(JSON_PROPERTY_ATTRIBUTES)
99+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
100+
public void setAttributes(CreateCheckPaymentAttributes attributes) {
101+
this.attributes = attributes;
102+
}
103+
104+
105+
public CreateCheckPayment relationships(CreateCheckPaymentRelationships relationships) {
106+
this.relationships = relationships;
48107
return this;
49108
}
50109

51110
/**
52-
* Get data
53-
* @return data
111+
* Get relationships
112+
* @return relationships
54113
**/
55114
@jakarta.annotation.Nonnull
56-
@JsonProperty(JSON_PROPERTY_DATA)
115+
@JsonProperty(JSON_PROPERTY_RELATIONSHIPS)
57116
@JsonInclude(value = JsonInclude.Include.ALWAYS)
58117

59-
public CheckPayment getData() {
60-
return data;
118+
public CreateCheckPaymentRelationships getRelationships() {
119+
return relationships;
61120
}
62121

63122

64-
@JsonProperty(JSON_PROPERTY_DATA)
123+
@JsonProperty(JSON_PROPERTY_RELATIONSHIPS)
65124
@JsonInclude(value = JsonInclude.Include.ALWAYS)
66-
public void setData(CheckPayment data) {
67-
this.data = data;
125+
public void setRelationships(CreateCheckPaymentRelationships relationships) {
126+
this.relationships = relationships;
68127
}
69128

70129

@@ -80,19 +139,23 @@ public boolean equals(Object o) {
80139
return false;
81140
}
82141
CreateCheckPayment createCheckPayment = (CreateCheckPayment) o;
83-
return Objects.equals(this.data, createCheckPayment.data);
142+
return Objects.equals(this.type, createCheckPayment.type) &&
143+
Objects.equals(this.attributes, createCheckPayment.attributes) &&
144+
Objects.equals(this.relationships, createCheckPayment.relationships);
84145
}
85146

86147
@Override
87148
public int hashCode() {
88-
return Objects.hash(data);
149+
return Objects.hash(type, attributes, relationships);
89150
}
90151

91152
@Override
92153
public String toString() {
93154
StringBuilder sb = new StringBuilder();
94155
sb.append("class CreateCheckPayment {\n");
95-
sb.append(" data: ").append(toIndentedString(data)).append("\n");
156+
sb.append(" type: ").append(toIndentedString(type)).append("\n");
157+
sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
158+
sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n");
96159
sb.append("}");
97160
return sb.toString();
98161
}
@@ -140,9 +203,19 @@ public String toUrlQueryString(String prefix) {
140203

141204
StringJoiner joiner = new StringJoiner("&");
142205

143-
// add `data` to the URL query string
144-
if (getData() != null) {
145-
joiner.add(getData().toUrlQueryString(prefix + "data" + suffix));
206+
// add `type` to the URL query string
207+
if (getType() != null) {
208+
joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
209+
}
210+
211+
// add `attributes` to the URL query string
212+
if (getAttributes() != null) {
213+
joiner.add(getAttributes().toUrlQueryString(prefix + "attributes" + suffix));
214+
}
215+
216+
// add `relationships` to the URL query string
217+
if (getRelationships() != null) {
218+
joiner.add(getRelationships().toUrlQueryString(prefix + "relationships" + suffix));
146219
}
147220

148221
return joiner.toString();

0 commit comments

Comments
 (0)