
com.azure.resourcemanager.billing.models.TransactionProperties 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;
import java.time.format.DateTimeFormatter;
/**
* A transaction.
*/
@Fluent
public final class TransactionProperties implements JsonSerializable {
/*
* The amount of any Azure credits automatically applied to this transaction.
*/
private TransactionPropertiesAzureCreditApplied azureCreditApplied;
/*
* Details of the Azure plan.
*/
private String azurePlan;
/*
* The ISO 4217 code for the currency in which this transaction is billed.
*/
private String billingCurrency;
/*
* The name of the billing profile.
*/
private Object billingProfileDisplayName;
/*
* The fully qualified ID that uniquely identifies a billing profile.
*/
private String billingProfileId;
/*
* The amount of Microsoft Azure Consumption Commitment(MACC) decrement through the transaction.
*/
private TransactionPropertiesConsumptionCommitmentDecremented consumptionCommitmentDecremented;
/*
* The name of the customer.
*/
private String customerDisplayName;
/*
* The fully qualified ID that uniquely identifies a customer.
*/
private String customerId;
/*
* The credit type of the transaction. Applies only to credited transactions.
*/
private CreditType creditType;
/*
* The date of transaction.
*/
private OffsetDateTime date;
/*
* The percentage discount, if any, applied to this transaction.
*/
private Float discount;
/*
* The price of the product after applying any discounts.
*/
private TransactionPropertiesEffectivePrice effectivePrice;
/*
* The exchange rate used to convert charged amount to billing currency, if applicable.
*/
private Float exchangeRate;
/*
* Invoice name on which the transaction was billed or 'Pending' if the transaction is not billed.
*/
private String invoice;
/*
* The fully qualified ID of the invoice on which the transaction was billed. This field is only applicable for
* transactions which are billed.
*/
private String invoiceId;
/*
* The name of the invoice section.
*/
private String invoiceSectionDisplayName;
/*
* The fully qualified ID that uniquely identifies an invoice section.
*/
private String invoiceSectionId;
/*
* Whether or not the transaction is third party.
*/
private Boolean isThirdParty;
/*
* Type of the transaction, billed or unbilled.
*/
private TransactionKind kind;
/*
* The retail price of the product.
*/
private TransactionPropertiesMarketPrice marketPrice;
/*
* The part number of the product for which the transaction took place. The field is only applicable for Enterprise
* Agreement invoices.
*/
private String partNumber;
/*
* The ISO 4217 code for the currency in which the product is priced.
*/
private String pricingCurrency;
/*
* The description of the product for which the transaction took place.
*/
private String productDescription;
/*
* The family of the product for which the transaction took place.
*/
private String productFamily;
/*
* The ID of the product type for which the transaction took place.
*/
private String productTypeId;
/*
* The type of the product for which the transaction took place.
*/
private String productType;
/*
* The quantity purchased in the transaction.
*/
private Integer quantity;
/*
* There reason code for the transaction.
*/
private String reasonCode;
/*
* The date of the purchase of the product, or the start date of the month in which usage started.
*/
private OffsetDateTime servicePeriodStartDate;
/*
* The end date of the product term, or the end date of the month in which usage ended.
*/
private OffsetDateTime servicePeriodEndDate;
/*
* The pre-tax charged amount for the transaction.
*/
private TransactionPropertiesSubTotal subTotal;
/*
* The tax amount applied to the transaction.
*/
private TransactionPropertiesTax tax;
/*
* The charge associated with the transaction.
*/
private TransactionPropertiesTransactionAmount transactionAmount;
/*
* The type of transaction.
*/
private String transactionType;
/*
* The number of units used for a given product.
*/
private Float units;
/*
* The unit of measure used to bill for the product. For example, compute services are billed per hour.
*/
private String unitOfMeasure;
/*
* The description for the unit of measure for a given product.
*/
private String unitType;
/*
* Identifies the type of tax calculation used for the invoice. The field is applicable only to invoices with
* special tax calculation logic.
*/
private SpecialTaxationType specialTaxationType;
/*
* The refund details of a transaction.
*/
private TransactionPropertiesRefundTransactionDetails refundTransactionDetails;
/**
* Creates an instance of TransactionProperties class.
*/
public TransactionProperties() {
}
/**
* Get the azureCreditApplied property: The amount of any Azure credits automatically applied to this transaction.
*
* @return the azureCreditApplied value.
*/
public TransactionPropertiesAzureCreditApplied azureCreditApplied() {
return this.azureCreditApplied;
}
/**
* Set the azureCreditApplied property: The amount of any Azure credits automatically applied to this transaction.
*
* @param azureCreditApplied the azureCreditApplied value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withAzureCreditApplied(TransactionPropertiesAzureCreditApplied azureCreditApplied) {
this.azureCreditApplied = azureCreditApplied;
return this;
}
/**
* Get the azurePlan property: Details of the Azure plan.
*
* @return the azurePlan value.
*/
public String azurePlan() {
return this.azurePlan;
}
/**
* Set the azurePlan property: Details of the Azure plan.
*
* @param azurePlan the azurePlan value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withAzurePlan(String azurePlan) {
this.azurePlan = azurePlan;
return this;
}
/**
* Get the billingCurrency property: The ISO 4217 code for the currency in which this transaction is billed.
*
* @return the billingCurrency value.
*/
public String billingCurrency() {
return this.billingCurrency;
}
/**
* Set the billingCurrency property: The ISO 4217 code for the currency in which this transaction is billed.
*
* @param billingCurrency the billingCurrency value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withBillingCurrency(String billingCurrency) {
this.billingCurrency = billingCurrency;
return this;
}
/**
* Get the billingProfileDisplayName property: The name of the billing profile.
*
* @return the billingProfileDisplayName value.
*/
public Object billingProfileDisplayName() {
return this.billingProfileDisplayName;
}
/**
* Set the billingProfileDisplayName property: The name of the billing profile.
*
* @param billingProfileDisplayName the billingProfileDisplayName value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withBillingProfileDisplayName(Object billingProfileDisplayName) {
this.billingProfileDisplayName = billingProfileDisplayName;
return this;
}
/**
* Get the billingProfileId property: The fully qualified ID that uniquely identifies a billing profile.
*
* @return the billingProfileId value.
*/
public String billingProfileId() {
return this.billingProfileId;
}
/**
* Set the billingProfileId property: The fully qualified ID that uniquely identifies a billing profile.
*
* @param billingProfileId the billingProfileId value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withBillingProfileId(String billingProfileId) {
this.billingProfileId = billingProfileId;
return this;
}
/**
* Get the consumptionCommitmentDecremented property: The amount of Microsoft Azure Consumption Commitment(MACC)
* decrement through the transaction.
*
* @return the consumptionCommitmentDecremented value.
*/
public TransactionPropertiesConsumptionCommitmentDecremented consumptionCommitmentDecremented() {
return this.consumptionCommitmentDecremented;
}
/**
* Set the consumptionCommitmentDecremented property: The amount of Microsoft Azure Consumption Commitment(MACC)
* decrement through the transaction.
*
* @param consumptionCommitmentDecremented the consumptionCommitmentDecremented value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withConsumptionCommitmentDecremented(
TransactionPropertiesConsumptionCommitmentDecremented consumptionCommitmentDecremented) {
this.consumptionCommitmentDecremented = consumptionCommitmentDecremented;
return this;
}
/**
* Get the customerDisplayName property: The name of the customer.
*
* @return the customerDisplayName value.
*/
public String customerDisplayName() {
return this.customerDisplayName;
}
/**
* Set the customerDisplayName property: The name of the customer.
*
* @param customerDisplayName the customerDisplayName value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withCustomerDisplayName(String customerDisplayName) {
this.customerDisplayName = customerDisplayName;
return this;
}
/**
* Get the customerId property: The fully qualified ID that uniquely identifies a customer.
*
* @return the customerId value.
*/
public String customerId() {
return this.customerId;
}
/**
* Set the customerId property: The fully qualified ID that uniquely identifies a customer.
*
* @param customerId the customerId value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withCustomerId(String customerId) {
this.customerId = customerId;
return this;
}
/**
* Get the creditType property: The credit type of the transaction. Applies only to credited transactions.
*
* @return the creditType value.
*/
public CreditType creditType() {
return this.creditType;
}
/**
* Set the creditType property: The credit type of the transaction. Applies only to credited transactions.
*
* @param creditType the creditType value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withCreditType(CreditType creditType) {
this.creditType = creditType;
return this;
}
/**
* Get the date property: The date of transaction.
*
* @return the date value.
*/
public OffsetDateTime date() {
return this.date;
}
/**
* Set the date property: The date of transaction.
*
* @param date the date value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withDate(OffsetDateTime date) {
this.date = date;
return this;
}
/**
* Get the discount property: The percentage discount, if any, applied to this transaction.
*
* @return the discount value.
*/
public Float discount() {
return this.discount;
}
/**
* Set the discount property: The percentage discount, if any, applied to this transaction.
*
* @param discount the discount value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withDiscount(Float discount) {
this.discount = discount;
return this;
}
/**
* Get the effectivePrice property: The price of the product after applying any discounts.
*
* @return the effectivePrice value.
*/
public TransactionPropertiesEffectivePrice effectivePrice() {
return this.effectivePrice;
}
/**
* Set the effectivePrice property: The price of the product after applying any discounts.
*
* @param effectivePrice the effectivePrice value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withEffectivePrice(TransactionPropertiesEffectivePrice effectivePrice) {
this.effectivePrice = effectivePrice;
return this;
}
/**
* Get the exchangeRate property: The exchange rate used to convert charged amount to billing currency, if
* applicable.
*
* @return the exchangeRate value.
*/
public Float exchangeRate() {
return this.exchangeRate;
}
/**
* Set the exchangeRate property: The exchange rate used to convert charged amount to billing currency, if
* applicable.
*
* @param exchangeRate the exchangeRate value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withExchangeRate(Float exchangeRate) {
this.exchangeRate = exchangeRate;
return this;
}
/**
* Get the invoice property: Invoice name on which the transaction was billed or 'Pending' if the transaction is not
* billed.
*
* @return the invoice value.
*/
public String invoice() {
return this.invoice;
}
/**
* Set the invoice property: Invoice name on which the transaction was billed or 'Pending' if the transaction is not
* billed.
*
* @param invoice the invoice value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withInvoice(String invoice) {
this.invoice = invoice;
return this;
}
/**
* Get the invoiceId property: The fully qualified ID of the invoice on which the transaction was billed. This field
* is only applicable for transactions which are billed.
*
* @return the invoiceId value.
*/
public String invoiceId() {
return this.invoiceId;
}
/**
* Set the invoiceId property: The fully qualified ID of the invoice on which the transaction was billed. This field
* is only applicable for transactions which are billed.
*
* @param invoiceId the invoiceId value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withInvoiceId(String invoiceId) {
this.invoiceId = invoiceId;
return this;
}
/**
* Get the invoiceSectionDisplayName property: The name of the invoice section.
*
* @return the invoiceSectionDisplayName value.
*/
public String invoiceSectionDisplayName() {
return this.invoiceSectionDisplayName;
}
/**
* Set the invoiceSectionDisplayName property: The name of the invoice section.
*
* @param invoiceSectionDisplayName the invoiceSectionDisplayName value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withInvoiceSectionDisplayName(String invoiceSectionDisplayName) {
this.invoiceSectionDisplayName = invoiceSectionDisplayName;
return this;
}
/**
* Get the invoiceSectionId property: The fully qualified ID that uniquely identifies an invoice section.
*
* @return the invoiceSectionId value.
*/
public String invoiceSectionId() {
return this.invoiceSectionId;
}
/**
* Set the invoiceSectionId property: The fully qualified ID that uniquely identifies an invoice section.
*
* @param invoiceSectionId the invoiceSectionId value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withInvoiceSectionId(String invoiceSectionId) {
this.invoiceSectionId = invoiceSectionId;
return this;
}
/**
* Get the isThirdParty property: Whether or not the transaction is third party.
*
* @return the isThirdParty value.
*/
public Boolean isThirdParty() {
return this.isThirdParty;
}
/**
* Set the isThirdParty property: Whether or not the transaction is third party.
*
* @param isThirdParty the isThirdParty value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withIsThirdParty(Boolean isThirdParty) {
this.isThirdParty = isThirdParty;
return this;
}
/**
* Get the kind property: Type of the transaction, billed or unbilled.
*
* @return the kind value.
*/
public TransactionKind kind() {
return this.kind;
}
/**
* Set the kind property: Type of the transaction, billed or unbilled.
*
* @param kind the kind value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withKind(TransactionKind kind) {
this.kind = kind;
return this;
}
/**
* Get the marketPrice property: The retail price of the product.
*
* @return the marketPrice value.
*/
public TransactionPropertiesMarketPrice marketPrice() {
return this.marketPrice;
}
/**
* Set the marketPrice property: The retail price of the product.
*
* @param marketPrice the marketPrice value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withMarketPrice(TransactionPropertiesMarketPrice marketPrice) {
this.marketPrice = marketPrice;
return this;
}
/**
* Get the partNumber property: The part number of the product for which the transaction took place. The field is
* only applicable for Enterprise Agreement invoices.
*
* @return the partNumber value.
*/
public String partNumber() {
return this.partNumber;
}
/**
* Set the partNumber property: The part number of the product for which the transaction took place. The field is
* only applicable for Enterprise Agreement invoices.
*
* @param partNumber the partNumber value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withPartNumber(String partNumber) {
this.partNumber = partNumber;
return this;
}
/**
* Get the pricingCurrency property: The ISO 4217 code for the currency in which the product is priced.
*
* @return the pricingCurrency value.
*/
public String pricingCurrency() {
return this.pricingCurrency;
}
/**
* Set the pricingCurrency property: The ISO 4217 code for the currency in which the product is priced.
*
* @param pricingCurrency the pricingCurrency value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withPricingCurrency(String pricingCurrency) {
this.pricingCurrency = pricingCurrency;
return this;
}
/**
* Get the productDescription property: The description of the product for which the transaction took place.
*
* @return the productDescription value.
*/
public String productDescription() {
return this.productDescription;
}
/**
* Set the productDescription property: The description of the product for which the transaction took place.
*
* @param productDescription the productDescription value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withProductDescription(String productDescription) {
this.productDescription = productDescription;
return this;
}
/**
* Get the productFamily property: The family of the product for which the transaction took place.
*
* @return the productFamily value.
*/
public String productFamily() {
return this.productFamily;
}
/**
* Set the productFamily property: The family of the product for which the transaction took place.
*
* @param productFamily the productFamily value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withProductFamily(String productFamily) {
this.productFamily = productFamily;
return this;
}
/**
* Get the productTypeId property: The ID of the product type for which the transaction took place.
*
* @return the productTypeId value.
*/
public String productTypeId() {
return this.productTypeId;
}
/**
* Set the productTypeId property: The ID of the product type for which the transaction took place.
*
* @param productTypeId the productTypeId value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withProductTypeId(String productTypeId) {
this.productTypeId = productTypeId;
return this;
}
/**
* Get the productType property: The type of the product for which the transaction took place.
*
* @return the productType value.
*/
public String productType() {
return this.productType;
}
/**
* Set the productType property: The type of the product for which the transaction took place.
*
* @param productType the productType value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withProductType(String productType) {
this.productType = productType;
return this;
}
/**
* Get the quantity property: The quantity purchased in the transaction.
*
* @return the quantity value.
*/
public Integer quantity() {
return this.quantity;
}
/**
* Set the quantity property: The quantity purchased in the transaction.
*
* @param quantity the quantity value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withQuantity(Integer quantity) {
this.quantity = quantity;
return this;
}
/**
* Get the reasonCode property: There reason code for the transaction.
*
* @return the reasonCode value.
*/
public String reasonCode() {
return this.reasonCode;
}
/**
* Set the reasonCode property: There reason code for the transaction.
*
* @param reasonCode the reasonCode value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withReasonCode(String reasonCode) {
this.reasonCode = reasonCode;
return this;
}
/**
* Get the servicePeriodStartDate property: The date of the purchase of the product, or the start date of the month
* in which usage started.
*
* @return the servicePeriodStartDate value.
*/
public OffsetDateTime servicePeriodStartDate() {
return this.servicePeriodStartDate;
}
/**
* Set the servicePeriodStartDate property: The date of the purchase of the product, or the start date of the month
* in which usage started.
*
* @param servicePeriodStartDate the servicePeriodStartDate value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withServicePeriodStartDate(OffsetDateTime servicePeriodStartDate) {
this.servicePeriodStartDate = servicePeriodStartDate;
return this;
}
/**
* Get the servicePeriodEndDate property: The end date of the product term, or the end date of the month in which
* usage ended.
*
* @return the servicePeriodEndDate value.
*/
public OffsetDateTime servicePeriodEndDate() {
return this.servicePeriodEndDate;
}
/**
* Set the servicePeriodEndDate property: The end date of the product term, or the end date of the month in which
* usage ended.
*
* @param servicePeriodEndDate the servicePeriodEndDate value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withServicePeriodEndDate(OffsetDateTime servicePeriodEndDate) {
this.servicePeriodEndDate = servicePeriodEndDate;
return this;
}
/**
* Get the subTotal property: The pre-tax charged amount for the transaction.
*
* @return the subTotal value.
*/
public TransactionPropertiesSubTotal subTotal() {
return this.subTotal;
}
/**
* Set the subTotal property: The pre-tax charged amount for the transaction.
*
* @param subTotal the subTotal value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withSubTotal(TransactionPropertiesSubTotal subTotal) {
this.subTotal = subTotal;
return this;
}
/**
* Get the tax property: The tax amount applied to the transaction.
*
* @return the tax value.
*/
public TransactionPropertiesTax tax() {
return this.tax;
}
/**
* Set the tax property: The tax amount applied to the transaction.
*
* @param tax the tax value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withTax(TransactionPropertiesTax tax) {
this.tax = tax;
return this;
}
/**
* Get the transactionAmount property: The charge associated with the transaction.
*
* @return the transactionAmount value.
*/
public TransactionPropertiesTransactionAmount transactionAmount() {
return this.transactionAmount;
}
/**
* Set the transactionAmount property: The charge associated with the transaction.
*
* @param transactionAmount the transactionAmount value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withTransactionAmount(TransactionPropertiesTransactionAmount transactionAmount) {
this.transactionAmount = transactionAmount;
return this;
}
/**
* Get the transactionType property: The type of transaction.
*
* @return the transactionType value.
*/
public String transactionType() {
return this.transactionType;
}
/**
* Set the transactionType property: The type of transaction.
*
* @param transactionType the transactionType value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withTransactionType(String transactionType) {
this.transactionType = transactionType;
return this;
}
/**
* Get the units property: The number of units used for a given product.
*
* @return the units value.
*/
public Float units() {
return this.units;
}
/**
* Set the units property: The number of units used for a given product.
*
* @param units the units value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withUnits(Float units) {
this.units = units;
return this;
}
/**
* Get the unitOfMeasure property: The unit of measure used to bill for the product. For example, compute services
* are billed per hour.
*
* @return the unitOfMeasure value.
*/
public String unitOfMeasure() {
return this.unitOfMeasure;
}
/**
* Set the unitOfMeasure property: The unit of measure used to bill for the product. For example, compute services
* are billed per hour.
*
* @param unitOfMeasure the unitOfMeasure value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withUnitOfMeasure(String unitOfMeasure) {
this.unitOfMeasure = unitOfMeasure;
return this;
}
/**
* Get the unitType property: The description for the unit of measure for a given product.
*
* @return the unitType value.
*/
public String unitType() {
return this.unitType;
}
/**
* Set the unitType property: The description for the unit of measure for a given product.
*
* @param unitType the unitType value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withUnitType(String unitType) {
this.unitType = unitType;
return this;
}
/**
* Get the specialTaxationType property: Identifies the type of tax calculation used for the invoice. The field is
* applicable only to invoices with special tax calculation logic.
*
* @return the specialTaxationType value.
*/
public SpecialTaxationType specialTaxationType() {
return this.specialTaxationType;
}
/**
* Set the specialTaxationType property: Identifies the type of tax calculation used for the invoice. The field is
* applicable only to invoices with special tax calculation logic.
*
* @param specialTaxationType the specialTaxationType value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties withSpecialTaxationType(SpecialTaxationType specialTaxationType) {
this.specialTaxationType = specialTaxationType;
return this;
}
/**
* Get the refundTransactionDetails property: The refund details of a transaction.
*
* @return the refundTransactionDetails value.
*/
public TransactionPropertiesRefundTransactionDetails refundTransactionDetails() {
return this.refundTransactionDetails;
}
/**
* Set the refundTransactionDetails property: The refund details of a transaction.
*
* @param refundTransactionDetails the refundTransactionDetails value to set.
* @return the TransactionProperties object itself.
*/
public TransactionProperties
withRefundTransactionDetails(TransactionPropertiesRefundTransactionDetails refundTransactionDetails) {
this.refundTransactionDetails = refundTransactionDetails;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (azureCreditApplied() != null) {
azureCreditApplied().validate();
}
if (consumptionCommitmentDecremented() != null) {
consumptionCommitmentDecremented().validate();
}
if (effectivePrice() != null) {
effectivePrice().validate();
}
if (marketPrice() != null) {
marketPrice().validate();
}
if (subTotal() != null) {
subTotal().validate();
}
if (tax() != null) {
tax().validate();
}
if (transactionAmount() != null) {
transactionAmount().validate();
}
if (refundTransactionDetails() != null) {
refundTransactionDetails().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("azureCreditApplied", this.azureCreditApplied);
jsonWriter.writeStringField("azurePlan", this.azurePlan);
jsonWriter.writeStringField("billingCurrency", this.billingCurrency);
jsonWriter.writeUntypedField("billingProfileDisplayName", this.billingProfileDisplayName);
jsonWriter.writeStringField("billingProfileId", this.billingProfileId);
jsonWriter.writeJsonField("consumptionCommitmentDecremented", this.consumptionCommitmentDecremented);
jsonWriter.writeStringField("customerDisplayName", this.customerDisplayName);
jsonWriter.writeStringField("customerId", this.customerId);
jsonWriter.writeStringField("creditType", this.creditType == null ? null : this.creditType.toString());
jsonWriter.writeStringField("date",
this.date == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.date));
jsonWriter.writeNumberField("discount", this.discount);
jsonWriter.writeJsonField("effectivePrice", this.effectivePrice);
jsonWriter.writeNumberField("exchangeRate", this.exchangeRate);
jsonWriter.writeStringField("invoice", this.invoice);
jsonWriter.writeStringField("invoiceId", this.invoiceId);
jsonWriter.writeStringField("invoiceSectionDisplayName", this.invoiceSectionDisplayName);
jsonWriter.writeStringField("invoiceSectionId", this.invoiceSectionId);
jsonWriter.writeBooleanField("isThirdParty", this.isThirdParty);
jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString());
jsonWriter.writeJsonField("marketPrice", this.marketPrice);
jsonWriter.writeStringField("partNumber", this.partNumber);
jsonWriter.writeStringField("pricingCurrency", this.pricingCurrency);
jsonWriter.writeStringField("productDescription", this.productDescription);
jsonWriter.writeStringField("productFamily", this.productFamily);
jsonWriter.writeStringField("productTypeId", this.productTypeId);
jsonWriter.writeStringField("productType", this.productType);
jsonWriter.writeNumberField("quantity", this.quantity);
jsonWriter.writeStringField("reasonCode", this.reasonCode);
jsonWriter.writeStringField("servicePeriodStartDate",
this.servicePeriodStartDate == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.servicePeriodStartDate));
jsonWriter.writeStringField("servicePeriodEndDate",
this.servicePeriodEndDate == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.servicePeriodEndDate));
jsonWriter.writeJsonField("subTotal", this.subTotal);
jsonWriter.writeJsonField("tax", this.tax);
jsonWriter.writeJsonField("transactionAmount", this.transactionAmount);
jsonWriter.writeStringField("transactionType", this.transactionType);
jsonWriter.writeNumberField("units", this.units);
jsonWriter.writeStringField("unitOfMeasure", this.unitOfMeasure);
jsonWriter.writeStringField("unitType", this.unitType);
jsonWriter.writeStringField("specialTaxationType",
this.specialTaxationType == null ? null : this.specialTaxationType.toString());
jsonWriter.writeJsonField("refundTransactionDetails", this.refundTransactionDetails);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of TransactionProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of TransactionProperties 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 TransactionProperties.
*/
public static TransactionProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
TransactionProperties deserializedTransactionProperties = new TransactionProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("azureCreditApplied".equals(fieldName)) {
deserializedTransactionProperties.azureCreditApplied
= TransactionPropertiesAzureCreditApplied.fromJson(reader);
} else if ("azurePlan".equals(fieldName)) {
deserializedTransactionProperties.azurePlan = reader.getString();
} else if ("billingCurrency".equals(fieldName)) {
deserializedTransactionProperties.billingCurrency = reader.getString();
} else if ("billingProfileDisplayName".equals(fieldName)) {
deserializedTransactionProperties.billingProfileDisplayName = reader.readUntyped();
} else if ("billingProfileId".equals(fieldName)) {
deserializedTransactionProperties.billingProfileId = reader.getString();
} else if ("consumptionCommitmentDecremented".equals(fieldName)) {
deserializedTransactionProperties.consumptionCommitmentDecremented
= TransactionPropertiesConsumptionCommitmentDecremented.fromJson(reader);
} else if ("customerDisplayName".equals(fieldName)) {
deserializedTransactionProperties.customerDisplayName = reader.getString();
} else if ("customerId".equals(fieldName)) {
deserializedTransactionProperties.customerId = reader.getString();
} else if ("creditType".equals(fieldName)) {
deserializedTransactionProperties.creditType = CreditType.fromString(reader.getString());
} else if ("date".equals(fieldName)) {
deserializedTransactionProperties.date = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("discount".equals(fieldName)) {
deserializedTransactionProperties.discount = reader.getNullable(JsonReader::getFloat);
} else if ("effectivePrice".equals(fieldName)) {
deserializedTransactionProperties.effectivePrice
= TransactionPropertiesEffectivePrice.fromJson(reader);
} else if ("exchangeRate".equals(fieldName)) {
deserializedTransactionProperties.exchangeRate = reader.getNullable(JsonReader::getFloat);
} else if ("invoice".equals(fieldName)) {
deserializedTransactionProperties.invoice = reader.getString();
} else if ("invoiceId".equals(fieldName)) {
deserializedTransactionProperties.invoiceId = reader.getString();
} else if ("invoiceSectionDisplayName".equals(fieldName)) {
deserializedTransactionProperties.invoiceSectionDisplayName = reader.getString();
} else if ("invoiceSectionId".equals(fieldName)) {
deserializedTransactionProperties.invoiceSectionId = reader.getString();
} else if ("isThirdParty".equals(fieldName)) {
deserializedTransactionProperties.isThirdParty = reader.getNullable(JsonReader::getBoolean);
} else if ("kind".equals(fieldName)) {
deserializedTransactionProperties.kind = TransactionKind.fromString(reader.getString());
} else if ("marketPrice".equals(fieldName)) {
deserializedTransactionProperties.marketPrice = TransactionPropertiesMarketPrice.fromJson(reader);
} else if ("partNumber".equals(fieldName)) {
deserializedTransactionProperties.partNumber = reader.getString();
} else if ("pricingCurrency".equals(fieldName)) {
deserializedTransactionProperties.pricingCurrency = reader.getString();
} else if ("productDescription".equals(fieldName)) {
deserializedTransactionProperties.productDescription = reader.getString();
} else if ("productFamily".equals(fieldName)) {
deserializedTransactionProperties.productFamily = reader.getString();
} else if ("productTypeId".equals(fieldName)) {
deserializedTransactionProperties.productTypeId = reader.getString();
} else if ("productType".equals(fieldName)) {
deserializedTransactionProperties.productType = reader.getString();
} else if ("quantity".equals(fieldName)) {
deserializedTransactionProperties.quantity = reader.getNullable(JsonReader::getInt);
} else if ("reasonCode".equals(fieldName)) {
deserializedTransactionProperties.reasonCode = reader.getString();
} else if ("servicePeriodStartDate".equals(fieldName)) {
deserializedTransactionProperties.servicePeriodStartDate = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("servicePeriodEndDate".equals(fieldName)) {
deserializedTransactionProperties.servicePeriodEndDate = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("subTotal".equals(fieldName)) {
deserializedTransactionProperties.subTotal = TransactionPropertiesSubTotal.fromJson(reader);
} else if ("tax".equals(fieldName)) {
deserializedTransactionProperties.tax = TransactionPropertiesTax.fromJson(reader);
} else if ("transactionAmount".equals(fieldName)) {
deserializedTransactionProperties.transactionAmount
= TransactionPropertiesTransactionAmount.fromJson(reader);
} else if ("transactionType".equals(fieldName)) {
deserializedTransactionProperties.transactionType = reader.getString();
} else if ("units".equals(fieldName)) {
deserializedTransactionProperties.units = reader.getNullable(JsonReader::getFloat);
} else if ("unitOfMeasure".equals(fieldName)) {
deserializedTransactionProperties.unitOfMeasure = reader.getString();
} else if ("unitType".equals(fieldName)) {
deserializedTransactionProperties.unitType = reader.getString();
} else if ("specialTaxationType".equals(fieldName)) {
deserializedTransactionProperties.specialTaxationType
= SpecialTaxationType.fromString(reader.getString());
} else if ("refundTransactionDetails".equals(fieldName)) {
deserializedTransactionProperties.refundTransactionDetails
= TransactionPropertiesRefundTransactionDetails.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedTransactionProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy