Can't cancel subscription

63 views
Skip to first unread message

Олександр Силка

unread,
Feb 10, 2021, 12:23:16 PM2/10/21
to Kill Bill users mailing-list
I have created account in killbill on  2021-02-01 so created date in db 2021-02-01 12:50:57 then subscribed this account to plan with billing in arrear (subscriptions?entitlementDate=2021-02-01&billingDate=2021-02-01&bcd=1) subscription created date 2021-02-01 12:52:13.
 Few days later(2021-02-10) I am trying to remove this subscription (1.0/kb/subscriptions/3d1612ae-8c56-4dc3-9977-b2cf3e8cc411?requestedDate=2021-02-01&useRequestedDateForBilling=true) but received next error 
Caused by: org.killbill.billing.client.KillBillClientException: Requested date 2021-02-01T12:50:57.000Z is not allowed to be prior to the previous transition 2021-02-01T12:52:13.000Z

So it's not clear for me why this date in error message (looks like it's requested date + time from account created date 2021-02-01T12:50:57.000Z)  I am passing date without time and what is  previous transition (subscription created date ?) ? Is it bug or expected logic ? How I can cancel subscription in this case 

stephane brossier

unread,
Feb 10, 2021, 8:05:43 PM2/10/21
to Олександр Силка, Kill Bill users mailing-list
It seems like a bug. Which version are you using?

Also are the details of the requests exactly as you wrote them or not really -- e.g latest version there is no query param to pass a BCD, so just wondering.



--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/28fddc76-76e0-4109-8efe-b82e44de1216n%40googlegroups.com.

alemut...@gmail.com

unread,
Jan 4, 2022, 5:26:52 AM1/4/22
to Kill Bill users mailing-list
Hi, we are facing same issue on killbill:0.22.20. The problem is when we try to delete a subscription in the same month of it's creation date.

here is the step we used:
create subscription on 2021-01-02
update bcd to 1
delete subscription passing request params ?useRequestedDateForBilling=true&billingPolicy=START_OF_TERM&requestedDate=2021-01-26


if we remove these params the invoices are not being generated with correct amount.
snippet of the log:

2021-12-02
 POST http://localhost:8444/1.0/kb/subscriptions?billingDate=2021-01-02&entitlementDate=2021-01-02
 201
235512 < Location: http://localhost:8444/1.0/kb/subscriptions/76ffcc18-9d8c-43bb-8183-280cf9b480e4
 
 PUT http://localhost:8444/1.0/kb/subscriptions/76ffcc18-9d8c-43bb-8183-280cf9b480e4/bcd?bcd=1&forceNewBcdWithPastEffectiveDate=true&effectiveFromDate=2021-01-02
 
 2021-12-02 18:35:08,434 [http-nio-127.0.0.1-8444-exec-20] INFO  o.k.b.e.api.DefaultEntitlement - Update Entitlement BCD:  id = '76ffcc18-9d8c-43bb-8183-280cf9b480e4', newBCD='1', date='2021-01-02'
2021-12-02 18:35:08,459 [bus_events-th] INFO  o.k.b.beatrix.extbus.BeatrixListener - Sending extBusEvent='DefaultBusExternalEvent{objectId=76ffcc18-9d8c-43bb-8183-280cf9b480e4, accountId=561c0b18-e440-4bc7-89f1-454649c92c70, tenantId=d86c4277-a9b9-44d4-af8d-15f419cc7125, objectType=SUBSCRIPTION, eventType=SUBSCRIPTION_BCD_CHANGE}' from busEvent='DefaultRequestedSubscriptionEvent{bundleId=43fb31da-6f08-4dff-b4e9-0f8d21764bd4, totalOrdering=0, subscriptionId=76ffcc18-9d8c-43bb-8183-280cf9b480e4, eventId=94965e3c-72f1-47fd-90e4-754487379be3, requestedTransitionTime=2021-02-01T19:14:31.000Z, effectiveTransitionTime=2021-02-01T19:14:31.000Z, previousState=null, previousPriceList='null', previousBillCycleDayLocal='null', previousPlan='null', previousPhase='null', nextState=null, nextPriceList='null', nextBillCycleDayLocal='null', nextPlan='null', nextPhase='null', remainingEventsForUserOperation=0, transitionType=BCD_CHANGE, startDate=null}'
2021-12-02 18:35:08,461 [http-nio-127.0.0.1-8444-exec-20] INFO  c.s.j.a.c.filter.LoggingFilter - 235513 * Server out-bound response
235513 < 204
235513 < Content-Type: application/json
235513 < Vary: Accept-Encoding
235513 <


DELETE http://localhost:8444/1.0/kb/subscriptions/76ffcc18-9d8c-43bb-8183-280cf9b480e4?useRequestedDateForBilling=true&billingPolicy=START_OF_TERM&requestedDate=2021-01-26

2021-12-02 18:35:15,813 [http-nio-127.0.0.1-8444-exec-18] INFO  o.k.b.e.api.DefaultEntitlement - Cancel Entitlement:  id = '76ffcc18-9d8c-43bb-8183-280cf9b480e4', entDate='2021-01-26', billPolicy='START_OF_TERM'
2021-12-02 18:35:15,834 [http-nio-127.0.0.1-8444-exec-18] WARN  o.k.b.jaxrs.mappers.LoggingResponse - Bad request
org.killbill.billing.subscription.api.user.SubscriptionBaseApiException: Requested date 2021-01-02T19:14:31.000Z is not allowed to be prior to the previous transition 2021-02-01T19:14:31.000Z
        at org.killbill.billing.subscription.api.user.DefaultSubscriptionBaseApiService.validateEffectiveDate(DefaultSubscriptionBaseApiService.java:710)
        at org.killbill.billing.subscription.api.user.DefaultSubscriptionBaseApiService.doCancelPlan(DefaultSubscriptionBaseApiService.java:271)
        at org.killbill.billing.subscription.api.user.DefaultSubscriptionBaseApiService.cancelWithPolicyNoValidationAndCatalog(DefaultSubscriptionBaseApiService.java:239)
        at org.killbill.billing.subscription.api.user.DefaultSubscriptionBaseApiService.cancelWithPolicy(DefaultSubscriptionBaseApiService.java:220)
        at org.killbill.billing.subscription.api.user.DefaultSubscriptionBase.cancelWithPolicy(DefaultSubscriptionBase.java:280)
        at org.killbill.billing.entitlement.api.DefaultEntitlement$3.doCall(DefaultEntitlement.java:501)
        at org.killbill.billing.entitlement.api.DefaultEntitlement$3.doCall(DefaultEntitlement.java:490)
        at org.killbill.billing.entitlement.api.EntitlementPluginExecution.executeWithPlugin(EntitlementPluginExecution.java:97)
        at org.killbill.billing.entitlement.api.DefaultEntitlement.cancelEntitlementWithDateOverrideBillingPolicy(DefaultEntitlement.java:520)
        at org.killbill.billing.jaxrs.resources.SubscriptionResource$3.doOperation(SubscriptionResource.java:623)
        at org.killbill.billing.jaxrs.resources.SubscriptionResource$3.doOperation(SubscriptionResource.java:607)
        at org.killbill.billing.jaxrs.resources.SubscriptionResource$EntitlementCallCompletion.withSynchronization(SubscriptionResource.java:832)
        at org.killbill.billing.jaxrs.resources.SubscriptionResource.cancelSubscriptionPlan(SubscriptionResource.java:654)
        at org.killbill.commons.skeleton.metrics.TimedResourceInterceptor.invoke(TimedResourceInterceptor.java:72)
        at org.killbill.billing.server.modules.JaxRSAopModule$JaxRsMethodInterceptor$1.execute(JaxRSAopModule.java:87)
        at org.killbill.billing.util.entity.dao.DBRouterUntyped.withRODBIAllowed(DBRouterUntyped.java:57)
        at org.killbill.billing.server.modules.JaxRSAopModule$JaxRsMethodInterceptor.invoke(JaxRSAopModule.java:82)
        at sun.reflect.GeneratedMethodAccessor499.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
        at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:290)
        at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:280)
        at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:184)
        at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:89)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85)
        at org.killbill.billing.server.security.TenantFilter.doFilter(TenantFilter.java:111)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at org.killbill.billing.server.filters.ResponseCorsFilter.doFilter(ResponseCorsFilter.java:75)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at ch.qos.logback.classic.helpers.MDCInsertingServletFilter.doFilter(MDCInsertingServletFilter.java:49)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
        at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.shiro.guice.web.SimpleFilterChain.doFilter(SimpleFilterChain.java:44)
        at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
        at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
        at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
        at org.apache.shiro.guice.web.SimpleFilterChain.doFilter(SimpleFilterChain.java:41)
        at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
        at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
        at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
        at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
        at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
        at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
        at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:111)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:880)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1601)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
2021-12-02 18:35:15,834 [http-nio-127.0.0.1-8444-exec-18] INFO  c.s.j.a.c.filter.LoggingFilter - 235524 * Server out-bound response
235524 < 400
235524 < Content-Type: application/json
235524 < Vary: Accept-Encoding
235524 <


235525 > DELETE http://localhost:8444/1.0/kb/subscriptions/76ffcc18-9d8c-43bb-8183-280cf9b480e4?useRequestedDateForBilling=true&requestedDate=2021-01-26

021-12-02 18:35:15,980 [http-nio-127.0.0.1-8444-exec-24] INFO  o.k.b.e.api.DefaultEntitlement - Cancel Entitlement:  id = '76ffcc18-9d8c-43bb-8183-280cf9b480e4', entDate='2021-01-26', overrideBillDate='true'
2021-12-02 18:35:16,000 [http-nio-127.0.0.1-8444-exec-24] WARN  o.k.b.jaxrs.mappers.LoggingResponse - Bad request
org.killbill.billing.subscription.api.user.SubscriptionBaseApiException: Requested date 2021-01-26T19:14:31.000Z is not allowed to be prior to the previous transition 2021-02-01T19:14:31.000Z
        at org.killbill.billing.subscription.api.user.DefaultSubscriptionBaseApiService.validateEffectiveDate(DefaultSubscriptionBaseApiService.java:710)
        at org.killbill.billing.subscription.api.user.DefaultSubscriptionBaseApiService.doCancelPlan(DefaultSubscriptionBaseApiService.java:271)
        at org.killbill.billing.subscription.api.user.DefaultSubscriptionBaseApiService.cancelWithRequestedDate(DefaultSubscriptionBaseApiService.java:208)

Thanks
Reply all
Reply to author
Forward
0 new messages