001
002package com.commercetools.api.models.payment;
003
004import java.util.*;
005import java.util.function.Function;
006
007import javax.annotation.Nullable;
008
009import io.vrap.rmf.base.client.Builder;
010import io.vrap.rmf.base.client.utils.Generated;
011
012/**
013 * PaymentMethodInfoBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     PaymentMethodInfo paymentMethodInfo = PaymentMethodInfo.builder()
019 *             .build()
020 * </code></pre>
021 * </div>
022 */
023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
024public class PaymentMethodInfoBuilder implements Builder<PaymentMethodInfo> {
025
026    @Nullable
027    private String paymentInterface;
028
029    @Nullable
030    private String method;
031
032    @Nullable
033    private com.commercetools.api.models.common.LocalizedString name;
034
035    /**
036     *  <p>Payment service that processes the Payment (for example, a PSP). Once set, it cannot be changed. The combination of <code>paymentInterface</code> and the <code>interfaceId</code> of a Payment must be unique.</p>
037     * @param paymentInterface value to be set
038     * @return Builder
039     */
040
041    public PaymentMethodInfoBuilder paymentInterface(@Nullable final String paymentInterface) {
042        this.paymentInterface = paymentInterface;
043        return this;
044    }
045
046    /**
047     *  <p>Payment method used, for example, credit card, or cash advance.</p>
048     * @param method value to be set
049     * @return Builder
050     */
051
052    public PaymentMethodInfoBuilder method(@Nullable final String method) {
053        this.method = method;
054        return this;
055    }
056
057    /**
058     *  <p>Localizable name of the payment method.</p>
059     * @param builder function to build the name value
060     * @return Builder
061     */
062
063    public PaymentMethodInfoBuilder name(
064            Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedStringBuilder> builder) {
065        this.name = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of()).build();
066        return this;
067    }
068
069    /**
070     *  <p>Localizable name of the payment method.</p>
071     * @param builder function to build the name value
072     * @return Builder
073     */
074
075    public PaymentMethodInfoBuilder withName(
076            Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedString> builder) {
077        this.name = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of());
078        return this;
079    }
080
081    /**
082     *  <p>Localizable name of the payment method.</p>
083     * @param name value to be set
084     * @return Builder
085     */
086
087    public PaymentMethodInfoBuilder name(@Nullable final com.commercetools.api.models.common.LocalizedString name) {
088        this.name = name;
089        return this;
090    }
091
092    /**
093     *  <p>Payment service that processes the Payment (for example, a PSP). Once set, it cannot be changed. The combination of <code>paymentInterface</code> and the <code>interfaceId</code> of a Payment must be unique.</p>
094     * @return paymentInterface
095     */
096
097    @Nullable
098    public String getPaymentInterface() {
099        return this.paymentInterface;
100    }
101
102    /**
103     *  <p>Payment method used, for example, credit card, or cash advance.</p>
104     * @return method
105     */
106
107    @Nullable
108    public String getMethod() {
109        return this.method;
110    }
111
112    /**
113     *  <p>Localizable name of the payment method.</p>
114     * @return name
115     */
116
117    @Nullable
118    public com.commercetools.api.models.common.LocalizedString getName() {
119        return this.name;
120    }
121
122    /**
123     * builds PaymentMethodInfo with checking for non-null required values
124     * @return PaymentMethodInfo
125     */
126    public PaymentMethodInfo build() {
127        return new PaymentMethodInfoImpl(paymentInterface, method, name);
128    }
129
130    /**
131     * builds PaymentMethodInfo without checking for non-null required values
132     * @return PaymentMethodInfo
133     */
134    public PaymentMethodInfo buildUnchecked() {
135        return new PaymentMethodInfoImpl(paymentInterface, method, name);
136    }
137
138    /**
139     * factory method for an instance of PaymentMethodInfoBuilder
140     * @return builder
141     */
142    public static PaymentMethodInfoBuilder of() {
143        return new PaymentMethodInfoBuilder();
144    }
145
146    /**
147     * create builder for PaymentMethodInfo instance
148     * @param template instance with prefilled values for the builder
149     * @return builder
150     */
151    public static PaymentMethodInfoBuilder of(final PaymentMethodInfo template) {
152        PaymentMethodInfoBuilder builder = new PaymentMethodInfoBuilder();
153        builder.paymentInterface = template.getPaymentInterface();
154        builder.method = template.getMethod();
155        builder.name = template.getName();
156        return builder;
157    }
158
159}