
com.azure.resourcemanager.billing.models.ReservationPaymentDetail 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.LocalDate;
import java.util.Objects;
/**
* Information about payment related to a reservation order.
*/
@Fluent
public final class ReservationPaymentDetail implements JsonSerializable {
/*
* Date when the payment needs to be done.
*/
private LocalDate dueDate;
/*
* Date when the transaction is completed. Is null when it is scheduled.
*/
private LocalDate paymentDate;
/*
* Amount in pricing currency. Tax not included.
*/
private Price pricingCurrencyTotal;
/*
* Amount charged in Billing currency. Tax not included. Is null for future payments
*/
private Price billingCurrencyTotal;
/*
* Shows the Account that is charged for this payment.
*/
private String billingAccount;
/*
* Describes whether the payment is completed, failed, pending, cancelled or scheduled in the future.
*/
private PaymentStatus status;
/*
* Extended status information for the reservation.
*/
private ReservationExtendedStatusInfo extendedStatusInfo;
/**
* Creates an instance of ReservationPaymentDetail class.
*/
public ReservationPaymentDetail() {
}
/**
* Get the dueDate property: Date when the payment needs to be done.
*
* @return the dueDate value.
*/
public LocalDate dueDate() {
return this.dueDate;
}
/**
* Set the dueDate property: Date when the payment needs to be done.
*
* @param dueDate the dueDate value to set.
* @return the ReservationPaymentDetail object itself.
*/
public ReservationPaymentDetail withDueDate(LocalDate dueDate) {
this.dueDate = dueDate;
return this;
}
/**
* Get the paymentDate property: Date when the transaction is completed. Is null when it is scheduled.
*
* @return the paymentDate value.
*/
public LocalDate paymentDate() {
return this.paymentDate;
}
/**
* Set the paymentDate property: Date when the transaction is completed. Is null when it is scheduled.
*
* @param paymentDate the paymentDate value to set.
* @return the ReservationPaymentDetail object itself.
*/
public ReservationPaymentDetail withPaymentDate(LocalDate paymentDate) {
this.paymentDate = paymentDate;
return this;
}
/**
* Get the pricingCurrencyTotal property: Amount in pricing currency. Tax not included.
*
* @return the pricingCurrencyTotal value.
*/
public Price pricingCurrencyTotal() {
return this.pricingCurrencyTotal;
}
/**
* Set the pricingCurrencyTotal property: Amount in pricing currency. Tax not included.
*
* @param pricingCurrencyTotal the pricingCurrencyTotal value to set.
* @return the ReservationPaymentDetail object itself.
*/
public ReservationPaymentDetail withPricingCurrencyTotal(Price pricingCurrencyTotal) {
this.pricingCurrencyTotal = pricingCurrencyTotal;
return this;
}
/**
* Get the billingCurrencyTotal property: Amount charged in Billing currency. Tax not included. Is null for future
* payments.
*
* @return the billingCurrencyTotal value.
*/
public Price billingCurrencyTotal() {
return this.billingCurrencyTotal;
}
/**
* Set the billingCurrencyTotal property: Amount charged in Billing currency. Tax not included. Is null for future
* payments.
*
* @param billingCurrencyTotal the billingCurrencyTotal value to set.
* @return the ReservationPaymentDetail object itself.
*/
public ReservationPaymentDetail withBillingCurrencyTotal(Price billingCurrencyTotal) {
this.billingCurrencyTotal = billingCurrencyTotal;
return this;
}
/**
* Get the billingAccount property: Shows the Account that is charged for this payment.
*
* @return the billingAccount value.
*/
public String billingAccount() {
return this.billingAccount;
}
/**
* Set the billingAccount property: Shows the Account that is charged for this payment.
*
* @param billingAccount the billingAccount value to set.
* @return the ReservationPaymentDetail object itself.
*/
public ReservationPaymentDetail withBillingAccount(String billingAccount) {
this.billingAccount = billingAccount;
return this;
}
/**
* Get the status property: Describes whether the payment is completed, failed, pending, cancelled or scheduled in
* the future.
*
* @return the status value.
*/
public PaymentStatus status() {
return this.status;
}
/**
* Set the status property: Describes whether the payment is completed, failed, pending, cancelled or scheduled in
* the future.
*
* @param status the status value to set.
* @return the ReservationPaymentDetail object itself.
*/
public ReservationPaymentDetail withStatus(PaymentStatus status) {
this.status = status;
return this;
}
/**
* Get the extendedStatusInfo property: Extended status information for the reservation.
*
* @return the extendedStatusInfo value.
*/
public ReservationExtendedStatusInfo extendedStatusInfo() {
return this.extendedStatusInfo;
}
/**
* Set the extendedStatusInfo property: Extended status information for the reservation.
*
* @param extendedStatusInfo the extendedStatusInfo value to set.
* @return the ReservationPaymentDetail object itself.
*/
public ReservationPaymentDetail withExtendedStatusInfo(ReservationExtendedStatusInfo extendedStatusInfo) {
this.extendedStatusInfo = extendedStatusInfo;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (pricingCurrencyTotal() != null) {
pricingCurrencyTotal().validate();
}
if (billingCurrencyTotal() != null) {
billingCurrencyTotal().validate();
}
if (extendedStatusInfo() != null) {
extendedStatusInfo().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("dueDate", Objects.toString(this.dueDate, null));
jsonWriter.writeStringField("paymentDate", Objects.toString(this.paymentDate, null));
jsonWriter.writeJsonField("pricingCurrencyTotal", this.pricingCurrencyTotal);
jsonWriter.writeJsonField("billingCurrencyTotal", this.billingCurrencyTotal);
jsonWriter.writeStringField("billingAccount", this.billingAccount);
jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString());
jsonWriter.writeJsonField("extendedStatusInfo", this.extendedStatusInfo);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ReservationPaymentDetail from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ReservationPaymentDetail 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 ReservationPaymentDetail.
*/
public static ReservationPaymentDetail fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ReservationPaymentDetail deserializedReservationPaymentDetail = new ReservationPaymentDetail();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("dueDate".equals(fieldName)) {
deserializedReservationPaymentDetail.dueDate
= reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()));
} else if ("paymentDate".equals(fieldName)) {
deserializedReservationPaymentDetail.paymentDate
= reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()));
} else if ("pricingCurrencyTotal".equals(fieldName)) {
deserializedReservationPaymentDetail.pricingCurrencyTotal = Price.fromJson(reader);
} else if ("billingCurrencyTotal".equals(fieldName)) {
deserializedReservationPaymentDetail.billingCurrencyTotal = Price.fromJson(reader);
} else if ("billingAccount".equals(fieldName)) {
deserializedReservationPaymentDetail.billingAccount = reader.getString();
} else if ("status".equals(fieldName)) {
deserializedReservationPaymentDetail.status = PaymentStatus.fromString(reader.getString());
} else if ("extendedStatusInfo".equals(fieldName)) {
deserializedReservationPaymentDetail.extendedStatusInfo
= ReservationExtendedStatusInfo.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedReservationPaymentDetail;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy