001
002package com.commercetools.api.models.payment;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.constraints.NotNull;
010
011import com.fasterxml.jackson.annotation.*;
012import com.fasterxml.jackson.databind.annotation.*;
013
014import io.vrap.rmf.base.client.utils.Generated;
015
016/**
017 *  <p>Changing the TransactionState generates the PaymentTransactionStateChanged Message.</p>
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     PaymentChangeTransactionStateAction paymentChangeTransactionStateAction = PaymentChangeTransactionStateAction.builder()
024 *             .transactionId("{transactionId}")
025 *             .state(TransactionState.INITIAL)
026 *             .build()
027 * </code></pre>
028 * </div>
029 */
030@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
031@JsonDeserialize(as = PaymentChangeTransactionStateActionImpl.class)
032public interface PaymentChangeTransactionStateAction extends PaymentUpdateAction {
033
034    /**
035     * discriminator value for PaymentChangeTransactionStateAction
036     */
037    String CHANGE_TRANSACTION_STATE = "changeTransactionState";
038
039    /**
040     *  <p>Unique identifier of the Transaction.</p>
041     * @return transactionId
042     */
043    @NotNull
044    @JsonProperty("transactionId")
045    public String getTransactionId();
046
047    /**
048     *  <p>New TransactionState.</p>
049     * @return state
050     */
051    @NotNull
052    @JsonProperty("state")
053    public TransactionState getState();
054
055    /**
056     *  <p>Unique identifier of the Transaction.</p>
057     * @param transactionId value to be set
058     */
059
060    public void setTransactionId(final String transactionId);
061
062    /**
063     *  <p>New TransactionState.</p>
064     * @param state value to be set
065     */
066
067    public void setState(final TransactionState state);
068
069    /**
070     * factory method
071     * @return instance of PaymentChangeTransactionStateAction
072     */
073    public static PaymentChangeTransactionStateAction of() {
074        return new PaymentChangeTransactionStateActionImpl();
075    }
076
077    /**
078     * factory method to create a shallow copy PaymentChangeTransactionStateAction
079     * @param template instance to be copied
080     * @return copy instance
081     */
082    public static PaymentChangeTransactionStateAction of(final PaymentChangeTransactionStateAction template) {
083        PaymentChangeTransactionStateActionImpl instance = new PaymentChangeTransactionStateActionImpl();
084        instance.setTransactionId(template.getTransactionId());
085        instance.setState(template.getState());
086        return instance;
087    }
088
089    /**
090     * factory method to create a deep copy of PaymentChangeTransactionStateAction
091     * @param template instance to be copied
092     * @return copy instance
093     */
094    @Nullable
095    public static PaymentChangeTransactionStateAction deepCopy(
096            @Nullable final PaymentChangeTransactionStateAction template) {
097        if (template == null) {
098            return null;
099        }
100        PaymentChangeTransactionStateActionImpl instance = new PaymentChangeTransactionStateActionImpl();
101        instance.setTransactionId(template.getTransactionId());
102        instance.setState(template.getState());
103        return instance;
104    }
105
106    /**
107     * builder factory method for PaymentChangeTransactionStateAction
108     * @return builder
109     */
110    public static PaymentChangeTransactionStateActionBuilder builder() {
111        return PaymentChangeTransactionStateActionBuilder.of();
112    }
113
114    /**
115     * create builder for PaymentChangeTransactionStateAction instance
116     * @param template instance with prefilled values for the builder
117     * @return builder
118     */
119    public static PaymentChangeTransactionStateActionBuilder builder(
120            final PaymentChangeTransactionStateAction template) {
121        return PaymentChangeTransactionStateActionBuilder.of(template);
122    }
123
124    /**
125     * accessor map function
126     * @param <T> mapped type
127     * @param helper function to map the object
128     * @return mapped value
129     */
130    default <T> T withPaymentChangeTransactionStateAction(Function<PaymentChangeTransactionStateAction, T> helper) {
131        return helper.apply(this);
132    }
133
134    /**
135     * gives a TypeReference for usage with Jackson DataBind
136     * @return TypeReference
137     */
138    public static com.fasterxml.jackson.core.type.TypeReference<PaymentChangeTransactionStateAction> typeReference() {
139        return new com.fasterxml.jackson.core.type.TypeReference<PaymentChangeTransactionStateAction>() {
140            @Override
141            public String toString() {
142                return "TypeReference<PaymentChangeTransactionStateAction>";
143            }
144        };
145    }
146}