All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.payments.PaymentStatusBuilder Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
package io.sphere.sdk.payments;

import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import io.sphere.sdk.states.State;

import javax.annotation.Nullable;
import java.util.Optional;

public final class PaymentStatusBuilder extends Base implements Builder {
    @Nullable
    private String interfaceCode;
    @Nullable
    private String interfaceText;
    @Nullable
    private Reference state;

    private PaymentStatusBuilder() {
    }
    
    public static PaymentStatusBuilder of() {
        return new PaymentStatusBuilder();
    }

    public PaymentStatusBuilder interfaceCode(@Nullable final String interfaceCode) {
        this.interfaceCode = interfaceCode;
        return this;
    }

    public PaymentStatusBuilder interfaceText(@Nullable final String interfaceText) {
        this.interfaceText = interfaceText;
        return this;
    }

    public PaymentStatusBuilder state(@Nullable final Referenceable state) {
        this.state = Optional.ofNullable(state).map(s -> s.toReference()).orElse(null);
        return this;
    }

    @Nullable
    public String getInterfaceCode() {
        return interfaceCode;
    }

    @Nullable
    public String getInterfaceText() {
        return interfaceText;
    }

    @Nullable
    public Reference getState() {
        return state;
    }

    @Override
    public PaymentStatus build() {
        return new PaymentStatusImpl(interfaceCode, interfaceText, state);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy