Invoice not generated on phase change

90 views
Skip to first unread message

julien...@champs-libres.coop

unread,
Mar 30, 2018, 9:25:30 AM3/30/18
to Kill Bill users mailing-list
Hi,

I am quite disappointed with our killbill instance: kill bill does not generate invoice on phase change.

Our catalog has several product with a first trial period of 30 days. After 30 days, the plan change, but the invoice is not generated.

When I trigger a dry-run invoice, the invoice is generated correctly with the correct price and date. I can persist this invoice without any problem.

In KAUI, the "next invoice date" was N/A before the invoice generation, and is set to the next correct date after the generation. I also see a "invoice-service:next-billing-date-queue" in the queue in KAUI, but this was not the case before.

I do not know how to begin for debugging this. Is this linked to our catalog ? But all worked perfectly in dev mode when I changed date/time. Linked to our install ? We use docker container in swarm with a mysql database installed in a different server, which is fully persistant.  I didn't set any additionnal parameters to our killbill's docker container, but I read something about configuring the queue (https://github.com/killbill/killbill/wiki/Kill-Bill-Bus-and-Notification-Queue-Configuration). Did I miss something important there ?

Our full catalog is here (in a gist for more readability): https://gist.github.com/julienfastre/4548dfcebb45b94ecad3f71043e4f4a9.

We use Killbill 0.18.16.

Thanks for your help.
Julien Fastré

stephane brossier

unread,
Mar 30, 2018, 1:12:54 PM3/30/18
to Julien Fastré, Kill Bill users mailing-list
Julien,

The invoice generation on PHASE change is one of the most tested scenario, we have 100x of tests based on Plans that have 2 Phases.

Where to start?
  • Check your log for any exceptions -- maybe the server could not write on the database, ... ?
  • I am assuming if you were able to test this on your dev environment by moving the clock, then your catalog is correct. are you using the same catalog? what changed between the 2 systems?
  • Troubleshooting:

Given a subscription with a PHASE event, you should see the following in your table -- 2 entries in subscription_events tables-- and what is important you should see a notification in the notifications table  (or notifications_history if already processed). In the example below you see in red the notification event that will trigger that phase change.


select id, effective_date, event_type, subscription_id, event_type, user_type, plan_name, phase_name from subscription_events where subscription_id = '7766061a-951a-41ad-9994

*************************** 1. row ***************************

             id: f98ba428-6a51-43b0-9cd9-ef9003eddadf

 effective_date: 2013-08-02 18:00:00

     event_type: API_USER

subscription_id: 7766061a-951a-41ad-9994-130f9fc4d956

     event_type: API_USER

      user_type: CREATE

      plan_name: sports-monthly

     phase_name: sports-monthly-trial

*************************** 2. row ***************************

             id: 336d98f3-195b-4e2a-a8a8-85f17cfabbfd

 effective_date: 2013-09-01 18:00:00

     event_type: PHASE

subscription_id: 7766061a-951a-41ad-9994-130f9fc4d956

     event_type: PHASE

      user_type: NULL

      plan_name: NULL

     phase_name: sports-monthly-evergreen




select * from notifications_history where search_key1 = 59\G
*************************** 1. row ***************************
                record_id: 16
               class_name: org.killbill.billing.invoice.notification.NextBillingDateNotificationKey
               event_json: {"uuidKey":null,"uuidKeys":["7766061a-951a-41ad-9994-130f9fc4d956"],"targetDate":"2013-09-01T18:00:00.000Z","isDryRunForInvoiceNotification":true,"isRescheduled":null}
               user_token: a04258fd-cd1b-49de-aad8-2d9c50f429e2
              error_count: 0
              search_key1: 59
              search_key2: 161
               queue_name: invoice-service:next-billing-date-queue
           effective_date: 2013-08-30 18:00:00
        future_user_token: 9f28634f-2cc0-4d18-ab80-b4de75fc37ba
*************************** 2. row ***************************
                record_id: 17
               class_name: org.killbill.billing.subscription.engine.core.SubscriptionNotificationKey
               event_json: {"eventId":"336d98f3-195b-4e2a-a8a8-85f17cfabbfd","seqId":0}
               user_token: a04258fd-cd1b-49de-aad8-2d9c50f429e2
              error_count: 0
              search_key1: 59
              search_key2: 161
               queue_name: subscription-service:subscription-events
           effective_date: 2013-09-01 18:00:00
        future_user_token: 05e11cd1-0e6a-4c16-986e-cea1c9c4d746



Hope this helps,

Stéphane





--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to killbilling-users@googlegroups.com.
Visit this group at https://groups.google.com/group/killbilling-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/935a7cf1-15cc-483c-a2c5-01d5a3d8d4e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julien Fastré

unread,
Mar 31, 2018, 12:16:44 PM3/31/18
to stephane brossier, Kill Bill users mailing-list
Stephane,

I am positively sure that Kill Bill is well tested.

Thanks for your hint. I will start to track the entries you mention in
the database. It the easter week-end, I will start this next week.

Julien

Le 30/03/18 à 19:12, stephane brossier a écrit :
> Julien,
>
> The invoice generation on PHASE change is one of the most tested
> scenario, we have 100x of tests based on Plans that have 2 Phases.
>
> Where to start?
>
> * Check your log for any exceptions -- maybe the server could not
> write on the database, ... ?
> * I am assuming if you were able to test this on your dev environment
> by moving the clock, then your catalog is correct. are you using the
> same catalog? what changed between the 2 systems?
> * Troubleshooting:
>
>
> Given a subscription with a PHASE event, you should see the following in
> your table -- 2 entries in /subscription_events/ tables-- and what is
> important you should see a notification in the /notifications/ table 
> (or /notifications_history /if already processed). In the example below
> <https://github.com/killbill/killbill/wiki/Kill-Bill-Bus-and-Notification-Queue-Configuration>).
> Did I miss something important there ?
>
> Our full catalog is here (in a gist for more readability):
> https://gist.github.com/julienfastre/4548dfcebb45b94ecad3f71043e4f4a9 <https://gist.github.com/julienfastre/4548dfcebb45b94ecad3f71043e4f4a9>.
>
> We use Killbill 0.18.16.
>
> Thanks for your help.
> Julien Fastré
>
> --
> 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
> <mailto:killbilling-us...@googlegroups.com>.
> To post to this group, send email to
> killbill...@googlegroups.com
> <mailto:killbill...@googlegroups.com>.
> <https://groups.google.com/group/killbilling-users>.
> <https://groups.google.com/d/msgid/killbilling-users/935a7cf1-15cc-483c-a2c5-01d5a3d8d4e8%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>

--
Julien Fastré
Champs Libres
http://www.champs-libres.coop
+32 486 540 660

Champs Libres Cooperative SCRLFS
Rue Nanon 98 - 5000 Namur - Belgique
BE0541.427.670
Reply all
Reply to author
Forward
0 new messages