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

com.azure.resourcemanager.billing.fluent.models.PaymentMethodLinkInner Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.billing.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.billing.models.PaymentMethodFamily;
import com.azure.resourcemanager.billing.models.PaymentMethodLogo;
import com.azure.resourcemanager.billing.models.PaymentMethodStatus;
import com.azure.resourcemanager.billing.models.ProxyResourceWithTags;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * A payment method link.
 */
@Fluent
public final class PaymentMethodLinkInner extends ProxyResourceWithTags {
    /*
     * Payment method link properties
     */
    private PaymentMethodLinkProperties innerProperties;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    private SystemData systemData;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

    /**
     * Creates an instance of PaymentMethodLinkInner class.
     */
    public PaymentMethodLinkInner() {
    }

    /**
     * Get the innerProperties property: Payment method link properties.
     * 
     * @return the innerProperties value.
     */
    private PaymentMethodLinkProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     * 
     * @return the systemData value.
     */
    @Override
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public PaymentMethodLinkInner withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the accountHolderName property: The account holder name for the payment method. This is only supported for
     * payment methods with family CreditCard.
     * 
     * @return the accountHolderName value.
     */
    public String accountHolderName() {
        return this.innerProperties() == null ? null : this.innerProperties().accountHolderName();
    }

    /**
     * Get the displayName property: The display name of the payment method.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.innerProperties() == null ? null : this.innerProperties().displayName();
    }

    /**
     * Get the expiration property: The expiration month and year of the payment method. This is only supported for
     * payment methods with family CreditCard.
     * 
     * @return the expiration value.
     */
    public String expiration() {
        return this.innerProperties() == null ? null : this.innerProperties().expiration();
    }

    /**
     * Get the family property: The family of payment method.
     * 
     * @return the family value.
     */
    public PaymentMethodFamily family() {
        return this.innerProperties() == null ? null : this.innerProperties().family();
    }

    /**
     * Get the lastFourDigits property: Last four digits of payment method.
     * 
     * @return the lastFourDigits value.
     */
    public String lastFourDigits() {
        return this.innerProperties() == null ? null : this.innerProperties().lastFourDigits();
    }

    /**
     * Get the logos property: The list of logos for the payment method.
     * 
     * @return the logos value.
     */
    public List logos() {
        return this.innerProperties() == null ? null : this.innerProperties().logos();
    }

    /**
     * Get the paymentMethod property: Projection of a payment method. Will not be returned in this or future versions.
     * 
     * @return the paymentMethod value.
     */
    public PaymentMethodProperties paymentMethod() {
        return this.innerProperties() == null ? null : this.innerProperties().paymentMethod();
    }

    /**
     * Set the paymentMethod property: Projection of a payment method. Will not be returned in this or future versions.
     * 
     * @param paymentMethod the paymentMethod value to set.
     * @return the PaymentMethodLinkInner object itself.
     */
    public PaymentMethodLinkInner withPaymentMethod(PaymentMethodProperties paymentMethod) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PaymentMethodLinkProperties();
        }
        this.innerProperties().withPaymentMethod(paymentMethod);
        return this;
    }

    /**
     * Get the paymentMethodId property: Id of payment method. Example:
     * /providers/Microsoft.Billing/paymentMethods/ABCDABCDABC0.
     * 
     * @return the paymentMethodId value.
     */
    public String paymentMethodId() {
        return this.innerProperties() == null ? null : this.innerProperties().paymentMethodId();
    }

    /**
     * Set the paymentMethodId property: Id of payment method. Example:
     * /providers/Microsoft.Billing/paymentMethods/ABCDABCDABC0.
     * 
     * @param paymentMethodId the paymentMethodId value to set.
     * @return the PaymentMethodLinkInner object itself.
     */
    public PaymentMethodLinkInner withPaymentMethodId(String paymentMethodId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PaymentMethodLinkProperties();
        }
        this.innerProperties().withPaymentMethodId(paymentMethodId);
        return this;
    }

    /**
     * Get the paymentMethodType property: The type of payment method.
     * 
     * @return the paymentMethodType value.
     */
    public String paymentMethodType() {
        return this.innerProperties() == null ? null : this.innerProperties().paymentMethodType();
    }

    /**
     * Get the status property: Status of the payment method.
     * 
     * @return the status value.
     */
    public PaymentMethodStatus status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of PaymentMethodLinkInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of PaymentMethodLinkInner if the JsonReader was pointing to an instance of it, or null if it
     * was pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the PaymentMethodLinkInner.
     */
    public static PaymentMethodLinkInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            PaymentMethodLinkInner deserializedPaymentMethodLinkInner = new PaymentMethodLinkInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedPaymentMethodLinkInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedPaymentMethodLinkInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedPaymentMethodLinkInner.type = reader.getString();
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedPaymentMethodLinkInner.withTags(tags);
                } else if ("systemData".equals(fieldName)) {
                    deserializedPaymentMethodLinkInner.systemData = SystemData.fromJson(reader);
                } else if ("properties".equals(fieldName)) {
                    deserializedPaymentMethodLinkInner.innerProperties = PaymentMethodLinkProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedPaymentMethodLinkInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy