killbill / killbill-analytics-plugin

Kill Bill plugin for financial reporting
https://killbill.io
Apache License 2.0
12 stars 32 forks source link

Incorrect use a catalog api leads to `Could not find a plan matching spec` #70

Open sbrossie opened 7 years ago

sbrossie commented 7 years ago

The issue was reported on the mailing list, and i could easily reproduce it:

org.apache.felix.log.LogException: org.killbill.billing.catalog.api.CatalogApiException: Could not find a plan matching spec: (plan: 'MALTESTPRODUCT_MONTHLY', product: 'undefined', billing period: 'undefined', pricelist 'undefined')
        at org.killbill.billing.catalog.VersionedCatalog.findCatalogPlanEntry(VersionedCatalog.java:186)
        at org.killbill.billing.catalog.VersionedCatalog.findPlan(VersionedCatalog.java:301)
        at org.killbill.billing.catalog.VersionedCatalog.findPhase(VersionedCatalog.java:332)
        at org.killbill.billing.plugin.analytics.dao.factory.BusinessFactoryBase.getPlanPhaseFromInvoiceItem(BusinessFactoryBase.java:381)
        at org.killbill.billing.plugin.analytics.dao.factory.BusinessContextFactory.getPlanPhaseFromInvoiceItem(BusinessContextFactory.java:401)
        at org.killbill.billing.plugin.analytics.dao.factory.BusinessInvoiceFactory.createBusinessInvoiceItem(BusinessInvoiceFactory.java:244)
        at org.killbill.billing.plugin.analytics.dao.factory.BusinessInvoiceFactory.createBusinessInvoiceItem(BusinessInvoiceFactory.java:190)
        at org.killbill.billing.plugin.analytics.dao.factory.BusinessInvoiceFactory.access$000(BusinessInvoiceFactory.java:65)
        at org.killbill.billing.plugin.analytics.dao.factory.BusinessInvoiceFactory$1.call(BusinessInvoiceFactory.java:117)
        at org.killbill.billing.plugin.analytics.dao.factory.BusinessInvoiceFactory$1.call(BusinessInvoiceFactory.java:114)
sbrossie commented 7 years ago

See discussion a out catalog api in this comment

sbrossie commented 7 years ago

The fix above is a partial fix: It allows to pass the subscriptionStartDate, but analytics code converts that date from LocalDate to DateTime using toDateTimeAtStartOfDay.

When creating new catalog entries and right away subscribing to plans, we have a lot of chances to hit this problem -- reported on the mailing list several times.

I am suggesting to make a fix at KB core level

Arulraj12 commented 6 years ago

Hi, Is this issue still open in 0.18.14? If there, what is the workaround solution and how long need to wait for subscription like 30 second sleep?

sbrossie commented 6 years ago

I believe this has been fixed, but if this is not the case, please provide a scenario we can use to reproduce -- test against 0.18.17.

On Wed, Feb 7, 2018 at 6:51 AM, Arulraj12 notifications@github.com wrote:

Hi, Is this issue still open in 0.18.14? If there, what is the workaround solution and how long need to wait for subscription like 30 second sleep?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/killbill/killbill-analytics-plugin/issues/70#issuecomment-363792494, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPEfv1T-sMcKUruAhPsVHzgnNAfMb9zks5tSbhogaJpZM4Mzhct .