diff --git a/satellite/payments/stripecoinpayments/accounts_test.go b/satellite/payments/stripecoinpayments/accounts_test.go index 8e2dd30df..604ee05db 100644 --- a/satellite/payments/stripecoinpayments/accounts_test.go +++ b/satellite/payments/stripecoinpayments/accounts_test.go @@ -27,7 +27,6 @@ import ( ) func TestSignupCouponCodes(t *testing.T) { - testplanet.Run(t, testplanet.Config{SatelliteCount: 1}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) { sat := planet.Satellites[0] db := sat.DB diff --git a/satellite/payments/stripecoinpayments/coupons.go b/satellite/payments/stripecoinpayments/coupons.go index 890827f45..44b90b514 100644 --- a/satellite/payments/stripecoinpayments/coupons.go +++ b/satellite/payments/stripecoinpayments/coupons.go @@ -62,7 +62,6 @@ func (coupons *coupons) GetByUserID(ctx context.Context, userID uuid.UUID) (_ *p defer mon.Task()(&ctx, userID)(&err) customerID, err := coupons.service.db.Customers().GetCustomerID(ctx, userID) - if err != nil { return nil, Error.Wrap(err) } diff --git a/satellite/payments/stripecoinpayments/customers_test.go b/satellite/payments/stripecoinpayments/customers_test.go index dcc13e254..14b3492d7 100644 --- a/satellite/payments/stripecoinpayments/customers_test.go +++ b/satellite/payments/stripecoinpayments/customers_test.go @@ -97,7 +97,6 @@ func TestCustomersRepositoryList(t *testing.T) { for i, cus := range page.Customers { assert.Equal(t, "customerID"+strconv.Itoa(2-i), cus.ID) - } }) } diff --git a/satellite/payments/stripecoinpayments/service.go b/satellite/payments/stripecoinpayments/service.go index 88467e392..b462c1526 100644 --- a/satellite/payments/stripecoinpayments/service.go +++ b/satellite/payments/stripecoinpayments/service.go @@ -81,7 +81,6 @@ type Service struct { // NewService creates a Service instance. func NewService(log *zap.Logger, stripeClient StripeClient, config Config, db DB, projectsDB console.Projects, usageDB accounting.ProjectAccounting, storageTBPrice, egressTBPrice, segmentPrice string, bonusRate int64) (*Service, error) { - coinPaymentsClient := coinpayments.NewClient( coinpayments.Credentials{ PublicKey: config.CoinpaymentsPublicKey, diff --git a/satellite/payments/stripecoinpayments/service_test.go b/satellite/payments/stripecoinpayments/service_test.go index 521f2b920..b45ae5514 100644 --- a/satellite/payments/stripecoinpayments/service_test.go +++ b/satellite/payments/stripecoinpayments/service_test.go @@ -251,7 +251,7 @@ func TestService_InvoiceItemsFromProjectRecord(t *testing.T) { SegmentsQuantity int64 } - var testCases = []TestCase{ + testCases := []TestCase{ {}, // all zeros { Storage: 10000000000, // Byte-Hours diff --git a/satellite/payments/stripecoinpayments/stripemock.go b/satellite/payments/stripecoinpayments/stripemock.go index 7c7e07104..d5a7e21cf 100644 --- a/satellite/payments/stripecoinpayments/stripemock.go +++ b/satellite/payments/stripecoinpayments/stripemock.go @@ -259,7 +259,6 @@ func (m *mockCustomers) New(params *stripe.CustomerParams) (*stripe.Customer, er func (m *mockCustomers) Get(id string, params *stripe.CustomerParams) (*stripe.Customer, error) { if err := m.repopulate(); err != nil { - return nil, err } @@ -331,6 +330,9 @@ func (c *listContainer) GetListMeta() *stripe.ListMeta { } func (m *mockPaymentMethods) List(listParams *stripe.PaymentMethodListParams) *paymentmethod.Iter { + mocks.Lock() + defer mocks.Unlock() + listMeta := &stripe.ListMeta{ HasMore: false, TotalCount: uint32(len(m.attached)), @@ -338,9 +340,6 @@ func (m *mockPaymentMethods) List(listParams *stripe.PaymentMethodListParams) *p lc := newListContainer(listMeta) query := stripe.Query(func(*stripe.Params, *form.Values) ([]interface{}, stripe.ListContainer, error) { - mocks.Lock() - defer mocks.Unlock() - list, ok := m.attached[*listParams.Customer] if !ok { list = []*stripe.PaymentMethod{} @@ -357,7 +356,6 @@ func (m *mockPaymentMethods) List(listParams *stripe.PaymentMethodListParams) *p } func (m *mockPaymentMethods) New(params *stripe.PaymentMethodParams) (*stripe.PaymentMethod, error) { - randID := testrand.BucketName() newMethod := &stripe.PaymentMethod{ ID: fmt.Sprintf("pm_card_%s", randID), @@ -380,11 +378,10 @@ func (m *mockPaymentMethods) New(params *stripe.PaymentMethodParams) (*stripe.Pa } func (m *mockPaymentMethods) Attach(id string, params *stripe.PaymentMethodAttachParams) (*stripe.PaymentMethod, error) { - var method *stripe.PaymentMethod - mocks.Lock() defer mocks.Unlock() + var method *stripe.PaymentMethod for _, candidate := range m.unattached { if candidate.ID == id { method = candidate @@ -399,11 +396,10 @@ func (m *mockPaymentMethods) Attach(id string, params *stripe.PaymentMethodAttac } func (m *mockPaymentMethods) Detach(id string, params *stripe.PaymentMethodDetachParams) (*stripe.PaymentMethod, error) { - var unattached *stripe.PaymentMethod - mocks.Lock() defer mocks.Unlock() + var unattached *stripe.PaymentMethod for user, userMethods := range m.attached { var remaining []*stripe.PaymentMethod for _, method := range userMethods { diff --git a/satellite/payments/stripecoinpayments/transactions.go b/satellite/payments/stripecoinpayments/transactions.go index 06332c6fa..83b3656c7 100644 --- a/satellite/payments/stripecoinpayments/transactions.go +++ b/satellite/payments/stripecoinpayments/transactions.go @@ -71,7 +71,7 @@ type TransactionsPage struct { // IDList returns transaction id list of page's transactions. func (page *TransactionsPage) IDList() TransactionAndUserList { - var ids = make(TransactionAndUserList) + ids := make(TransactionAndUserList) for _, tx := range page.Transactions { ids[tx.ID] = tx.AccountID }