1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 00:22:50 -05:00
Commit Graph

91 Commits

Author SHA1 Message Date
9ec8bbb8bb Use upgrade path to change sponsorship
Sponsorships need to be annual to match the GB add-on charge rate
2021-11-12 20:49:00 -05:00
45f6ec1781 Families for enterprise/stripe integrations (#1699)
* Add PlanSponsorshipType to static store

* Add sponsorship type to token and creates sponsorship

* PascalCase properties

* Require sponsorship for remove

* Create subscription sponsorship helper class

* Handle Sponsored subscription changes

* Add sponsorship id to subscription metadata

* Make sponsoring references nullable

This state indicates that a sponsorship has lapsed, but was not able to
be reverted for billing reasons

* WIP: Validate and remove subscriptions

* Update sponsorships on organization and org user delete

* Add friendly name to organization sponsorship
2021-11-12 20:48:59 -05:00
18006591fc Add autoscale to SSO auto provision (#1642) 2021-10-19 07:00:44 -05:00
63c8070b01 Add Stripe Adapter and IBraintreeGateway to DI (#1596) 2021-09-27 23:01:13 +02:00
3d74f514ad Early return zero or negative amount invoices (#1595)
Stripe handles these by immediately finalizing as paid and crediting
their account the appropriate amount.
2021-09-27 09:20:47 -05:00
d39f45c81c Organization autoscaling (#1585)
* Add autoscale fields to Organization

* Add autoscale setting changes

* Autoscale organizations

updates InviteUsersAsync to support all invite sources.

sends an email to org owners when organization autoscaled

* All organizations autoscale

Disabling autoscaling can be done by setting max seats to current seats.

We only warn about autoscaling on the first autoscaling event.

* Fix tests

* Bug fixes

* Simplify subscription update logic

* Void invoices that fail to delete

Stripe no longer allows deletion of draft invoices that were created as part of subscription updates. It's necessary to void out these invoices without sending tem to the client.

* Notify org owners when their subscription runs out of seats

* Use datetime for notifications

Allows for later re-sending email if we want to periodically remind
owners

* Do not update subscription if it already matches new quatity

* Include all migrations

* Remove unnecessary inline styling

* SubscriptionUpdate handles update decisions

* Remove unnecessary html setter

* PR review

* Use minimum access for class methods
2021-09-23 05:36:08 -05:00
97b27220dd Use invoice to pay if subscription set to invoice (#1571)
* Use invoice to pay if subscription set to invoice

* Apply suggestions from code review

Co-authored-by: Addison Beck <abeck@bitwarden.com>

* PR review

Move to subscriber model for subscription updates.

Co-authored-by: Addison Beck <abeck@bitwarden.com>
2021-09-14 08:18:06 -05:00
db0ef226c4 Fix stripe invoice time on seat adjust (#1564)
* Finalize and void subscription updates

Stripe does not allow deletion of invoices created as subscription updates.
Instead, finalize it and void it out without sending to the customer.

* Store and Restore invoice days until due

Currently, we're overwriting customer invoice lead times whenever they
attempt to update their seat count. Changes are now updated to previous
behavior after our seat adjustment work

* PR Comments
2021-09-03 08:55:29 -05:00
a735bdd027 Fix sales tax error if using PayPal or credit (#1524)
Add sales tax information to previewInvoice, which is used to calculate
the amount of the PayPal or account credit charge. Without this, the
charged amount and Stripe subscription amounts are different and throws
an error.
2021-08-19 15:21:06 +10:00
785e788cb6 Support large organization sync (#1311)
* Increase organization max seat size from 30k to 2b (#1274)

* Increase organization max seat size from 30k to 2b

* PR review. Do not modify unless state matches expected

* Organization sync simultaneous event reporting (#1275)

* Split up azure messages according to max size

* Allow simultaneous login of organization user events

* Early resolve small event lists

* Clarify logic

Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com>

* Improve readability

This comes at the cost of multiple serializations, but the
 improvement in wire-time should more than make up for this
 on message where serialization time matters

Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com>

* Queue emails (#1286)

* Extract common Azure queue methods

* Do not use internal entity framework namespace

* Prefer IEnumerable to IList unless needed

All of these implementations were just using `Count == 1`,
which is easily replicated. This will be used when abstracting Azure queues

* Add model for azure queue message

* Abstract Azure queue for reuse

* Creat service to enqueue mail messages for later processing

Azure queue mail service uses Azure queues.
Blocking just blocks until all the work is done -- This is
how emailing works today

* Provide mail queue service to DI

* Queue organization invite emails for later processing

All emails can later be added to this queue

* Create Admin hosted service to process enqueued mail messages

* Prefer constructors to static generators

* Mass delete organization users (#1287)

* Add delete many to Organization Users

* Correct formatting

* Remove erroneous migration

* Clarify parameter name

* Formatting fixes

* Simplify bump account revision sproc

* Formatting fixes

* Match file names to objects

* Indicate if large import is expected

* Early pull all existing users we were planning on inviting (#1290)

* Early pull all existing users we were planning on inviting

* Improve sproc name

* Batch upsert org users (#1289)

* Add UpsertMany sprocs to OrganizationUser

* Add method to create TVPs from any object.

Uses DbOrder attribute to generate.
Sproc will fail unless TVP column order matches that of the db type

* Combine migrations

* Correct formatting

* Include sql objects in sql project

* Keep consisten parameter names

* Batch deletes for performance

* Correct formatting

* consolidate migrations

* Use batch methods in OrganizationImport

* Declare @BatchSize

* Transaction names limited to 32 chars

Drop sproc before creating it if it exists

* Update import tests

* Allow for more users in org upgrades

* Fix formatting

* Improve class hierarchy structure

* Use name tuple types

* Fix formatting

* Front load all reflection

* Format constructor

* Simplify ToTvp as class-specific extension

Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com>
2021-05-17 09:43:02 -05:00
5537470703 Use sas token for attachment downloads (#1153)
* Get limited life attachment download URL

This change limits url download to a 1min lifetime.
This requires moving to a new container to allow for non-public blob
access.

Clients will have to call GetAttachmentData api function to receive the download
URL. For backwards compatibility, attachment URLs are still present, but will not
work for attachments stored in non-public access blobs.

* Make GlobalSettings interface for testing

* Test LocalAttachmentStorageService equivalence

* Remove comment

* Add missing globalSettings using

* Simplify default attachment container

* Default to attachments containe for existing methods

A new upload method will be made for uploading to attachments-v2.
For compatibility for clients which don't use these new methods, we need
to still use the old container. The new container will be used only for
new uploads

* Remove Default MetaData fixture.

* Keep attachments container blob-level security for all instances

* Close unclosed FileStream

* Favor default value for noop services
2021-02-22 15:35:16 -06:00
bc4eeff604 changed the address data used to pull sales tax for premium subscriptions (#1109)
* changed the address data used to pull sales tax for premium subscriptions

* nulled checked for extra safety

* fixes null check
2021-01-25 09:56:53 -05:00
001bbf2f2b null checked Stripe.Customer.Address for org seat and storage upgrades (#1099) 2021-01-20 12:40:45 -05:00
c9cab74476 Sales Tax for Premium signups (#1087)
* Started charging sales tax on Premium signups

* added a line break
2021-01-14 17:53:37 -05:00
fee5c932db started charging sales tax on seat/storage upgrades and auto renewals (#1034)
* started charging sales tax on seat/storage upgrades and auto renewals

* Code review fixes for auto-renewing subscriptions charging sales tax
2020-12-09 14:04:46 -05:00
b877c25234 Implemented tax collection for subscriptions (#1017)
* Implemented tax collection for subscriptions

* Cleanup for Sales Tax

* Cleanup for Sales Tax

* Changes a constraint to an index for checking purposes

* Added and implemented a ReadById method for TaxRate

* Code review fixes for Tax Rate implementation

* Code review fixes for Tax Rate implementation

* Made the SalesTax migration script rerunnable
2020-12-04 12:05:16 -05:00
2cd6d4f61a plan adjustments (#890) 2020-08-25 14:23:36 -04:00
a37706eba1 Restore original collection method (#804) 2020-06-30 11:52:50 -04:00
d7b00f6c27 Subscription update to maintain auto charge (#803) 2020-06-29 20:29:19 -04:00
f23a8edc45 Update stripe lib (#793) 2020-06-24 21:24:19 -04:00
0f28ac45f9 Consistency on TaxInfo use in service params 2020-06-18 10:41:55 -04:00
b7a500eb63 combined tax updates with other operations 2020-06-17 19:49:27 -04:00
b2cb9a2f69 Billing addr line1 fix, pr feedback 2020-06-15 09:12:03 -04:00
1552ff7b29 Collect tax info, correct line1 2020-06-12 19:35:17 -04:00
d88838f19e API updates for tax info collection 2020-06-08 17:40:18 -04:00
d49cc18a41 Stripe not crediting customer balance after void 2020-05-18 12:38:00 -04:00
9ef39bcadb Removed payment_behavior, errant whitespace 2020-05-13 09:54:10 -04:00
a024b43cea Updated code style and PR feedback 2020-05-12 17:22:04 -04:00
a9a7003bfc Subscription change, invoice process update 2020-05-12 12:48:21 -04:00
9a2d8e96e4 Updated Stripe API SDK version to 36.9.0 2020-05-08 10:15:48 -04:00
9800b752c0 Changed all C# control flow block statements to include space between keyword and open paren 2020-03-27 14:36:37 -04:00
5e7ac0a9bc handle appleReceipt already existing on customer 2019-09-23 10:27:14 -04:00
b72744eafc alloe sub cancellation when deleting account 2019-09-20 13:45:47 -04:00
784c86893f throw apple iap exceptions 2019-09-20 00:01:35 -04:00
ff5a0ff0ce payment service support for iap 2019-09-19 23:30:16 -04:00
294a6dbba5 set/use default payment method on customer 2019-09-06 08:47:36 -04:00
1be6e2008b qty is only 1 if re-creating after proration 2019-09-03 16:49:25 -04:00
4982c21c37 qty should be 1 when restoring invoice items 2019-09-03 12:48:42 -04:00
54162d6531 fix credit card bug for premium 2019-09-02 20:23:43 -04:00
a3b30595f5 null check paymentToken 2019-08-31 00:33:29 -04:00
fa3bb0c081 set customer source and method earlier 2019-08-12 11:15:05 -04:00
5c3bf78226 handle sub incomplete status 2019-08-12 10:42:14 -04:00
41f9f6a7f0 only refund captured charges 2019-08-12 10:33:06 -04:00
74bbeae776 adjust storage with payment intent/method handling 2019-08-10 12:59:32 -04:00
e60f1a4f50 add missing sub create options 2019-08-10 12:07:24 -04:00
bc5322f4cf support for payment intent/method on org signup 2019-08-10 11:58:44 -04:00
00e808d731 payment intent/method support for incomplete status 2019-08-09 23:56:26 -04:00
efcf626999 update payment method with stripe card payment method 2019-08-09 16:29:23 -04:00
b11fd2fab8 handle PaymentMethods for PaymentSource billing info 2019-08-09 15:53:01 -04:00
9686b4bf2b process off session payment methods 2019-08-09 14:06:07 -04:00