From 5c33e2f8f4d5f9c2f99528ade975f3126392f84d Mon Sep 17 00:00:00 2001 From: Matteo Giordano Date: Thu, 25 Jun 2020 12:03:00 +0200 Subject: [PATCH] Expose invoice currency conversion --- .../apiclient/dto/model/dto/InvoiceDTO.java | 42 ++++++++++++------- .../apiclient/dto/model/dto/OrderLineDTO.java | 13 ++++++ 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/cloudesire-api-client-dto/src/main/java/com/cloudesire/platform/apiclient/dto/model/dto/InvoiceDTO.java b/cloudesire-api-client-dto/src/main/java/com/cloudesire/platform/apiclient/dto/model/dto/InvoiceDTO.java index 1e9746504..68ccb17fa 100644 --- a/cloudesire-api-client-dto/src/main/java/com/cloudesire/platform/apiclient/dto/model/dto/InvoiceDTO.java +++ b/cloudesire-api-client-dto/src/main/java/com/cloudesire/platform/apiclient/dto/model/dto/InvoiceDTO.java @@ -12,22 +12,23 @@ import java.util.Date; import java.util.EnumSet; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.Set; @ApiModel( description = "An invoice generated by the platform after a customer order" ) public class InvoiceDTO extends BaseInvoiceDTO { - @ApiModelProperty( value = "The amount to be paid" ) + @ApiModelProperty( "The amount to be paid" ) protected VATPriceDTO total; - @ApiModelProperty( value = "Who will pay the invoice" ) + @ApiModelProperty( "Who will pay the invoice" ) private UrlEntityDTO nominee; - @ApiModelProperty( value = "If the invoice emission and payment is handled by vendor/reseller or by the platform" ) + @ApiModelProperty( "If the invoice emission and payment is handled by vendor/reseller or by the platform" ) private boolean selfBilled = false; - @ApiModelProperty( value = "If this invoice is subject to the Italian electronic document tax" ) + @ApiModelProperty( "If this invoice is subject to the Italian electronic document tax" ) private boolean stampDuty = false; @NotNull @@ -35,49 +36,52 @@ public class InvoiceDTO extends BaseInvoiceDTO private String type = "NORMAL"; @NotNull - @ApiModelProperty( value = "The product name this invoice refers to" ) + @ApiModelProperty( "The product name this invoice refers to" ) private String product = "N/A"; @NotNull - @ApiModelProperty( value = "The ProductVersion name this invoice refers to" ) + @ApiModelProperty( "The ProductVersion name this invoice refers to" ) private String productVersion = "N/A"; @JsonInclude ( JsonInclude.Include.NON_EMPTY ) - @ApiModelProperty( value = "A reference of a successful payment" ) + @ApiModelProperty( "A reference of a successful payment" ) private String paymentReference; @JsonInclude ( JsonInclude.Include.NON_EMPTY ) - @ApiModelProperty( value = "When the payment of the invoice has completed successfully" ) + @ApiModelProperty( "When the payment of the invoice has completed successfully" ) private Date paymentReceived; @JsonInclude ( JsonInclude.Include.NON_EMPTY ) - @ApiModelProperty( value = "The last payment error if any" ) + @ApiModelProperty( "The last payment error if any" ) private String lastPaymentError; private UrlEntityDTO subscription; private UrlEntityDTO order; - @ApiModelProperty( value = "The operations that can be executed by the current user on the invoice" ) + @ApiModelProperty( "The operations that can be executed by the current user on the invoice" ) private Set availableOperations = EnumSet.noneOf( InvoiceOperationType.class ); - @ApiModelProperty( value = "The reference to a PDF version of the invoice" ) + @ApiModelProperty( "The reference to a PDF version of the invoice" ) private String remoteId; - @ApiModelProperty( value = "The quota received by the platform owner when the invoice has been issued" ) + @ApiModelProperty( "The quota received by the platform owner when the invoice has been issued" ) private BigDecimal revenueSharingQuota; @ApiModelProperty( "The billed lines of the invoice" ) private List entries; - @ApiModelProperty( value = "If the invoice has been generated by the vendor/reseller" ) + @ApiModelProperty( "If the invoice has been generated by the vendor/reseller" ) private Boolean cashed; private InvoiceStatus status; - @ApiModelProperty( value = "Who resold the Product" ) + @ApiModelProperty( "Who resold the Product" ) private UrlEntityDTO reseller; + @ApiModelProperty( "Currency conversion factors at the invoice's issue" ) + private Map currencyConversion; + /** * @deprecated use {@link #getTotal()} */ @@ -374,6 +378,16 @@ public void setLastPaymentError( String lastPaymentError ) this.lastPaymentError = lastPaymentError; } + public Map getCurrencyConversion() + { + return currencyConversion; + } + + public void setCurrencyConversion( Map currencyConversion ) + { + this.currencyConversion = currencyConversion; + } + /** * @deprecated by {@code getStatus()} */ diff --git a/cloudesire-api-client-dto/src/main/java/com/cloudesire/platform/apiclient/dto/model/dto/OrderLineDTO.java b/cloudesire-api-client-dto/src/main/java/com/cloudesire/platform/apiclient/dto/model/dto/OrderLineDTO.java index 15ffbb4f1..65a64bf2a 100644 --- a/cloudesire-api-client-dto/src/main/java/com/cloudesire/platform/apiclient/dto/model/dto/OrderLineDTO.java +++ b/cloudesire-api-client-dto/src/main/java/com/cloudesire/platform/apiclient/dto/model/dto/OrderLineDTO.java @@ -54,6 +54,9 @@ public class OrderLineDTO implements Line @ApiModelProperty( "Custom billing identifier" ) private String identifier; + @ApiModelProperty( "Original line currency" ) + private String originalCurrency; + /** * @deprecated by {@link #getSubtotal()} */ @@ -214,6 +217,16 @@ public void setIdentifier( String identifier ) this.identifier = identifier; } + public String getOriginalCurrency() + { + return originalCurrency; + } + + public void setOriginalCurrency( String originalCurrency ) + { + this.originalCurrency = originalCurrency; + } + @Override public boolean equals( Object o ) {