Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not overwrite itemDetails for invoice tax items which contains some value there #44

Merged
merged 9 commits into from
Aug 16, 2024

Conversation

vlaskhilkevich
Copy link
Collaborator

@vlaskhilkevich vlaskhilkevich commented Aug 10, 2024

This PR -

@vlaskhilkevich vlaskhilkevich changed the title Support consistency with existing KB invoice items where tierDetails Support consistency with existing KB invoice items where tierDetails is presented Aug 10, 2024
@vlaskhilkevich vlaskhilkevich changed the title Support consistency with existing KB invoice items where tierDetails is presented Support consistency in item details values with existing KB invoice items where tierDetails is presented Aug 10, 2024
Comment on lines 41 to 52
public TaxItemDetails(@Nonnull final Double taxRate, @Nullable final UsageConsumableInArrearAggregate usageDetail) {
this(taxRate, usageDetail != null ? usageDetail.getTierDetails() : null, usageDetail != null ? usageDetail.getAmount() : null);
}

@JsonCreator
public TaxItemDetails(@JsonProperty("taxRate") final Double taxRate,
@JsonProperty("tierDetails") List<UsageConsumableInArrearTierUnitAggregate> tierDetails,
@JsonProperty("amount") BigDecimal amount) {
this.tierDetails = tierDetails;
this.amount = amount;
this.taxRate = taxRate;
}
Copy link
Collaborator

@singh-sukhvir singh-sukhvir Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if Killbill adds more details than just tiers and amount. itemDetails is a json string ( it could contain any information not just tiers/amount). Can't we do something like below without even having to use object TaxItemDetails for the same.


                ObjectMapper mapper = new ObjectMapper();
                JsonNode actualObj = mapper. readTree(itemDetails);
                ((ObjectNode) actualObj).put("taxRate", 1.0);

Copy link
Collaborator Author

@vlaskhilkevich vlaskhilkevich Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's great suggestion 👍, I didn't like the way how vertex plugin became exposed to invoice module implementation details of KB and it's specific version defined in pom.xml, missed this simple approach.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 028ba4a

pom.xml Outdated
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.4.1</version>
Copy link
Collaborator Author

@vlaskhilkevich vlaskhilkevich Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to update jackson-annotations and jackson-core to be compatible (as to upperBind version enforcements warning)

@vlaskhilkevich vlaskhilkevich changed the title Support consistency in item details values with existing KB invoice items where tierDetails is presented Support consistency in item details values with existing KB invoice items where itemDetails is presented Aug 13, 2024
@vlaskhilkevich vlaskhilkevich changed the title Support consistency in item details values with existing KB invoice items where itemDetails is presented Do not overwrite itemDetails for invoice tax items it's not empty Aug 13, 2024
@vlaskhilkevich vlaskhilkevich changed the title Do not overwrite itemDetails for invoice tax items it's not empty Do not overwrite itemDetails for invoice tax items where it's not empty Aug 13, 2024
@vlaskhilkevich vlaskhilkevich changed the title Do not overwrite itemDetails for invoice tax items where it's not empty Do not overwrite itemDetails for invoice tax items which contains some value there Aug 13, 2024
@singh-sukhvir singh-sukhvir merged commit 9cda610 into master Aug 16, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants