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

payment: perform AUTO_PAY_OFF check early when paying invoices #1234

Merged
merged 15 commits into from Oct 9, 2019

Conversation

@pierre
Copy link
Member

commented Oct 1, 2019

This fixes #812, #1193 and #1211.

pierre added 2 commits Oct 1, 2019
This fixes #812.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
@pierre pierre requested a review from sbrossie Oct 1, 2019
…_auto_pay_off

This wasn't needed and lets us support AUTO_PAY_OFF accounts without a
default payment method.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
@pierre pierre removed the request for review from sbrossie Oct 1, 2019
pierre added 2 commits Oct 2, 2019
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
pierre added 8 commits Oct 2, 2019
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
This fixes #1193.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
See #1193.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
This fixes #1211.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
@pierre pierre requested a review from sbrossie Oct 2, 2019
@pierre

This comment has been minimized.

Copy link
Member Author

commented Oct 2, 2019

@sbrossie Assuming CircleCi is green, this should be ready to be reviewed now.

if (spec.getBillingEffectiveDate() != null) {
final LocalDate nowInAccountTimeZone = new LocalDate(callContext.getCreatedDate(), spec.getBillingEffectiveDate().getChronology().getZone());
if (spec.getBillingEffectiveDate().isAfter(nowInAccountTimeZone)) {
isImmediateOp = false;

This comment has been minimized.

Copy link
@sbrossie

sbrossie Oct 7, 2019

Member

I am questioning whether this logic will lead to the right expectation:

  • isImmediateOp = false => this was obtained by checking that spec#getBillingEffectiveDate is not null and is in the future, all good.
  • isImmediateOp = true => obtained as a default for when prev condition is not met. However, prev condition only checked that spec#getBillingEffectiveDate is not null and is in the future, but we could still have spec.getBillingEffectiveDate().is**Not**After(nowInAccountTimeZone) and yet have a date that is in the future ?

This comment has been minimized.

Copy link
@pierre

pierre Oct 8, 2019

Author Member

Good catch! See 60f3dfe.

The only downside is that I had to re-use some of the logic internal to InternalCallContextFactory inside jaxrs.


// Retrieve the tags for the ACCOUNT object to correctly implement callCompletion in the simple use-cases.
// In reality, this is much more complex though and not all scenarii are supported (e.g. entitlement plugin could add some tags on the fly).
final List<Tag> accountTags = tagUserApi.getTagsForAccountType(account.getId(), ObjectType.ACCOUNT, false, callContext);

This comment has been minimized.

Copy link
@sbrossie

sbrossie Oct 7, 2019

Member

Should we only fetch those when callCompletion = true ?

This comment has been minimized.

Copy link
@pierre

pierre Oct 8, 2019

Author Member

Good point, see 895e4d2.

pierre added 2 commits Oct 8, 2019
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
…uture

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
@sbrossie sbrossie merged commit 745aac9 into work-for-release-0.21.x Oct 9, 2019
5 checks passed
5 checks passed
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: integration-tests Your tests passed on CircleCI!
Details
ci/circleci: test-h2 Your tests passed on CircleCI!
Details
ci/circleci: test-mysql Your tests passed on CircleCI!
Details
ci/circleci: test-postgresql Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.