
com.azure.resourcemanager.billing.models.PaymentOnAccount 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.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;
/**
* A Payment on Account.
*/
@Fluent
public final class PaymentOnAccount implements JsonSerializable {
/*
* Payment on Account amount.
*/
private PaymentOnAccountAmount amount;
/*
* The ID of the billing profile for the payments on account.
*/
private String billingProfileId;
/*
* The name of the billing profile for the payments on account.
*/
private String billingProfileDisplayName;
/*
* The ID of the invoice for which the payments on account was generated.
*/
private String invoiceId;
/*
* The name of the invoice for the payments on account.
*/
private String invoiceName;
/*
* The date of the payments on account.
*/
private OffsetDateTime date;
/*
* Payment on Account type.
*/
private PaymentMethodFamily paymentMethodType;
/**
* Creates an instance of PaymentOnAccount class.
*/
public PaymentOnAccount() {
}
/**
* Get the amount property: Payment on Account amount.
*
* @return the amount value.
*/
public PaymentOnAccountAmount amount() {
return this.amount;
}
/**
* Set the amount property: Payment on Account amount.
*
* @param amount the amount value to set.
* @return the PaymentOnAccount object itself.
*/
public PaymentOnAccount withAmount(PaymentOnAccountAmount amount) {
this.amount = amount;
return this;
}
/**
* Get the billingProfileId property: The ID of the billing profile for the payments on account.
*
* @return the billingProfileId value.
*/
public String billingProfileId() {
return this.billingProfileId;
}
/**
* Get the billingProfileDisplayName property: The name of the billing profile for the payments on account.
*
* @return the billingProfileDisplayName value.
*/
public String billingProfileDisplayName() {
return this.billingProfileDisplayName;
}
/**
* Get the invoiceId property: The ID of the invoice for which the payments on account was generated.
*
* @return the invoiceId value.
*/
public String invoiceId() {
return this.invoiceId;
}
/**
* Get the invoiceName property: The name of the invoice for the payments on account.
*
* @return the invoiceName value.
*/
public String invoiceName() {
return this.invoiceName;
}
/**
* Get the date property: The date of the payments on account.
*
* @return the date value.
*/
public OffsetDateTime date() {
return this.date;
}
/**
* Get the paymentMethodType property: Payment on Account type.
*
* @return the paymentMethodType value.
*/
public PaymentMethodFamily paymentMethodType() {
return this.paymentMethodType;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (amount() != null) {
amount().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("amount", this.amount);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of PaymentOnAccount from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of PaymentOnAccount 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 PaymentOnAccount.
*/
public static PaymentOnAccount fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
PaymentOnAccount deserializedPaymentOnAccount = new PaymentOnAccount();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("amount".equals(fieldName)) {
deserializedPaymentOnAccount.amount = PaymentOnAccountAmount.fromJson(reader);
} else if ("billingProfileId".equals(fieldName)) {
deserializedPaymentOnAccount.billingProfileId = reader.getString();
} else if ("billingProfileDisplayName".equals(fieldName)) {
deserializedPaymentOnAccount.billingProfileDisplayName = reader.getString();
} else if ("invoiceId".equals(fieldName)) {
deserializedPaymentOnAccount.invoiceId = reader.getString();
} else if ("invoiceName".equals(fieldName)) {
deserializedPaymentOnAccount.invoiceName = reader.getString();
} else if ("date".equals(fieldName)) {
deserializedPaymentOnAccount.date = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("paymentMethodType".equals(fieldName)) {
deserializedPaymentOnAccount.paymentMethodType = PaymentMethodFamily.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedPaymentOnAccount;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy