Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: offline billing accounts in org #638

Merged
merged 1 commit into from
Jun 7, 2024
Merged

feat: offline billing accounts in org #638

merged 1 commit into from
Jun 7, 2024

Conversation

kushsharma
Copy link
Member

@kushsharma kushsharma commented Jun 5, 2024

  • Offline billing accounts are not registered in billing provider like Stripe by default.
  • Only online b/a can use CheckoutAPI so when requesting to create new Checkout, it will automatically try to register the billing account to provider if it is offline
  • DelegatedCheckout with virtual credits can be used with offline customers
  • Offline customers will not interact with billing provider at all and can't support subscriptions as well
  • A offline customer can be migrated to online using RegisterBillingAccount API
  • feat(frontier): create billing account without billing provider proton#360
  • A change in frontier env/yaml configs are introduced to handle offline accounts better
billing:
  # default currency to be used for billing if not provided by the user
  # e.g. usd, inr, eur
  default_currency: "inr"
  # billing customer account configuration
  customer:
    # automatically create a default customer account when an org is created
    auto_create_with_org: true
    # name of the plan that should be used subscribed automatically when the org is created
    # it also automatically creates an empty billing account under the org
    default_plan: ""
    # default offline status for the customer account, if true the customer account
    # will not be registered in billing provider
    default_offline: false
    # free credits to be added to the customer account when created as a part of the org
    onboard_credits_with_org: 0

Copy link

vercel bot commented Jun 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
frontier ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2024 1:00pm

@coveralls
Copy link

coveralls commented Jun 5, 2024

Pull Request Test Coverage Report for Build 9381349099

Details

  • 12 of 1824 (0.66%) changed or added relevant lines in 13 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 9.38%

Changes Missing Coverage Covered Lines Changed/Added Lines %
billing/subscription/service.go 0 1 0.0%
billing/customer/customer.go 0 3 0.0%
billing/checkout/service.go 0 4 0.0%
internal/store/postgres/billing_customer_repository.go 10 14 71.43%
pkg/server/interceptors/authorization.go 0 4 0.0%
internal/api/v1beta1/billing_customer.go 0 12 0.0%
core/event/service.go 0 21 0.0%
proto/v1beta1/frontier_grpc.pb.go 0 26 0.0%
billing/customer/service.go 0 30 0.0%
internal/api/v1beta1/mocks/customer_service.go 0 50 0.0%
Files with Coverage Reduction New Missed Lines %
internal/api/v1beta1/mocks/customer_service.go 1 10.34%
Totals Coverage Status
Change from base Build 9361738958: 0.04%
Covered Lines: 9638
Relevant Lines: 102755

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 6, 2024

Pull Request Test Coverage Report for Build 9402997861

Details

  • 12 of 1838 (0.65%) changed or added relevant lines in 14 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 9.381%

Changes Missing Coverage Covered Lines Changed/Added Lines %
billing/subscription/service.go 0 1 0.0%
cmd/serve.go 0 1 0.0%
billing/customer/customer.go 0 3 0.0%
billing/checkout/service.go 0 4 0.0%
internal/store/postgres/billing_customer_repository.go 10 14 71.43%
pkg/server/interceptors/authorization.go 0 4 0.0%
internal/api/v1beta1/billing_customer.go 0 12 0.0%
proto/v1beta1/frontier_grpc.pb.go 0 26 0.0%
billing/customer/service.go 0 30 0.0%
core/event/service.go 0 34 0.0%
Files with Coverage Reduction New Missed Lines %
internal/api/v1beta1/mocks/customer_service.go 1 10.34%
Totals Coverage Status
Change from base Build 9381599834: 0.04%
Covered Lines: 9641
Relevant Lines: 102770

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 6, 2024

Pull Request Test Coverage Report for Build 9402923486

Details

  • 12 of 1838 (0.65%) changed or added relevant lines in 14 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 9.381%

Changes Missing Coverage Covered Lines Changed/Added Lines %
billing/subscription/service.go 0 1 0.0%
cmd/serve.go 0 1 0.0%
billing/customer/customer.go 0 3 0.0%
billing/checkout/service.go 0 4 0.0%
internal/store/postgres/billing_customer_repository.go 10 14 71.43%
pkg/server/interceptors/authorization.go 0 4 0.0%
internal/api/v1beta1/billing_customer.go 0 12 0.0%
proto/v1beta1/frontier_grpc.pb.go 0 26 0.0%
billing/customer/service.go 0 30 0.0%
core/event/service.go 0 34 0.0%
Files with Coverage Reduction New Missed Lines %
internal/api/v1beta1/mocks/customer_service.go 1 10.34%
Totals Coverage Status
Change from base Build 9381599834: 0.04%
Covered Lines: 9641
Relevant Lines: 102770

💛 - Coveralls

- Offline billing accounts are not registered in billing provider
like Stripe by default.
- Only online b/a can use CheckoutAPI so when requesting to create
new Checkout, it will automatically try to register the billing
account to provider if it is offline
- DelegatedCheckout with virtual credits can be used with offline
customers
- Offline customers will not interact with billing provider at all
and can't support subscriptions as well
- A offline customer can be migrated to online using RegisterBillingAccount
API
- raystack/proton#360
- A change in frontier env/yaml configs are introduced to handle
offline accounts better
```yaml
billing:
  # default currency to be used for billing if not provided by the user
  # e.g. usd, inr, eur
  default_currency: "inr"
  # billing customer account configuration
  customer:
    # automatically create a default customer account when an org is created
    auto_create_with_org: true
    # name of the plan that should be used subscribed automatically when the org is created
    # it also automatically creates an empty billing account under the org
    default_plan: ""
    # default offline status for the customer account, if true the customer account
    # will not be registered in billing provider
    default_offline: false
    # free credits to be added to the customer account when created as a part of the org
    onboard_credits_with_org: 0
```

Signed-off-by: Kush Sharma <thekushsharma@gmail.com>
@kushsharma kushsharma merged commit 7fca56e into main Jun 7, 2024
7 checks passed
@kushsharma kushsharma deleted the ba-offline branch June 7, 2024 13:15
@coveralls
Copy link

coveralls commented Jun 7, 2024

Pull Request Test Coverage Report for Build 9417411053

Details

  • 514 of 5274 (9.75%) changed or added relevant lines in 14 files are covered.
  • 108 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.03%) to 9.312%

Changes Missing Coverage Covered Lines Changed/Added Lines %
billing/subscription/service.go 0 1 0.0%
cmd/serve.go 0 1 0.0%
billing/customer/customer.go 0 3 0.0%
billing/checkout/service.go 0 4 0.0%
internal/store/postgres/billing_customer_repository.go 10 14 71.43%
pkg/server/interceptors/authorization.go 0 16 0.0%
internal/api/v1beta1/billing_customer.go 1 31 3.23%
core/event/service.go 0 44 0.0%
billing/customer/service.go 0 52 0.0%
proto/v1beta1/frontier_grpc.pb.go 0 78 0.0%
Files with Coverage Reduction New Missed Lines %
internal/api/v1beta1/mocks/customer_service.go 1 8.52%
core/event/service.go 2 0.0%
proto/v1beta1/frontier.pb.go 105 5.78%
Totals Coverage Status
Change from base Build 9381599834: -0.03%
Covered Lines: 9642
Relevant Lines: 103546

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants