
com.azure.resourcemanager.billing.fluent.models.PaymentMethodLinkProperties 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.json.JsonReader;
import com.azure.json.JsonSerializable;
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 java.io.IOException;
import java.util.List;
/**
* The properties of a payment method link.
*/
@Fluent
public final class PaymentMethodLinkProperties implements JsonSerializable {
/*
* The account holder name for the payment method. This is only supported for payment methods with family
* CreditCard.
*/
private String accountHolderName;
/*
* The display name of the payment method.
*/
private String displayName;
/*
* The expiration month and year of the payment method. This is only supported for payment methods with family
* CreditCard.
*/
private String expiration;
/*
* The family of payment method.
*/
private PaymentMethodFamily family;
/*
* Last four digits of payment method.
*/
private String lastFourDigits;
/*
* The list of logos for the payment method.
*/
private List logos;
/*
* Projection of a payment method. Will not be returned in this or future versions.
*/
private PaymentMethodProperties paymentMethod;
/*
* Id of payment method. Example: /providers/Microsoft.Billing/paymentMethods/ABCDABCDABC0
*/
private String paymentMethodId;
/*
* The type of payment method.
*/
private String paymentMethodType;
/*
* Status of the payment method.
*/
private PaymentMethodStatus status;
/**
* Creates an instance of PaymentMethodLinkProperties class.
*/
public PaymentMethodLinkProperties() {
}
/**
* 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.accountHolderName;
}
/**
* Get the displayName property: The display name of the payment method.
*
* @return the displayName value.
*/
public String displayName() {
return this.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.expiration;
}
/**
* Get the family property: The family of payment method.
*
* @return the family value.
*/
public PaymentMethodFamily family() {
return this.family;
}
/**
* Get the lastFourDigits property: Last four digits of payment method.
*
* @return the lastFourDigits value.
*/
public String lastFourDigits() {
return this.lastFourDigits;
}
/**
* Get the logos property: The list of logos for the payment method.
*
* @return the logos value.
*/
public List logos() {
return this.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.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 PaymentMethodLinkProperties object itself.
*/
public PaymentMethodLinkProperties withPaymentMethod(PaymentMethodProperties paymentMethod) {
this.paymentMethod = 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.paymentMethodId;
}
/**
* Set the paymentMethodId property: Id of payment method. Example:
* /providers/Microsoft.Billing/paymentMethods/ABCDABCDABC0.
*
* @param paymentMethodId the paymentMethodId value to set.
* @return the PaymentMethodLinkProperties object itself.
*/
public PaymentMethodLinkProperties withPaymentMethodId(String paymentMethodId) {
this.paymentMethodId = paymentMethodId;
return this;
}
/**
* Get the paymentMethodType property: The type of payment method.
*
* @return the paymentMethodType value.
*/
public String paymentMethodType() {
return this.paymentMethodType;
}
/**
* Get the status property: Status of the payment method.
*
* @return the status value.
*/
public PaymentMethodStatus status() {
return this.status;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (logos() != null) {
logos().forEach(e -> e.validate());
}
if (paymentMethod() != null) {
paymentMethod().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("paymentMethod", this.paymentMethod);
jsonWriter.writeStringField("paymentMethodId", this.paymentMethodId);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of PaymentMethodLinkProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of PaymentMethodLinkProperties if the JsonReader was pointing to an instance of it, or null
* if it was pointing to JSON null.
* @throws IOException If an error occurs while reading the PaymentMethodLinkProperties.
*/
public static PaymentMethodLinkProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
PaymentMethodLinkProperties deserializedPaymentMethodLinkProperties = new PaymentMethodLinkProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("accountHolderName".equals(fieldName)) {
deserializedPaymentMethodLinkProperties.accountHolderName = reader.getString();
} else if ("displayName".equals(fieldName)) {
deserializedPaymentMethodLinkProperties.displayName = reader.getString();
} else if ("expiration".equals(fieldName)) {
deserializedPaymentMethodLinkProperties.expiration = reader.getString();
} else if ("family".equals(fieldName)) {
deserializedPaymentMethodLinkProperties.family = PaymentMethodFamily.fromString(reader.getString());
} else if ("lastFourDigits".equals(fieldName)) {
deserializedPaymentMethodLinkProperties.lastFourDigits = reader.getString();
} else if ("logos".equals(fieldName)) {
List logos = reader.readArray(reader1 -> PaymentMethodLogo.fromJson(reader1));
deserializedPaymentMethodLinkProperties.logos = logos;
} else if ("paymentMethod".equals(fieldName)) {
deserializedPaymentMethodLinkProperties.paymentMethod = PaymentMethodProperties.fromJson(reader);
} else if ("paymentMethodId".equals(fieldName)) {
deserializedPaymentMethodLinkProperties.paymentMethodId = reader.getString();
} else if ("paymentMethodType".equals(fieldName)) {
deserializedPaymentMethodLinkProperties.paymentMethodType = reader.getString();
} else if ("status".equals(fieldName)) {
deserializedPaymentMethodLinkProperties.status = PaymentMethodStatus.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedPaymentMethodLinkProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy