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

com.squareup.square.models.DestinationDetailsCardRefundDetails Maven / Gradle / Ivy

There is a newer version: 41.2.0.20241017
Show newest version

package com.squareup.square.models;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.apimatic.core.types.OptionalNullable;
import java.util.Objects;

/**
 * This is a model class for DestinationDetailsCardRefundDetails type.
 */
public class DestinationDetailsCardRefundDetails {
    private final Card card;
    private final OptionalNullable entryMethod;
    private final OptionalNullable authResultCode;

    /**
     * Initialization constructor.
     * @param  card  Card value for card.
     * @param  entryMethod  String value for entryMethod.
     * @param  authResultCode  String value for authResultCode.
     */
    @JsonCreator
    public DestinationDetailsCardRefundDetails(
            @JsonProperty("card") Card card,
            @JsonProperty("entry_method") String entryMethod,
            @JsonProperty("auth_result_code") String authResultCode) {
        this.card = card;
        this.entryMethod = OptionalNullable.of(entryMethod);
        this.authResultCode = OptionalNullable.of(authResultCode);
    }

    /**
     * Initialization constructor.
     * @param  card  Card value for card.
     * @param  entryMethod  String value for entryMethod.
     * @param  authResultCode  String value for authResultCode.
     */

    protected DestinationDetailsCardRefundDetails(Card card, OptionalNullable entryMethod,
            OptionalNullable authResultCode) {
        this.card = card;
        this.entryMethod = entryMethod;
        this.authResultCode = authResultCode;
    }

    /**
     * Getter for Card.
     * Represents the payment details of a card to be used for payments. These details are
     * determined by the payment token generated by Web Payments SDK.
     * @return Returns the Card
     */
    @JsonGetter("card")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public Card getCard() {
        return card;
    }

    /**
     * Internal Getter for EntryMethod.
     * The method used to enter the card's details for the refund. The method can be `KEYED`,
     * `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
     * @return Returns the Internal String
     */
    @JsonGetter("entry_method")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonSerialize(using = OptionalNullable.Serializer.class)
    protected OptionalNullable internalGetEntryMethod() {
        return this.entryMethod;
    }

    /**
     * Getter for EntryMethod.
     * The method used to enter the card's details for the refund. The method can be `KEYED`,
     * `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
     * @return Returns the String
     */
    @JsonIgnore
    public String getEntryMethod() {
        return OptionalNullable.getFrom(entryMethod);
    }

    /**
     * Internal Getter for AuthResultCode.
     * The authorization code provided by the issuer when a refund is approved.
     * @return Returns the Internal String
     */
    @JsonGetter("auth_result_code")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonSerialize(using = OptionalNullable.Serializer.class)
    protected OptionalNullable internalGetAuthResultCode() {
        return this.authResultCode;
    }

    /**
     * Getter for AuthResultCode.
     * The authorization code provided by the issuer when a refund is approved.
     * @return Returns the String
     */
    @JsonIgnore
    public String getAuthResultCode() {
        return OptionalNullable.getFrom(authResultCode);
    }

    @Override
    public int hashCode() {
        return Objects.hash(card, entryMethod, authResultCode);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof DestinationDetailsCardRefundDetails)) {
            return false;
        }
        DestinationDetailsCardRefundDetails other = (DestinationDetailsCardRefundDetails) obj;
        return Objects.equals(card, other.card)
            && Objects.equals(entryMethod, other.entryMethod)
            && Objects.equals(authResultCode, other.authResultCode);
    }

    /**
     * Converts this DestinationDetailsCardRefundDetails into string format.
     * @return String representation of this class
     */
    @Override
    public String toString() {
        return "DestinationDetailsCardRefundDetails [" + "card=" + card + ", entryMethod="
                + entryMethod + ", authResultCode=" + authResultCode + "]";
    }

    /**
     * Builds a new {@link DestinationDetailsCardRefundDetails.Builder} object.
     * Creates the instance with the state of the current model.
     * @return a new {@link DestinationDetailsCardRefundDetails.Builder} object
     */
    public Builder toBuilder() {
        Builder builder = new Builder()
                .card(getCard());
        builder.entryMethod = internalGetEntryMethod();
        builder.authResultCode = internalGetAuthResultCode();
        return builder;
    }

    /**
     * Class to build instances of {@link DestinationDetailsCardRefundDetails}.
     */
    public static class Builder {
        private Card card;
        private OptionalNullable entryMethod;
        private OptionalNullable authResultCode;



        /**
         * Setter for card.
         * @param  card  Card value for card.
         * @return Builder
         */
        public Builder card(Card card) {
            this.card = card;
            return this;
        }

        /**
         * Setter for entryMethod.
         * @param  entryMethod  String value for entryMethod.
         * @return Builder
         */
        public Builder entryMethod(String entryMethod) {
            this.entryMethod = OptionalNullable.of(entryMethod);
            return this;
        }

        /**
         * UnSetter for entryMethod.
         * @return Builder
         */
        public Builder unsetEntryMethod() {
            entryMethod = null;
            return this;
        }

        /**
         * Setter for authResultCode.
         * @param  authResultCode  String value for authResultCode.
         * @return Builder
         */
        public Builder authResultCode(String authResultCode) {
            this.authResultCode = OptionalNullable.of(authResultCode);
            return this;
        }

        /**
         * UnSetter for authResultCode.
         * @return Builder
         */
        public Builder unsetAuthResultCode() {
            authResultCode = null;
            return this;
        }

        /**
         * Builds a new {@link DestinationDetailsCardRefundDetails} object using the set fields.
         * @return {@link DestinationDetailsCardRefundDetails}
         */
        public DestinationDetailsCardRefundDetails build() {
            return new DestinationDetailsCardRefundDetails(card, entryMethod, authResultCode);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy