1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-07 05:58:13 -05:00

49 Commits

Author SHA1 Message Date
Oscar Hinton
e4a10aae27
Split out repositories to Infrastructure.Dapper / EntityFramework (#1759) 2022-01-11 10:40:51 +01:00
Jake Fink
11aafac915
remove re-throws of exceptions, which clear the stack trace (#1760)
* remove re-throws of exceptions, which clear the stack trace

* remove whitespace
2021-12-16 15:35:07 -05:00
Oscar Hinton
23b0a1f9df
Run dotnet format (#1764) 2021-12-16 15:35:09 +01:00
Matt Gibson
33edc8eba0
Families for Enterprise (#1714)
* Create common test infrastructure project

* Add helpers to further type PlanTypes

* Enable testing of ASP.net MVC controllers

Controller properties have all kinds of validations in the background.
In general, we don't user properties on our Controllers, so the easiest
way to allow for Autofixture-based testing of our Controllers is to just
omit setting all properties on them.

* Workaround for broken MemberAutoDataAttribute

https://github.com/AutoFixture/AutoFixture/pull/1164 shows that only
the first test case is pulled for this attribute.

This is a workaround that populates the provided parameters, left to
right, using AutoFixture to populate any remaining.

* WIP: Organization sponsorship flow

* Add Attribute to use the Bit Autodata dependency chain

BitAutoDataAttribute is used to mark a Theory as autopopulating
parameters.

Extract common attribute methods to to a helper class. Cannot
inherit a common base, since both require inheriting from different
Xunit base classes to work.

* WIP: scaffolding for families for enterprise sponsorship flow

* Fix broken tests

* Create sponsorship offer (#1688)

* Initial db work (#1687)

* Add organization sponsorship databases to all providers

* Generalize create and update for database, specialize in code

* Add PlanSponsorshipType to db model

* Write valid json for test entries

* Initial scaffolding of emails (#1686)

* Initial scaffolding of emails

* Work on adding models for FamilyForEnterprise emails

* Switch verbage

* Put preliminary copy in emails

* Skip test

* 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

* Add sponsorship available boolean to orgDetails

* Add sponsorship service to DI

* Use userId to find org users

* Send f4e offer email

* Simplify names of f4e mail messages

* Fix Stripe org default tax rates

* Universal sponsorship redeem api

* Populate user in current context

* Add product type to organization details

* Use upgrade path to change sponsorship

Sponsorships need to be annual to match the GB add-on charge rate

* Use organization and auth to find organization sponsorship

* Add resend sponsorship offer api endpoint

* Fix double email send

* Fix sponsorship upgrade options

* Add is sponsored item to subscription response

* Add sponsorship validation to upcoming invoice webhook

* Add sponsorship validation to upcoming invoice webhook

* Fix organization delete sponsorship hooks

* Test org sponsorship service

* Fix sproc

* Create common test infrastructure project

* Add helpers to further type PlanTypes

* Enable testing of ASP.net MVC controllers

Controller properties have all kinds of validations in the background.
In general, we don't user properties on our Controllers, so the easiest
way to allow for Autofixture-based testing of our Controllers is to just
omit setting all properties on them.

* Workaround for broken MemberAutoDataAttribute

https://github.com/AutoFixture/AutoFixture/pull/1164 shows that only
the first test case is pulled for this attribute.

This is a workaround that populates the provided parameters, left to
right, using AutoFixture to populate any remaining.

* WIP: Organization sponsorship flow

* Add Attribute to use the Bit Autodata dependency chain

BitAutoDataAttribute is used to mark a Theory as autopopulating
parameters.

Extract common attribute methods to to a helper class. Cannot
inherit a common base, since both require inheriting from different
Xunit base classes to work.

* WIP: scaffolding for families for enterprise sponsorship flow

* Fix broken tests

* Create sponsorship offer (#1688)

* Initial db work (#1687)

* Add organization sponsorship databases to all providers

* Generalize create and update for database, specialize in code

* Add PlanSponsorshipType to db model

* Write valid json for test entries

* Initial scaffolding of emails (#1686)

* Initial scaffolding of emails

* Work on adding models for FamilyForEnterprise emails

* Switch verbage

* Put preliminary copy in emails

* Skip test

* 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

* Add sponsorship available boolean to orgDetails

* Add sponsorship service to DI

* Use userId to find org users

* Send f4e offer email

* Simplify names of f4e mail messages

* Fix Stripe org default tax rates

* Universal sponsorship redeem api

* Populate user in current context

* Add product type to organization details

* Use upgrade path to change sponsorship

Sponsorships need to be annual to match the GB add-on charge rate

* Use organization and auth to find organization sponsorship

* Add resend sponsorship offer api endpoint

* Fix double email send

* Fix sponsorship upgrade options

* Add is sponsored item to subscription response

* Add sponsorship validation to upcoming invoice webhook

* Add sponsorship validation to upcoming invoice webhook

* Fix organization delete sponsorship hooks

* Test org sponsorship service

* Fix sproc

* Fix build error

* Update emails

* Fix tests

* Skip local test

* Add newline

* Fix stripe subscription update

* Finish emails

* Skip test

* Fix unit tests

* Remove unused variable

* Fix unit tests

* Switch to handlebars ifs

* Remove ending email

* Remove reconfirmation template

* Switch naming convention

* Switch naming convention

* Fix migration

* Update copy and links

* Switch to using Guid in the method

* Remove unneeded css styles

* Add sql files to Sql.sqlproj

* Removed old comments

* Made name more verbose

* Fix SQL error

* Move unit tests to service

* Fix sp

* Revert "Move unit tests to service"

This reverts commit 1185bf3ec8ca36ccd75717ed2463adf8885159a6.

* Do repository validation in service layer

* Fix tests

* Fix merge conflicts and remove TODO

* Remove unneeded models

* Fix spacing and formatting

* Switch Org -> Organization

* Remove single use variables

* Switch method name

* Fix Controller

* Switch to obfuscating email

* Fix unit tests

Co-authored-by: Justin Baur <admin@justinbaur.com>
2021-11-19 17:25:06 -05:00
Kyle Spearrin
7cc7b84eaf
use fixed-time comparison of secrets (#1698) 2021-11-08 15:55:42 -05:00
Chad Scharf
c09ae5f906
ReferenceEvent Rebilled missing data (#1240) 2021-03-24 15:27:16 -04:00
Matt Gibson
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
Addison Beck
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
Chad Scharf
2742b414fd
reference event changes and cleanup (#823) 2020-07-15 12:38:45 -04:00
Chad Scharf
cdfde692a6 Fixed SDK reference issue in Billing proj 2020-05-13 09:58:17 -04:00
Chad Scharf
9800b752c0 Changed all C# control flow block statements to include space between keyword and open paren 2020-03-27 14:36:37 -04:00
Kyle Spearrin
c5ae1b8283 prevent duplicate paypal charges 2020-01-17 21:16:26 -05:00
Kyle Spearrin
7fd6e4359d fix warnings 2020-01-10 08:47:58 -05:00
Kyle Spearrin
d04d92bb89 AttemptToPayInvoiceWithAppleReceipt 2019-09-23 09:03:18 -04:00
Kyle Spearrin
920debf2c9 upper card brand 2019-09-05 20:45:01 -04:00
Kyle Spearrin
cf9c8d8fe9 support PaymentMethodDetails in stripe webhook 2019-09-03 17:00:05 -04:00
Kyle Spearrin
ed86a5f9d5 add a delay to invoice.payment_succeeded hook 2019-09-02 08:41:06 -04:00
Kyle Spearrin
669a7c00d8 load fresh sub and invoices on webhooks 2019-08-20 11:09:02 -04:00
Kyle Spearrin
18e6149329 handle incomplete status in webhook 2019-08-12 10:45:05 -04:00
Kyle Spearrin
00e808d731 payment intent/method support for incomplete status 2019-08-09 23:56:26 -04:00
Kyle Spearrin
48ec345702 update stripe SDK 2019-08-08 17:36:41 -04:00
Kyle Spearrin
e242539b84 check if already paid 2019-06-17 08:19:26 -04:00
Kyle Spearrin
377e6ff697 handle invoice already paid error 2019-06-17 08:15:56 -04:00
Kyle Spearrin
9916668a7a more stripe logging 2019-02-28 20:49:39 -05:00
Kyle Spearrin
25ea96f1bd support for sources in webhooks 2019-02-27 10:11:45 -05:00
Kyle Spearrin
c1b271193b add some logging to stripe webhook 2019-02-22 09:31:05 -05:00
Kyle Spearrin
acb7ff2b09 bad request if no ids on subscription 2019-02-16 22:08:04 -05:00
Kyle Spearrin
7d36a0d398 filter canceled orgs 2019-02-16 16:08:12 -05:00
Kyle Spearrin
dee395960a webhook fixes 2019-02-15 16:18:53 -05:00
Kyle Spearrin
67146cd4be send payment failed emails 2019-02-14 11:49:39 -05:00
Kyle Spearrin
7ad899c728 todo for payment failure email 2019-02-09 18:12:52 -05:00
Kyle Spearrin
1dc22f61d1 catch sql FK violations on webhook tx creation 2019-02-07 17:28:09 -05:00
Kyle Spearrin
7675478daa refund if something screws up 2019-02-03 00:05:35 -05:00
Kyle Spearrin
9e14af3223 attempt to pay invoices via braintree 2019-02-03 00:00:21 -05:00
Kyle Spearrin
98bd42dde1 fix enums 2019-02-02 23:04:14 -05:00
Kyle Spearrin
fb3cdba99e check to make sure not already refunded 2019-02-01 23:29:12 -05:00
Kyle Spearrin
4ade9a229b stripe charge hooks and fixes to pp refunds 2019-02-01 23:04:51 -05:00
Kyle Spearrin
a34ca4700d upgrade stripe lib and breaking changes 2019-01-29 14:41:37 -05:00
Kyle Spearrin
053096c1a1 subscription renewal reminder emails 2018-05-11 08:29:23 -04:00
Kyle Spearrin
a1957d2506 handle sub unpaid and upcoming invoice events 2018-04-05 21:56:36 -04:00
Kyle Spearrin
c2df445ac2 added stripe webhook signature checking 2017-08-12 22:30:44 -04:00
Kyle Spearrin
680d7b2bed update expiration dates 2017-08-12 22:16:42 -04:00
Kyle Spearrin
b7e8852250 disable premium membership 2017-07-25 09:04:22 -04:00
Kyle Spearrin
4853917924 IHttpContextAccessor registration missing 2017-05-08 12:34:53 -04:00
Kyle Spearrin
2d3ea25baa comment update 2017-04-26 16:18:41 -04:00
Kyle Spearrin
7907d839c9 disable organization when subscription is canceled 2017-04-26 16:14:15 -04:00
Kyle Spearrin
398a4d8e46 stripe webhook key from billing settings 2017-04-26 14:29:25 -04:00
Kyle Spearrin
1296853983 upadte package and move billing to full .net 2017-03-18 22:26:36 -04:00
Kyle Spearrin
188571cad8 Billing project 2017-03-18 18:52:44 -04:00