Open
Description
This commit will support invoicing by "product" with a new feature flag, payments.stripe-coin-payments.product-based-invoicing
.
If product-based invoicing is enabled, the "legacy" method of aggregating usage by bucket/project and the following configs will no longer apply by default:
# semicolon-separated usage price overrides in the format partner:storage,egress,segment,egress_discount_ratio. The egress discount ratio is the ratio of free egress per unit-month of storage
# payments.usage-price-overrides: ""
# price user should pay for egress in dollars/TB
# payments.usage-price.egress-tb: "7"
# price user should pay for segments stored on network per month in dollars/segment
# payments.usage-price.segment: "0.0000088"
# price user should pay for storage per month in dollars/TB
# payments.usage-price.storage-tb: "4"
Instead, usage is aggregated across all projects/buckets, and primarily defined by the following configs:
# a JSON mapping of partners to a mapping of product ID to placements in the format: {"partner0":{productID0:[placement0],productID1:[placement1,placement2]}}. If a partner uses a placement not defined for them in this config, they will be charged according to --payments.placement-price-overrides.
# payments.partners-placement-price-overrides: ""
# a JSON mapping of product ID to placements in the format: {productID0:[placement0],productID1:[placement1,placement2]}. Products must be defined by the --payments.products config, or the satellite will not start.
# payments.placement-price-overrides: ""
# a JSON mapping of non-zero product IDs to their names and price structures in the format: {"productID": {"name": "...", "storage": "...", "egress": "...", "segment": "...", "egress_discount_ratio": "..."}}. The egress discount ratio is the ratio of free egress per unit-month of storage
# payments.products: ""
Parts of the UI and console API still rely on the "legacy" payments.usage-price
configs. For example, the "upgrade" dialog in the UI, and price estimations in the usage report.
AC:
- Identify parts of the UI and console API which do not account for "product-based pricing" being enabled
- if product-based pricing is enabled, identify pricing in these locations via placment+project mapping, like in the invoicing change.
- in a situation where region is not specified, use placement "0" to identify the product (e.g. in the upgrade dialog)
- If product-based pricing is disabled, the previous behavior should still work