storj/satellite/payments/creditcards.go
stefanbenten 086a3d5348 satellite/{payments,admin}: add deletion of user creditcards on account deletion
Change-Id: I38bf7e3995846150268f7b88a70f75b0ac871b62
2020-08-27 10:18:19 +00:00

43 lines
1.4 KiB
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package payments
import (
"context"
"storj.io/common/uuid"
)
// CreditCards exposes all needed functionality to manage account credit cards.
//
// architecture: Service
type CreditCards interface {
// List returns a list of credit cards for a given payment account.
List(ctx context.Context, userID uuid.UUID) ([]CreditCard, error)
// Add is used to save new credit card and attach it to payment account.
Add(ctx context.Context, userID uuid.UUID, cardToken string) error
// Remove is used to detach a credit card from payment account.
Remove(ctx context.Context, userID uuid.UUID, cardID string) error
// RemoveAll is used to detach all credit cards from payment account.
// It should only be used in case of a user deletion.
RemoveAll(ctx context.Context, userID uuid.UUID) error
// MakeDefault makes a credit card default payment method.
// this credit card should be attached to account before make it default.
MakeDefault(ctx context.Context, userID uuid.UUID, cardID string) error
}
// CreditCard holds all public information about credit card.
type CreditCard struct {
ID string `json:"id"`
ExpMonth int `json:"expMonth"`
ExpYear int `json:"expYear"`
Brand string `json:"brand"`
Last4 string `json:"last4"`
IsDefault bool `json:"isDefault"`
}