-
Notifications
You must be signed in to change notification settings - Fork 402
/
creditcards.go
38 lines (30 loc) · 1.17 KB
/
creditcards.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// 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
// 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"`
}