Serge Bazanski | fa818da | 2021-05-06 00:12:53 +0200 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | package invoice; |
| 3 | option go_package = "code.hackerspace.pl/hscloud/bgpwtf/invoice/proto"; |
| 4 | |
| 5 | import "bgpwtf/invoice/proto/invoice.proto"; |
| 6 | |
| 7 | // Subscription is the subscription to a service for which we want to generate |
| 8 | // monthly (at least for now) invoices. |
| 9 | message Subscription { |
| 10 | // Template is the data that will be used to emit the invoice. It will be |
| 11 | // used verbatim in a CreateInvoice request, apart from the following |
| 12 | // changes: |
| 13 | // - if 'date' is not set, the current date will be substituted instead |
| 14 | // - for every item in the invoice, any %Y and %M value in its title will |
| 15 | // be replaced by the year and month of the billing cycle. The billing |
| 16 | // cycle is defined in relation to the date in the Cycle enum below.. |
| 17 | InvoiceData template = 1; |
| 18 | |
| 19 | // Cycle defines the billing cycle policy for this subscription. |
| 20 | enum Cycle { |
| 21 | CYCLE_INVALID = 0; |
| 22 | // The subscription is billed for the month that it is invoiced for. |
| 23 | // Eg., if the invoice has a date of April 1st, April 15th or April |
| 24 | // 30th, the %M in title will be replaced with 04. |
| 25 | // |
| 26 | // This is used for subscriptions that are invoiced a month in advance, |
| 27 | // with invoices being sent out in the beginning of the month. |
| 28 | // |
| 29 | // In the future, the meaning of this enum value might change to 'bill |
| 30 | // at beginning of month/cycle', but currently we only bill once per |
| 31 | // month. |
| 32 | CYCLE_CURRENT = 1; |
| 33 | // The subscription is billed for the month from when it was invoiced. |
| 34 | // Eg., if the invoice has a date of April 1st, April 15th or April |
| 35 | // 30th, the %M in the title will be replaced with 03. |
| 36 | // This is used for subscriptions that are invoiced right after a month |
| 37 | // ends. |
| 38 | // In the future, the meaning of this enum value might change to 'bill |
| 39 | // at end of month/cycle', but currently we only bill once per month. |
| 40 | CYCLE_PREV = 2; |
| 41 | } |
| 42 | Cycle cycle = 2; |
| 43 | } |
| 44 | |
| 45 | // Configuration is a prototext defining subscriptions. Currently it's read |
| 46 | // from a file by //bgpwtf/invoice/recurrent. In The future this might be |
| 47 | // broken up into a database schema. |
| 48 | message Configuration { |
| 49 | repeated Subscription subscription = 1; |
| 50 | } |