
com.azure.resourcemanager.billing.models.InvoicePropertiesRefundDetails 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.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;
/**
* The details of a refund request.
*/
@Fluent
public final class InvoicePropertiesRefundDetails extends RefundDetailsSummary {
/*
* The reason for refund.
*/
private RefundReasonCode refundReason;
/*
* The ID of refund operation.
*/
private String refundOperationId;
/*
* The status of refund request.
*/
private RefundStatus refundStatus;
/*
* The number of transactions refunded.
*/
private Integer transactionCount;
/*
* The invoice ID of the rebill invoice for a refund.
*/
private String rebillInvoiceId;
/*
* Date when the refund was completed.
*/
private OffsetDateTime completedOn;
/*
* Date when the refund was approved.
*/
private OffsetDateTime approvedOn;
/*
* Date when the refund was requested.
*/
private OffsetDateTime requestedOn;
/**
* Creates an instance of InvoicePropertiesRefundDetails class.
*/
public InvoicePropertiesRefundDetails() {
}
/**
* Get the refundReason property: The reason for refund.
*
* @return the refundReason value.
*/
@Override
public RefundReasonCode refundReason() {
return this.refundReason;
}
/**
* Get the refundOperationId property: The ID of refund operation.
*
* @return the refundOperationId value.
*/
@Override
public String refundOperationId() {
return this.refundOperationId;
}
/**
* Get the refundStatus property: The status of refund request.
*
* @return the refundStatus value.
*/
@Override
public RefundStatus refundStatus() {
return this.refundStatus;
}
/**
* Get the transactionCount property: The number of transactions refunded.
*
* @return the transactionCount value.
*/
@Override
public Integer transactionCount() {
return this.transactionCount;
}
/**
* Get the rebillInvoiceId property: The invoice ID of the rebill invoice for a refund.
*
* @return the rebillInvoiceId value.
*/
@Override
public String rebillInvoiceId() {
return this.rebillInvoiceId;
}
/**
* Get the completedOn property: Date when the refund was completed.
*
* @return the completedOn value.
*/
@Override
public OffsetDateTime completedOn() {
return this.completedOn;
}
/**
* Get the approvedOn property: Date when the refund was approved.
*
* @return the approvedOn value.
*/
@Override
public OffsetDateTime approvedOn() {
return this.approvedOn;
}
/**
* Get the requestedOn property: Date when the refund was requested.
*
* @return the requestedOn value.
*/
@Override
public OffsetDateTime requestedOn() {
return this.requestedOn;
}
/**
* {@inheritDoc}
*/
@Override
public InvoicePropertiesRefundDetails withAmountRequested(RefundDetailsSummaryAmountRequested amountRequested) {
super.withAmountRequested(amountRequested);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public InvoicePropertiesRefundDetails withAmountRefunded(RefundDetailsSummaryAmountRefunded amountRefunded) {
super.withAmountRefunded(amountRefunded);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (amountRequested() != null) {
amountRequested().validate();
}
if (amountRefunded() != null) {
amountRefunded().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("amountRequested", amountRequested());
jsonWriter.writeJsonField("amountRefunded", amountRefunded());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of InvoicePropertiesRefundDetails from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of InvoicePropertiesRefundDetails 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 InvoicePropertiesRefundDetails.
*/
public static InvoicePropertiesRefundDetails fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
InvoicePropertiesRefundDetails deserializedInvoicePropertiesRefundDetails
= new InvoicePropertiesRefundDetails();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("requestedOn".equals(fieldName)) {
deserializedInvoicePropertiesRefundDetails.requestedOn = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("approvedOn".equals(fieldName)) {
deserializedInvoicePropertiesRefundDetails.approvedOn = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("completedOn".equals(fieldName)) {
deserializedInvoicePropertiesRefundDetails.completedOn = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("amountRequested".equals(fieldName)) {
deserializedInvoicePropertiesRefundDetails
.withAmountRequested(RefundDetailsSummaryAmountRequested.fromJson(reader));
} else if ("amountRefunded".equals(fieldName)) {
deserializedInvoicePropertiesRefundDetails
.withAmountRefunded(RefundDetailsSummaryAmountRefunded.fromJson(reader));
} else if ("rebillInvoiceId".equals(fieldName)) {
deserializedInvoicePropertiesRefundDetails.rebillInvoiceId = reader.getString();
} else if ("transactionCount".equals(fieldName)) {
deserializedInvoicePropertiesRefundDetails.transactionCount
= reader.getNullable(JsonReader::getInt);
} else if ("refundStatus".equals(fieldName)) {
deserializedInvoicePropertiesRefundDetails.refundStatus
= RefundStatus.fromString(reader.getString());
} else if ("refundOperationId".equals(fieldName)) {
deserializedInvoicePropertiesRefundDetails.refundOperationId = reader.getString();
} else if ("refundReason".equals(fieldName)) {
deserializedInvoicePropertiesRefundDetails.refundReason
= RefundReasonCode.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedInvoicePropertiesRefundDetails;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy