Open platform to collect and prioritize feedback
refactoring: remove unused billing code (#920)
Guilherme Oenning7c75f0b987e8
diff --git a/GUIDELINES.md b/GUIDELINES.mdindex edcbf05bb..841956b7f 100644--- a/GUIDELINES.md+++ b/GUIDELINES.md@@ -6,7 +6,7 @@- `app/models/dto.<something>`: A simple object used for data transfer between various packages/services. E.g: `dto.NewUserInfo`;- `app/models/entity.<something>`: An object that is mapped to a database table. E.g: `entity.User`;- `app/models/cmd.<something>` something that must be done and potentially return some value. E.g.: `cmd.HttpRequest`, `cmd.LogDebug`, `cmd.SendMail`, `cmd.CreateNewUser`;-- `app/models/query.<something>` get some information from somewhere. E.g.: `query.GetUserById`, `query.GetBillingStatus`;+- `app/models/query.<something>` get some information from somewhere. E.g.: `query.GetUserById`, `query.GetAllPosts`;# UI Developmentdiff --git a/app/actions/billing.go b/app/actions/billing.godeleted file mode 100644index a1c756277..000000000--- a/app/actions/billing.go+++ /dev/null@@ -1,134 +0,0 @@-package actions--import (- "context"- "fmt"-- "github.com/getfider/fider/app"-- "github.com/getfider/fider/app/models/query"- "github.com/getfider/fider/app/pkg/bus"- "github.com/getfider/fider/app/pkg/errors"- "github.com/getfider/fider/app/pkg/log"-- "github.com/getfider/fider/app/models"- "github.com/getfider/fider/app/models/dto"- "github.com/getfider/fider/app/pkg/validate"- "github.com/goenning/vat"-)--// CreateEditBillingPaymentInfo is used to create/edit billing payment info-type CreateEditBillingPaymentInfo struct {- Model *dto.CreateEditBillingPaymentInfo-}--// Initialize the model-func (input *CreateEditBillingPaymentInfo) Initialize() interface{} {- input.Model = new(dto.CreateEditBillingPaymentInfo)- return input.Model-}--// IsAuthorized returns true if current user is authorized to perform this action-func (input *CreateEditBillingPaymentInfo) IsAuthorized(ctx context.Context, user *models.User) bool {- return user != nil && user.IsAdministrator()-}--// Validate if current model is valid-func (input *CreateEditBillingPaymentInfo) Validate(ctx context.Context, user *models.User) *validate.Result {- result := validate.Success()-- if input.Model.Name == "" {- result.AddFieldFailure("name", "Name is required.")- }-- if input.Model.Email == "" {- result.AddFieldFailure("email", "Email is required")- } else {- messages := validate.Email(input.Model.Email)- if len(messages) > 0 {- result.AddFieldFailure("email", messages...)- }- }-- if input.Model.AddressLine1 == "" {- result.AddFieldFailure("addressLine1", "Address Line 1 is required.")- }-- if input.Model.AddressLine2 == "" {- result.AddFieldFailure("addressLine2", "Address Line 2 is required.")- }-- if input.Model.AddressCity == "" {- result.AddFieldFailure("addressCity", "City is required.")- }-- if input.Model.AddressPostalCode == "" {- result.AddFieldFailure("addressPostalCode", "Postal Code is required.")- }-- getPaymentInfo := &query.GetPaymentInfo{}- err := bus.Dispatch(ctx, getPaymentInfo)- if err != nil {- return validate.Error(err)- }-- current := getPaymentInfo.Result- isNew := current == nil- isUpdate := current != nil && input.Model.Card == nil- isReplacing := current != nil && input.Model.Card != nil-- if (isNew || isReplacing) && (input.Model.Card == nil || input.Model.Card.Token == "") {- result.AddFieldFailure("card", "Card information is required.")- }-- if input.Model.AddressCountry == "" {- result.AddFieldFailure("addressCountry", "Country is required.")- } else {- err := bus.Dispatch(ctx, &query.GetCountryByCode{Code: input.Model.AddressCountry})- if err != nil {- if err == app.ErrNotFound {- result.AddFieldFailure("addressCountry", fmt.Sprintf("'%s' is not a valid country code.", input.Model.AddressCountry))- } else {- return validate.Error(err)- }- }-- if (isNew || isReplacing) && input.Model.Card != nil && input.Model.AddressCountry != input.Model.Card.Country {- result.AddFieldFailure("addressCountry", "Country doesn't match with card issue country.")- } else if isUpdate && input.Model.AddressCountry != current.CardCountry {- result.AddFieldFailure("addressCountry", "Country doesn't match with card issue country.")- }-- if isReplacing || isUpdate {- prevIsEU := vat.IsEU(current.AddressCountry)- nextIsEU := vat.IsEU(input.Model.AddressCountry)- if prevIsEU != nextIsEU {- result.AddFieldFailure("currency", "Billing currency cannot be changed.")- }- }- }-- if input.Model.VATNumber != "" && vat.IsEU(input.Model.AddressCountry) && (isNew || input.Model.VATNumber != current.VATNumber) {- valid, euCC := vat.ValidateNumberFormat(input.Model.VATNumber)- if !valid {- result.AddFieldFailure("vatNumber", "VAT Number is an invalid format.")- } else if euCC != input.Model.AddressCountry {- result.AddFieldFailure("vatNumber", "VAT Number doesn't match with selected country.")- } else {- resp, err := vat.Query(input.Model.VATNumber)- if err != nil {- if err == vat.ErrInvalidVATNumberFormat {- result.AddFieldFailure("vatNumber", "VAT Number is an invalid format.")- } else {- log.Error(ctx, errors.Wrap(err, "failed to validate VAT Number '%s'", input.Model.VATNumber))- result.AddFieldFailure("vatNumber", "We couldn't validate your VAT Number right now, please try again soon.")- }- }- if !resp.IsValid {- result.AddFieldFailure("vatNumber", "VAT Number is invalid.")- }- }- }-- return result-}diff --git a/app/actions/billing_test.go b/app/actions/billing_test.godeleted file mode 100644index 3a0babe05..000000000--- a/app/actions/billing_test.go+++ /dev/null@@ -1,131 +0,0 @@-package actions_test--import (- "context"- "testing"-- "github.com/getfider/fider/app/services/billing"-- "github.com/getfider/fider/app"-- "github.com/getfider/fider/app/actions"- "github.com/getfider/fider/app/models"- "github.com/getfider/fider/app/models/dto"- . "github.com/getfider/fider/app/pkg/assert"- "github.com/getfider/fider/app/pkg/bus"-)--func TestCreateEditBillingPaymentInfo_InvalidInput(t *testing.T) {- RegisterT(t)- bus.Init(billing.Service{})-- testCases := []struct {- expected []string- input *dto.CreateEditBillingPaymentInfo- }{- {- expected: []string{"card", "name", "email", "addressLine1", "addressLine2", "addressCity", "addressPostalCode", "addressCountry"},- input: &dto.CreateEditBillingPaymentInfo{},- },- {- expected: []string{"card", "email", "addressCity", "addressPostalCode", "addressCountry"},- input: &dto.CreateEditBillingPaymentInfo{- Name: "John",- AddressLine1: "Street 1",- AddressLine2: "Street 2",- Email: "jo@a",- AddressCountry: "PP",- },- },- {- expected: []string{"card", "email", "addressCity", "addressPostalCode", "addressCountry"},- input: &dto.CreateEditBillingPaymentInfo{- Name: "John",- AddressLine1: "Street 1",- AddressLine2: "Street 2",- Email: "jo@a",- AddressCountry: "US",- Card: &dto.CreateEditBillingPaymentInfoCard{- Country: "IE",- },- },- },- }-- for _, testCase := range testCases {- action := &actions.CreateEditBillingPaymentInfo{- Model: testCase.input,- }- ctx := context.WithValue(context.Background(), app.TenantCtxKey, &models.Tenant{ID: 2})- result := action.Validate(ctx, nil)- ExpectFailed(result, testCase.expected...)- }-}--func TestCreateEditBillingPaymentInfo_ValidInput(t *testing.T) {- RegisterT(t)- bus.Init(billing.Service{})-- action := &actions.CreateEditBillingPaymentInfo{- Model: &dto.CreateEditBillingPaymentInfo{- Name: "Jon Snow",- AddressLine1: "Street 1",- AddressLine2: "Street 2",- AddressCity: "New York",- AddressPostalCode: "12345",- AddressState: "NY",- Email: "[email protected]",- AddressCountry: "US",- Card: &dto.CreateEditBillingPaymentInfoCard{- Token: "tok_visa",- Country: "US",- },- },- }- ctx := context.WithValue(context.Background(), app.TenantCtxKey, &models.Tenant{ID: 2})- result := action.Validate(ctx, nil)- ExpectSuccess(result)-}--func TestCreateEditBillingPaymentInfo_VATNumber(t *testing.T) {- RegisterT(t)- bus.Init(billing.Service{})-- ctx := context.WithValue(context.Background(), app.TenantCtxKey, &models.Tenant{ID: 2})-- action := &actions.CreateEditBillingPaymentInfo{- Model: &dto.CreateEditBillingPaymentInfo{- Name: "Jon Snow",- AddressLine1: "Street 1",- AddressLine2: "Street 2",- AddressCity: "New York",- AddressPostalCode: "12345",- AddressState: "NY",- Email: "[email protected]",- AddressCountry: "IE",- VATNumber: "IE0",- Card: &dto.CreateEditBillingPaymentInfoCard{- Token: "tok_visa",- Country: "IE",- },- },- }- result := action.Validate(ctx, nil)- ExpectFailed(result, "vatNumber")-- action.Model.VATNumber = "GB270600730"- result = action.Validate(ctx, nil)- ExpectFailed(result, "vatNumber")-- action.Model.VATNumber = "IE6388047A"- result = action.Validate(ctx, nil)- ExpectFailed(result, "vatNumber")-- action.Model.VATNumber = "IE6388047V"- result = action.Validate(ctx, nil)- ExpectSuccess(result)-- action.Model.VATNumber = ""- result = action.Validate(ctx, nil)- ExpectSuccess(result)-}diff --git a/app/cmd/routes.go b/app/cmd/routes.goindex 0d3c0abe5..9686c4231 100644--- a/app/cmd/routes.go+++ b/app/cmd/routes.go@@ -159,14 +159,6 @@ func routes(r *web.Engine) *web.Engine {ui.Post("/_api/admin/roles/:role/users", handlers.ChangeUserRole())ui.Put("/_api/admin/users/:userID/block", handlers.BlockUser())ui.Delete("/_api/admin/users/:userID/block", handlers.UnblockUser())-- ui.Use(middlewares.RequireBillingEnabled())-- ui.Get("/admin/billing", handlers.BillingPage())- ui.Get("/_api/admin/billing/plans/:countryCode", handlers.GetBillingPlans())- ui.Post("/_api/admin/billing/paymentinfo", handlers.UpdatePaymentInfo())- ui.Post("/_api/admin/billing/subscription/:planID", handlers.BillingSubscribe())- ui.Delete("/_api/admin/billing/subscription/:planID", handlers.CancelBillingSubscription())}api := r.Group()diff --git a/app/cmd/server.go b/app/cmd/server.goindex d25be59c6..7a2c6df88 100644--- a/app/cmd/server.go+++ b/app/cmd/server.go@@ -14,7 +14,6 @@ import ("github.com/getfider/fider/app/pkg/log""github.com/getfider/fider/app/pkg/web"- _ "github.com/getfider/fider/app/services/billing"_ "github.com/getfider/fider/app/services/blob/fs"_ "github.com/getfider/fider/app/services/blob/s3"_ "github.com/getfider/fider/app/services/blob/sql"diff --git a/app/handlers/billing.go b/app/handlers/billing.godeleted file mode 100644index efedfe288..000000000--- a/app/handlers/billing.go+++ /dev/null@@ -1,161 +0,0 @@-package handlers--import (- "github.com/getfider/fider/app/actions"- "github.com/getfider/fider/app/models/cmd"- "github.com/getfider/fider/app/models/query"- "github.com/getfider/fider/app/pkg/bus"- "github.com/getfider/fider/app/pkg/web"-)--// BillingPage is the billing settings page-func BillingPage() web.HandlerFunc {- return func(c *web.Context) error {- if c.Tenant().Billing.StripeCustomerID == "" {- if err := bus.Dispatch(c, &cmd.CreateBillingCustomer{}); err != nil {- return c.Failure(err)- }-- if err := bus.Dispatch(c, &cmd.UpdateTenantBillingSettings{- Settings: c.Tenant().Billing,- }); err != nil {- return c.Failure(err)- }- }-- getUpcomingInvoiceQuery := &query.GetUpcomingInvoice{}- if c.Tenant().Billing.StripeSubscriptionID != "" {- err := bus.Dispatch(c, getUpcomingInvoiceQuery)- if err != nil {- return c.Failure(err)- }- }-- paymentInfo := &query.GetPaymentInfo{}- err := bus.Dispatch(c, paymentInfo)- if err != nil {- return c.Failure(err)- }-- listPlansQuery := &query.ListBillingPlans{}- if paymentInfo.Result != nil {- listPlansQuery.CountryCode = paymentInfo.Result.AddressCountry- err = bus.Dispatch(c, listPlansQuery)- if err != nil {- return c.Failure(err)- }- }-- countUsers := &query.CountUsers{}- allCountries := &query.GetAllCountries{}- if err := bus.Dispatch(c, countUsers); err != nil {- return c.Failure(err)- }-- return c.Page(web.Props{- Title: "Billing · Site Settings",- ChunkName: "Billing.page",- Data: web.Map{- "invoiceDue": getUpcomingInvoiceQuery.Result,- "tenantUserCount": countUsers.Result,- "plans": listPlansQuery.Result,- "paymentInfo": paymentInfo.Result,- "countries": allCountries.Result,- },- })- }-}--// UpdatePaymentInfo on stripe based on given input-func UpdatePaymentInfo() web.HandlerFunc {- return func(c *web.Context) error {- input := new(actions.CreateEditBillingPaymentInfo)- if result := c.BindTo(input); !result.Ok {- return c.HandleValidation(result)- }-- if err := bus.Dispatch(c, &cmd.UpdatePaymentInfo{Input: input.Model}); err != nil {- return c.Failure(err)- }-- return c.Ok(web.Map{})- }-}--// GetBillingPlans returns a list of plans for given country code-func GetBillingPlans() web.HandlerFunc {- return func(c *web.Context) error {- countryCode := c.Param("countryCode")- listPlansQuery := &query.ListBillingPlans{CountryCode: countryCode}- err := bus.Dispatch(c, listPlansQuery)- if err != nil {- return c.Failure(err)- }- return c.Ok(listPlansQuery.Result)- }-}--// BillingSubscribe subscribes current tenant to given plan on stripe-func BillingSubscribe() web.HandlerFunc {- return func(c *web.Context) error {- planID := c.Param("planID")-- paymentInfoQuery := &query.GetPaymentInfo{}- err := bus.Dispatch(c, paymentInfoQuery)- if err != nil {- return c.Failure(err)- }-- getPlanByIDQuery := &query.GetBillingPlanByID{- PlanID: planID,- CountryCode: paymentInfoQuery.Result.AddressCountry,- }- err = bus.Dispatch(c, getPlanByIDQuery)- if err != nil {- return c.Failure(err)- }- plan := getPlanByIDQuery.Result-- countUsers := &query.CountUsers{}- err = bus.Dispatch(c, countUsers)- if err != nil {- return c.Failure(err)- }-- if plan.MaxUsers > 0 && countUsers.Result > plan.MaxUsers {- return c.Unauthorized()- }-- if err = bus.Dispatch(c, &cmd.CreateBillingSubscription{- PlanID: plan.ID,- }); err != nil {- return c.Failure(err)- }-- updateBilling := &cmd.UpdateTenantBillingSettings{Settings: c.Tenant().Billing}- activateTenant := &cmd.ActivateTenant{TenantID: c.Tenant().ID}- if err := bus.Dispatch(c, updateBilling, activateTenant); err != nil {- return c.Failure(err)- }-- return c.Ok(web.Map{})- }-}--// CancelBillingSubscription cancels current subscription from current tenant-func CancelBillingSubscription() web.HandlerFunc {- return func(c *web.Context) error {- err := bus.Dispatch(c, &cmd.CancelBillingSubscription{})- if err != nil {- return c.Failure(err)- }-- if err := bus.Dispatch(c, &cmd.UpdateTenantBillingSettings{- Settings: c.Tenant().Billing,- }); err != nil {- return c.Failure(err)- }-- return c.Ok(web.Map{})- }-}diff --git a/app/middlewares/common.go b/app/middlewares/common.godeleted file mode 100644index b4bf54d35..000000000--- a/app/middlewares/common.go+++ /dev/null@@ -1,18 +0,0 @@-package middlewares--import (- "github.com/getfider/fider/app/pkg/env"- "github.com/getfider/fider/app/pkg/web"-)--// RequireBillingEnabled returns 404 if billing is not enabled, otherwise it continues the chain-func RequireBillingEnabled() web.MiddlewareFunc {- return func(next web.HandlerFunc) web.HandlerFunc {- return func(c *web.Context) error {- if !env.IsBillingEnabled() || c.Tenant().Billing == nil {- return c.NotFound()- }- return next(c)- }- }-}diff --git a/app/middlewares/security_test.go b/app/middlewares/security_test.goindex a786f70de..efd5c9fd7 100644--- a/app/middlewares/security_test.go+++ b/app/middlewares/security_test.go@@ -23,7 +23,7 @@ func TestSecureWithoutCDN(t *testing.T) {return c.NoContent(http.StatusOK)})- expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com ; script-src 'self' 'nonce-" + ctxID + "' https://js.stripe.com https://www.google-analytics.com ; img-src 'self' https: data: ; font-src 'self' https://fonts.gstatic.com data: ; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://ipinfo.io https://js.stripe.com ; frame-src 'self' https://js.stripe.com"+ expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com ; script-src 'self' 'nonce-" + ctxID + "' https://www.google-analytics.com ; img-src 'self' https: data: ; font-src 'self' https://fonts.gstatic.com data: ; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com ; frame-src 'self'"Expect(status).Equals(http.StatusOK)Expect(response.Header().Get("Content-Security-Policy")).Equals(expectedPolicy)@@ -46,7 +46,7 @@ func TestSecureWithCDN(t *testing.T) {return c.NoContent(http.StatusOK)})- expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com *.test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://js.stripe.com https://www.google-analytics.com *.test.fider.io; img-src 'self' https: data: *.test.fider.io; font-src 'self' https://fonts.gstatic.com data: *.test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://ipinfo.io https://js.stripe.com *.test.fider.io; frame-src 'self' https://js.stripe.com"+ expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com *.test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://www.google-analytics.com *.test.fider.io; img-src 'self' https: data: *.test.fider.io; font-src 'self' https://fonts.gstatic.com data: *.test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com *.test.fider.io; frame-src 'self'"Expect(status).Equals(http.StatusOK)Expect(response.Header().Get("Content-Security-Policy")).Equals(expectedPolicy)@@ -69,7 +69,7 @@ func TestSecureWithCDN_SingleHost(t *testing.T) {return c.NoContent(http.StatusOK)})- expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://js.stripe.com https://www.google-analytics.com test.fider.io; img-src 'self' https: data: test.fider.io; font-src 'self' https://fonts.gstatic.com data: test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://ipinfo.io https://js.stripe.com test.fider.io; frame-src 'self' https://js.stripe.com"+ expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://www.google-analytics.com test.fider.io; img-src 'self' https: data: test.fider.io; font-src 'self' https://fonts.gstatic.com data: test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com test.fider.io; frame-src 'self'"Expect(status).Equals(http.StatusOK)Expect(response.Header().Get("Content-Security-Policy")).Equals(expectedPolicy)diff --git a/app/models/cmd/billing.go b/app/models/cmd/billing.godeleted file mode 100644index 77fba7a23..000000000--- a/app/models/cmd/billing.go+++ /dev/null@@ -1,23 +0,0 @@-package cmd--import "github.com/getfider/fider/app/models/dto"--type CancelBillingSubscription struct {-}--type CreateBillingSubscription struct {- PlanID string-}--type CreateBillingCustomer struct {-}--type DeleteBillingCustomer struct {-}--type ClearPaymentInfo struct {-}--type UpdatePaymentInfo struct {- Input *dto.CreateEditBillingPaymentInfo-}diff --git a/app/models/cmd/tenant.go b/app/models/cmd/tenant.goindex 9dd031831..a726ca506 100644--- a/app/models/cmd/tenant.go+++ b/app/models/cmd/tenant.go@@ -22,10 +22,6 @@ type UpdateTenantSettings struct {Settings *models.UpdateTenantSettings}-type UpdateTenantBillingSettings struct {- Settings *models.TenantBilling-}-type UpdateTenantAdvancedSettings struct {Settings *models.UpdateTenantAdvancedSettings}diff --git a/app/models/dto/billing.go b/app/models/dto/billing.godeleted file mode 100644index 5a19563a7..000000000--- a/app/models/dto/billing.go+++ /dev/null@@ -1,68 +0,0 @@-package dto--import "time"--// Country is a valid country within Fider-type Country struct {- Code string `json:"code"`- Name string `json:"name"`- IsEU bool `json:"isEU"`-}--// BillingPlan is the model for billing plan from Stripe-type BillingPlan struct {- ID string `json:"id"`- Name string `json:"name"`- Description string `json:"description"`- Currency string `json:"currency"`- MaxUsers int `json:"maxUsers"`- Price int64 `json:"price"`- Interval string `json:"interval"`-}--// UpcomingInvoice is the model for upcoming invoice from Stripe-type UpcomingInvoice struct {- Currency string `json:"currency"`- DueDate time.Time `json:"dueDate"`- AmountDue int64 `json:"amountDue"`-}--// PaymentInfo is the model for billing payment info-type PaymentInfo struct {- StripeCardID string `json:"-"`- CardCountry string `json:"cardCountry"`- CardBrand string `json:"cardBrand"`- CardLast4 string `json:"cardLast4"`- CardExpMonth uint8 `json:"cardExpMonth"`- CardExpYear uint16 `json:"cardExpYear"`- AddressCity string `json:"addressCity"`- AddressCountry string `json:"addressCountry"`- Name string `json:"name"`- Email string `json:"email"`- AddressLine1 string `json:"addressLine1"`- AddressLine2 string `json:"addressLine2"`- AddressState string `json:"addressState"`- AddressPostalCode string `json:"addressPostalCode"`- VATNumber string `json:"vatNumber"`-}--// CreateEditBillingPaymentInfo is the input model to create or edit billing payment info-type CreateEditBillingPaymentInfo struct {- Name string `json:"name"`- Email string `json:"email"`- Card *CreateEditBillingPaymentInfoCard `json:"card"`- AddressLine1 string `json:"addressLine1"`- AddressLine2 string `json:"addressLine2"`- AddressCity string `json:"addressCity"`- AddressState string `json:"addressState"`- AddressPostalCode string `json:"addressPostalCode"`- AddressCountry string `json:"addressCountry" format:"upper"`- VATNumber string `json:"vatNumber"`-}--// CreateEditBillingPaymentInfoCard is the input model for a card during billing payment info update-type CreateEditBillingPaymentInfoCard struct {- Type string `json:"type"`- Token string `json:"token"`- Country string `json:"country"`-}diff --git a/app/models/identity.go b/app/models/identity.goindex ce4d0d7f3..a8ae48f09 100644--- a/app/models/identity.go+++ b/app/models/identity.go@@ -10,26 +10,16 @@ import (//Tenant represents a tenanttype Tenant struct {- ID int `json:"id"`- Name string `json:"name"`- Subdomain string `json:"subdomain"`- Invitation string `json:"invitation"`- WelcomeMessage string `json:"welcomeMessage"`- CNAME string `json:"cname"`- Status int `json:"status"`- IsPrivate bool `json:"isPrivate"`- LogoBlobKey string `json:"logoBlobKey"`- Billing *TenantBilling `json:"billing,omitempty"`- CustomCSS string `json:"-"`-}--//TenantBilling has all the billing information of given tenant-type TenantBilling struct {- StripeCustomerID string- StripeSubscriptionID string- StripePlanID string `json:"stripePlanID"`- TrialEndsAt time.Time `json:"trialEndsAt"`- SubscriptionEndsAt *time.Time `json:"subscriptionEndsAt,omitempty"`+ ID int `json:"id"`+ Name string `json:"name"`+ Subdomain string `json:"subdomain"`+ Invitation string `json:"invitation"`+ WelcomeMessage string `json:"welcomeMessage"`+ CNAME string `json:"cname"`+ Status int `json:"status"`+ IsPrivate bool `json:"isPrivate"`+ LogoBlobKey string `json:"logoBlobKey"`+ CustomCSS string `json:"-"`}//Upload represents a file that has been uploaded to Fiderdiff --git a/app/models/query/billing.go b/app/models/query/billing.godeleted file mode 100644index 78bd4c099..000000000--- a/app/models/query/billing.go+++ /dev/null@@ -1,34 +0,0 @@-package query--import "github.com/getfider/fider/app/models/dto"--type ListBillingPlans struct {- CountryCode string-- Result []*dto.BillingPlan-}--type GetBillingPlanByID struct {- PlanID string- CountryCode string-- Result *dto.BillingPlan-}--type GetUpcomingInvoice struct {- Result *dto.UpcomingInvoice-}--type GetPaymentInfo struct {- Result *dto.PaymentInfo-}--type GetAllCountries struct {- Result []*dto.Country-}--type GetCountryByCode struct {- Code string-- Result *dto.Country-}diff --git a/app/pkg/env/env.go b/app/pkg/env/env.goindex f1f751a8a..b777db800 100644--- a/app/pkg/env/env.go+++ b/app/pkg/env/env.go@@ -31,10 +31,6 @@ type config struct {MaxIdleConns int `env:"DATABASE_MAX_IDLE_CONNS,default=2,strict"`MaxOpenConns int `env:"DATABASE_MAX_OPEN_CONNS,default=4,strict"`}- Stripe struct {- SecretKey string `env:"STRIPE_SECRET_KEY"`- PublicKey string `env:"STRIPE_PUBLIC_KEY"`- }CDN struct {Host string `env:"CDN_HOST"`}@@ -129,11 +125,6 @@ func mustBeSet(name string) {}}-// IsBillingEnabled returns true if billing is enabled-func IsBillingEnabled() bool {- return Config.Stripe.SecretKey != ""-}-// IsSingleHostMode returns true if host mode is set to single tenantfunc IsSingleHostMode() bool {return Config.HostMode == "single"diff --git a/app/pkg/env/env_test.go b/app/pkg/env/env_test.goindex 5cc193797..ecebb07b7 100644--- a/app/pkg/env/env_test.go+++ b/app/pkg/env/env_test.go@@ -50,16 +50,6 @@ func TestMultiTenantDomain(t *testing.T) {Expect(env.MultiTenantDomain()).Equals(".fider.io")}-func TestIsBillingEnbled(t *testing.T) {- RegisterT(t)-- env.Config.Stripe.SecretKey = ""- env.Config.Stripe.PublicKey = "pk_111"- Expect(env.IsBillingEnabled()).IsFalse()- env.Config.Stripe.SecretKey = "sk_1234"- Expect(env.IsBillingEnabled()).IsTrue()-}-func TestSubdomain(t *testing.T) {RegisterT(t)diff --git a/app/pkg/web/engine.go b/app/pkg/web/engine.goindex b8a7eda8c..182fd113e 100644--- a/app/pkg/web/engine.go+++ b/app/pkg/web/engine.go@@ -27,13 +27,13 @@ var (cspBase = "base-uri 'self'"cspDefault = "default-src 'self'"cspStyle = "style-src 'self' 'nonce-%[1]s' https://fonts.googleapis.com %[2]s"- cspScript = "script-src 'self' 'nonce-%[1]s' https://js.stripe.com https://www.google-analytics.com %[2]s"+ cspScript = "script-src 'self' 'nonce-%[1]s' https://www.google-analytics.com %[2]s"cspFont = "font-src 'self' https://fonts.gstatic.com data: %[2]s"cspImage = "img-src 'self' https: data: %[2]s"cspObject = "object-src 'none'"- cspFrame = "frame-src 'self' https://js.stripe.com"+ cspFrame = "frame-src 'self'"cspMedia = "media-src 'none'"- cspConnect = "connect-src 'self' https://www.google-analytics.com https://ipinfo.io https://js.stripe.com %[2]s"+ cspConnect = "connect-src 'self' https://www.google-analytics.com %[2]s"//CspPolicyTemplate is the template used to generate the policyCspPolicyTemplate = fmt.Sprintf("%s; %s; %s; %s; %s; %s; %s; %s; %s; %s", cspBase, cspDefault, cspStyle, cspScript, cspImage, cspFont, cspObject, cspMedia, cspConnect, cspFrame)diff --git a/app/pkg/web/renderer.go b/app/pkg/web/renderer.goindex 9251ceac2..1ef067c82 100644--- a/app/pkg/web/renderer.go+++ b/app/pkg/web/renderer.go@@ -222,7 +222,6 @@ func (r *Renderer) Render(w io.Writer, statusCode int, name string, props Props,"environment": r.settings.Environment,"compiler": r.settings.Compiler,"googleAnalytics": r.settings.GoogleAnalytics,- "stripePublicKey": env.Config.Stripe.PublicKey,"domain": r.settings.Domain,"hasLegal": r.settings.HasLegal,"baseURL": ctx.BaseURL(),diff --git a/app/pkg/web/testdata/basic.html b/app/pkg/web/testdata/basic.htmlindex fb417ce12..dd5fa6984 100755--- a/app/pkg/web/testdata/basic.html+++ b/app/pkg/web/testdata/basic.html@@ -37,7 +37,7 @@<script id="server-data" type="application/json">- {"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}+ {"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}</script>diff --git a/app/pkg/web/testdata/canonical.html b/app/pkg/web/testdata/canonical.htmlindex 2dc415d13..175552dc0 100755--- a/app/pkg/web/testdata/canonical.html+++ b/app/pkg/web/testdata/canonical.html@@ -39,7 +39,7 @@<script id="server-data" type="application/json">- {"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}+ {"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}</script>diff --git a/app/pkg/web/testdata/chunk.html b/app/pkg/web/testdata/chunk.htmlindex 15ca3765c..ad1035af7 100644--- a/app/pkg/web/testdata/chunk.html+++ b/app/pkg/web/testdata/chunk.html@@ -44,7 +44,7 @@<script id="server-data" type="application/json">- {"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}+ {"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}</script>diff --git a/app/pkg/web/testdata/oauth.html b/app/pkg/web/testdata/oauth.htmlindex bea6b4f33..85710d90e 100755--- a/app/pkg/web/testdata/oauth.html+++ b/app/pkg/web/testdata/oauth.html@@ -37,7 +37,7 @@<script id="server-data" type="application/json">- {"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[{"provider":"google","displayName":"Google","clientID":"1234","url":"https://demo.test.fider.io:3000/oauth/google","callbackURL":"https://demo.test.fider.io:3000/oauth/google/callback","logoBlobKey":"google.png","isCustomProvider":false,"isEnabled":true}],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}+ {"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[{"provider":"google","displayName":"Google","clientID":"1234","url":"https://demo.test.fider.io:3000/oauth/google","callbackURL":"https://demo.test.fider.io:3000/oauth/google/callback","logoBlobKey":"google.png","isCustomProvider":false,"isEnabled":true}],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}</script>diff --git a/app/pkg/web/testdata/props.html b/app/pkg/web/testdata/props.htmlindex 6a0c2f735..1c850da44 100755--- a/app/pkg/web/testdata/props.html+++ b/app/pkg/web/testdata/props.html@@ -37,7 +37,7 @@<script id="server-data" type="application/json">- {"contextID":"CONTEXT_ID","description":"My Page Description","props":{"array":["1","2"],"number":2,"object":{"key1":"value1","key2":"value2"}},"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"My Page Title · Fider"}+ {"contextID":"CONTEXT_ID","description":"My Page Description","props":{"array":["1","2"],"number":2,"object":{"key1":"value1","key2":"value2"}},"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"My Page Title · Fider"}</script>diff --git a/app/pkg/web/testdata/tenant.html b/app/pkg/web/testdata/tenant.htmlindex 94c24161f..30aedb21b 100755--- a/app/pkg/web/testdata/tenant.html+++ b/app/pkg/web/testdata/tenant.html@@ -37,7 +37,7 @@<script id="server-data" type="application/json">- {"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"isPrivate":false,"logoBlobKey":""},"title":"Game of Thrones"}+ {"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"isPrivate":false,"logoBlobKey":""},"title":"Game of Thrones"}</script>diff --git a/app/pkg/web/testdata/user.html b/app/pkg/web/testdata/user.htmlindex 6a2a955a8..36040225c 100755--- a/app/pkg/web/testdata/user.html+++ b/app/pkg/web/testdata/user.html@@ -37,7 +37,7 @@<script id="server-data" type="application/json">- {"contextID":"CONTEXT_ID","description":"My Page Description","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"My Page Title · Fider","user":{"avatarBlobKey":"","avatarType":"gravatar","avatarURL":"https://demo.test.fider.io:3000/avatars/gravatar/5/Jon%20Snow","email":"[email protected]","id":5,"isAdministrator":true,"isCollaborator":true,"name":"Jon Snow","role":"administrator","status":"active"}}+ {"contextID":"CONTEXT_ID","description":"My Page Description","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"My Page Title · Fider","user":{"avatarBlobKey":"","avatarType":"gravatar","avatarURL":"https://demo.test.fider.io:3000/avatars/gravatar/5/Jon%20Snow","email":"[email protected]","id":5,"isAdministrator":true,"isCollaborator":true,"name":"Jon Snow","role":"administrator","status":"active"}}</script>diff --git a/app/services/billing/billing.go b/app/services/billing/billing.godeleted file mode 100644index a2ddbaf85..000000000--- a/app/services/billing/billing.go+++ /dev/null@@ -1,56 +0,0 @@-package billing--import (- "context"-- "github.com/getfider/fider/app"- "github.com/getfider/fider/app/models"- "github.com/getfider/fider/app/pkg/bus"- "github.com/getfider/fider/app/pkg/env"- "github.com/stripe/stripe-go"- "github.com/stripe/stripe-go/client"-)--var stripeClient *client.API--func init() {- bus.Register(Service{})-}--type Service struct{}--func (s Service) Name() string {- return "Stripe"-}--func (s Service) Category() string {- return "billing"-}--func (s Service) Enabled() bool {- return env.IsBillingEnabled()-}--func (s Service) Init() {- stripe.DefaultLeveledLogger = &stripe.LeveledLogger{Level: 0}- stripeClient = &client.API{}- stripeClient.Init(env.Config.Stripe.SecretKey, nil)-- bus.AddHandler(listPlans)- bus.AddHandler(getPlanByID)- bus.AddHandler(cancelSubscription)- bus.AddHandler(subscribe)- bus.AddHandler(getUpcomingInvoice)- bus.AddHandler(createCustomer)- bus.AddHandler(deleteCustomer)- bus.AddHandler(getPaymentInfo)- bus.AddHandler(clearPaymentInfo)- bus.AddHandler(updatePaymentInfo)- bus.AddHandler(getAllCountries)- bus.AddHandler(getCountryByCode)-}--func using(ctx context.Context, handler func(tenant *models.Tenant) error) error {- tenant, _ := ctx.Value(app.TenantCtxKey).(*models.Tenant)- return handler(tenant)-}diff --git a/app/services/billing/billing_test.go b/app/services/billing/billing_test.godeleted file mode 100644index 55b30b781..000000000--- a/app/services/billing/billing_test.go+++ /dev/null@@ -1,243 +0,0 @@-package billing_test--import (- "context"- "testing"- "time"-- "github.com/getfider/fider/app"-- "github.com/getfider/fider/app/pkg/bus"- "github.com/getfider/fider/app/pkg/env"-- "github.com/getfider/fider/app/models"- "github.com/getfider/fider/app/models/cmd"- "github.com/getfider/fider/app/models/dto"- "github.com/getfider/fider/app/models/query"- . "github.com/getfider/fider/app/pkg/assert"- "github.com/getfider/fider/app/services/billing"-)--func TestCreateCustomer_WithSubscription(t *testing.T) {- RegisterT(t)- if !env.IsBillingEnabled() {- return- }-- bus.Init(billing.Service{})-- tenant := &models.Tenant{- ID: 2,- Name: "Game Inc.",- Subdomain: "gameinc",- Billing: &models.TenantBilling{},- }- ctx := context.WithValue(context.Background(), app.TenantCtxKey, tenant)-- err := bus.Dispatch(ctx, &cmd.CreateBillingCustomer{})- Expect(err).IsNil()- Expect(tenant.Billing.StripeCustomerID).IsNotEmpty()-- err = bus.Dispatch(ctx, &cmd.UpdatePaymentInfo{- Input: &dto.CreateEditBillingPaymentInfo{- Email: "[email protected]",- Card: &dto.CreateEditBillingPaymentInfoCard{- Token: "tok_visa",- },- },- })- Expect(err).IsNil()-- createSubscription := &cmd.CreateBillingSubscription{PlanID: "plan_EKTT1YWe1Zmrtp"}- err = bus.Dispatch(ctx, createSubscription)- Expect(err).IsNil()- Expect(tenant.Billing.StripeSubscriptionID).IsNotEmpty()- Expect(tenant.Billing.StripePlanID).Equals("plan_EKTT1YWe1Zmrtp")-- invoiceQuery := &query.GetUpcomingInvoice{}- err = bus.Dispatch(ctx, invoiceQuery)- Expect(err).IsNil()- Expect(int(invoiceQuery.Result.AmountDue)).Equals(900)- Expect(invoiceQuery.Result.Currency).Equals("USD")-- err = bus.Dispatch(ctx, &cmd.CancelBillingSubscription{})- Expect(err).IsNil()- Expect(tenant.Billing.SubscriptionEndsAt).IsNotNil()-- err = bus.Dispatch(ctx, &cmd.DeleteBillingCustomer{})- Expect(err).IsNil()-}--var forUnitTestingTenant = &models.Tenant{- ID: 5,- Name: "For Unit Testing (DO NOT DELETE)",- Subdomain: "unittesting",- Billing: &models.TenantBilling{- StripeCustomerID: "cus_EICBuXBIkhI2EV",- },-}--func TestUpdatePaymentInfo(t *testing.T) {- RegisterT(t)- if !env.IsBillingEnabled() {- return- }-- bus.Init(billing.Service{})-- var firstCardID string-- ctx := context.WithValue(context.Background(), app.TenantCtxKey, forUnitTestingTenant)-- err := bus.Dispatch(ctx, &cmd.ClearPaymentInfo{})- Expect(err).IsNil()-- //Creating a new card- err = bus.Dispatch(ctx, &cmd.UpdatePaymentInfo{- Input: &dto.CreateEditBillingPaymentInfo{- Email: "[email protected]",- VATNumber: "IE1234",- Card: &dto.CreateEditBillingPaymentInfoCard{- Token: "tok_visa",- },- AddressCountry: "IE",- },- })- Expect(err).IsNil()-- paymentInfoQuery := &query.GetPaymentInfo{}- err = bus.Dispatch(ctx, paymentInfoQuery)- Expect(err).IsNil()- info := paymentInfoQuery.Result-- firstCardID = info.StripeCardID-- Expect(info.StripeCardID).IsNotEmpty()- Expect(info.Email).Equals("[email protected]")- Expect(info.VATNumber).Equals("IE1234")- Expect(info.CardBrand).Equals("Visa")- Expect(info.CardCountry).Equals("US")- Expect(info.CardLast4).Equals("4242")- Expect(int(info.CardExpMonth)).Equals(int(time.Now().Month()))- Expect(int(info.CardExpYear)).Equals(time.Now().Year() + 1)- Expect(info.Name).Equals("")- Expect(info.AddressLine1).Equals("")- Expect(info.AddressLine2).Equals("")- Expect(info.AddressCity).Equals("")- Expect(info.AddressState).Equals("")- Expect(info.AddressPostalCode).Equals("")- Expect(info.AddressCountry).Equals("")-- //Update existing card- err = bus.Dispatch(ctx, &cmd.UpdatePaymentInfo{- Input: &dto.CreateEditBillingPaymentInfo{- Email: "[email protected]",- Name: "Jon Snow",- AddressLine1: "Street 1",- AddressLine2: "Av. ABC",- AddressCity: "New York",- AddressState: "NYC",- AddressPostalCode: "12098",- AddressCountry: "US",- },- })- Expect(err).IsNil()-- paymentInfoQuery = &query.GetPaymentInfo{}- err = bus.Dispatch(ctx, paymentInfoQuery)- Expect(err).IsNil()- info = paymentInfoQuery.Result-- Expect(info.Name).Equals("Jon Snow")- Expect(info.VATNumber).Equals("")- Expect(info.CardLast4).Equals("4242")- Expect(info.AddressLine1).Equals("Street 1")- Expect(info.AddressLine2).Equals("Av. ABC")- Expect(info.AddressCity).Equals("New York")- Expect(info.AddressState).Equals("NYC")- Expect(info.AddressPostalCode).Equals("12098")- Expect(info.AddressCountry).Equals("US")-- //Replace card- err = bus.Dispatch(ctx, &cmd.UpdatePaymentInfo{- Input: &dto.CreateEditBillingPaymentInfo{- Email: "[email protected]",- Card: &dto.CreateEditBillingPaymentInfoCard{- Token: "tok_br",- },- },- })- Expect(err).IsNil()-- paymentInfoQuery = &query.GetPaymentInfo{}- err = bus.Dispatch(ctx, paymentInfoQuery)- Expect(err).IsNil()- info = paymentInfoQuery.Result-- Expect(info.StripeCardID).IsNotEmpty()- Expect(info.StripeCardID).NotEquals(firstCardID)- Expect(info.Email).Equals("[email protected]")- Expect(info.VATNumber).Equals("")- Expect(info.CardBrand).Equals("Visa")- Expect(info.CardCountry).Equals("BR")- Expect(info.CardLast4).Equals("0002")- Expect(int(info.CardExpMonth)).Equals(int(time.Now().Month()))- Expect(int(info.CardExpYear)).Equals(time.Now().Year() + 1)- Expect(info.Name).Equals("")- Expect(info.AddressLine1).Equals("")- Expect(info.AddressLine2).Equals("")- Expect(info.AddressCity).Equals("")- Expect(info.AddressState).Equals("")- Expect(info.AddressPostalCode).Equals("")- Expect(info.AddressCountry).Equals("")-}--func TestListPlans(t *testing.T) {- RegisterT(t)- if !env.IsBillingEnabled() {- return- }-- bus.Init(billing.Service{})- ctx := context.Background()-- q := &query.ListBillingPlans{CountryCode: "US"}- err := bus.Dispatch(ctx, q)- Expect(err).IsNil()- Expect(q.Result).HasLen(3)-- Expect(q.Result[0].ID).Equals("plan_EKTT1YWe1Zmrtp")- Expect(q.Result[0].Name).Equals("Starter")- Expect(q.Result[0].Currency).Equals("USD")- Expect(q.Result[0].MaxUsers).Equals(200)-- Expect(q.Result[1].ID).Equals("plan_DoK187GZcnFpKY")- Expect(q.Result[1].Name).Equals("Business (monthly)")- Expect(q.Result[1].Currency).Equals("USD")- Expect(q.Result[1].MaxUsers).Equals(0)-- Expect(q.Result[2].ID).Equals("plan_DpN9SkJMjNTvLd")- Expect(q.Result[2].Name).Equals("Business (yearly)")- Expect(q.Result[2].Currency).Equals("USD")- Expect(q.Result[2].MaxUsers).Equals(0)-- q = &query.ListBillingPlans{CountryCode: "DE"}- err = bus.Dispatch(ctx, q)- Expect(err).IsNil()- Expect(q.Result).HasLen(3)-- Expect(q.Result[0].ID).Equals("plan_EKTSnrGmj5BuKI")- Expect(q.Result[0].Name).Equals("Starter")- Expect(q.Result[0].Currency).Equals("EUR")-- Expect(q.Result[0].MaxUsers).Equals(200)- Expect(q.Result[1].ID).Equals("plan_EKPnahGhiTEnCc")- Expect(q.Result[1].Name).Equals("Business (monthly)")- Expect(q.Result[1].Currency).Equals("EUR")- Expect(q.Result[1].MaxUsers).Equals(0)-- Expect(q.Result[2].ID).Equals("plan_EKTU4xD7LNI9dO")- Expect(q.Result[2].Name).Equals("Business (yearly)")- Expect(q.Result[2].Currency).Equals("EUR")- Expect(q.Result[2].MaxUsers).Equals(0)-}diff --git a/app/services/billing/country.go b/app/services/billing/country.godeleted file mode 100644index 7f456421e..000000000--- a/app/services/billing/country.go+++ /dev/null@@ -1,278 +0,0 @@-package billing--import (- "context"-- "github.com/getfider/fider/app"-- "github.com/getfider/fider/app/models/dto"- "github.com/getfider/fider/app/models/query"- "github.com/goenning/vat"-)--func getAllCountries(ctx context.Context, q *query.GetAllCountries) error {- q.Result = allCountries- return nil-}--func getCountryByCode(ctx context.Context, q *query.GetCountryByCode) error {- for _, c := range allCountries {- if c.Code == q.Code {- q.Result = c- return nil- }- }- return app.ErrNotFound-}--var allCountries = []*dto.Country{- &dto.Country{Code: "AF", Name: "Afghanistan", IsEU: vat.IsEU("AF")},- &dto.Country{Code: "AX", Name: "Åland Islands", IsEU: vat.IsEU("AX")},- &dto.Country{Code: "AL", Name: "Albania", IsEU: vat.IsEU("AL")},- &dto.Country{Code: "DZ", Name: "Algeria", IsEU: vat.IsEU("DZ")},- &dto.Country{Code: "AS", Name: "American Samoa", IsEU: vat.IsEU("AS")},- &dto.Country{Code: "AD", Name: "Andorra", IsEU: vat.IsEU("AD")},- &dto.Country{Code: "AO", Name: "Angola", IsEU: vat.IsEU("AO")},- &dto.Country{Code: "AI", Name: "Anguilla", IsEU: vat.IsEU("AI")},- &dto.Country{Code: "AQ", Name: "Antarctica", IsEU: vat.IsEU("AQ")},- &dto.Country{Code: "AG", Name: "Antigua and Barbuda", IsEU: vat.IsEU("AG")},- &dto.Country{Code: "AR", Name: "Argentina", IsEU: vat.IsEU("AR")},- &dto.Country{Code: "AM", Name: "Armenia", IsEU: vat.IsEU("AM")},- &dto.Country{Code: "AW", Name: "Aruba", IsEU: vat.IsEU("AW")},- &dto.Country{Code: "AU", Name: "Australia", IsEU: vat.IsEU("AU")},- &dto.Country{Code: "AT", Name: "Austria", IsEU: vat.IsEU("AT")},- &dto.Country{Code: "AZ", Name: "Azerbaijan", IsEU: vat.IsEU("AZ")},- &dto.Country{Code: "BS", Name: "Bahamas", IsEU: vat.IsEU("BS")},- &dto.Country{Code: "BH", Name: "Bahrain", IsEU: vat.IsEU("BH")},- &dto.Country{Code: "BD", Name: "Bangladesh", IsEU: vat.IsEU("BD")},- &dto.Country{Code: "BB", Name: "Barbados", IsEU: vat.IsEU("BB")},- &dto.Country{Code: "BY", Name: "Belarus", IsEU: vat.IsEU("BY")},- &dto.Country{Code: "BE", Name: "Belgium", IsEU: vat.IsEU("BE")},- &dto.Country{Code: "BZ", Name: "Belize", IsEU: vat.IsEU("BZ")},- &dto.Country{Code: "BJ", Name: "Benin", IsEU: vat.IsEU("BJ")},- &dto.Country{Code: "BM", Name: "Bermuda", IsEU: vat.IsEU("BM")},- &dto.Country{Code: "BT", Name: "Bhutan", IsEU: vat.IsEU("BT")},- &dto.Country{Code: "BO", Name: "Bolivia, Plurinational State of", IsEU: vat.IsEU("BO")},- &dto.Country{Code: "BQ", Name: "Bonaire, Sint Eustatius and Saba", IsEU: vat.IsEU("BQ")},- &dto.Country{Code: "BA", Name: "Bosnia and Herzegovina", IsEU: vat.IsEU("BA")},- &dto.Country{Code: "BW", Name: "Botswana", IsEU: vat.IsEU("BW")},- &dto.Country{Code: "BV", Name: "Bouvet Island", IsEU: vat.IsEU("BV")},- &dto.Country{Code: "BR", Name: "Brazil", IsEU: vat.IsEU("BR")},- &dto.Country{Code: "IO", Name: "British Indian Ocean Territory", IsEU: vat.IsEU("IO")},- &dto.Country{Code: "BN", Name: "Brunei Darussalam", IsEU: vat.IsEU("BN")},- &dto.Country{Code: "BG", Name: "Bulgaria", IsEU: vat.IsEU("BG")},- &dto.Country{Code: "BF", Name: "Burkina Faso", IsEU: vat.IsEU("BF")},- &dto.Country{Code: "BI", Name: "Burundi", IsEU: vat.IsEU("BI")},- &dto.Country{Code: "KH", Name: "Cambodia", IsEU: vat.IsEU("KH")},- &dto.Country{Code: "CM", Name: "Cameroon", IsEU: vat.IsEU("CM")},- &dto.Country{Code: "CA", Name: "Canada", IsEU: vat.IsEU("CA")},- &dto.Country{Code: "CV", Name: "Cape Verde", IsEU: vat.IsEU("CV")},- &dto.Country{Code: "KY", Name: "Cayman Islands", IsEU: vat.IsEU("KY")},- &dto.Country{Code: "CF", Name: "Central African Republic", IsEU: vat.IsEU("CF")},- &dto.Country{Code: "TD", Name: "Chad", IsEU: vat.IsEU("TD")},- &dto.Country{Code: "CL", Name: "Chile", IsEU: vat.IsEU("CL")},- &dto.Country{Code: "CN", Name: "China", IsEU: vat.IsEU("CN")},- &dto.Country{Code: "CX", Name: "Christmas Island", IsEU: vat.IsEU("CX")},- &dto.Country{Code: "CC", Name: "Cocos (Keeling) Islands", IsEU: vat.IsEU("CC")},- &dto.Country{Code: "CO", Name: "Colombia", IsEU: vat.IsEU("CO")},- &dto.Country{Code: "KM", Name: "Comoros", IsEU: vat.IsEU("KM")},- &dto.Country{Code: "CG", Name: "Congo", IsEU: vat.IsEU("CG")},- &dto.Country{Code: "CD", Name: "Congo, the Democratic Republic of the", IsEU: vat.IsEU("CD")},- &dto.Country{Code: "CK", Name: "Cook Islands", IsEU: vat.IsEU("CK")},- &dto.Country{Code: "CR", Name: "Costa Rica", IsEU: vat.IsEU("CR")},- &dto.Country{Code: "CI", Name: "Côte d'Ivoire", IsEU: vat.IsEU("CI")},- &dto.Country{Code: "HR", Name: "Croatia", IsEU: vat.IsEU("HR")},- &dto.Country{Code: "CU", Name: "Cuba", IsEU: vat.IsEU("CU")},- &dto.Country{Code: "CW", Name: "Curaçao", IsEU: vat.IsEU("CW")},- &dto.Country{Code: "CY", Name: "Cyprus", IsEU: vat.IsEU("CY")},- &dto.Country{Code: "CZ", Name: "Czech Republic", IsEU: vat.IsEU("CZ")},- &dto.Country{Code: "DK", Name: "Denmark", IsEU: vat.IsEU("DK")},- &dto.Country{Code: "DJ", Name: "Djibouti", IsEU: vat.IsEU("DJ")},- &dto.Country{Code: "DM", Name: "Dominica", IsEU: vat.IsEU("DM")},- &dto.Country{Code: "DO", Name: "Dominican Republic", IsEU: vat.IsEU("DO")},- &dto.Country{Code: "EC", Name: "Ecuador", IsEU: vat.IsEU("EC")},- &dto.Country{Code: "EG", Name: "Egypt", IsEU: vat.IsEU("EG")},- &dto.Country{Code: "SV", Name: "El Salvador", IsEU: vat.IsEU("SV")},- &dto.Country{Code: "GQ", Name: "Equatorial Guinea", IsEU: vat.IsEU("GQ")},- &dto.Country{Code: "ER", Name: "Eritrea", IsEU: vat.IsEU("ER")},- &dto.Country{Code: "EE", Name: "Estonia", IsEU: vat.IsEU("EE")},- &dto.Country{Code: "ET", Name: "Ethiopia", IsEU: vat.IsEU("ET")},- &dto.Country{Code: "FK", Name: "Falkland Islands (Malvinas)", IsEU: vat.IsEU("FK")},- &dto.Country{Code: "FO", Name: "Faroe Islands", IsEU: vat.IsEU("FO")},- &dto.Country{Code: "FJ", Name: "Fiji", IsEU: vat.IsEU("FJ")},- &dto.Country{Code: "FI", Name: "Finland", IsEU: vat.IsEU("FI")},- &dto.Country{Code: "FR", Name: "France", IsEU: vat.IsEU("FR")},- &dto.Country{Code: "GF", Name: "French Guiana", IsEU: vat.IsEU("GF")},- &dto.Country{Code: "PF", Name: "French Polynesia", IsEU: vat.IsEU("PF")},- &dto.Country{Code: "TF", Name: "French Southern Territories", IsEU: vat.IsEU("TF")},- &dto.Country{Code: "GA", Name: "Gabon", IsEU: vat.IsEU("GA")},- &dto.Country{Code: "GM", Name: "Gambia", IsEU: vat.IsEU("GM")},- &dto.Country{Code: "GE", Name: "Georgia", IsEU: vat.IsEU("GE")},- &dto.Country{Code: "DE", Name: "Germany", IsEU: vat.IsEU("DE")},- &dto.Country{Code: "GH", Name: "Ghana", IsEU: vat.IsEU("GH")},- &dto.Country{Code: "GI", Name: "Gibraltar", IsEU: vat.IsEU("GI")},- &dto.Country{Code: "GR", Name: "Greece", IsEU: vat.IsEU("GR")},- &dto.Country{Code: "GL", Name: "Greenland", IsEU: vat.IsEU("GL")},- &dto.Country{Code: "GD", Name: "Grenada", IsEU: vat.IsEU("GD")},- &dto.Country{Code: "GP", Name: "Guadeloupe", IsEU: vat.IsEU("GP")},- &dto.Country{Code: "GU", Name: "Guam", IsEU: vat.IsEU("GU")},- &dto.Country{Code: "GT", Name: "Guatemala", IsEU: vat.IsEU("GT")},- &dto.Country{Code: "GG", Name: "Guernsey", IsEU: vat.IsEU("GG")},- &dto.Country{Code: "GN", Name: "Guinea", IsEU: vat.IsEU("GN")},- &dto.Country{Code: "GW", Name: "Guinea-Bissau", IsEU: vat.IsEU("GW")},- &dto.Country{Code: "GY", Name: "Guyana", IsEU: vat.IsEU("GY")},- &dto.Country{Code: "HT", Name: "Haiti", IsEU: vat.IsEU("HT")},- &dto.Country{Code: "HM", Name: "Heard Island and McDonald Islands", IsEU: vat.IsEU("HM")},- &dto.Country{Code: "VA", Name: "Holy See (Vatican City State)", IsEU: vat.IsEU("VA")},- &dto.Country{Code: "HN", Name: "Honduras", IsEU: vat.IsEU("HN")},- &dto.Country{Code: "HK", Name: "Hong Kong", IsEU: vat.IsEU("HK")},- &dto.Country{Code: "HU", Name: "Hungary", IsEU: vat.IsEU("HU")},- &dto.Country{Code: "IS", Name: "Iceland", IsEU: vat.IsEU("IS")},- &dto.Country{Code: "IN", Name: "India", IsEU: vat.IsEU("IN")},- &dto.Country{Code: "ID", Name: "Indonesia", IsEU: vat.IsEU("ID")},- &dto.Country{Code: "IR", Name: "Iran, Islamic Republic of", IsEU: vat.IsEU("IR")},- &dto.Country{Code: "IQ", Name: "Iraq", IsEU: vat.IsEU("IQ")},- &dto.Country{Code: "IE", Name: "Ireland", IsEU: vat.IsEU("IE")},- &dto.Country{Code: "IM", Name: "Isle of Man", IsEU: vat.IsEU("IM")},- &dto.Country{Code: "IL", Name: "Israel", IsEU: vat.IsEU("IL")},- &dto.Country{Code: "IT", Name: "Italy", IsEU: vat.IsEU("IT")},- &dto.Country{Code: "JM", Name: "Jamaica", IsEU: vat.IsEU("JM")},- &dto.Country{Code: "JP", Name: "Japan", IsEU: vat.IsEU("JP")},- &dto.Country{Code: "JE", Name: "Jersey", IsEU: vat.IsEU("JE")},- &dto.Country{Code: "JO", Name: "Jordan", IsEU: vat.IsEU("JO")},- &dto.Country{Code: "KZ", Name: "Kazakhstan", IsEU: vat.IsEU("KZ")},- &dto.Country{Code: "KE", Name: "Kenya", IsEU: vat.IsEU("KE")},- &dto.Country{Code: "KI", Name: "Kiribati", IsEU: vat.IsEU("KI")},- &dto.Country{Code: "KP", Name: "Korea, Democratic People's Republic of", IsEU: vat.IsEU("KP")},- &dto.Country{Code: "KR", Name: "Korea, Republic of", IsEU: vat.IsEU("KR")},- &dto.Country{Code: "KW", Name: "Kuwait", IsEU: vat.IsEU("KW")},- &dto.Country{Code: "KG", Name: "Kyrgyzstan", IsEU: vat.IsEU("KG")},- &dto.Country{Code: "LA", Name: "Lao People's Democratic Republic", IsEU: vat.IsEU("LA")},- &dto.Country{Code: "LV", Name: "Latvia", IsEU: vat.IsEU("LV")},- &dto.Country{Code: "LB", Name: "Lebanon", IsEU: vat.IsEU("LB")},- &dto.Country{Code: "LS", Name: "Lesotho", IsEU: vat.IsEU("LS")},- &dto.Country{Code: "LR", Name: "Liberia", IsEU: vat.IsEU("LR")},- &dto.Country{Code: "LY", Name: "Libya", IsEU: vat.IsEU("LY")},- &dto.Country{Code: "LI", Name: "Liechtenstein", IsEU: vat.IsEU("LI")},- &dto.Country{Code: "LT", Name: "Lithuania", IsEU: vat.IsEU("LT")},- &dto.Country{Code: "LU", Name: "Luxembourg", IsEU: vat.IsEU("LU")},- &dto.Country{Code: "MO", Name: "Macao", IsEU: vat.IsEU("MO")},- &dto.Country{Code: "MK", Name: "Macedonia, the former Yugoslav Republic of", IsEU: vat.IsEU("MK")},- &dto.Country{Code: "MG", Name: "Madagascar", IsEU: vat.IsEU("MG")},- &dto.Country{Code: "MW", Name: "Malawi", IsEU: vat.IsEU("MW")},- &dto.Country{Code: "MY", Name: "Malaysia", IsEU: vat.IsEU("MY")},- &dto.Country{Code: "MV", Name: "Maldives", IsEU: vat.IsEU("MV")},- &dto.Country{Code: "ML", Name: "Mali", IsEU: vat.IsEU("ML")},- &dto.Country{Code: "MT", Name: "Malta", IsEU: vat.IsEU("MT")},- &dto.Country{Code: "MH", Name: "Marshall Islands", IsEU: vat.IsEU("MH")},- &dto.Country{Code: "MQ", Name: "Martinique", IsEU: vat.IsEU("MQ")},- &dto.Country{Code: "MR", Name: "Mauritania", IsEU: vat.IsEU("MR")},- &dto.Country{Code: "MU", Name: "Mauritius", IsEU: vat.IsEU("MU")},- &dto.Country{Code: "YT", Name: "Mayotte", IsEU: vat.IsEU("YT")},- &dto.Country{Code: "MX", Name: "Mexico", IsEU: vat.IsEU("MX")},- &dto.Country{Code: "FM", Name: "Micronesia, Federated States of", IsEU: vat.IsEU("FM")},- &dto.Country{Code: "MD", Name: "Moldova, Republic of", IsEU: vat.IsEU("MD")},- &dto.Country{Code: "MC", Name: "Monaco", IsEU: vat.IsEU("MC")},- &dto.Country{Code: "MN", Name: "Mongolia", IsEU: vat.IsEU("MN")},- &dto.Country{Code: "ME", Name: "Montenegro", IsEU: vat.IsEU("ME")},- &dto.Country{Code: "MS", Name: "Montserrat", IsEU: vat.IsEU("MS")},- &dto.Country{Code: "MA", Name: "Morocco", IsEU: vat.IsEU("MA")},- &dto.Country{Code: "MZ", Name: "Mozambique", IsEU: vat.IsEU("MZ")},- &dto.Country{Code: "MM", Name: "Myanmar", IsEU: vat.IsEU("MM")},- &dto.Country{Code: "NA", Name: "Namibia", IsEU: vat.IsEU("NA")},- &dto.Country{Code: "NR", Name: "Nauru", IsEU: vat.IsEU("NR")},- &dto.Country{Code: "NP", Name: "Nepal", IsEU: vat.IsEU("NP")},- &dto.Country{Code: "NL", Name: "Netherlands", IsEU: vat.IsEU("NL")},- &dto.Country{Code: "NC", Name: "New Caledonia", IsEU: vat.IsEU("NC")},- &dto.Country{Code: "NZ", Name: "New Zealand", IsEU: vat.IsEU("NZ")},- &dto.Country{Code: "NI", Name: "Nicaragua", IsEU: vat.IsEU("NI")},- &dto.Country{Code: "NE", Name: "Niger", IsEU: vat.IsEU("NE")},- &dto.Country{Code: "NG", Name: "Nigeria", IsEU: vat.IsEU("NG")},- &dto.Country{Code: "NU", Name: "Niue", IsEU: vat.IsEU("NU")},- &dto.Country{Code: "NF", Name: "Norfolk Island", IsEU: vat.IsEU("NF")},- &dto.Country{Code: "MP", Name: "Northern Mariana Islands", IsEU: vat.IsEU("MP")},- &dto.Country{Code: "NO", Name: "Norway", IsEU: vat.IsEU("NO")},- &dto.Country{Code: "OM", Name: "Oman", IsEU: vat.IsEU("OM")},- &dto.Country{Code: "PK", Name: "Pakistan", IsEU: vat.IsEU("PK")},- &dto.Country{Code: "PW", Name: "Palau", IsEU: vat.IsEU("PW")},- &dto.Country{Code: "PS", Name: "Palestinian Territory, Occupied", IsEU: vat.IsEU("PS")},- &dto.Country{Code: "PA", Name: "Panama", IsEU: vat.IsEU("PA")},- &dto.Country{Code: "PG", Name: "Papua New Guinea", IsEU: vat.IsEU("PG")},- &dto.Country{Code: "PY", Name: "Paraguay", IsEU: vat.IsEU("PY")},- &dto.Country{Code: "PE", Name: "Peru", IsEU: vat.IsEU("PE")},- &dto.Country{Code: "PH", Name: "Philippines", IsEU: vat.IsEU("PH")},- &dto.Country{Code: "PN", Name: "Pitcairn", IsEU: vat.IsEU("PN")},- &dto.Country{Code: "PL", Name: "Poland", IsEU: vat.IsEU("PL")},- &dto.Country{Code: "PT", Name: "Portugal", IsEU: vat.IsEU("PT")},- &dto.Country{Code: "PR", Name: "Puerto Rico", IsEU: vat.IsEU("PR")},- &dto.Country{Code: "QA", Name: "Qatar", IsEU: vat.IsEU("QA")},- &dto.Country{Code: "RE", Name: "Réunion", IsEU: vat.IsEU("RE")},- &dto.Country{Code: "RO", Name: "Romania", IsEU: vat.IsEU("RO")},- &dto.Country{Code: "RU", Name: "Russian Federation", IsEU: vat.IsEU("RU")},- &dto.Country{Code: "RW", Name: "Rwanda", IsEU: vat.IsEU("RW")},- &dto.Country{Code: "BL", Name: "Saint Barthélemy", IsEU: vat.IsEU("BL")},- &dto.Country{Code: "SH", Name: "Saint Helena, Ascension and Tristan da Cunha", IsEU: vat.IsEU("SH")},- &dto.Country{Code: "KN", Name: "Saint Kitts and Nevis", IsEU: vat.IsEU("KN")},- &dto.Country{Code: "LC", Name: "Saint Lucia", IsEU: vat.IsEU("LC")},- &dto.Country{Code: "MF", Name: "Saint Martin (French part)", IsEU: vat.IsEU("MF")},- &dto.Country{Code: "PM", Name: "Saint Pierre and Miquelon", IsEU: vat.IsEU("PM")},- &dto.Country{Code: "VC", Name: "Saint Vincent and the Grenadines", IsEU: vat.IsEU("VC")},- &dto.Country{Code: "WS", Name: "Samoa", IsEU: vat.IsEU("WS")},- &dto.Country{Code: "SM", Name: "San Marino", IsEU: vat.IsEU("SM")},- &dto.Country{Code: "ST", Name: "Sao Tome and Principe", IsEU: vat.IsEU("ST")},- &dto.Country{Code: "SA", Name: "Saudi Arabia", IsEU: vat.IsEU("SA")},- &dto.Country{Code: "SN", Name: "Senegal", IsEU: vat.IsEU("SN")},- &dto.Country{Code: "RS", Name: "Serbia", IsEU: vat.IsEU("RS")},- &dto.Country{Code: "SC", Name: "Seychelles", IsEU: vat.IsEU("SC")},- &dto.Country{Code: "SL", Name: "Sierra Leone", IsEU: vat.IsEU("SL")},- &dto.Country{Code: "SG", Name: "Singapore", IsEU: vat.IsEU("SG")},- &dto.Country{Code: "SX", Name: "Sint Maarten (Dutch part)", IsEU: vat.IsEU("SX")},- &dto.Country{Code: "SK", Name: "Slovakia", IsEU: vat.IsEU("SK")},- &dto.Country{Code: "SI", Name: "Slovenia", IsEU: vat.IsEU("SI")},- &dto.Country{Code: "SB", Name: "Solomon Islands", IsEU: vat.IsEU("SB")},- &dto.Country{Code: "SO", Name: "Somalia", IsEU: vat.IsEU("SO")},- &dto.Country{Code: "ZA", Name: "South Africa", IsEU: vat.IsEU("ZA")},- &dto.Country{Code: "GS", Name: "South Georgia and the South Sandwich Islands", IsEU: vat.IsEU("GS")},- &dto.Country{Code: "SS", Name: "South Sudan", IsEU: vat.IsEU("SS")},- &dto.Country{Code: "ES", Name: "Spain", IsEU: vat.IsEU("ES")},- &dto.Country{Code: "LK", Name: "Sri Lanka", IsEU: vat.IsEU("LK")},- &dto.Country{Code: "SD", Name: "Sudan", IsEU: vat.IsEU("SD")},- &dto.Country{Code: "SR", Name: "Suriname", IsEU: vat.IsEU("SR")},- &dto.Country{Code: "SJ", Name: "Svalbard and Jan Mayen", IsEU: vat.IsEU("SJ")},- &dto.Country{Code: "SZ", Name: "Swaziland", IsEU: vat.IsEU("SZ")},- &dto.Country{Code: "SE", Name: "Sweden", IsEU: vat.IsEU("SE")},- &dto.Country{Code: "CH", Name: "Switzerland", IsEU: vat.IsEU("CH")},- &dto.Country{Code: "SY", Name: "Syrian Arab Republic", IsEU: vat.IsEU("SY")},- &dto.Country{Code: "TW", Name: "Taiwan, Province of China", IsEU: vat.IsEU("TW")},- &dto.Country{Code: "TJ", Name: "Tajikistan", IsEU: vat.IsEU("TJ")},- &dto.Country{Code: "TZ", Name: "Tanzania, United Republic of", IsEU: vat.IsEU("TZ")},- &dto.Country{Code: "TH", Name: "Thailand", IsEU: vat.IsEU("TH")},- &dto.Country{Code: "TL", Name: "Timor-Leste", IsEU: vat.IsEU("TL")},- &dto.Country{Code: "TG", Name: "Togo", IsEU: vat.IsEU("TG")},- &dto.Country{Code: "TK", Name: "Tokelau", IsEU: vat.IsEU("TK")},- &dto.Country{Code: "TO", Name: "Tonga", IsEU: vat.IsEU("TO")},- &dto.Country{Code: "TT", Name: "Trinidad and Tobago", IsEU: vat.IsEU("TT")},- &dto.Country{Code: "TN", Name: "Tunisia", IsEU: vat.IsEU("TN")},- &dto.Country{Code: "TR", Name: "Turkey", IsEU: vat.IsEU("TR")},- &dto.Country{Code: "TM", Name: "Turkmenistan", IsEU: vat.IsEU("TM")},- &dto.Country{Code: "TC", Name: "Turks and Caicos Islands", IsEU: vat.IsEU("TC")},- &dto.Country{Code: "TV", Name: "Tuvalu", IsEU: vat.IsEU("TV")},- &dto.Country{Code: "UG", Name: "Uganda", IsEU: vat.IsEU("UG")},- &dto.Country{Code: "UA", Name: "Ukraine", IsEU: vat.IsEU("UA")},- &dto.Country{Code: "AE", Name: "United Arab Emirates", IsEU: vat.IsEU("AE")},- &dto.Country{Code: "GB", Name: "United Kingdom", IsEU: vat.IsEU("GB")},- &dto.Country{Code: "US", Name: "United States", IsEU: vat.IsEU("US")},- &dto.Country{Code: "UM", Name: "United States Minor Outlying Islands", IsEU: vat.IsEU("UM")},- &dto.Country{Code: "UY", Name: "Uruguay", IsEU: vat.IsEU("UY")},- &dto.Country{Code: "UZ", Name: "Uzbekistan", IsEU: vat.IsEU("UZ")},- &dto.Country{Code: "VU", Name: "Vanuatu", IsEU: vat.IsEU("VU")},- &dto.Country{Code: "VE", Name: "Venezuela, Bolivarian Republic of", IsEU: vat.IsEU("VE")},- &dto.Country{Code: "VN", Name: "Viet Nam", IsEU: vat.IsEU("VN")},- &dto.Country{Code: "VG", Name: "Virgin Islands, British", IsEU: vat.IsEU("VG")},- &dto.Country{Code: "VI", Name: "Virgin Islands, U.S.", IsEU: vat.IsEU("VI")},- &dto.Country{Code: "WF", Name: "Wallis and Futuna", IsEU: vat.IsEU("WF")},- &dto.Country{Code: "EH", Name: "Western Sahara", IsEU: vat.IsEU("EH")},- &dto.Country{Code: "YE", Name: "Yemen", IsEU: vat.IsEU("YE")},- &dto.Country{Code: "ZM", Name: "Zambia", IsEU: vat.IsEU("ZM")},- &dto.Country{Code: "ZW", Name: "Zimbabwe", IsEU: vat.IsEU("ZW")},-}diff --git a/app/services/billing/customer.go b/app/services/billing/customer.godeleted file mode 100644index 5fb3dd9f7..000000000--- a/app/services/billing/customer.go+++ /dev/null@@ -1,234 +0,0 @@-package billing--import (- "context"- "fmt"- "strconv"-- "github.com/getfider/fider/app/models"- "github.com/getfider/fider/app/models/cmd"- "github.com/getfider/fider/app/models/dto"- "github.com/getfider/fider/app/models/query"- "github.com/getfider/fider/app/pkg/env"- "github.com/getfider/fider/app/pkg/errors"- "github.com/goenning/vat"- "github.com/stripe/stripe-go"-)--func createCustomer(ctx context.Context, c *cmd.CreateBillingCustomer) error {- return using(ctx, func(tenant *models.Tenant) error {- if tenant.Billing == nil {- return errors.New("Tenant doesn't have a billing record")- }-- if tenant.Billing.StripeCustomerID == "" {- params := &stripe.CustomerParams{- Description: stripe.String(tenant.Name),- }- params.AddMetadata("tenant_id", strconv.Itoa(tenant.ID))- params.AddMetadata("tenant_subdomain", tenant.Subdomain)- customer, err := stripeClient.Customers.New(params)- if err != nil {- return errors.Wrap(err, "failed to create Stripe customer")- }-- tenant.Billing.StripeCustomerID = customer.ID- return nil- }-- return nil- })-}--func deleteCustomer(ctx context.Context, c *cmd.DeleteBillingCustomer) error {- return using(ctx, func(tenant *models.Tenant) error {- if !env.IsTest() {- return errors.New("Stripe customer can only be deleted on test mode")- }-- _, err := stripeClient.Customers.Del(tenant.Billing.StripeCustomerID, &stripe.CustomerParams{})- if err != nil {- return errors.Wrap(err, "failed to delete Stripe customer")- }- return nil- })-}--func getPaymentInfo(ctx context.Context, q *query.GetPaymentInfo) error {- return using(ctx, func(tenant *models.Tenant) error {- if tenant.Billing == nil || tenant.Billing.StripeCustomerID == "" {- return nil- }-- customerID := tenant.Billing.StripeCustomerID-- customer, err := stripeClient.Customers.Get(customerID, &stripe.CustomerParams{})- if err != nil {- return errors.Wrap(err, "failed to get customer")- }-- if customer.Metadata["tenant_id"] != strconv.Itoa(tenant.ID) {- panic(fmt.Sprintf("Stripe TenantID (%s) doesn't match current Tenant ID (%s). Aborting.", customer.Metadata["tenant_id"], strconv.Itoa(tenant.ID)))- }-- if customer.DefaultSource == nil {- return nil- }-- card, err := stripeClient.Cards.Get(customer.DefaultSource.ID, &stripe.CardParams{- Customer: stripe.String(customerID),- })- if err != nil {- return errors.Wrap(err, "failed to get customer's card")- }-- q.Result = &dto.PaymentInfo{- Email: customer.Email,- Name: card.Name,- StripeCardID: card.ID,- CardCountry: card.Country,- CardBrand: string(card.Brand),- CardLast4: card.Last4,- CardExpMonth: card.ExpMonth,- CardExpYear: card.ExpYear,- AddressCity: card.AddressCity,- AddressCountry: card.AddressCountry,- AddressLine1: card.AddressLine1,- AddressLine2: card.AddressLine2,- AddressState: card.AddressState,- AddressPostalCode: card.AddressZip,- }-- for _, taxId := range customer.TaxIDs.Data {- q.Result.VATNumber = taxId.ID- }-- return nil- })-}--func clearPaymentInfo(ctx context.Context, c *cmd.ClearPaymentInfo) error {- return using(ctx, func(tenant *models.Tenant) error {- currentInfo := &query.GetPaymentInfo{}- if err := getPaymentInfo(ctx, currentInfo); err != nil {- return err- }-- if currentInfo.Result != nil {- customerID := tenant.Billing.StripeCustomerID- _, err := stripeClient.Customers.Update(customerID, &stripe.CustomerParams{- Description: stripe.String(tenant.Name),- Email: stripe.String(""),- TaxIDData: []*stripe.CustomerTaxIDDataParams{- {- Type: stripe.String(string(stripe.TaxIDTypeEUVAT)),- Value: stripe.String(""),- },- },- })- if err != nil {- return errors.Wrap(err, "failed to delete customer billing email")- }- if currentInfo.Result.StripeCardID != "" {- _, err = stripeClient.Cards.Del(currentInfo.Result.StripeCardID, &stripe.CardParams{- Customer: stripe.String(customerID),- })- if err != nil {- return errors.Wrap(err, "failed to delete customer card")- }- }- }-- return nil- })-}--func updatePaymentInfo(ctx context.Context, c *cmd.UpdatePaymentInfo) error {- return using(ctx, func(tenant *models.Tenant) error {- customerID := tenant.Billing.StripeCustomerID-- currentInfo := &query.GetPaymentInfo{}- if err := getPaymentInfo(ctx, currentInfo); err != nil {- return err- }-- if !vat.IsEU(c.Input.AddressCountry) {- c.Input.VATNumber = ""- }-- // update customer info- params := &stripe.CustomerParams{- Email: stripe.String(c.Input.Email),- Description: stripe.String(c.Input.Name),- Shipping: &stripe.CustomerShippingDetailsParams{- Name: stripe.String(c.Input.Name),- Address: &stripe.AddressParams{- City: stripe.String(c.Input.AddressCity),- Country: stripe.String(c.Input.AddressCountry),- Line1: stripe.String(c.Input.AddressLine1),- Line2: stripe.String(c.Input.AddressLine2),- PostalCode: stripe.String(c.Input.AddressPostalCode),- State: stripe.String(c.Input.AddressState),- },- },- TaxIDData: []*stripe.CustomerTaxIDDataParams{- {- Type: stripe.String(string(stripe.TaxIDTypeEUVAT)),- Value: stripe.String(c.Input.VATNumber),- },- },- }- _, err := stripeClient.Customers.Update(customerID, params)- if err != nil {- return errors.Wrap(err, "failed to update customer billing email")- }-- // new card, just create it- if currentInfo.Result == nil || currentInfo.Result.StripeCardID == "" {- _, err = stripeClient.Cards.New(&stripe.CardParams{- Customer: stripe.String(customerID),- Token: stripe.String(c.Input.Card.Token),- })- if err != nil {- return errors.Wrap(err, "failed to create stripe card")- }- return nil- }-- // replacing card, create new and delete old- if c.Input.Card != nil && c.Input.Card.Token != "" {- _, err = stripeClient.Cards.New(&stripe.CardParams{- Customer: stripe.String(customerID),- Token: stripe.String(c.Input.Card.Token),- })- if err != nil {- return errors.Wrap(err, "failed to create new stripe card")- }-- _, err = stripeClient.Cards.Del(currentInfo.Result.StripeCardID, &stripe.CardParams{- Customer: stripe.String(customerID),- Token: stripe.String(c.Input.Card.Token),- })- if err != nil {- return errors.Wrap(err, "failed to delete old stripe card")- }- return nil- }-- // updating card, just update current card- _, err = stripeClient.Cards.Update(currentInfo.Result.StripeCardID, &stripe.CardParams{- Customer: stripe.String(customerID),- Name: stripe.String(c.Input.Name),- AddressCity: stripe.String(c.Input.AddressCity),- AddressCountry: stripe.String(c.Input.AddressCountry),- AddressLine1: stripe.String(c.Input.AddressLine1),- AddressLine2: stripe.String(c.Input.AddressLine2),- AddressState: stripe.String(c.Input.AddressState),- AddressZip: stripe.String(c.Input.AddressPostalCode),- })- if err != nil {- return errors.Wrap(err, "failed to update stripe card")- }- return nil- })-}diff --git a/app/services/billing/plans.go b/app/services/billing/plans.godeleted file mode 100644index 9a9c1f291..000000000--- a/app/services/billing/plans.go+++ /dev/null@@ -1,92 +0,0 @@-package billing--import (- "context"- "sort"- "strconv"- "strings"- "sync"-- "github.com/getfider/fider/app/models/dto"- "github.com/getfider/fider/app/models/query"- "github.com/getfider/fider/app/pkg/errors"- "github.com/goenning/vat"- "github.com/stripe/stripe-go"-)--var plansMutex sync.RWMutex-var allPlans []*dto.BillingPlan--func listPlans(ctx context.Context, q *query.ListBillingPlans) error {- if allPlans != nil {- q.Result = filterPlansByCountryCode(allPlans, q.CountryCode)- return nil- }-- plansMutex.Lock()- defer plansMutex.Unlock()-- if allPlans == nil {- allPlans = make([]*dto.BillingPlan, 0)- it := stripeClient.Plans.List(&stripe.PlanListParams{- Active: stripe.Bool(true),- })- for it.Next() {- plan := it.Plan()- name, ok := plan.Metadata["friendly_name"]- if !ok {- name = plan.Nickname- }- maxUsers, _ := strconv.Atoi(plan.Metadata["max_users"])- allPlans = append(allPlans, &dto.BillingPlan{- ID: plan.ID,- Name: name,- Description: plan.Metadata["description"],- MaxUsers: maxUsers,- Price: plan.Amount,- Currency: strings.ToUpper(string(plan.Currency)),- Interval: string(plan.Interval),- })- }- if err := it.Err(); err != nil {- return err- }- sort.Slice(allPlans, func(i, j int) bool {- return allPlans[i].Price < allPlans[j].Price- })- }-- q.Result = filterPlansByCountryCode(allPlans, q.CountryCode)- return nil-}--func getPlanByID(ctx context.Context, q *query.GetBillingPlanByID) error {- listPlansQuery := &query.ListBillingPlans{CountryCode: q.CountryCode}- err := listPlans(ctx, listPlansQuery)- if err != nil {- return err- }-- for _, plan := range listPlansQuery.Result {- if plan.ID == q.PlanID {- q.Result = plan- return nil- }- }- return errors.New("failed to get plan by id '%s'", q.PlanID)-}--func filterPlansByCountryCode(plans []*dto.BillingPlan, countryCode string) []*dto.BillingPlan {- currency := "USD"- if vat.IsEU(countryCode) {- currency = "EUR"- }-- filteredPlans := make([]*dto.BillingPlan, 0)- for _, p := range plans {- if p.Currency == currency {- filteredPlans = append(filteredPlans, p)- }- }- return filteredPlans-}diff --git a/app/services/billing/subscription.go b/app/services/billing/subscription.godeleted file mode 100644index 0ca0599ab..000000000--- a/app/services/billing/subscription.go+++ /dev/null@@ -1,98 +0,0 @@-package billing--import (- "context"- "strings"- "time"-- "github.com/getfider/fider/app/models"- "github.com/getfider/fider/app/models/cmd"- "github.com/getfider/fider/app/models/dto"- "github.com/getfider/fider/app/models/query"- "github.com/getfider/fider/app/pkg/errors"- "github.com/stripe/stripe-go"-)--func cancelSubscription(ctx context.Context, c *cmd.CancelBillingSubscription) error {- return using(ctx, func(tenant *models.Tenant) error {- sub, err := stripeClient.Subscriptions.Update(tenant.Billing.StripeSubscriptionID, &stripe.SubscriptionParams{- CancelAtPeriodEnd: stripe.Bool(true),- })- if err != nil {- return errors.Wrap(err, "failed to cancel stripe subscription")- }- endDate := time.Unix(sub.CurrentPeriodEnd, 0)- tenant.Billing.SubscriptionEndsAt = &endDate- return nil- })-}--func subscribe(ctx context.Context, c *cmd.CreateBillingSubscription) error {- return using(ctx, func(tenant *models.Tenant) error {- customerID := tenant.Billing.StripeCustomerID- if tenant.Billing.StripeSubscriptionID != "" {- sub, err := stripeClient.Subscriptions.Get(tenant.Billing.StripeSubscriptionID, nil)- if err != nil {- return errors.Wrap(err, "failed to get stripe subscription")- }- _, err = stripeClient.Subscriptions.Update(tenant.Billing.StripeSubscriptionID, &stripe.SubscriptionParams{- CancelAtPeriodEnd: stripe.Bool(false),- Items: []*stripe.SubscriptionItemsParams{- {- ID: stripe.String(sub.Items.Data[0].ID),- Plan: stripe.String(c.PlanID),- },- },- })-- if err != nil {- return errors.Wrap(err, "failed to update stripe subscription")- }-- tenant.Billing.SubscriptionEndsAt = nil- } else {- sub, err := stripeClient.Subscriptions.New(&stripe.SubscriptionParams{- Customer: stripe.String(customerID),- Items: []*stripe.SubscriptionItemsParams{- {- Plan: stripe.String(c.PlanID),- },- },- })-- if err != nil {- return errors.Wrap(err, "failed to create stripe subscription")- }-- tenant.Billing.StripeSubscriptionID = sub.ID- }-- tenant.Billing.StripePlanID = c.PlanID- return nil- })-}--func getUpcomingInvoice(ctx context.Context, q *query.GetUpcomingInvoice) error {- return using(ctx, func(tenant *models.Tenant) error {- inv, err := stripeClient.Invoices.GetNext(&stripe.InvoiceParams{- Customer: stripe.String(tenant.Billing.StripeCustomerID),- Subscription: stripe.String(tenant.Billing.StripeSubscriptionID),- })- if err != nil {- if stripeErr, ok := err.(*stripe.Error); ok {- if stripeErr.HTTPStatusCode == 404 {- return nil- }- }- return errors.Wrap(err, "failed to get upcoming invoice")- }-- dueDate := time.Unix(inv.DueDate, 0)- q.Result = &dto.UpcomingInvoice{- Currency: strings.ToUpper(string(inv.Currency)),- AmountDue: inv.AmountDue,- DueDate: dueDate,- }- return nil- })-}diff --git a/app/services/sqlstore/postgres/postgres.go b/app/services/sqlstore/postgres/postgres.goindex 12b553cdb..3e72c5c02 100644--- a/app/services/sqlstore/postgres/postgres.go+++ b/app/services/sqlstore/postgres/postgres.go@@ -107,7 +107,6 @@ func (s Service) Init() {bus.AddHandler(updateTenantSettings)bus.AddHandler(updateTenantPrivacySettings)bus.AddHandler(updateTenantAdvancedSettings)- bus.AddHandler(updateTenantBillingSettings)bus.AddHandler(getVerificationByKey)bus.AddHandler(saveVerificationKey)diff --git a/app/services/sqlstore/postgres/tenant.go b/app/services/sqlstore/postgres/tenant.goindex 0ea501cad..5b1023c89 100644--- a/app/services/sqlstore/postgres/tenant.go+++ b/app/services/sqlstore/postgres/tenant.go@@ -17,17 +17,16 @@ import ()type dbTenant struct {- ID int `db:"id"`- Name string `db:"name"`- Subdomain string `db:"subdomain"`- CNAME string `db:"cname"`- Invitation string `db:"invitation"`- WelcomeMessage string `db:"welcome_message"`- Status int `db:"status"`- IsPrivate bool `db:"is_private"`- LogoBlobKey string `db:"logo_bkey"`- CustomCSS string `db:"custom_css"`- Billing *dbTenantBilling `db:"billing"`+ ID int `db:"id"`+ Name string `db:"name"`+ Subdomain string `db:"subdomain"`+ CNAME string `db:"cname"`+ Invitation string `db:"invitation"`+ WelcomeMessage string `db:"welcome_message"`+ Status int `db:"status"`+ IsPrivate bool `db:"is_private"`+ LogoBlobKey string `db:"logo_bkey"`+ CustomCSS string `db:"custom_css"`}func (t *dbTenant) toModel() *models.Tenant {@@ -48,29 +47,9 @@ func (t *dbTenant) toModel() *models.Tenant {CustomCSS: t.CustomCSS,}- if t.Billing != nil && t.Billing.TrialEndsAt.Valid {- tenant.Billing = &models.TenantBilling{- TrialEndsAt: t.Billing.TrialEndsAt.Time,- StripeCustomerID: t.Billing.StripeCustomerID.String,- StripeSubscriptionID: t.Billing.StripeSubscriptionID.String,- StripePlanID: t.Billing.StripePlanID.String,- }- if t.Billing.SubscriptionEndsAt.Valid {- tenant.Billing.SubscriptionEndsAt = &t.Billing.SubscriptionEndsAt.Time- }- }-return tenant}-type dbTenantBilling struct {- StripeCustomerID dbx.NullString `db:"stripe_customer_id"`- StripeSubscriptionID dbx.NullString `db:"stripe_subscription_id"`- StripePlanID dbx.NullString `db:"stripe_plan_id"`- TrialEndsAt dbx.NullTime `db:"trial_ends_at"`- SubscriptionEndsAt dbx.NullTime `db:"subscription_ends_at"`-}-type dbEmailVerification struct {ID int `db:"id"`Name string `db:"name"`@@ -160,29 +139,6 @@ func updateTenantSettings(ctx context.Context, c *cmd.UpdateTenantSettings) erro})}-func updateTenantBillingSettings(ctx context.Context, c *cmd.UpdateTenantBillingSettings) error {- return using(ctx, func(trx *dbx.Trx, tenant *models.Tenant, user *models.User) error {- _, err := trx.Execute(`- UPDATE tenants_billing- SET stripe_customer_id = $1,- stripe_plan_id = $2,- stripe_subscription_id = $3,- subscription_ends_at = $4- WHERE tenant_id = $5- `,- c.Settings.StripeCustomerID,- c.Settings.StripePlanID,- c.Settings.StripeSubscriptionID,- c.Settings.SubscriptionEndsAt,- tenant.ID,- )- if err != nil {- return errors.Wrap(err, "failed update tenant billing settings")- }- return nil- })-}-func updateTenantAdvancedSettings(ctx context.Context, c *cmd.UpdateTenantAdvancedSettings) error {return using(ctx, func(trx *dbx.Trx, tenant *models.Tenant, user *models.User) error {query := "UPDATE tenants SET custom_css = $1 WHERE id = $2"@@ -262,16 +218,6 @@ func createTenant(ctx context.Context, c *cmd.CreateTenant) error {return err}- if env.IsBillingEnabled() {- _, err = trx.Execute(- `INSERT INTO tenants_billing (tenant_id, trial_ends_at) VALUES ($1, $2)`,- id, now.Add(30*24*time.Hour),- )- if err != nil {- return err- }- }-byDomain := &query.GetTenantByDomain{Domain: c.Subdomain}err = bus.Dispatch(ctx, byDomain)c.Result = byDomain.Result@@ -284,16 +230,9 @@ func getFirstTenant(ctx context.Context, q *query.GetFirstTenant) error {tenant := dbTenant{}err := trx.Get(&tenant, `- SELECT t.id, t.name, t.subdomain, t.cname, t.invitation, t.welcome_message, t.status, t.is_private, t.logo_bkey, t.custom_css,- tb.trial_ends_at AS billing_trial_ends_at,- tb.subscription_ends_at AS billing_subscription_ends_at,- tb.stripe_customer_id AS billing_stripe_customer_id,- tb.stripe_plan_id AS billing_stripe_plan_id,- tb.stripe_subscription_id AS billing_stripe_subscription_id- FROM tenants t- LEFT JOIN tenants_billing tb- ON tb.tenant_id = t.id- ORDER BY t.id LIMIT 1+ SELECT id, name, subdomain, cname, invitation, welcome_message, status, is_private, logo_bkey, custom_css+ FROM tenants+ ORDER BY id LIMIT 1`)if err != nil {@@ -310,17 +249,10 @@ func getTenantByDomain(ctx context.Context, q *query.GetTenantByDomain) error {tenant := dbTenant{}err := trx.Get(&tenant, `- SELECT t.id, t.name, t.subdomain, t.cname, t.invitation, t.welcome_message, t.status, t.is_private, t.logo_bkey, t.custom_css,- tb.trial_ends_at AS billing_trial_ends_at,- tb.subscription_ends_at AS billing_subscription_ends_at,- tb.stripe_customer_id AS billing_stripe_customer_id,- tb.stripe_plan_id AS billing_stripe_plan_id,- tb.stripe_subscription_id AS billing_stripe_subscription_id+ SELECT id, name, subdomain, cname, invitation, welcome_message, status, is_private, logo_bkey, custom_cssFROM tenants t- LEFT JOIN tenants_billing tb- ON tb.tenant_id = t.id- WHERE t.subdomain = $1 OR t.subdomain = $2 OR t.cname = $3- ORDER BY t.cname DESC+ WHERE subdomain = $1 OR subdomain = $2 OR cname = $3+ ORDER BY cname DESC`, env.Subdomain(q.Domain), q.Domain, q.Domain)if err != nil {return errors.Wrap(err, "failed to get tenant with domain '%s'", q.Domain)diff --git a/app/services/sqlstore/postgres/tenant_test.go b/app/services/sqlstore/postgres/tenant_test.goindex 2b0374e1c..5d6ddbf80 100644--- a/app/services/sqlstore/postgres/tenant_test.go+++ b/app/services/sqlstore/postgres/tenant_test.go@@ -21,7 +21,6 @@ func TestTenantStorage_Add_Activate(t *testing.T) {ctx := SetupDatabaseTest(t)defer TeardownDatabaseTest()- env.Config.Stripe.SecretKey = ""createTenant := &cmd.CreateTenant{Name: "My Domain Inc.",Subdomain: "mydomain",@@ -49,31 +48,6 @@ func TestTenantStorage_Add_Activate(t *testing.T) {Expect(getByDomain.Result.Subdomain).Equals("mydomain")Expect(getByDomain.Result.Status).Equals(enum.TenantActive)Expect(getByDomain.Result.IsPrivate).IsFalse()- Expect(getByDomain.Result.Billing).IsNil()-}--func TestTenantStorage_Add_WithBillingEnabled(t *testing.T) {- ctx := SetupDatabaseTest(t)- defer TeardownDatabaseTest()-- env.Config.Stripe.SecretKey = "sk_1"- err := bus.Dispatch(ctx, &cmd.CreateTenant{- Name: "My Domain Inc.",- Subdomain: "mydomain",- Status: enum.TenantPending,- })- Expect(err).IsNil()-- getByDomain := &query.GetTenantByDomain{Domain: "mydomain"}- err = bus.Dispatch(ctx, getByDomain)- Expect(err).IsNil()-- Expect(getByDomain.Result.Name).Equals("My Domain Inc.")- Expect(getByDomain.Result.Subdomain).Equals("mydomain")- Expect(getByDomain.Result.Status).Equals(enum.TenantPending)- Expect(getByDomain.Result.IsPrivate).IsFalse()- Expect(getByDomain.Result.Billing).IsNotNil()- Expect(getByDomain.Result.Billing.TrialEndsAt).TemporarilySimilar(time.Now().Add(30*24*time.Hour), 5*time.Second)}func TestTenantStorage_SingleTenant_Add(t *testing.T) {diff --git a/go.mod b/go.modindex 2b3cbb59f..023728317 100644--- a/go.mod+++ b/go.mod@@ -10,7 +10,6 @@ require (github.com/dgrijalva/jwt-go v3.2.0+incompatiblegithub.com/goenning/imagic v0.0.1github.com/goenning/letteravatar v0.0.0-20180605200324-553181ed4055- github.com/goenning/vat v0.1.0github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirectgithub.com/golangci/golangci-lint v1.38.0github.com/gosimple/slug v1.9.0@@ -21,7 +20,6 @@ require (github.com/magefile/mage v1.11.0github.com/patrickmn/go-cache v2.1.0+incompatiblegithub.com/russross/blackfriday v1.6.0- github.com/stripe/stripe-go v70.15.0+incompatiblegolang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93)diff --git a/go.sum b/go.sumindex 6105819bb..53bd5e6fc 100644--- a/go.sum+++ b/go.sum@@ -153,8 +153,6 @@ github.com/goenning/imagic v0.0.1 h1:JJ1AhdRugiPucmIHCB6GmvigCAfMYV7rTYhus4ROZ50github.com/goenning/imagic v0.0.1/go.mod h1:uCYR1hKybppzS6QEa7KnPPa3Q69SjcL95eDR5MW1j38=github.com/goenning/letteravatar v0.0.0-20180605200324-553181ed4055 h1:xwq8JGLwF1UughJdViZyiUo6FcTv7mN6L532hBNbnfQ=github.com/goenning/letteravatar v0.0.0-20180605200324-553181ed4055/go.mod h1:3lA285vlcUfyyBfimSIsT200bJb1ScVZEN2KKoW8TDY=-github.com/goenning/vat v0.1.0 h1:Th8EhqCZdPVQgYlNwgp19MmfgmlZcVX4TTnmlAGnjIc=-github.com/goenning/vat v0.1.0/go.mod h1:jIdg4o7ZwGAVzBbQ5tPFMj6ypfcYkChoumAWZ2Li2ME=github.com/gofrs/flock v0.8.0 h1:MSdYClljsF3PbENUUEx85nkWfJSGfzYI9yEBZOJz6CY=github.com/gofrs/flock v0.8.0/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=@@ -505,8 +503,6 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=-github.com/stripe/stripe-go v70.15.0+incompatible h1:hNML7M1zx8RgtepEMlxyu/FpVPrP7KZm1gPFQquJQvM=-github.com/stripe/stripe-go v70.15.0+incompatible/go.mod h1:A1dQZmO/QypXmsL0T8axYZkSN/uA/T/A64pfKdBAMiY=github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b h1:HxLVTlqcHhFAz3nWUcuvpH7WuOMv8LQoCWmruLfFH2U=diff --git a/package-lock.json b/package-lock.jsonindex 89f2a5d19..af47c3f0c 100644--- a/package-lock.json+++ b/package-lock.json@@ -12,7 +12,6 @@"react": "17.0.1","react-dom": "17.0.1","react-icons": "4.2.0",- "react-stripe-elements": "6.1.2","react-textarea-autosize": "8.3.2","react-toastify": "7.0.3","tslib": "2.1.0"@@ -27,7 +26,6 @@"@types/puppeteer": "5.4.3","@types/react": "17.0.2","@types/react-dom": "17.0.1",- "@types/react-stripe-elements": "6.0.4","@types/react-textarea-autosize": "4.3.5","@wojtekmaj/enzyme-adapter-react-17": "0.4.1","css-loader": "5.1.1",@@ -52,6 +50,10 @@"webpack": "5.24.3","webpack-bundle-analyzer": "4.4.0","webpack-cli": "4.5.0"+ },+ "engines": {+ "node": ">=14",+ "npm": ">=7"}},"node_modules/@babel/code-frame": {@@ -1121,16 +1123,6 @@"@types/react": "*"}},- "node_modules/@types/react-stripe-elements": {- "version": "6.0.4",- "resolved": "https://registry.npmjs.org/@types/react-stripe-elements/-/react-stripe-elements-6.0.4.tgz",- "integrity": "sha512-EzEeBiOwQJ0fPzZhtg9zqyy5GJbEbi0sFNFCowFXmRwraRcMRyZ4p2UK8nylzfCR2KtMPZ2fgUVH9xD/VL/StQ==",- "dev": true,- "dependencies": {- "@types/react": "*",- "@types/stripe-v3": "*"- }- },"node_modules/@types/react-textarea-autosize": {"version": "4.3.5","resolved": "https://registry.npmjs.org/@types/react-textarea-autosize/-/react-textarea-autosize-4.3.5.tgz",@@ -1146,12 +1138,6 @@"integrity": "sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw==","dev": true},- "node_modules/@types/stripe-v3": {- "version": "3.1.23",- "resolved": "https://registry.npmjs.org/@types/stripe-v3/-/stripe-v3-3.1.23.tgz",- "integrity": "sha512-fqCnai832M6o6qH6A+Dqk1I/SXAzx629bknbrDigyvkuAPGZGrjkLCMxfnrtWswHXNPjj/TtuGf4lQnDXc815w==",- "dev": true- },"node_modules/@types/tough-cookie": {"version": "4.0.0","resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.0.tgz",@@ -7366,6 +7352,7 @@"version": "15.7.2","resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz","integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",+ "dev": true,"dependencies": {"loose-envify": "^1.4.0","object-assign": "^4.1.1",@@ -7386,7 +7373,8 @@"node_modules/prop-types/node_modules/react-is": {"version": "16.13.1","resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",- "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",+ "dev": true},"node_modules/proxy-from-env": {"version": "1.1.0",@@ -7547,18 +7535,6 @@"react": "^16.0.0 || ^17.0.0"}},- "node_modules/react-stripe-elements": {- "version": "6.1.2",- "resolved": "https://registry.npmjs.org/react-stripe-elements/-/react-stripe-elements-6.1.2.tgz",- "integrity": "sha512-gYbYhVVJm3Woc84TgmuiqUj44rI/BZGUVUTTmS0U6kZyZa5fYMPlKKIsVZdQZufQ7Ab4BXLO2LSxBlGY0s2jew==",- "dependencies": {- "prop-types": "15.7.2"- },- "peerDependencies": {- "react": "^15.5.4 || ^16.0.0-0",- "react-dom": "^15.5.4 || ^16.0.0-0"- }- },"node_modules/react-test-renderer": {"version": "17.0.1","resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-17.0.1.tgz",@@ -11827,16 +11803,6 @@"@types/react": "*"}},- "@types/react-stripe-elements": {- "version": "6.0.4",- "resolved": "https://registry.npmjs.org/@types/react-stripe-elements/-/react-stripe-elements-6.0.4.tgz",- "integrity": "sha512-EzEeBiOwQJ0fPzZhtg9zqyy5GJbEbi0sFNFCowFXmRwraRcMRyZ4p2UK8nylzfCR2KtMPZ2fgUVH9xD/VL/StQ==",- "dev": true,- "requires": {- "@types/react": "*",- "@types/stripe-v3": "*"- }- },"@types/react-textarea-autosize": {"version": "4.3.5","resolved": "https://registry.npmjs.org/@types/react-textarea-autosize/-/react-textarea-autosize-4.3.5.tgz",@@ -11852,12 +11818,6 @@"integrity": "sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw==","dev": true},- "@types/stripe-v3": {- "version": "3.1.23",- "resolved": "https://registry.npmjs.org/@types/stripe-v3/-/stripe-v3-3.1.23.tgz",- "integrity": "sha512-fqCnai832M6o6qH6A+Dqk1I/SXAzx629bknbrDigyvkuAPGZGrjkLCMxfnrtWswHXNPjj/TtuGf4lQnDXc815w==",- "dev": true- },"@types/tough-cookie": {"version": "4.0.0","resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.0.tgz",@@ -16618,6 +16578,7 @@"version": "15.7.2","resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz","integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",+ "dev": true,"requires": {"loose-envify": "^1.4.0","object-assign": "^4.1.1",@@ -16627,7 +16588,8 @@"react-is": {"version": "16.13.1","resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",- "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",+ "dev": true}}},@@ -16777,14 +16739,6 @@"react-is": "^16.12.0 || ^17.0.0"}},- "react-stripe-elements": {- "version": "6.1.2",- "resolved": "https://registry.npmjs.org/react-stripe-elements/-/react-stripe-elements-6.1.2.tgz",- "integrity": "sha512-gYbYhVVJm3Woc84TgmuiqUj44rI/BZGUVUTTmS0U6kZyZa5fYMPlKKIsVZdQZufQ7Ab4BXLO2LSxBlGY0s2jew==",- "requires": {- "prop-types": "15.7.2"- }- },"react-test-renderer": {"version": "17.0.1","resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-17.0.1.tgz",diff --git a/package.json b/package.jsonindex 78a089136..89053a867 100644--- a/package.json+++ b/package.json@@ -9,7 +9,6 @@"react": "17.0.1","react-dom": "17.0.1","react-icons": "4.2.0",- "react-stripe-elements": "6.1.2","react-textarea-autosize": "8.3.2","react-toastify": "7.0.3","tslib": "2.1.0"@@ -24,7 +23,6 @@"@types/puppeteer": "5.4.3","@types/react": "17.0.2","@types/react-dom": "17.0.1",- "@types/react-stripe-elements": "6.0.4","@types/react-textarea-autosize": "4.3.5","@wojtekmaj/enzyme-adapter-react-17": "0.4.1","css-loader": "5.1.1",diff --git a/public/AsyncPages.tsx b/public/AsyncPages.tsxindex d2bd07232..a235d9515 100644--- a/public/AsyncPages.tsx+++ b/public/AsyncPages.tsx@@ -143,14 +143,6 @@ export const AsyncMySettingsPage = load());-export const AsyncBillingPage = load(- () =>- import(- /* webpackChunkName: "Billing.page" */- "@fider/pages/Administration/pages/Billing.page"- )-);-export const AsyncOAuthEchoPage = load(() =>import(diff --git a/public/assets/images/card-americanexpress.svg b/public/assets/images/card-americanexpress.svgdeleted file mode 100644index 52b26e831..000000000--- a/public/assets/images/card-americanexpress.svg+++ /dev/null@@ -1,17 +0,0 @@-<svg- xmlns="http://www.w3.org/2000/svg"- width="780"- height="500"- enable-background="new 0 0 780 500"- version="1.1"- viewBox="0 0 780 500"->- <path- d="m40 1e-3h700c22.092 0 40 17.909 40 40v420c0 22.092-17.908 40-40 40h-700c-22.091 0-40-17.908-40-40v-420c0-22.091 17.909-40 40-40z"- fill="#2557D6"- />- <path- d="m0.253 235.69h37.441l8.442-19.51h18.9l8.42 19.51h73.668v-14.915l6.576 14.98h38.243l6.576-15.202v15.138h183.08l-0.085-32.026h3.542c2.479 0.083 3.204 0.302 3.204 4.226v27.8h94.689v-7.455c7.639 3.92 19.518 7.455 35.148 7.455h39.836l8.525-19.51h18.9l8.337 19.51h76.765v-18.532l11.626 18.532h61.515v-122.51h-60.88v14.468l-8.522-14.468h-62.471v14.468l-7.828-14.468h-84.38c-14.123 0-26.539 1.889-36.569 7.153v-7.153h-58.229v7.153c-6.383-5.426-15.079-7.153-24.75-7.153h-212.74l-14.274 31.641-14.659-31.641h-67.005v14.468l-7.362-14.468h-57.145l-26.539 58.246v64.261h3e-3zm236.34-17.67h-22.464l-0.083-68.794-31.775 68.793h-19.24l-31.858-68.854v68.854h-44.57l-8.42-19.592h-45.627l-8.505 19.592h-23.801l39.241-87.837h32.559l37.269 83.164v-83.164h35.766l28.678 59.587 26.344-59.587h36.485l1e-3 87.838zm-165.9-37.823l-14.998-35.017-14.915 35.017h29.913zm255.3 37.821h-73.203v-87.837h73.203v18.291h-51.289v15.833h50.06v18.005h-50.061v17.542h51.289l1e-3 18.166zm103.16-64.18c0 14.004-9.755 21.24-15.439 23.412 4.794 1.748 8.891 4.838 10.84 7.397 3.094 4.369 3.628 8.271 3.628 16.116v17.255h-22.104l-0.083-11.077c0-5.285 0.528-12.886-3.458-17.112-3.202-3.09-8.083-3.76-15.973-3.76h-23.523v31.95h-21.914v-87.838h50.401c11.199 0 19.451 0.283 26.535 4.207 6.933 3.924 11.09 9.652 11.09 19.45zm-27.699 13.042c-3.013 1.752-6.573 1.81-10.841 1.81h-26.62v-19.51h26.982c3.818 0 7.804 0.164 10.393 1.584 2.842 1.28 4.601 4.003 4.601 7.765 0 3.84-1.674 6.929-4.515 8.351zm62.844 51.138h-22.358v-87.837h22.358v87.837zm259.56 0h-31.053l-41.535-65.927v65.927h-44.628l-8.527-19.592h-45.521l-8.271 19.592h-25.648c-10.649 0-24.138-2.257-31.773-9.715-7.701-7.458-11.708-17.56-11.708-33.533 0-13.027 2.395-24.936 11.812-34.347 7.085-7.01 18.18-10.242 33.28-10.242h21.215v18.821h-20.771c-7.997 0-12.514 1.14-16.862 5.203-3.735 3.699-6.298 10.69-6.298 19.897 0 9.41 1.951 16.196 6.023 20.628 3.373 3.476 9.506 4.53 15.272 4.53h9.842l30.884-69.076h32.835l37.102 83.081v-83.08h33.366l38.519 61.174v-61.174h22.445v87.833zm-133.2-37.82l-15.165-35.017-15.081 35.017h30.246zm189.04 178.08c-5.322 7.457-15.694 11.238-29.736 11.238h-42.319v-18.84h42.147c4.181 0 7.106-0.527 8.868-2.175 1.665-1.474 2.605-3.554 2.591-5.729 0-2.561-1.064-4.593-2.677-5.811-1.59-1.342-3.904-1.95-7.722-1.95-20.574-0.67-46.244 0.608-46.244-27.194 0-12.742 8.443-26.156 31.439-26.156h43.649v-17.479h-40.557c-12.237 0-21.129 2.81-27.425 7.174v-7.175h-59.985c-9.595 0-20.854 2.279-26.179 7.175v-7.175h-107.12v7.175c-8.524-5.892-22.908-7.175-29.549-7.175h-70.656v7.175c-6.745-6.258-21.742-7.175-30.886-7.175h-79.077l-18.094 18.764-16.949-18.764h-118.13v122.59h115.9l18.646-19.062 17.565 19.062 71.442 0.061v-28.838h7.021c9.479 0.14 20.66-0.228 30.523-4.312v33.085h58.928v-31.952h2.842c3.628 0 3.985 0.144 3.985 3.615v28.333h179.01c11.364 0 23.244-2.786 29.824-7.845v7.845h56.78c11.815 0 23.354-1.587 32.134-5.649l2e-3 -22.84zm-354.94-47.155c0 24.406-19.005 29.445-38.159 29.445h-27.343v29.469h-42.591l-26.984-29.086-28.042 29.086h-86.802v-87.859h88.135l26.961 28.799 27.875-28.799h70.021c17.389 0 36.929 4.613 36.929 28.945zm-174.22 40.434h-53.878v-17.48h48.11v-17.926h-48.11v-15.974h54.939l23.969 25.604-25.03 25.776zm86.81 10.06l-33.644-35.789 33.644-34.65v70.439zm49.757-39.066h-28.318v-22.374h28.572c7.912 0 13.404 3.09 13.404 10.772 0 7.599-5.238 11.602-13.658 11.602zm148.36-40.373h73.138v18.17h-51.315v15.973h50.062v17.926h-50.062v17.48l51.314 0.08v18.23h-73.139l2e-3 -87.859zm-28.119 47.029c4.878 1.725 8.865 4.816 10.734 7.375 3.095 4.291 3.542 8.294 3.631 16.037v17.418h-22.002v-10.992c0-5.286 0.531-13.112-3.542-17.198-3.201-3.147-8.083-3.899-16.076-3.899h-23.42v32.09h-22.02v-87.859h50.594c11.093 0 19.173 0.47 26.366 4.146 6.915 4.004 11.266 9.487 11.266 19.511-1e-3 14.022-9.764 21.178-15.531 23.371zm-12.385-11.107c-2.932 1.667-6.556 1.811-10.818 1.811h-26.622v-19.732h26.982c3.902 0 7.807 0.08 10.458 1.587 2.84 1.423 4.538 4.146 4.538 7.903 0 3.758-1.699 6.786-4.538 8.431zm197.82 5.597c4.27 4.229 6.554 9.571 6.554 18.613 0 18.9-12.322 27.723-34.425 27.723h-42.68v-18.84h42.51c4.157 0 7.104-0.525 8.95-2.175 1.508-1.358 2.589-3.333 2.589-5.729 0-2.561-1.17-4.592-2.675-5.811-1.675-1.34-3.986-1.949-7.803-1.949-20.493-0.67-46.157 0.609-46.157-27.192 0-12.744 8.355-26.158 31.33-26.158h43.932v18.7h-40.198c-3.984 0-6.575 0.145-8.779 1.587-2.4 1.422-3.29 3.534-3.29 6.319 0 3.314 2.037 5.57 4.795 6.546 2.311 0.77 4.795 0.995 8.526 0.995l11.797 0.306c11.895 0.276 20.061 2.248 25.024 7.065zm86.955-23.52h-39.938c-3.986 0-6.638 0.144-8.867 1.587-2.312 1.423-3.202 3.534-3.202 6.322 0 3.314 1.951 5.568 4.791 6.544 2.312 0.771 4.795 0.996 8.444 0.996l11.878 0.304c11.983 0.284 19.982 2.258 24.86 7.072 0.891 0.67 1.422 1.422 2.033 2.175v-25h1e-3z"- fill="#fff"- />-</svg>\ No newline at end of filediff --git a/public/assets/images/card-diners.svg b/public/assets/images/card-diners.svgdeleted file mode 100644index 427801323..000000000--- a/public/assets/images/card-diners.svg+++ /dev/null@@ -1,25 +0,0 @@- <svg- xmlns="http://www.w3.org/2000/svg"- width="780"- height="500"- enable-background="new 0 0 780 500"- version="1.1"- viewBox="0 0 780 500"->- <path- d="M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40 C0,17.909,17.909,0,40,0z"- fill="#0079BE"- />- <path- d="m599.93 251.45c0-99.415-82.98-168.13-173.9-168.1h-78.242c-92.003-0.033-167.73 68.705-167.73 168.1 0 90.93 75.727 165.64 167.73 165.2h78.242c90.914 0.436 173.9-74.294 173.9-165.2z"- fill="#fff"- />- <path- d="m348.28 97.43c-84.07 0.027-152.19 68.308-152.21 152.58 0.02 84.258 68.144 152.53 152.21 152.56 84.09-0.027 152.23-68.303 152.24-152.56-0.011-84.272-68.149-152.55-152.24-152.58z"- fill="#0079BE"- />- <path- d="m252.07 249.6c0.08-41.181 25.746-76.297 61.94-90.25v180.48c-36.194-13.948-61.861-49.045-61.94-90.23zm131 90.274v-180.53c36.207 13.92 61.914 49.057 61.979 90.257-0.065 41.212-25.772 76.322-61.979 90.269z"- fill="#fff"- />-</svg>\ No newline at end of filediff --git a/public/assets/images/card-discover.svg b/public/assets/images/card-discover.svgdeleted file mode 100644index 8aa7e300a..000000000--- a/public/assets/images/card-discover.svg+++ /dev/null@@ -1,16 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" width="780" height="500" viewBox="0 0 780 500">- <g fill-rule="evenodd">- <path- d="M54.992 0C24.627 0 0 24.63 0 55.004v390.992C0 476.376 24.619 501 54.992 501h670.016C755.373 501 780 476.37 780 445.996V55.004C780 24.624 755.381 0 725.008 0H54.992z"- fill="#4D4D4D"- />- <path- d="M327.152 161.893c8.837 0 16.248 1.784 25.268 6.09v22.751c-8.544-7.863-15.955-11.154-25.756-11.154-19.264 0-34.414 15.015-34.414 34.05 0 20.075 14.681 34.196 35.37 34.196 9.312 0 16.586-3.12 24.8-10.857v22.763c-9.341 4.14-16.911 5.776-25.756 5.776-31.278 0-55.582-22.596-55.582-51.737 0-28.826 24.951-51.878 56.07-51.878zm-97.113.627c11.546 0 22.11 3.72 30.943 10.994l-10.748 13.248c-5.35-5.646-10.41-8.028-16.564-8.028-8.853 0-15.3 4.745-15.3 10.989 0 5.354 3.619 8.188 15.944 12.482 23.365 8.044 30.29 15.176 30.29 30.926 0 19.193-14.976 32.553-36.32 32.553-15.63 0-26.994-5.795-36.458-18.872l13.268-12.03c4.73 8.61 12.622 13.222 22.42 13.222 9.163 0 15.947-5.952 15.947-13.984 0-4.164-2.055-7.734-6.158-10.258-2.066-1.195-6.158-2.977-14.2-5.647-19.291-6.538-25.91-13.527-25.91-27.185 0-16.225 14.214-28.41 32.846-28.41zm234.723 1.728h22.437l28.084 66.592 28.446-66.592h22.267l-45.494 101.686h-11.053l-44.687-101.686zm-397.348.152h30.15c33.312 0 56.534 20.382 56.534 49.641 0 14.59-7.104 28.696-19.118 38.057-10.108 7.901-21.626 11.445-37.574 11.445H67.414V164.4zm96.135 0h20.54v99.143h-20.54V164.4zm411.734 0h58.252v16.8H595.81v22.005h36.336v16.791h-36.336v26.762h37.726v16.785h-58.252V164.4zm71.858 0h30.455c23.69 0 37.265 10.71 37.265 29.272 0 15.18-8.514 25.14-23.986 28.105l33.148 41.766h-25.26l-28.429-39.828h-2.678v39.828h-20.515V164.4zm20.515 15.616v30.025h6.002c13.117 0 20.069-5.362 20.069-15.328 0-9.648-6.954-14.697-19.745-14.697h-6.326zM87.94 181.199v65.559h5.512c13.273 0 21.656-2.394 28.11-7.88 7.103-5.955 11.376-15.465 11.376-24.98 0-9.499-4.273-18.725-11.376-24.681-6.785-5.78-14.837-8.018-28.11-8.018H87.94z"- fill="#FFF"- />- <path- d="m415.13 161.21c30.941 0 56.022 23.58 56.022 52.709v0.033c0 29.13-25.081 52.742-56.021 52.742s-56.022-23.613-56.022-52.742v-0.033c0-29.13 25.082-52.71 56.022-52.71zm364.85 127.15c-26.05 18.33-221.08 149.34-558.75 212.62h503.76c30.365 0 54.992-24.63 54.992-55.004v-157.62z"- fill="#F47216"- />- </g>-</svg>\ No newline at end of filediff --git a/public/assets/images/card-jcb.svg b/public/assets/images/card-jcb.svgdeleted file mode 100644index 954410927..000000000--- a/public/assets/images/card-jcb.svg+++ /dev/null@@ -1,65 +0,0 @@-<svg- xmlns="http://www.w3.org/2000/svg"- width="780"- height="500"- enable-background="new 0 0 780 500"- version="1.1"- viewBox="0 0 780 500"->- <path- d="M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40 C0,17.909,17.909,0,40,0z"- fill="#0E4C96"- />- <path- d="m632.24 361.27c0 41.615-33.729 75.36-75.36 75.36h-409.13v-297.88c0-41.626 33.733-75.37 75.365-75.37l409.12-1e-3 1e-3 297.89z"- fill="#fff"- />- <linearGradient- id="c"- x1="83.977"- x2="84.977"- y1="645.5"- y2="645.5"- gradientTransform="matrix(132.87 0 0 -323.02 -10686 2.0876e5)"- gradientUnits="userSpaceOnUse"- >- <stop stop-color="#007B40" offset="0" />- <stop stop-color="#55B330" offset="1" />- </linearGradient>- <path- d="m498.86 256.54c11.684 0.253 23.437-0.516 35.076 0.4 11.787 2.199 14.629 20.043 4.156 25.888-7.141 3.851-15.633 1.433-23.379 2.113h-15.852l-1e-3 -28.401zm41.833-32.145c2.596 9.164-6.238 17.392-15.066 16.13h-26.767c0.185-8.642-0.368-18.021 0.271-26.208 10.725 0.301 21.549-0.616 32.21 0.479 4.581 1.151 8.414 4.917 9.352 9.599zm64.428-135.9c0.498 17.501 0.071 35.927 0.214 53.783-0.035 72.596 0.072 145.19-0.055 217.79-0.47 27.207-24.582 50.844-51.601 51.387-27.046 0.111-54.095 0.016-81.142 0.047v-109.75c29.47-0.154 58.959 0.307 88.417-0.232 13.667-0.859 28.632-9.875 29.27-24.914 1.61-15.103-12.632-25.551-26.152-27.201-5.198-0.135-5.044-1.516 0-2.117 12.892-2.787 23.02-16.133 19.226-29.499-3.236-14.058-18.772-19.499-31.697-19.472-26.351-0.18-52.709-0.026-79.062-0.077 0.172-20.489-0.354-41 0.286-61.474 2.087-26.716 26.806-48.747 53.447-48.27h78.849v-1e-3z"- fill="url(#c)"- />- <linearGradient- id="b"- x1="83.984"- x2="84.979"- y1="645.5"- y2="645.5"- gradientTransform="matrix(133.43 0 0 -323.02 -11031 2.0876e5)"- gradientUnits="userSpaceOnUse"- >- <stop stop-color="#1D2970" offset="0" />- <stop stop-color="#006DBA" offset="1" />- </linearGradient>- <path- d="m174.74 139.54c0.674-27.163 24.889-50.611 51.875-51.007 26.944-0.083 53.891-0.012 80.837-0.036-0.074 90.885 0.148 181.78-0.112 272.66-1.038 26.835-24.99 49.835-51.679 50.308-26.996 0.099-53.995 0.014-80.992 0.042v-113.45c26.223 6.194 53.722 8.832 80.473 4.721 15.993-2.574 33.488-10.424 38.902-27.014 3.986-14.191 1.742-29.126 2.334-43.691v-33.824h-46.297c-0.208 22.369 0.426 44.779-0.335 67.125-1.248 13.734-14.846 22.46-27.8 21.994-16.066 0.17-47.898-11.639-47.898-11.639-0.08-41.918 0.466-94.409 0.692-136.18z"- fill="url(#b)"- />- <linearGradient- id="a"- x1="83.978"- x2="84.977"- y1="645.5"- y2="645.5"- gradientTransform="matrix(132.96 0 0 -323.03 -10842 2.0877e5)"- gradientUnits="userSpaceOnUse"- >- <stop stop-color="#6E2B2F" offset="0" />- <stop stop-color="#E30138" offset="1" />- </linearGradient>- <path- d="m324.72 211.89c-2.434 0.517-0.489-8.301-1.113-11.646 0.165-21.15-0.347-42.323 0.283-63.458 2.083-26.829 26.991-48.916 53.739-48.288h78.766c-0.073 90.884 0.147 181.78-0.111 272.66-1.039 26.834-24.992 49.833-51.681 50.308-26.997 0.1-53.997 0.015-80.997 0.043v-124.3c18.44 15.128 43.5 17.483 66.473 17.524 17.316-6e-3 34.534-2.674 51.35-6.67v-22.772c-18.953 9.446-41.232 15.446-62.243 10.019-14.655-3.65-25.294-17.812-25.056-32.937-1.699-15.728 7.524-32.335 22.981-37.011 19.189-6.008 40.107-1.413 58.096 6.397 3.854 2.019 7.765 4.521 6.222-1.921v-17.9c-30.084-7.156-62.101-9.792-92.329-2.004-8.749 2.469-17.271 6.212-24.38 11.958z"- fill="url(#a)"- />-</svg>\ No newline at end of filediff --git a/public/assets/images/card-mastercard.svg b/public/assets/images/card-mastercard.svgdeleted file mode 100644index a4cf75a00..000000000--- a/public/assets/images/card-mastercard.svg+++ /dev/null@@ -1,31 +0,0 @@-<svg- xmlns="http://www.w3.org/2000/svg"- width="780"- height="500"- enable-background="new 0 0 780 500"- version="1.1"- viewBox="0 0 780 500"->- <path- d="M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40 C0,17.909,17.909,0,40,0z"- fill="#16366F"- />- <path- d="m449.01 250c0 99.143-80.37 179.5-179.51 179.5s-179.5-80.361-179.5-179.5c0-99.133 80.362-179.5 179.5-179.5 99.137 0 179.51 80.37 179.51 179.5"- fill="#D9222A"- />- <path- d="m510.49 70.496c-46.38 0-88.643 17.596-120.5 46.466-6.49 5.889-12.548 12.237-18.125 18.996h36.266c4.966 6.037 9.536 12.388 13.685 19.013h-63.635c-3.827 6.121-7.28 12.469-10.341 19.008h84.312c2.893 6.185 5.431 12.53 7.6 19.004h-99.512c-2.091 6.235-3.832 12.581-5.217 19.009h109.94c2.689 12.49 4.044 25.231 4.041 38.008 0 19.934-3.254 39.113-9.254 57.02h-99.512c2.164 6.479 4.7 12.825 7.595 19.01h84.317c-3.064 6.54-6.52 12.889-10.347 19.013h-63.625c4.154 6.629 8.73 12.979 13.685 18.996h36.258c-5.57 6.772-11.63 13.126-18.13 19.012 31.86 28.867 74.118 46.454 120.5 46.454 99.138-1e-3 179.51-80.362 179.51-179.5 0-99.13-80.37-179.5-179.51-179.5"- fill="#EE9F2D"- />- <path d="m666.08 350.06c0-3.201 2.592-5.801 5.796-5.801s5.796 2.6 5.796 5.801c0 3.199-2.592 5.799-5.796 5.799-3.202-1e-3 -5.797-2.598-5.796-5.799zm5.796 4.408c2.435-1e-3 4.407-1.975 4.408-4.408 0-2.433-1.972-4.404-4.404-4.404h-4e-3c-2.429-4e-3 -4.4 1.963-4.404 4.392v0.013c-3e-3 2.432 1.967 4.406 4.399 4.408 1e-3 -1e-3 3e-3 -1e-3 5e-3 -1e-3zm-0.783-1.86h-1.188v-5.094h2.149c0.45 0 0.908 0 1.305 0.254 0.413 0.278 0.646 0.77 0.646 1.278 0 0.57-0.337 1.104-0.883 1.312l0.937 2.25h-1.315l-0.78-2.016h-0.87v2.016h-1e-3zm0-2.89h0.658c0.246 0 0.504 0.02 0.725-0.1 0.196-0.125 0.296-0.359 0.296-0.584 0-0.195-0.12-0.42-0.288-0.516-0.207-0.131-0.536-0.101-0.758-0.101h-0.633v1.301zm-443.5-80.063c-2.045-0.237-2.945-0.301-4.35-0.301-11.045 0-16.637 3.789-16.637 11.268 0 4.611 2.73 7.546 6.987 7.546 7.938 0 13.659-7.56 14-18.513zm14.171 32.996h-16.146l0.371-7.676c-4.925 6.067-11.496 8.95-20.425 8.95-10.562 0-17.804-8.25-17.804-20.229 0-18.024 12.596-28.54 34.217-28.54 2.208 0 5.041 0.2 7.941 0.569 0.605-2.441 0.763-3.486 0.763-4.8 0-4.908-3.396-6.738-12.5-6.738-9.533-0.108-17.396 2.271-20.625 3.334 0.204-1.23 2.7-16.658 2.7-16.658 9.712-2.846 16.117-3.917 23.325-3.917 16.733 0 25.596 7.512 25.58 21.712 0.032 3.805-0.597 8.5-1.58 14.671-1.692 10.731-5.32 33.718-5.817 39.322zm-62.158 0h-19.488l11.163-69.997-24.925 69.997h-13.28l-1.64-69.597-11.734 69.597h-18.242l15.238-91.054h28.02l1.7 50.966 17.092-50.966h31.167l-15.071 91.054m354.98-32.996c-2.037-0.237-2.942-0.301-4.342-0.301-11.041 0-16.634 3.789-16.634 11.268 0 4.611 2.726 7.546 6.983 7.546 7.939 0 13.664-7.56 13.993-18.513zm14.183 32.996h-16.145l0.365-7.676c-4.925 6.067-11.5 8.95-20.42 8.95-10.566 0-17.8-8.25-17.8-20.229 0-18.024 12.587-28.54 34.212-28.54 2.208 0 5.037 0.2 7.934 0.569 0.604-2.441 0.763-3.486 0.763-4.8 0-4.908-3.392-6.738-12.496-6.738-9.533-0.108-17.388 2.271-20.63 3.334 0.205-1.23 2.709-16.658 2.709-16.658 9.713-2.846 16.113-3.917 23.312-3.917 16.741 0 25.604 7.512 25.588 21.712 0.032 3.805-0.597 8.5-1.58 14.671-1.682 10.731-5.32 33.718-5.812 39.322zm-220.39-1.125c-5.334 1.68-9.492 2.399-14 2.399-9.963 0-15.4-5.725-15.4-16.267-0.142-3.27 1.433-11.879 2.67-19.737 1.125-6.917 8.45-50.53 8.45-50.53h19.371l-2.262 11.209h11.7l-2.643 17.796h-11.742c-2.25 14.083-5.454 31.625-5.491 33.95 0 3.817 2.037 5.483 6.67 5.483 2.221 0 3.941-0.226 5.255-0.7l-2.578 16.397m59.391-0.6c-6.654 2.033-13.075 3.017-19.879 3-21.683-0.021-32.987-11.346-32.987-33.032 0-25.313 14.38-43.947 33.9-43.947 15.97 0 26.17 10.433 26.17 26.796 0 5.429-0.7 10.729-2.387 18.212h-38.575c-1.304 10.742 5.57 15.217 16.837 15.217 6.935 0 13.188-1.43 20.142-4.663l-3.221 18.417zm-10.887-43.9c0.107-1.543 2.054-13.217-9.013-13.217-6.171 0-10.583 4.704-12.38 13.217h21.393zm-123.42-5.017c0 9.367 4.541 15.825 14.841 20.676 7.892 3.709 9.113 4.809 9.113 8.17 0 4.617-3.48 6.7-11.192 6.7-5.812 0-11.22-0.907-17.458-2.92 0 0-2.563 16.32-2.68 17.101 4.43 0.966 8.38 1.861 20.28 2.19 20.562 0 30.058-7.829 30.058-24.75 0-10.175-3.975-16.146-13.737-20.633-8.171-3.75-9.109-4.588-9.109-8.046 0-4.004 3.238-6.046 9.538-6.046 3.825 0 9.05 0.408 14 1.113l2.775-17.175c-5.046-0.8-12.696-1.442-17.15-1.442-21.8 0-29.346 11.387-29.279 25.062m229.09-23.116c5.413 0 10.459 1.42 17.413 4.92l3.187-19.762c-2.854-1.12-12.904-7.7-21.416-7.7-13.042 0-24.066 6.47-31.82 17.15-11.31-3.746-15.959 3.825-21.659 11.367l-5.062 1.179c0.383-2.483 0.73-4.95 0.613-7.446h-17.896c-2.445 22.917-6.779 46.13-10.171 69.075l-0.884 4.976h19.496c3.254-21.143 5.038-34.681 6.121-43.842l7.342-4.084c1.096-4.08 4.529-5.458 11.416-5.292-0.926 5.008-1.389 10.09-1.383 15.184 0 24.225 13.071 39.308 34.05 39.308 5.404 0 10.042-0.712 17.221-2.657l3.431-20.76c-6.46 3.18-11.761 4.676-16.561 4.676-11.328 0-18.183-8.362-18.183-22.184-1e-3 -20.05 10.195-34.108 24.745-34.108" />- <path- d="m185.21 297.24h-19.491l11.17-69.988-24.925 69.988h-13.282l-1.642-69.588-11.733 69.588h-18.243l15.238-91.042h28.02l0.788 56.362 18.904-56.362h30.267l-15.071 91.042"- fill="#fff"- />- <path d="m647.52 211.6l-4.319 26.308c-5.33-7.012-11.054-12.087-18.612-12.087-9.834 0-18.784 7.454-24.642 18.425-8.158-1.692-16.597-4.563-16.597-4.563l-4e-3 0.067c0.658-6.133 0.92-9.875 0.862-11.146h-17.9c-2.437 22.917-6.77 46.13-10.157 69.075l-0.893 4.976h19.492c2.633-17.097 4.65-31.293 6.133-42.551 6.659-6.017 9.992-11.267 16.721-10.917-2.979 7.206-4.725 15.504-4.725 24.017 0 18.513 9.367 30.725 23.534 30.725 7.141 0 12.62-2.462 17.966-8.17l-0.912 6.884h18.433l14.842-91.043h-19.222zm-24.37 73.942c-6.634 0-9.983-4.909-9.983-14.597 0-14.553 6.271-24.875 15.112-24.875 6.695 0 10.32 5.104 10.32 14.508 1e-3 14.681-6.369 24.964-15.449 24.964z" />- <path- d="m233.19 264.26c-2.042-0.236-2.946-0.3-4.346-0.3-11.046 0-16.634 3.788-16.634 11.267 0 4.604 2.73 7.547 6.98 7.547 7.945-1e-3 13.666-7.559 14-18.514zm14.179 32.984h-16.146l0.367-7.663c-4.921 6.054-11.5 8.95-20.421 8.95-10.567 0-17.804-8.25-17.804-20.229 0-18.032 12.591-28.542 34.216-28.542 2.209 0 5.042 0.2 7.938 0.571 0.604-2.442 0.762-3.487 0.762-4.808 0-4.908-3.391-6.73-12.496-6.73-9.537-0.108-17.395 2.272-20.629 3.322 0.204-1.226 2.7-16.638 2.7-16.638 9.709-2.858 16.121-3.93 23.321-3.93 16.738 0 25.604 7.518 25.588 21.705 0.029 3.82-0.605 8.512-1.584 14.675-1.687 10.725-5.32 33.725-5.812 39.317zm261.38-88.592l-3.192 19.767c-6.95-3.496-12-4.921-17.407-4.921-14.551 0-24.75 14.058-24.75 34.107 0 13.821 6.857 22.181 18.183 22.181 4.8 0 10.096-1.492 16.554-4.677l-3.42 20.75c-7.184 1.959-11.816 2.672-17.226 2.672-20.976 0-34.05-15.084-34.05-39.309 0-32.55 18.059-55.3 43.888-55.3 8.507 1e-3 18.562 3.609 21.42 4.73m31.442 55.608c-2.041-0.236-2.941-0.3-4.346-0.3-11.042 0-16.634 3.788-16.634 11.267 0 4.604 2.729 7.547 6.984 7.547 7.937-1e-3 13.662-7.559 13.996-18.514zm14.179 32.984h-16.15l0.37-7.663c-4.924 6.054-11.5 8.95-20.42 8.95-10.563 0-17.804-8.25-17.804-20.229 0-18.032 12.595-28.542 34.212-28.542 2.213 0 5.042 0.2 7.941 0.571 0.601-2.442 0.763-3.487 0.763-4.808 0-4.908-3.392-6.73-12.496-6.73-9.533-0.108-17.396 2.272-20.629 3.322 0.204-1.226 2.704-16.638 2.704-16.638 9.709-2.858 16.116-3.93 23.316-3.93 16.742 0 25.604 7.518 25.583 21.705 0.034 3.82-0.595 8.512-1.579 14.675-1.682 10.725-5.324 33.725-5.811 39.317zm-220.39-1.122c-5.338 1.68-9.496 2.409-14 2.409-9.963 0-15.4-5.726-15.4-16.266-0.138-3.281 1.437-11.881 2.675-19.738 1.12-6.926 8.446-50.533 8.446-50.533h19.367l-2.259 11.212h9.942l-2.646 17.788h-9.975c-2.25 14.091-5.463 31.619-5.496 33.949 0 3.83 2.042 5.483 6.671 5.483 2.22 0 3.938-0.217 5.254-0.692l-2.579 16.388m59.392-0.591c-6.65 2.033-13.08 3.013-19.88 3-21.684-0.021-32.987-11.346-32.987-33.033 0-25.321 14.38-43.95 33.9-43.95 15.97 0 26.17 10.429 26.17 26.8 0 5.433-0.7 10.733-2.382 18.212h-38.575c-1.306 10.741 5.569 15.221 16.837 15.221 6.93 0 13.188-1.434 20.137-4.676l-3.22 18.426zm-10.892-43.912c0.117-1.538 2.059-13.217-9.013-13.217-6.166 0-10.579 4.717-12.375 13.217h21.388zm-123.42-5.004c0 9.365 4.542 15.816 14.842 20.675 7.891 3.708 9.112 4.812 9.112 8.17 0 4.617-3.483 6.7-11.187 6.7-5.817 0-11.225-0.908-17.467-2.92 0 0-2.554 16.32-2.67 17.1 4.42 0.967 8.374 1.85 20.274 2.191 20.567 0 30.059-7.829 30.059-24.746 0-10.18-3.971-16.15-13.738-20.637-8.167-3.758-9.112-4.583-9.112-8.046 0-4 3.245-6.058 9.541-6.058 3.821 0 9.046 0.42 14.004 1.125l2.771-17.18c-5.041-0.8-12.691-1.441-17.146-1.441-21.804 0-29.345 11.379-29.283 25.067m398.45 50.629h-18.437l0.917-6.893c-5.347 5.717-10.825 8.18-17.967 8.18-14.168 0-23.53-12.213-23.53-30.725 0-24.63 14.521-45.393 31.709-45.393 7.558 0 13.28 3.088 18.604 10.096l4.325-26.308h19.221l-14.842 91.043zm-28.745-17.109c9.075 0 15.45-10.283 15.45-24.953 0-9.405-3.63-14.509-10.325-14.509-8.838 0-15.116 10.317-15.116 24.875-1e-3 9.686 3.357 14.587 9.991 14.587zm-56.843-56.929c-2.439 22.917-6.773 46.13-10.162 69.063l-0.891 4.975h19.491c6.971-45.275 8.658-54.117 19.588-53.009 1.742-9.266 4.982-17.383 7.399-21.479-8.163-1.7-12.721 2.913-18.688 11.675 0.471-3.787 1.334-7.466 1.163-11.225h-17.9m-160.42 0c-2.446 22.917-6.78 46.13-10.167 69.063l-0.887 4.975h19.5c6.962-45.275 8.646-54.117 19.569-53.009 1.75-9.266 4.992-17.383 7.4-21.479-8.154-1.7-12.716 2.913-18.678 11.675 0.47-3.787 1.325-7.466 1.162-11.225h-17.899m254.57 68.242c0-3.214 2.596-5.8 5.796-5.8 3.197-3e-3 5.792 2.587 5.795 5.785v0.015c-1e-3 3.2-2.595 5.794-5.795 5.796-3.2-2e-3 -5.794-2.596-5.796-5.796zm5.796 4.404c2.432 1e-3 4.403-1.97 4.403-4.401v-2e-3c3e-3 -2.433-1.968-4.406-4.399-4.408h-4e-3c-2.435 1e-3 -4.408 1.974-4.409 4.408 3e-3 2.432 1.976 4.403 4.409 4.403zm-0.784-1.87h-1.188v-5.084h2.154c0.446 0 0.908 8e-3 1.296 0.254 0.416 0.283 0.654 0.767 0.654 1.274 0 0.575-0.338 1.113-0.888 1.317l0.941 2.236h-1.319l-0.78-2.008h-0.87v2.008 3e-3zm0-2.88h0.654c0.245 0 0.513 0.018 0.729-0.1 0.195-0.125 0.295-0.361 0.295-0.587-9e-3 -0.21-0.115-0.404-0.287-0.524-0.204-0.117-0.542-0.085-0.763-0.085h-0.629v1.296h1e-3z"- fill="#fff"- />-</svg>\ No newline at end of filediff --git a/public/assets/images/card-unknown.svg b/public/assets/images/card-unknown.svgdeleted file mode 100644index a8ca58d69..000000000--- a/public/assets/images/card-unknown.svg+++ /dev/null@@ -1,28 +0,0 @@-<svg- xmlns="http://www.w3.org/2000/svg"- width="780"- height="500"- enable-background="new 0 0 780 500"- version="1.1"- viewBox="0 0 780 500"->- <path- d="M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40 C0,17.909,17.909,0,40,0z"- fill="#000C9D"- />- <rect x="66.908" y="106.91" width="110.32" height="99.679" fill="#9D9400" />- <path- d="m94.714 284.15v-3.795h-5.117v-11.27h-4.198l-0.402 11.27h-11.443l10.58-25.07-3.967-1.725-11.673 27.141v3.449h16.445v9.66h4.658v-9.66h5.117zm19.586-30.589c-4.025 0-7.878 1.381-11.213 4.6l2.588 2.934c2.645-2.473 5.002-3.68 8.395-3.68 4.197 0 7.532 2.357 7.532 6.727 0 4.773-3.737 6.959-7.532 6.959h-2.358l-0.575 3.795h3.335c4.658 0 8.223 1.84 8.223 7.531 0 4.945-3.278 8.107-8.855 8.107-3.22 0-6.555-1.322-8.798-3.967l-3.22 2.645c2.99 3.68 7.705 5.232 12.133 5.232 8.165 0 13.742-5.174 13.742-12.018 0-6.152-4.37-9.371-9.027-9.717 4.197-0.807 7.762-4.43 7.762-9.199 0-5.406-4.715-9.949-12.132-9.949zm34.477 0c-5.347 0-8.912 1.896-12.075 5.693l3.335 2.529c2.53-2.934 4.658-4.197 8.568-4.197 4.427 0 7.072 2.76 7.072 7.188 0 6.496-3.22 10.809-18.17 25.127v3.908h23.518l0.575-4.08h-18.63c13.052-11.904 17.71-17.826 17.71-25.07 0-6.325-4.428-11.098-11.903-11.098zm48.738 36.339h-8.28v-35.648h-4.198l-11.73 7.244 2.07 3.393 9.085-5.463v30.476h-9.775v3.908h22.828v-3.91zm69.587-5.75v-3.795h-5.117v-11.27h-4.198l-0.402 11.27h-11.443l10.58-25.07-3.967-1.725-11.673 27.141v3.449h16.445v9.66h4.658v-9.66h5.117zm19.585-30.589c-4.025 0-7.877 1.381-11.212 4.6l2.587 2.934c2.645-2.473 5.003-3.68 8.395-3.68 4.198 0 7.533 2.357 7.533 6.727 0 4.773-3.738 6.959-7.533 6.959h-2.357l-0.575 3.795h3.335c4.657 0 8.222 1.84 8.222 7.531 0 4.945-3.277 8.107-8.855 8.107-3.22 0-6.555-1.322-8.797-3.967l-3.22 2.645c2.99 3.68 7.705 5.232 12.132 5.232 8.165 0 13.743-5.174 13.743-12.018 0-6.152-4.37-9.371-9.028-9.717 4.198-0.807 7.763-4.43 7.763-9.199 0-5.406-4.715-9.949-12.133-9.949zm34.478 0c-5.348 0-8.913 1.896-12.075 5.693l3.335 2.529c2.53-2.934 4.657-4.197 8.567-4.197 4.428 0 7.073 2.76 7.073 7.188 0 6.496-3.221 10.809-18.171 25.127v3.908h23.518l0.575-4.08h-18.63c13.053-11.904 17.71-17.826 17.71-25.07 0-6.325-4.427-11.098-11.902-11.098zm48.737 36.339h-8.28v-35.648h-4.196l-11.729 7.244 2.069 3.393 9.085-5.463v30.476h-9.774v3.908h22.827l-2e-3 -3.91zm69.588-5.75v-3.795h-5.119v-11.27h-4.197l-0.401 11.27h-11.443l10.58-25.07-3.969-1.725-11.672 27.141v3.449h16.445v9.66h4.656v-9.66h5.12zm19.584-30.589c-4.023 0-7.877 1.381-11.213 4.6l2.588 2.934c2.646-2.473 5.002-3.68 8.396-3.68 4.195 0 7.531 2.357 7.531 6.727 0 4.773-3.736 6.959-7.531 6.959h-2.358l-0.574 3.795h3.334c4.658 0 8.225 1.84 8.225 7.531 0 4.945-3.278 8.107-8.854 8.107-3.222 0-6.556-1.322-8.799-3.967l-3.22 2.645c2.988 3.68 7.703 5.232 12.134 5.232 8.163 0 13.741-5.174 13.741-12.018 0-6.152-4.371-9.371-9.026-9.717 4.196-0.807 7.762-4.43 7.762-9.199-3e-3 -5.406-4.718-9.949-12.136-9.949zm34.479 0c-5.348 0-8.912 1.896-12.076 5.693l3.337 2.529c2.528-2.934 4.657-4.197 8.565-4.197 4.428 0 7.072 2.76 7.072 7.188 0 6.496-3.219 10.809-18.17 25.127v3.908h23.518l0.576-4.08h-18.631c13.053-11.904 17.711-17.826 17.711-25.07 0-6.326-4.428-11.098-11.904-11.098h2e-3zm48.736 36.339h-8.279v-35.648h-4.197l-11.729 7.244 2.07 3.393 9.084-5.463v30.476h-9.775v3.908h22.828l-2e-3 -3.91zm69.588-5.75v-3.795h-5.117v-11.27h-4.197l-0.401 11.27h-11.443l10.58-25.07-3.967-1.725-11.672 27.141v3.449h16.445v9.66h4.655v-9.66h5.117zm19.584-30.589c-4.023 0-7.877 1.381-11.211 4.6l2.588 2.934c2.646-2.473 5.002-3.68 8.396-3.68 4.196 0 7.532 2.357 7.532 6.727 0 4.773-3.737 6.959-7.532 6.959h-2.357l-0.574 3.795h3.334c4.658 0 8.224 1.84 8.224 7.531 0 4.945-3.277 8.107-8.855 8.107-3.219 0-6.555-1.322-8.797-3.967l-3.221 2.645c2.99 3.68 7.705 5.232 12.133 5.232 8.166 0 13.742-5.174 13.742-12.018 0-6.152-4.369-9.371-9.027-9.717 4.197-0.807 7.764-4.43 7.764-9.199 0-5.406-4.715-9.949-12.133-9.949h-6e-3zm34.478 0c-5.347 0-8.912 1.896-12.074 5.693l3.334 2.529c2.531-2.934 4.658-4.197 8.567-4.197 4.429 0 7.072 2.76 7.072 7.188 0 6.496-3.221 10.809-18.17 25.127v3.908h23.519l0.575-4.08h-18.631c13.054-11.904 17.711-17.826 17.711-25.07 2e-3 -6.325-4.428-11.098-11.903-11.098zm48.739 36.339h-8.278v-35.648h-4.2l-11.729 7.244 2.068 3.393 9.086-5.463v30.476h-9.775v3.908h22.828v-3.91z"- fill="#fff"- />- <path- d="m72.219 389.2h6.445v-22.246l-7.012 1.406v-3.594l6.973-1.406h3.945v25.84h6.446v3.32h-16.797v-3.32zm25.468 0h6.446v-22.246l-7.012 1.406v-3.594l6.973-1.406h3.945v25.84h6.445v3.32h-16.797v-3.32zm40.918 0h13.77v3.32h-18.516v-3.32c1.497-1.549 3.535-3.625 6.114-6.229 2.591-2.617 4.218-4.305 4.882-5.061 1.263-1.42 2.142-2.617 2.637-3.594 0.508-0.988 0.762-1.959 0.762-2.91 0-1.549-0.547-2.811-1.64-3.789-1.081-0.977-2.495-1.465-4.24-1.465-1.237 0-2.545 0.215-3.925 0.646-1.367 0.43-2.831 1.08-4.394 1.953v-3.986c1.588-0.637 3.072-1.119 4.453-1.443 1.38-0.326 2.643-0.486 3.789-0.486 3.021 0 5.429 0.754 7.226 2.264 1.797 1.512 2.696 3.529 2.696 6.055 0 1.199-0.228 2.338-0.684 3.418-0.442 1.068-1.256 2.332-2.441 3.789-0.326 0.377-1.361 1.471-3.106 3.281-1.745 1.796-4.206 4.315-7.383 7.557zm34.024-12.402c1.888 0.404 3.359 1.244 4.414 2.521 1.067 1.275 1.601 2.852 1.601 4.727 0 2.877-0.99 5.104-2.968 6.682-1.979 1.574-4.792 2.361-8.438 2.361-1.224 0-2.487-0.125-3.789-0.371-1.289-0.234-2.623-0.594-4.004-1.074v-3.809c1.093 0.639 2.292 1.119 3.594 1.445 1.302 0.324 2.663 0.488 4.082 0.488 2.474 0 4.356-0.488 5.645-1.465 1.302-0.979 1.953-2.396 1.953-4.26 0-1.719-0.605-3.061-1.817-4.021-1.198-0.979-2.872-1.465-5.02-1.465h-3.398v-3.242h3.555c1.94 0 3.425-0.385 4.453-1.152 1.029-0.781 1.543-1.9 1.543-3.359 0-1.496-0.534-2.645-1.601-3.438-1.055-0.809-2.572-1.211-4.551-1.211-1.081 0-2.24 0.117-3.477 0.354-1.237 0.232-2.597 0.598-4.082 1.092v-3.514c1.498-0.418 2.897-0.73 4.2-0.939 1.314-0.207 2.551-0.311 3.71-0.311 2.995 0 5.365 0.682 7.11 2.049 1.745 1.354 2.617 3.189 2.617 5.508 0 1.615-0.462 2.98-1.387 4.102-0.925 1.105-2.24 1.872-3.945 2.302zm26.289-13.438h15.488v3.32h-11.874v7.148c0.573-0.195 1.146-0.34 1.719-0.43 0.573-0.105 1.146-0.156 1.719-0.156 3.255 0 5.833 0.893 7.734 2.676s2.852 4.199 2.852 7.246c0 3.139-0.977 5.578-2.93 7.324-1.954 1.732-4.708 2.598-8.262 2.598-1.224 0-2.474-0.104-3.75-0.312-1.263-0.207-2.571-0.521-3.926-0.938v-3.965c1.172 0.639 2.383 1.113 3.633 1.426s2.572 0.469 3.965 0.469c2.253 0 4.037-0.594 5.352-1.777s1.972-2.793 1.972-4.824-0.657-3.639-1.972-4.824-3.099-1.775-5.352-1.775c-1.055 0-2.109 0.117-3.164 0.352-1.041 0.234-2.109 0.6-3.203 1.092l-1e-3 -14.65zm33.867 15.313c-1.875 0-3.353 0.502-4.434 1.506-1.067 1.002-1.601 2.383-1.601 4.141s0.534 3.137 1.601 4.139c1.082 1.004 2.56 1.506 4.434 1.506 1.875 0 3.354-0.502 4.434-1.504 1.08-1.016 1.62-2.396 1.62-4.141 0-1.758-0.54-3.139-1.62-4.141-1.068-1.004-2.546-1.506-4.434-1.506zm-3.945-1.68c-1.693-0.416-3.015-1.203-3.965-2.363-0.938-1.158-1.406-2.57-1.406-4.236 0-2.332 0.827-4.174 2.48-5.527 1.667-1.354 3.945-2.029 6.836-2.029 2.904 0 5.183 0.676 6.836 2.027 1.653 1.355 2.48 3.197 2.48 5.529 0 1.666-0.475 3.078-1.425 4.236-0.938 1.16-2.247 1.947-3.926 2.363 1.9 0.443 3.378 1.311 4.434 2.598 1.067 1.289 1.601 2.865 1.601 4.729 0 2.824-0.866 4.992-2.598 6.504-1.719 1.51-4.186 2.266-7.402 2.266s-5.69-0.756-7.422-2.266c-1.719-1.512-2.578-3.68-2.578-6.504 0-1.863 0.534-3.439 1.602-4.729 1.067-1.289 2.551-2.154 4.453-2.598zm-1.446-6.228c0 1.51 0.469 2.688 1.407 3.533 0.95 0.848 2.278 1.271 3.984 1.271 1.693 0 3.015-0.424 3.965-1.271 0.963-0.848 1.445-2.023 1.445-3.535 0-1.51-0.481-2.688-1.445-3.535-0.951-0.846-2.272-1.271-3.965-1.271-1.706 0-3.034 0.426-3.984 1.271-0.938 0.847-1.407 2.025-1.407 3.537z"- fill="#fff"- fill-opacity=".784"- />- <path- d="m325.45 388.23h6.444v-22.246l-7.012 1.406v-3.594l6.973-1.406h3.946v25.84h6.444v3.32h-16.797l2e-3 -3.32zm36.738-12.404c1.889 0.404 3.359 1.244 4.415 2.521 1.067 1.275 1.602 2.852 1.602 4.727 0 2.877-0.989 5.105-2.969 6.68-1.979 1.576-4.791 2.363-8.438 2.363-1.224 0-2.487-0.123-3.79-0.371-1.288-0.232-2.622-0.592-4.003-1.074v-3.809c1.094 0.639 2.292 1.121 3.595 1.445 1.303 0.326 2.662 0.488 4.082 0.488 2.474 0 4.354-0.488 5.645-1.465 1.302-0.977 1.953-2.396 1.953-4.258 0-1.719-0.605-3.061-1.816-4.023-1.197-0.977-2.871-1.465-5.02-1.465h-3.398v-3.242h3.556c1.939 0 3.425-0.385 4.453-1.152 1.028-0.781 1.543-1.9 1.543-3.359 0-1.496-0.533-2.643-1.603-3.438-1.055-0.807-2.571-1.209-4.55-1.209-1.081 0-2.24 0.115-3.479 0.35-1.236 0.234-2.598 0.6-4.081 1.096v-3.518c1.497-0.416 2.896-0.729 4.198-0.938 1.315-0.209 2.553-0.312 3.71-0.312 2.996 0 5.365 0.686 7.11 2.053 1.744 1.354 2.616 3.189 2.616 5.508 0 1.613-0.462 2.98-1.386 4.102-0.923 1.103-2.239 1.872-3.945 2.3zm16.915 12.404h13.771v3.32h-18.518v-3.32c1.498-1.551 3.536-3.627 6.114-6.23 2.59-2.617 4.218-4.305 4.883-5.059 1.264-1.42 2.143-2.617 2.637-3.594 0.508-0.99 0.762-1.961 0.762-2.91 0-1.549-0.547-2.812-1.64-3.789-1.081-0.977-2.494-1.465-4.239-1.465-1.236 0-2.545 0.215-3.926 0.645-1.367 0.43-2.831 1.08-4.396 1.953v-3.984c1.589-0.639 3.073-1.119 4.453-1.445s2.645-0.488 3.789-0.488c3.021 0 5.43 0.756 7.227 2.268 1.797 1.51 2.695 3.527 2.695 6.055 0 1.195-0.227 2.336-0.684 3.418-0.441 1.066-1.256 2.33-2.441 3.789-0.325 0.377-1.36 1.471-3.104 3.279-1.746 1.796-4.206 4.315-7.383 7.557zm22.753 0h6.447v-22.246l-7.014 1.406v-3.594l6.975-1.406h3.943v25.84h6.445v3.32h-16.798l2e-3 -3.32zm49.472-12.404c1.889 0.404 3.358 1.244 4.414 2.521 1.067 1.275 1.604 2.852 1.604 4.727 0 2.877-0.99 5.105-2.971 6.68-1.979 1.576-4.791 2.363-8.438 2.363-1.223 0-2.485-0.123-3.788-0.371-1.289-0.232-2.623-0.592-4.005-1.074v-3.809c1.095 0.639 2.293 1.121 3.595 1.445 1.303 0.326 2.664 0.488 4.082 0.488 2.475 0 4.354-0.488 5.645-1.465 1.303-0.977 1.953-2.396 1.953-4.258 0-1.719-0.605-3.061-1.814-4.023-1.198-0.977-2.873-1.465-5.021-1.465h-3.396v-3.242h3.554c1.94 0 3.424-0.385 4.453-1.152 1.028-0.781 1.543-1.9 1.543-3.359 0-1.496-0.533-2.643-1.603-3.438-1.055-0.807-2.569-1.209-4.551-1.209-1.08 0-2.238 0.115-3.477 0.35-1.236 0.234-2.599 0.6-4.082 1.096v-3.518c1.497-0.416 2.897-0.729 4.2-0.938 1.314-0.209 2.552-0.312 3.709-0.312 2.996 0 5.365 0.686 7.109 2.053 1.746 1.354 2.617 3.189 2.617 5.508 0 1.613-0.461 2.98-1.387 4.102-0.923 1.103-2.238 1.872-3.945 2.3zm24.356-10l-9.959 15.568h9.959v-15.568zm-1.036-3.435h4.961v19.004h4.159v3.281h-4.159v6.875h-3.925v-6.875h-13.166v-3.811l12.132-18.477h-2e-3v3e-3zm15.706 0h15.486v3.32h-11.875v7.146c0.574-0.195 1.146-0.338 1.721-0.43 0.572-0.104 1.146-0.156 1.718-0.156 3.256 0 5.834 0.893 7.735 2.676 1.9 1.785 2.851 4.199 2.851 7.246 0 3.139-0.978 5.58-2.931 7.324-1.953 1.73-4.707 2.598-8.262 2.598-1.223 0-2.473-0.104-3.75-0.311-1.262-0.209-2.57-0.521-3.926-0.939v-3.965c1.172 0.639 2.383 1.113 3.633 1.426 1.25 0.314 2.572 0.469 3.967 0.469 2.252 0 4.035-0.592 5.351-1.775 1.315-1.186 1.973-2.793 1.973-4.824s-0.656-3.641-1.973-4.824c-1.314-1.186-3.099-1.777-5.351-1.777-1.055 0-2.108 0.117-3.164 0.352-1.043 0.234-2.11 0.6-3.203 1.094v-14.65zm25.466 0h15.489v3.32h-11.877v7.146c0.572-0.195 1.146-0.338 1.72-0.43 0.571-0.104 1.146-0.156 1.719-0.156 3.256 0 5.832 0.893 7.733 2.676 1.9 1.785 2.853 4.199 2.853 7.246 0 3.139-0.978 5.58-2.93 7.324-1.953 1.73-4.707 2.598-8.263 2.598-1.225 0-2.475-0.104-3.75-0.311-1.264-0.209-2.571-0.521-3.926-0.939v-3.965c1.172 0.639 2.383 1.113 3.633 1.426 1.25 0.314 2.572 0.469 3.965 0.469 2.252 0 4.037-0.592 5.353-1.775 1.313-1.186 1.973-2.793 1.973-4.824s-0.658-3.641-1.973-4.824c-1.316-1.186-3.101-1.777-5.353-1.777-1.055 0-2.108 0.117-3.164 0.352-1.043 0.234-2.108 0.6-3.202 1.094v-14.65z"- fill="#fff"- fill-opacity=".784"- />-</svg>\ No newline at end of filediff --git a/public/assets/images/card-visa.svg b/public/assets/images/card-visa.svgdeleted file mode 100644index 4fded8808..000000000--- a/public/assets/images/card-visa.svg+++ /dev/null@@ -1,21 +0,0 @@-<svg- xmlns="http://www.w3.org/2000/svg"- width="780"- height="500"- enable-background="new 0 0 780 500"- version="1.1"- viewBox="0 0 780 500"->- <path- d="M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40 C0,17.909,17.909,0,40,0z"- fill="#0E4595"- />- <path- d="m293.2 348.73l33.361-195.76h53.36l-33.385 195.76h-53.336zm246.11-191.54c-10.57-3.966-27.137-8.222-47.822-8.222-52.725 0-89.865 26.55-90.18 64.603-0.299 28.13 26.514 43.822 46.752 53.186 20.771 9.595 27.752 15.714 27.654 24.283-0.131 13.121-16.586 19.116-31.922 19.116-21.357 0-32.703-2.967-50.227-10.276l-6.876-3.11-7.489 43.823c12.463 5.464 35.51 10.198 59.438 10.443 56.09 0 92.5-26.246 92.916-66.882 0.199-22.269-14.016-39.216-44.801-53.188-18.65-9.055-30.072-15.099-29.951-24.268 0-8.137 9.668-16.839 30.557-16.839 17.449-0.27 30.09 3.535 39.938 7.5l4.781 2.26 7.232-42.429m137.31-4.223h-41.232c-12.773 0-22.332 3.487-27.941 16.234l-79.244 179.4h56.031s9.16-24.123 11.232-29.418c6.125 0 60.555 0.084 68.338 0.084 1.596 6.853 6.49 29.334 6.49 29.334h49.514l-43.188-195.64zm-65.418 126.41c4.412-11.279 21.26-54.723 21.26-54.723-0.316 0.522 4.379-11.334 7.074-18.684l3.605 16.879s10.219 46.729 12.354 56.528h-44.293zm-363.3-126.41l-52.24 133.5-5.567-27.13c-9.725-31.273-40.025-65.155-73.898-82.118l47.766 171.2 56.456-0.064 84.004-195.39h-56.521"- fill="#fff"- />- <path- d="m146.92 152.96h-86.041l-0.681 4.073c66.938 16.204 111.23 55.363 129.62 102.41l-18.71-89.96c-3.23-12.395-12.597-16.094-24.186-16.527"- fill="#F2AE14"- />-</svg>\ No newline at end of filediff --git a/public/components/common/CardInfo.scss b/public/components/common/CardInfo.scssdeleted file mode 100644index 4f3e35703..000000000--- a/public/components/common/CardInfo.scss+++ /dev/null@@ -1,18 +0,0 @@-@import "~@fider/assets/styles/variables.scss";--.c-card-info {- span,- img {- vertical-align: middle;- margin-right: 5px;- }- img {- max-width: 40px;- max-height: 40px;- }- .c-card-info-exp {- margin-left: 5px;- font-size: $font-size-small;- color: $gray-darker;- }-}diff --git a/public/components/common/CardInfo.tsx b/public/components/common/CardInfo.tsxdeleted file mode 100644index 60a9413c1..000000000--- a/public/components/common/CardInfo.tsx+++ /dev/null@@ -1,52 +0,0 @@-import React from "react";-import "./CardInfo.scss";-import { useFider } from "@fider/hooks";--const visa = require("@fider/assets/images/card-visa.svg");-const diners = require("@fider/assets/images/card-diners.svg");-const americanExpress = require("@fider/assets/images/card-americanexpress.svg");-const discover = require("@fider/assets/images/card-discover.svg");-const jcb = require("@fider/assets/images/card-jcb.svg");-const unknown = require("@fider/assets/images/card-unknown.svg");-const masterCard = require("@fider/assets/images/card-mastercard.svg");--interface CardBrandProps {- brand: string;- last4: string;- expMonth: number;- expYear: number;-}--export const CardInfo = (props: CardBrandProps) => {- const fider = useFider();-- return (- <p className="c-card-info">- <img src={`${fider.settings.globalAssetsURL}${brandImage(props.brand)}`} alt={props.brand} />- <span>- **** **** **** {props.last4}{" "}- <span className="c-card-info-exp">- Exp. {props.expMonth}/{props.expYear}- </span>- </span>- </p>- );-};--const brandImage = (brand: string) => {- switch (brand) {- case "Visa":- return visa;- case "American Express":- return americanExpress;- case "MasterCard":- return masterCard;- case "Discover":- return discover;- case "JCB":- return jcb;- case "Diners Club":- return diners;- }- return unknown;-};diff --git a/public/components/common/FiderVersion.tsx b/public/components/common/FiderVersion.tsxindex 1e6539093..6aa3c2d96 100644--- a/public/components/common/FiderVersion.tsx+++ b/public/components/common/FiderVersion.tsx@@ -6,15 +6,11 @@ export const FiderVersion = () => {return (<p className="info center hidden-sm hidden-md">- {!fider.isBillingEnabled() && (- <>- Support our{" "}- <a target="_blank" href="http://opencollective.com/fider">- OpenCollective- </a>- <br />- </>- )}+ Support our{" "}+ <a target="_blank" href="http://opencollective.com/fider">+ OpenCollective+ </a>+ <br />Fider v{fider.settings.version}</p>);diff --git a/public/components/common/Header.tsx b/public/components/common/Header.tsxindex 54f2fccd2..d7ce3e03b 100644--- a/public/components/common/Header.tsx+++ b/public/components/common/Header.tsx@@ -1,7 +1,7 @@import "./Header.scss";import React, { useState, useEffect } from "react";-import { SignInModal, EnvironmentInfo, Avatar, TenantLogo, TenantStatusInfo } from "@fider/components";+import { SignInModal, EnvironmentInfo, Avatar, TenantLogo } from "@fider/components";import { actions } from "@fider/services";import { FaUser, FaCog, FaCaretDown } from "react-icons/fa";import { useFider } from "@fider/hooks";@@ -79,7 +79,6 @@ export const Header = () => {)}</div></div>- <TenantStatusInfo /></div>);};diff --git a/public/components/common/TenantStatusInfo.tsx b/public/components/common/TenantStatusInfo.tsxdeleted file mode 100644index b68eb6450..000000000--- a/public/components/common/TenantStatusInfo.tsx+++ /dev/null@@ -1,20 +0,0 @@-import React from "react";-import { TenantStatus } from "@fider/models";-import { Message } from "./Message";-import { useFider } from "@fider/hooks";--export const TenantStatusInfo = () => {- const fider = useFider();-- if (!fider.isBillingEnabled() || fider.session.tenant.status !== TenantStatus.Locked) {- return null;- }-- return (- <div className="container">- <Message type="error">- This site is locked due to lack of a subscription. Visit the <a href="/admin/billing">Billing</a> settings to update it.- </Message>- </div>- );-};diff --git a/public/components/common/form/Form.scss b/public/components/common/form/Form.scssindex de8a73e39..488abf568 100644--- a/public/components/common/form/Form.scss+++ b/public/components/common/form/Form.scss@@ -48,8 +48,7 @@input[type="text"],textarea,- select,- .StripeElement {+ select {background-color: $white;-webkit-appearance: none;appearance: none;diff --git a/public/components/common/form/TextArea.tsx b/public/components/common/form/TextArea.tsxindex 43374509c..813a9c683 100644--- a/public/components/common/form/TextArea.tsx+++ b/public/components/common/form/TextArea.tsx@@ -42,7 +42,7 @@ export const TextArea: React.FunctionComponent<TextAreaProps> = (props) => {value={props.value}minRows={props.minRows || 3}placeholder={props.placeholder}- inputRef={props.inputRef}+ ref={props.inputRef}onFocus={props.onFocus}/></div>diff --git a/public/components/common/index.tsx b/public/components/common/index.tsxindex 0fc48dd6a..791467873 100644--- a/public/components/common/index.tsx+++ b/public/components/common/index.tsx@@ -1,5 +1,4 @@export * from "./Button";-export * from "./CardInfo";export * from "./form/Form";export * from "./form/Input";export * from "./form/ImageUploader";@@ -13,7 +12,6 @@ export * from "./form/Checkbox";export * from "./form/ImageViewer";export * from "./MultiLineText";export * from "./EnvironmentInfo";-export * from "./TenantStatusInfo";export * from "./Avatar";export * from "./Message";export * from "./Hint";diff --git a/public/models/billing.ts b/public/models/billing.tsdeleted file mode 100644index 12ec38f97..000000000--- a/public/models/billing.ts+++ /dev/null@@ -1,37 +0,0 @@-export interface PaymentInfo {- cardBrand: string;- cardLast4: string;- cardExpMonth: number;- cardExpYear: number;- addressCity: string;- addressCountry: string;- name: string;- email: string;- addressLine1: string;- addressLine2: string;- addressState: string;- addressPostalCode: string;- vatNumber: string;-}--export interface InvoiceDue {- currency: string;- amountDue: number;- dueDate: string;-}--export interface BillingPlan {- id: string;- name: string;- description: string;- currency: string;- maxUsers: number;- price: number;- interval: "month" | "year";-}--export interface Country {- code: string;- name: string;- isEU: boolean;-}diff --git a/public/models/identity.ts b/public/models/identity.tsindex 18c3e3bd9..530c3fa20 100644--- a/public/models/identity.ts+++ b/public/models/identity.ts@@ -8,11 +8,6 @@ export interface Tenant {status: TenantStatus;isPrivate: boolean;logoBlobKey: string;- billing?: {- stripePlanID: string;- subscriptionEndsAt: string;- trialEndsAt: string;- };}export enum TenantStatus {diff --git a/public/models/index.ts b/public/models/index.tsindex 317710ccb..be6347622 100644--- a/public/models/index.ts+++ b/public/models/index.ts@@ -1,5 +1,4 @@export * from "./post";export * from "./identity";-export * from "./billing";export * from "./settings";export * from "./notification";diff --git a/public/models/settings.ts b/public/models/settings.tsindex 7d38e87b3..d5e7478fd 100644--- a/public/models/settings.ts+++ b/public/models/settings.ts@@ -18,7 +18,6 @@ export interface SystemSettings {domain: string;hasLegal: boolean;baseURL: string;- stripePublicKey?: string;tenantAssetsURL: string;globalAssetsURL: string;oauth: OAuthProviderOption[];diff --git a/public/pages/Administration/components/BillingPlanPanel.tsx b/public/pages/Administration/components/BillingPlanPanel.tsxdeleted file mode 100644index 295b99bb3..000000000--- a/public/pages/Administration/components/BillingPlanPanel.tsx+++ /dev/null@@ -1,234 +0,0 @@-import React from "react";-import { Segment, Button, Moment, Modal, ButtonClickEvent } from "@fider/components";-import { BillingPlan, InvoiceDue } from "@fider/models";-import { Fider, actions, classSet, currencySymbol } from "@fider/services";-import { useFider } from "@fider/hooks";--interface BillingPlanOptionProps {- tenantUserCount: number;- disabled: boolean;- plan: BillingPlan;- currentPlan?: BillingPlan;- onSubscribe: (plan: BillingPlan) => Promise<void>;- onCancel: (plan: BillingPlan) => Promise<void>;-}--const BillingPlanOption = (props: BillingPlanOptionProps) => {- const fider = useFider();-- const billing = fider.session.tenant.billing!;- const isSelected = billing.stripePlanID === props.plan.id && !billing.subscriptionEndsAt;- const className = classSet({ "l-plan": true, selected: isSelected });-- return (- <div className="col-md-4">- <Segment className={className}>- <p className="l-title">{props.plan.name}</p>- <p className="l-description">{props.plan.description}</p>- <p>- <span className="l-currency">{currencySymbol(props.plan.currency)}</span>- <span className="l-price">{props.plan.price / 100}</span>- <span className="l-interval">/{props.plan.interval}</span>- </p>- {isSelected && (- <>- <p>- <Button disabled={props.disabled} color="danger" onClick={props.onCancel.bind(undefined, props.plan)}>- Cancel- </Button>- </p>- </>- )}- {!isSelected && (- <>- <p>- <Button disabled={props.disabled || (props.plan.maxUsers > 0 && props.tenantUserCount > props.plan.maxUsers)} onClick={props.onSubscribe.bind(undefined, props.plan)}>- Subscribe- </Button>- </p>- </>- )}- </Segment>- </div>- );-};--interface BillingPlanPanelProps {- invoiceDue?: InvoiceDue;- tenantUserCount: number;- disabled: boolean;- plans: BillingPlan[];-}--interface BillingPlanPanelState {- confirmPlan?: BillingPlan;- action?: "" | "subscribe" | "cancel";-}--export class BillingPlanPanel extends React.Component<BillingPlanPanelProps, BillingPlanPanelState> {- constructor(props: BillingPlanPanelProps) {- super(props);- this.state = {};- }-- private onSubscribe = async (plan: BillingPlan) => {- this.setState({- confirmPlan: plan,- action: "subscribe",- });- };-- private onCancel = async (plan: BillingPlan) => {- this.setState({- confirmPlan: plan,- action: "cancel",- });- };-- private confirm = async (e: ButtonClickEvent) => {- e.preventEnable();-- if (this.state.action && this.state.confirmPlan) {- const action = this.state.action === "subscribe" ? actions.billingSubscribe : actions.cancelBillingSubscription;- const result = await action(this.state.confirmPlan.id);- if (result.ok) {- location.reload();- }- }- };-- private closeModal = async () => {- this.setState({- action: "",- confirmPlan: undefined,- });- };-- private getCurrentPlan(): BillingPlan | undefined {- const filtered = this.props.plans.filter((x) => x.id === Fider.session.tenant.billing!.stripePlanID);- if (filtered.length > 0) {- return filtered[0];- }- }-- public render() {- const billing = Fider.session.tenant.billing!;- const currentPlan = this.getCurrentPlan();- const trialExpired = new Date(billing.trialEndsAt) <= new Date();-- return (- <>- <Modal.Window isOpen={!!this.state.action} center={false} onClose={this.closeModal}>- {this.state.action === "subscribe" && <Modal.Header>Subscribe</Modal.Header>}- {this.state.action === "cancel" && <Modal.Header>Cancel Subscription</Modal.Header>}- <Modal.Content>- {this.state.action === "subscribe" && (- <>- <p>- You'll be billed a total of{" "}- <strong>- {currencySymbol(this.state.confirmPlan!.currency)}- {this.state.confirmPlan!.price / 100} per {this.state.confirmPlan!.interval}- </strong>{" "}- on your card.- </p>- <ul>- <li>You can cancel it at any time.</li>- <li>You can upgrade/downgrade it at any time.</li>- </ul>- </>- )}- {this.state.action === "cancel" && (- <>- <p>You're about to cancel your subscription. Please review the following before continuing.</p>- <ul>- <li>Canceling the subscription will pause any further billing on your card.</li>- <li>You'll be able to use the service until the end of current period.</li>- <li>You can re-subscribe at any time.</li>- <li>No refunds will be given.</li>- </ul>- <strong>Are you sure?</strong>- </>- )}- </Modal.Content>- <Modal.Footer>- <Button color={this.state.action === "subscribe" ? "positive" : "danger"} size="tiny" onClick={this.confirm}>- {this.state.action === "subscribe" && "Confirm"}- {this.state.action === "cancel" && "Yes"}- </Button>- <Button color="cancel" size="tiny" onClick={this.closeModal}>- {this.state.action === "subscribe" && "Cancel"}- {this.state.action === "cancel" && "No"}- </Button>- </Modal.Footer>- </Modal.Window>-- <Segment className="l-billing-plans">- <h4>Plans</h4>- {currentPlan && (- <p className="info">- {billing.subscriptionEndsAt ? (- <>- Your <strong>{currentPlan.name}</strong> subscription ends at{" "}- <strong>- <Moment date={billing.subscriptionEndsAt} useRelative={false} />- </strong>- . Subscribe to a new plan and avoid a service interruption.- </>- ) : this.props.invoiceDue ? (- <>- Your upcoming invoice of{" "}- <strong>- {currencySymbol(this.props.invoiceDue.currency)}- {this.props.invoiceDue.amountDue / 100}- </strong>{" "}- is due on{" "}- <strong>- <Moment date={this.props.invoiceDue.dueDate} useRelative={false} />- </strong>- .- </>- ) : (- <></>- )}- </p>- )}- {!billing.stripePlanID && (- <p className="info">- You don't have any active subscription.- {!trialExpired && (- <>- Your trial period ends at{" "}- <strong>- <Moment date={billing.trialEndsAt} useRelative={false} />- </strong>- . Subscribe to a plan and avoid a service interruption.- </>- )}- </p>- )}- <div className="row">- {this.props.plans.map((x) => (- <BillingPlanOption- key={x.id}- plan={x}- tenantUserCount={this.props.tenantUserCount}- currentPlan={currentPlan}- disabled={this.props.disabled}- onSubscribe={this.onSubscribe}- onCancel={this.onCancel}- />- ))}- </div>- <div className="row">- <div className="col-md-12">- <p className="info">- You have <strong>{this.props.tenantUserCount}</strong> tracked users.- </p>- </div>- </div>- </Segment>- </>- );- }-}diff --git a/public/pages/Administration/components/PaymentInfoModal.tsx b/public/pages/Administration/components/PaymentInfoModal.tsxdeleted file mode 100644index da009643a..000000000--- a/public/pages/Administration/components/PaymentInfoModal.tsx+++ /dev/null@@ -1,255 +0,0 @@-import React from "react";-import { injectStripe, CardElement, ReactStripeElements } from "react-stripe-elements";-import { Input, Field, Button, Form, Select, SelectOption, Modal, CardInfo } from "@fider/components";-import { Failure, actions } from "@fider/services";-import { PaymentInfo, Country } from "@fider/models";--interface PaymentInfoModalProps extends ReactStripeElements.InjectedStripeProps {- paymentInfo?: PaymentInfo;- countries: Country[];- onClose: () => void;-}--interface PaymentInfoModalState {- changingCard: boolean;- name: string;- email: string;- addressLine1: string;- addressLine2: string;- addressCity: string;- addressState: string;- addressPostalCode: string;- addressCountry: string;- vatNumber: string;- stripe: stripe.Stripe | null;- error?: Failure;-}--class PaymentInfoModal extends React.Component<PaymentInfoModalProps, PaymentInfoModalState> {- constructor(props: PaymentInfoModalProps) {- super(props);- this.state = {- stripe: null,- changingCard: false,- name: this.props.paymentInfo ? this.props.paymentInfo.name : "",- email: this.props.paymentInfo ? this.props.paymentInfo.email : "",- addressLine1: this.props.paymentInfo ? this.props.paymentInfo.addressLine1 : "",- addressLine2: this.props.paymentInfo ? this.props.paymentInfo.addressLine2 : "",- addressCity: this.props.paymentInfo ? this.props.paymentInfo.addressCity : "",- addressState: this.props.paymentInfo ? this.props.paymentInfo.addressState : "",- addressPostalCode: this.props.paymentInfo ? this.props.paymentInfo.addressPostalCode : "",- addressCountry: this.props.paymentInfo ? this.props.paymentInfo.addressCountry : "",- vatNumber: this.props.paymentInfo ? this.props.paymentInfo.vatNumber : "",- };- }-- public handleSubmit = async () => {- if (this.props.paymentInfo && !this.state.changingCard) {- const response = await actions.updatePaymentInfo({- ...this.state,- });-- if (response.ok) {- location.reload();- } else {- this.setState({- error: response.error,- });- }-- return;- }-- if (this.props.stripe) {- const result = await this.props.stripe.createToken({- name: this.state.name,- address_line1: this.state.addressLine1,- address_line2: this.state.addressLine2,- address_city: this.state.addressCity,- address_state: this.state.addressState,- address_zip: this.state.addressPostalCode,- address_country: this.state.addressCountry,- });-- if (result.token) {- const response = await actions.updatePaymentInfo({- ...this.state,- card: {- type: result.token.type,- token: result.token.id,- country: result.token.card ? result.token.card.country : "",- },- });-- if (response.ok) {- location.reload();- } else {- this.setState({- error: response.error,- });- }- } else if (result.error) {- this.setState({- error: {- errors: [- {- field: "card",- message: result.error.message!,- },- ],- },- });- }- }- };-- private setName = (name: string) => {- this.setState({ name });- };-- private setEmail = (email: string) => {- this.setState({ email });- };-- private setAddressLine1 = (addressLine1: string) => {- this.setState({ addressLine1 });- };-- private setAddressLine2 = (addressLine2: string) => {- this.setState({ addressLine2 });- };-- private setAddressCity = (addressCity: string) => {- this.setState({ addressCity });- };-- private setAddressState = (addressState: string) => {- this.setState({ addressState });- };-- private setAddressPostalCode = (addressPostalCode: string) => {- this.setState({ addressPostalCode });- };-- private setVATNumber = (vatNumber: string) => {- this.setState({ vatNumber });- };-- private setAddressCountry = (option: SelectOption | undefined) => {- if (option) {- this.setState({ addressCountry: option.value });- }- };-- private closeModal = async () => {- this.props.onClose();- };-- private changeCard = () => {- this.setState({ changingCard: true });- };-- private isEUCountry(): boolean {- if (this.state.addressCountry) {- const filtered = this.props.countries.filter((x) => x.code === this.state.addressCountry);- if (filtered && filtered.length > 0) {- return filtered[0].isEU;- }- }- return false;- }-- public render() {- return (- <Modal.Window isOpen={true} center={false} size="large" onClose={this.closeModal}>- <Modal.Content>- <Form className="c-payment-info-modal" error={this.state.error}>- <div className="row">- {(!this.props.paymentInfo || this.state.changingCard) && (- <div className="col-md-12">- <Field label="Credit/Debit Card" field="card">- <CardElement />- <p className="info">We neither store nor see your card information. We integrate directly with Stripe.</p>- </Field>- </div>- )}- {this.props.paymentInfo && !this.state.changingCard && (- <div className="col-md-12">- <Field- label="Credit/Debit Card"- field="card"- afterLabel={- <span className="ui info clickable" onClick={this.changeCard}>- change- </span>- }- >- <CardInfo- expMonth={this.props.paymentInfo.cardExpMonth}- expYear={this.props.paymentInfo.cardExpYear}- brand={this.props.paymentInfo.cardBrand}- last4={this.props.paymentInfo.cardLast4}- />- </Field>- </div>- )}- <div className="col-md-12">- <Input label="Name" field="name" value={this.state.name} onChange={this.setName} autoComplete="name" />- </div>- <div className="col-md-12">- <Input label="Email" field="email" value={this.state.email} onChange={this.setEmail} autoComplete="email" />- </div>- <div className="col-md-6">- <Input label="Address Line 1" value={this.state.addressLine1} field="addressLine1" onChange={this.setAddressLine1} autoComplete="address-line1" />- </div>- <div className="col-md-6">- <Input label="Address Line 2" value={this.state.addressLine2} field="addressLine2" onChange={this.setAddressLine2} autoComplete="address-line2" />- </div>- <div className="col-md-4">- <Input label="City" field="addressCity" value={this.state.addressCity} onChange={this.setAddressCity} autoComplete="address-level2" />- </div>- <div className="col-md-4">- <Input label="State / Region" field="addressState" value={this.state.addressState} onChange={this.setAddressState} autoComplete="address-level1" />- </div>- <div className="col-md-4">- <Input label="Postal Code" field="addressPostalCode" value={this.state.addressPostalCode} onChange={this.setAddressPostalCode} autoComplete="postal-code" />- </div>- <div className="col-md-6">- <Select- label="Country"- field="addressCountry"- onChange={this.setAddressCountry}- defaultValue={this.state.addressCountry}- options={[{ value: "", label: "" }, ...this.props.countries.map((x) => ({ value: x.code, label: x.name }))]}- />- </div>- {this.isEUCountry() && (- <div className="col-md-6">- <Input label="VAT Number" field="vatNumber" value={this.state.vatNumber} onChange={this.setVATNumber} />- </div>- )}- {!!this.state.addressCountry && (- <div className="col-md-12">- <Field field="currency">- <p className="info">Based on your Billing Address, your subscription will be charged in {this.isEUCountry() ? "Euro (EUR)" : "US Dollar (USD)"}.</p>- </Field>- </div>- )}- </div>- </Form>- </Modal.Content>-- <Modal.Footer>- <Button onClick={this.handleSubmit} color="positive">- Save- </Button>- <Button color="cancel" onClick={this.closeModal}>- Close- </Button>- </Modal.Footer>- </Modal.Window>- );- }-}--export default injectStripe(PaymentInfoModal);diff --git a/public/pages/Administration/components/SideMenu.tsx b/public/pages/Administration/components/SideMenu.tsxindex bbc390eb9..e87c33076 100644--- a/public/pages/Administration/components/SideMenu.tsx+++ b/public/pages/Administration/components/SideMenu.tsx@@ -56,7 +56,6 @@ export const SideMenu = (props: SiteMenuProps) => {<SideMenuItem name="advanced" title="Advanced" href="/admin/advanced" isActive={activeItem === "advanced"} />{fider.session.user.isAdministrator && (<>- {fider.isBillingEnabled() && !!fider.session.tenant.billing && <SideMenuItem name="billing" title="Billing" href="/admin/billing" isActive={activeItem === "billing"} />}<SideMenuItem name="export" title="Export" href="/admin/export" isActive={activeItem === "export"} /></>)}diff --git a/public/pages/Administration/pages/Billing.page.scss b/public/pages/Administration/pages/Billing.page.scssdeleted file mode 100644index a40393de3..000000000--- a/public/pages/Administration/pages/Billing.page.scss+++ /dev/null@@ -1,37 +0,0 @@-@import "~@fider/assets/styles/variables.scss";--#p-admin-billing {- .l-plan {- padding: 10px;- border: 1px solid transparent;-- &.selected {- border: 1px solid $main-color;- }-- .l-title {- color: $main-color;- font-size: $font-size-large;- font-weight: 600;- }-- .l-description {- min-height: 40px;- }-- span.l-currency {- color: $gray-darker;- font-size: $font-size-small;- vertical-align: top;- }-- span.l-price {- font-size: $font-size-big;- }-- span.l-interval {- color: $gray-darker;- font-size: $font-size-small;- }- }-}diff --git a/public/pages/Administration/pages/Billing.page.tsx b/public/pages/Administration/pages/Billing.page.tsxdeleted file mode 100644index ebf7ef50e..000000000--- a/public/pages/Administration/pages/Billing.page.tsx+++ /dev/null@@ -1,124 +0,0 @@-import "./Billing.page.scss";--import React from "react";--import { FaFileInvoice } from "react-icons/fa";-import { AdminBasePage } from "../components/AdminBasePage";-import { Segment, Button, CardInfo, Message } from "@fider/components";-import { PaymentInfo, BillingPlan, Country, InvoiceDue } from "@fider/models";-import { Fider, actions, navigator } from "@fider/services";-import PaymentInfoModal from "../components/PaymentInfoModal";-import { StripeProvider, Elements } from "react-stripe-elements";-import { BillingPlanPanel } from "../components/BillingPlanPanel";--interface BillingPageProps {- invoiceDue?: InvoiceDue;- plans?: BillingPlan[];- tenantUserCount: number;- paymentInfo?: PaymentInfo;- countries: Country[];-}--interface BillingPageState {- plans?: BillingPlan[];- stripe: stripe.Stripe | null;- showModal: boolean;-}--export default class BillingPage extends AdminBasePage<BillingPageProps, BillingPageState> {- public id = "p-admin-billing";- public name = "billing";- public icon = FaFileInvoice;- public title = "Billing";- public subtitle = "Manage your subscription";-- constructor(props: BillingPageProps) {- super(props);- this.state = {- stripe: null,- showModal: false,- plans: this.props.plans,- };- }-- private openModal = async () => {- if (!this.state.stripe) {- const script = document.createElement("script");- script.src = "https://js.stripe.com/v3/";- script.onload = () => {- this.setState({- stripe: Stripe(Fider.settings.stripePublicKey!),- showModal: true,- });- };- document.body.appendChild(script);- } else {- this.setState({- showModal: true,- });- }- };-- private closeModal = async () => {- this.setState({- showModal: false,- });- };-- public componentDidMount() {- if (!this.props.paymentInfo) {- navigator.getCountryCode().then(this.fetchPlans);- }- }-- private fetchPlans = (countryCode: string) => {- actions.listBillingPlans(countryCode).then((res) => {- if (res.ok) {- this.setState({ plans: res.data });- }- });- };-- public content() {- return (- <>- {this.state.showModal && (- <StripeProvider stripe={this.state.stripe}>- <Elements>- <PaymentInfoModal stripe={null} elements={null} paymentInfo={this.props.paymentInfo} countries={this.props.countries} onClose={this.closeModal} />- </Elements>- </StripeProvider>- )}- <div className="row">- <div className="col-md-12">- <Segment className="l-payment-info">- <h4>Payment Info</h4>- {this.props.paymentInfo && (- <>- <CardInfo- expMonth={this.props.paymentInfo.cardExpMonth}- expYear={this.props.paymentInfo.cardExpYear}- brand={this.props.paymentInfo.cardBrand}- last4={this.props.paymentInfo.cardLast4}- />- <Button onClick={this.openModal}>Edit</Button>- </>- )}- {!this.props.paymentInfo && (- <>- <Message type="warning">You don't have any payment method set up. Start by adding one.</Message>- <Button onClick={this.openModal}>Add</Button>- </>- )}- </Segment>- </div>- {this.state.plans && (- <div className="col-md-12">- <BillingPlanPanel invoiceDue={this.props.invoiceDue} tenantUserCount={this.props.tenantUserCount} disabled={!this.props.paymentInfo} plans={this.state.plans} />- </div>- )}- </div>- </>- );- }-}diff --git a/public/pages/Administration/pages/ManageMembers.page.tsx b/public/pages/Administration/pages/ManageMembers.page.tsxindex 5ec27c3f7..be3c837a7 100644--- a/public/pages/Administration/pages/ManageMembers.page.tsx+++ b/public/pages/Administration/pages/ManageMembers.page.tsx@@ -185,7 +185,7 @@ export default class ManageMembersPage extends AdminBasePage<ManageMembersPagePr</p><ul className="l-legend info"><li>- <strong>· Administrators</strong>have full access to edit and manage content, permissions and all site settings{Fider.isBillingEnabled() ? ", including billing." : "."}+ <strong>· Administrators</strong>have full access to edit and manage content, permissions and all site settings.</li><li><strong>· Collaborators</strong> can edit and manage content, but not permissions and settings.diff --git a/public/router.tsx b/public/router.tsxindex 19c32bee4..8ed4bf1f5 100644--- a/public/router.tsx+++ b/public/router.tsx@@ -19,7 +19,6 @@ const pathRegex = [route("/admin/members", Pages.AsyncManageMembersPage),route("/admin/tags", Pages.AsyncManageTagsPage),route("/admin/privacy", Pages.AsyncPrivacySettingsPage),- route("/admin/billing", Pages.AsyncBillingPage),route("/admin/export", Pages.AsyncExportPage),route("/admin/invitations", Pages.AsyncInvitationsPage),route("/admin/authentication", Pages.AsyncManageAuthenticationPage),diff --git a/public/services/actions/billing.ts b/public/services/actions/billing.tsdeleted file mode 100644index b2f44b3c8..000000000--- a/public/services/actions/billing.ts+++ /dev/null@@ -1,34 +0,0 @@-import { http, Result } from "@fider/services";-import { BillingPlan } from "@fider/models";--interface UpdatePaymentInfoRequest {- name: string;- card?: {- type: string;- token: string;- country: string;- };- addressLine1: string;- addressLine2: string;- addressCity: string;- addressState: string;- addressPostalCode: string;- addressCountry: string;- vatNumber: string;-}--export const listBillingPlans = async (countryCode: string): Promise<Result<BillingPlan[]>> => {- return http.get(`/_api/admin/billing/plans/${countryCode}`);-};--export const updatePaymentInfo = async (request: UpdatePaymentInfoRequest): Promise<Result> => {- return http.post("/_api/admin/billing/paymentinfo", request).then(http.event("billing", "updatepaymentinfo"));-};--export const billingSubscribe = async (planID: string): Promise<Result> => {- return http.post(`/_api/admin/billing/subscription/${planID}`).then(http.event("billing", "billingsubscribe"));-};--export const cancelBillingSubscription = async (planID: string): Promise<Result> => {- return http.delete(`/_api/admin/billing/subscription/${planID}`).then(http.event("billing", "cancelbillingsubscription"));-};diff --git a/public/services/actions/index.ts b/public/services/actions/index.tsindex 89511ab7d..ade45197f 100644--- a/public/services/actions/index.ts+++ b/public/services/actions/index.ts@@ -2,7 +2,6 @@ export * from "./user";export * from "./tag";export * from "./post";export * from "./tenant";-export * from "./billing";export * from "./notification";export * from "./invite";export * from "./infra";diff --git a/public/services/fider.ts b/public/services/fider.tsindex eea4c8c11..3d53f4b39 100644--- a/public/services/fider.ts+++ b/public/services/fider.ts@@ -55,10 +55,6 @@ export class FiderImpl {return this.pSettings;}- public isBillingEnabled(): boolean {- return !!this.pSettings.stripePublicKey;- }-public isProduction(): boolean {return this.pSettings.environment === "production";}diff --git a/public/services/http.ts b/public/services/http.tsindex 896d8a2fc..6d21fe601 100644--- a/public/services/http.ts+++ b/public/services/http.ts@@ -29,8 +29,6 @@ async function toResult<T>(response: Response): Promise<Result<T>> {notify.error("An unexpected error occurred while processing your request.");} else if (response.status === 403) {notify.error("You are not authorized to perform this operation.");- } else if (response.status === 423) {- notify.error("This operation is not allowed. Update your billing settings to unlock it.");}return {diff --git a/public/services/navigator.ts b/public/services/navigator.tsindex ed07d48a6..1981aaf51 100644--- a/public/services/navigator.ts+++ b/public/services/navigator.ts@@ -1,5 +1,4 @@-import { Fider, http } from "@fider/services";-import { cache } from "./cache";+import { Fider } from "@fider/services";const navigator = {url: () => {@@ -20,19 +19,6 @@ const navigator = {window.history.replaceState({ path: newURL }, "", newURL);}},- getCountryCode: (): Promise<string> => {- const countryCode = cache.session.get("geolocation_countrycode");- if (countryCode) {- return Promise.resolve(countryCode);- }-- return http.get<any>("https://ipinfo.io/geo").then((res) => {- if (res.ok) {- cache.session.set("geolocation_countrycode", res.data.country);- return res.data.country;- }- });- },};export default navigator;