Skip to content

Commit df9cb22

Browse files
committed
build(codegen): updating SDK
1 parent 0cf31c8 commit df9cb22

9 files changed

Lines changed: 484 additions & 17 deletions

File tree

changes.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,19 @@
99
- added query parameter `dataErasure` to method `delete /{projectKey}/in-store/key={storeKey}/business-units/{ID}`
1010
</details>
1111

12+
**Checkout changes**
13+
14+
<details>
15+
<summary>Changed MethodResponseBody(s)</summary>
16+
17+
- :warning: changed response body for `200: application/json` of method `post /{projectKey}/payment-intents/{paymentId}` from type `any` to `PaymentIntentResponse`
18+
</details>
19+
20+
21+
<details>
22+
<summary>Added Type(s)</summary>
23+
24+
- added type `PaymentIntentOutcome`
25+
- added type `PaymentIntentResponse`
26+
</details>
27+

commercetools/commercetools-sdk-java-checkout/src/main/java-generated/com/commercetools/checkout/client/ByProjectKeyPaymentIntentsByPaymentIdPost.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* <hr>
2727
* <div class=code-example>
2828
* <pre><code class='java'>{@code
29-
* CompletableFuture<ApiHttpResponse<java.lang.Object>> result = apiRoot
29+
* CompletableFuture<ApiHttpResponse<com.commercetools.checkout.models.payment_intents.PaymentIntentResponse>> result = apiRoot
3030
* .withProjectKey("{projectKey}")
3131
* .paymentIntents()
3232
* .withPaymentId("{paymentId}")
@@ -37,13 +37,13 @@
3737
*/
3838
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
3939
public class ByProjectKeyPaymentIntentsByPaymentIdPost extends
40-
TypeBodyApiMethod<ByProjectKeyPaymentIntentsByPaymentIdPost, java.lang.Object, com.commercetools.checkout.models.payment_intents.PaymentIntent>
40+
TypeBodyApiMethod<ByProjectKeyPaymentIntentsByPaymentIdPost, com.commercetools.checkout.models.payment_intents.PaymentIntentResponse, com.commercetools.checkout.models.payment_intents.PaymentIntent>
4141
implements
4242
com.commercetools.checkout.client.Secured_by_manage_paymentsTrait<ByProjectKeyPaymentIntentsByPaymentIdPost> {
4343

4444
@Override
45-
public TypeReference<java.lang.Object> resultType() {
46-
return new TypeReference<java.lang.Object>() {
45+
public TypeReference<com.commercetools.checkout.models.payment_intents.PaymentIntentResponse> resultType() {
46+
return new TypeReference<com.commercetools.checkout.models.payment_intents.PaymentIntentResponse>() {
4747
};
4848
}
4949

@@ -82,13 +82,16 @@ protected ApiHttpRequest buildHttpRequest() {
8282
}
8383

8484
@Override
85-
public ApiHttpResponse<java.lang.Object> executeBlocking(final ApiHttpClient client, final Duration timeout) {
86-
return executeBlocking(client, timeout, java.lang.Object.class);
85+
public ApiHttpResponse<com.commercetools.checkout.models.payment_intents.PaymentIntentResponse> executeBlocking(
86+
final ApiHttpClient client, final Duration timeout) {
87+
return executeBlocking(client, timeout,
88+
com.commercetools.checkout.models.payment_intents.PaymentIntentResponse.class);
8789
}
8890

8991
@Override
90-
public CompletableFuture<ApiHttpResponse<java.lang.Object>> execute(final ApiHttpClient client) {
91-
return execute(client, java.lang.Object.class);
92+
public CompletableFuture<ApiHttpResponse<com.commercetools.checkout.models.payment_intents.PaymentIntentResponse>> execute(
93+
final ApiHttpClient client) {
94+
return execute(client, com.commercetools.checkout.models.payment_intents.PaymentIntentResponse.class);
9295
}
9396

9497
public String getProjectKey() {

commercetools/commercetools-sdk-java-checkout/src/main/java-generated/com/commercetools/checkout/client/ByProjectKeyPaymentIntentsByPaymentIdPostString.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* <hr>
2828
* <div class=code-example>
2929
* <pre><code class='java'>{@code
30-
* CompletableFuture<ApiHttpResponse<java.lang.Object>> result = apiRoot
30+
* CompletableFuture<ApiHttpResponse<com.commercetools.checkout.models.payment_intents.PaymentIntentResponse>> result = apiRoot
3131
* .withProjectKey("{projectKey}")
3232
* .paymentIntents()
3333
* .withPaymentId("{paymentId}")
@@ -37,13 +37,14 @@
3737
* </div>
3838
*/
3939
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
40-
public class ByProjectKeyPaymentIntentsByPaymentIdPostString
41-
extends StringBodyApiMethod<ByProjectKeyPaymentIntentsByPaymentIdPostString, java.lang.Object> implements
40+
public class ByProjectKeyPaymentIntentsByPaymentIdPostString extends
41+
StringBodyApiMethod<ByProjectKeyPaymentIntentsByPaymentIdPostString, com.commercetools.checkout.models.payment_intents.PaymentIntentResponse>
42+
implements
4243
com.commercetools.checkout.client.Secured_by_manage_paymentsTrait<ByProjectKeyPaymentIntentsByPaymentIdPostString> {
4344

4445
@Override
45-
public TypeReference<java.lang.Object> resultType() {
46-
return new TypeReference<java.lang.Object>() {
46+
public TypeReference<com.commercetools.checkout.models.payment_intents.PaymentIntentResponse> resultType() {
47+
return new TypeReference<com.commercetools.checkout.models.payment_intents.PaymentIntentResponse>() {
4748
};
4849
}
4950

@@ -80,13 +81,16 @@ protected ApiHttpRequest buildHttpRequest() {
8081
}
8182

8283
@Override
83-
public ApiHttpResponse<java.lang.Object> executeBlocking(final ApiHttpClient client, final Duration timeout) {
84-
return executeBlocking(client, timeout, java.lang.Object.class);
84+
public ApiHttpResponse<com.commercetools.checkout.models.payment_intents.PaymentIntentResponse> executeBlocking(
85+
final ApiHttpClient client, final Duration timeout) {
86+
return executeBlocking(client, timeout,
87+
com.commercetools.checkout.models.payment_intents.PaymentIntentResponse.class);
8588
}
8689

8790
@Override
88-
public CompletableFuture<ApiHttpResponse<java.lang.Object>> execute(final ApiHttpClient client) {
89-
return execute(client, java.lang.Object.class);
91+
public CompletableFuture<ApiHttpResponse<com.commercetools.checkout.models.payment_intents.PaymentIntentResponse>> execute(
92+
final ApiHttpClient client) {
93+
return execute(client, com.commercetools.checkout.models.payment_intents.PaymentIntentResponse.class);
9094
}
9195

9296
public String getProjectKey() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
2+
package com.commercetools.checkout.models.payment_intents;
3+
4+
import java.util.Arrays;
5+
import java.util.Optional;
6+
7+
import com.fasterxml.jackson.annotation.JsonCreator;
8+
import com.fasterxml.jackson.annotation.JsonValue;
9+
10+
import io.vrap.rmf.base.client.JsonEnum;
11+
import io.vrap.rmf.base.client.utils.Generated;
12+
13+
/**
14+
* <p>The outcome returned by the payment Connector after processing a Payment Intent.</p>
15+
*/
16+
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
17+
public interface PaymentIntentOutcome extends JsonEnum {
18+
19+
/**
20+
<p>The Payment Intent was processed and approved by the payment service provider (PSP).</p> */
21+
PaymentIntentOutcome APPROVED = PaymentIntentOutcomeEnum.APPROVED;
22+
/**
23+
<p>The Payment Intent was rejected by the payment service provider (PSP).</p> */
24+
PaymentIntentOutcome REJECTED = PaymentIntentOutcomeEnum.REJECTED;
25+
/**
26+
<p>The Payment Intent was received and is being processed asynchronously by the payment service provider (PSP).</p> */
27+
PaymentIntentOutcome RECEIVED = PaymentIntentOutcomeEnum.RECEIVED;
28+
29+
/**
30+
* possible values of PaymentIntentOutcome
31+
*/
32+
enum PaymentIntentOutcomeEnum implements PaymentIntentOutcome {
33+
/**
34+
* approved
35+
*/
36+
APPROVED("approved"),
37+
38+
/**
39+
* rejected
40+
*/
41+
REJECTED("rejected"),
42+
43+
/**
44+
* received
45+
*/
46+
RECEIVED("received");
47+
private final String jsonName;
48+
49+
private PaymentIntentOutcomeEnum(final String jsonName) {
50+
this.jsonName = jsonName;
51+
}
52+
53+
public String getJsonName() {
54+
return jsonName;
55+
}
56+
57+
public String toString() {
58+
return jsonName;
59+
}
60+
}
61+
62+
/**
63+
* the JSON value
64+
* @return json value
65+
*/
66+
@JsonValue
67+
String getJsonName();
68+
69+
/**
70+
* the enum value
71+
* @return name
72+
*/
73+
String name();
74+
75+
/**
76+
* convert value to string
77+
* @return string representation
78+
*/
79+
String toString();
80+
81+
/**
82+
* factory method for a enum value of PaymentIntentOutcome
83+
* if no enum has been found an anonymous instance will be created
84+
* @param value the enum value to be wrapped
85+
* @return enum instance
86+
*/
87+
@JsonCreator
88+
public static PaymentIntentOutcome findEnum(String value) {
89+
return findEnumViaJsonName(value).orElse(new PaymentIntentOutcome() {
90+
@Override
91+
public String getJsonName() {
92+
return value;
93+
}
94+
95+
@Override
96+
public String name() {
97+
return value.toUpperCase();
98+
}
99+
100+
public String toString() {
101+
return value;
102+
}
103+
});
104+
}
105+
106+
/**
107+
* method to find enum using the JSON value
108+
* @param jsonName the json value to be wrapped
109+
* @return optional of enum instance
110+
*/
111+
public static Optional<PaymentIntentOutcome> findEnumViaJsonName(String jsonName) {
112+
return Arrays.stream(values()).filter(t -> t.getJsonName().equals(jsonName)).findFirst();
113+
}
114+
115+
/**
116+
* possible enum values
117+
* @return array of possible enum values
118+
*/
119+
public static PaymentIntentOutcome[] values() {
120+
return PaymentIntentOutcomeEnum.values();
121+
}
122+
123+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
2+
package com.commercetools.checkout.models.payment_intents;
3+
4+
import java.time.*;
5+
import java.util.*;
6+
import java.util.function.Function;
7+
8+
import javax.annotation.Nullable;
9+
10+
import com.fasterxml.jackson.annotation.*;
11+
12+
import io.vrap.rmf.base.client.utils.Generated;
13+
14+
import jakarta.validation.constraints.NotNull;
15+
import tools.jackson.databind.annotation.*;
16+
17+
/**
18+
* <p>Returned by Checkout after forwarding a Payment Intent request to the payment Connector. If the Connector response does not contain a valid <code>outcome</code> value, Checkout returns a <code>500 Internal Server Error</code>.</p>
19+
*
20+
* <hr>
21+
* Example to create an instance using the builder pattern
22+
* <div class=code-example>
23+
* <pre><code class='java'>
24+
* PaymentIntentResponse paymentIntentResponse = PaymentIntentResponse.builder()
25+
* .outcome(PaymentIntentOutcome.APPROVED)
26+
* .build()
27+
* </code></pre>
28+
* </div>
29+
*/
30+
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
31+
@JsonDeserialize(as = PaymentIntentResponseImpl.class)
32+
public interface PaymentIntentResponse {
33+
34+
/**
35+
* <p>The outcome of the Payment Intent as reported by the payment <span>Connector</span>.</p>
36+
* @return outcome
37+
*/
38+
@NotNull
39+
@JsonProperty("outcome")
40+
public PaymentIntentOutcome getOutcome();
41+
42+
/**
43+
* <p>The outcome of the Payment Intent as reported by the payment <span>Connector</span>.</p>
44+
* @param outcome value to be set
45+
*/
46+
47+
public void setOutcome(final PaymentIntentOutcome outcome);
48+
49+
/**
50+
* factory method
51+
* @return instance of PaymentIntentResponse
52+
*/
53+
public static PaymentIntentResponse of() {
54+
return new PaymentIntentResponseImpl();
55+
}
56+
57+
/**
58+
* factory method to create a shallow copy PaymentIntentResponse
59+
* @param template instance to be copied
60+
* @return copy instance
61+
*/
62+
public static PaymentIntentResponse of(final PaymentIntentResponse template) {
63+
PaymentIntentResponseImpl instance = new PaymentIntentResponseImpl();
64+
instance.setOutcome(template.getOutcome());
65+
return instance;
66+
}
67+
68+
public PaymentIntentResponse copyDeep();
69+
70+
/**
71+
* factory method to create a deep copy of PaymentIntentResponse
72+
* @param template instance to be copied
73+
* @return copy instance
74+
*/
75+
@Nullable
76+
public static PaymentIntentResponse deepCopy(@Nullable final PaymentIntentResponse template) {
77+
if (template == null) {
78+
return null;
79+
}
80+
PaymentIntentResponseImpl instance = new PaymentIntentResponseImpl();
81+
instance.setOutcome(template.getOutcome());
82+
return instance;
83+
}
84+
85+
/**
86+
* builder factory method for PaymentIntentResponse
87+
* @return builder
88+
*/
89+
public static PaymentIntentResponseBuilder builder() {
90+
return PaymentIntentResponseBuilder.of();
91+
}
92+
93+
/**
94+
* create builder for PaymentIntentResponse instance
95+
* @param template instance with prefilled values for the builder
96+
* @return builder
97+
*/
98+
public static PaymentIntentResponseBuilder builder(final PaymentIntentResponse template) {
99+
return PaymentIntentResponseBuilder.of(template);
100+
}
101+
102+
/**
103+
* accessor map function
104+
* @param <T> mapped type
105+
* @param helper function to map the object
106+
* @return mapped value
107+
*/
108+
default <T> T withPaymentIntentResponse(Function<PaymentIntentResponse, T> helper) {
109+
return helper.apply(this);
110+
}
111+
112+
/**
113+
* gives a TypeReference for usage with Jackson DataBind
114+
* @return TypeReference
115+
*/
116+
public static tools.jackson.core.type.TypeReference<PaymentIntentResponse> typeReference() {
117+
return new tools.jackson.core.type.TypeReference<PaymentIntentResponse>() {
118+
@Override
119+
public String toString() {
120+
return "TypeReference<PaymentIntentResponse>";
121+
}
122+
};
123+
}
124+
}

0 commit comments

Comments
 (0)