-
-
Notifications
You must be signed in to change notification settings - Fork 888
Fix overrides bug #2071
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
Fix overrides bug #2071
Conversation
|
If you agree that this is a bug, I can write a test for this fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK with the fix.
- I would suggest to even throw if we end up with null currency as it will break down the line
- Is there a way add a small test (if easy)
|
For 2/- above, I've added a test See c29ce39. |
| requestOptions); | ||
| callbackServlet.assertListenerStatus(); | ||
| final Subscription subscription = subscriptionApi.getSubscription(entitlementJson.getSubscriptionId(), requestOptions); | ||
| Assert.assertEquals(subscription.getState(), EntitlementState.ACTIVE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way we could check that price was correctly overridden - would subscription#getLastActivePlan() provide such info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 984a82d
| for (final PhasePriceJson input : priceOverrides) { | ||
| Preconditions.checkNotNull(input); | ||
|
|
||
| Preconditions.checkArgument(input.getFixedPrice() != null || input.getRecurringPrice() != null || input.getUsagePrices() != null || (input.getUsagePrices() != null && !input.getUsagePrices().isEmpty()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove the input.getUsagePrices() != null and simply keep the (input.getUsagePrices() != null && !input.getUsagePrices().isEmpty()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 984a82d
| final PlanPhaseSpecifier planPhaseSpecifier = spec.getPlanName() != null ? | ||
| new PlanPhaseSpecifier(spec.getPlanName(), phaseType) : | ||
| new PlanPhaseSpecifier(spec.getProductName(), spec.getBillingPeriod(), spec.getPriceListName(), phaseType); | ||
| final Currency resolvedCurrency = input.getFixedPrice() != null || input.getRecurringPrice() != null || (input.getUsagePrices() != null && !input.getUsagePrices().isEmpty()) ? currency : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I don't think this is needed.
There is a bug in the code due to which it is currently not possible to override a usage price by itself, it is necessary to update either a fixed or a recurring price too. This PR attempts to address this bug.
See this comment.