storage

package
v0.0.0-...-456c6e9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountDetails

type AccountDetails struct {
	Name     string `dynamodbav:"name"`
	IBAN     string `dynamodbav:"iban"`
	BIC      string `dynamodbav:"bic"`
	Currency string `dynamodbav:"currency"`
}

type CardDetails

type CardDetails struct {
	Name           string `dynamodbav:"name"`
	Number         string `dynamodbav:"number"`
	SecurityCode   int    `dynamodbav:"securityCode"`
	ExpirationDate string `dynamodbav:"expirationDate"`
}

CardDetails NOTE: duplicating this model as it can differ from the business model in the future

type DBRepository

type DBRepository interface {
	GetMerchantDetails(merchantID string) (entities.Merchant, error)
	CreateNewPayment(payment entities.Payment) error
	UpdatePayment(payment entities.Payment) error
	GetPayment(merchantID, paymentID string) (entities.Payment, error)
}

type DynamoDBClient

type DynamoDBClient interface {
	PutItem(
		ctx context.Context,
		params *dynamodb.PutItemInput,
		optFns ...func(*dynamodb.Options),
	) (*dynamodb.PutItemOutput, error)
	UpdateItem(
		ctx context.Context,
		params *dynamodb.UpdateItemInput,
		optFns ...func(*dynamodb.Options),
	) (*dynamodb.UpdateItemOutput, error)
	GetItem(
		ctx context.Context,
		params *dynamodb.GetItemInput,
		optFns ...func(*dynamodb.Options),
	) (*dynamodb.GetItemOutput, error)
}

type DynamoDBRepository

type DynamoDBRepository struct {
	// contains filtered or unexported fields
}

func NewDynamoDBRepository

func NewDynamoDBRepository(
	tableName string,
	config aws.Config,
	logger *slog.Logger,
) *DynamoDBRepository

func (*DynamoDBRepository) CreateNewPayment

func (r *DynamoDBRepository) CreateNewPayment(payment entities.Payment) error

func (*DynamoDBRepository) GetMerchantDetails

func (r *DynamoDBRepository) GetMerchantDetails(merchantID string) (entities.Merchant, error)

func (*DynamoDBRepository) GetPayment

func (r *DynamoDBRepository) GetPayment(merchantID, paymentID string) (entities.Payment, error)

func (*DynamoDBRepository) UpdatePayment

func (r *DynamoDBRepository) UpdatePayment(payment entities.Payment) error

type MemoryRepository

type MemoryRepository struct {
	// contains filtered or unexported fields
}

func NewMemoryRepository

func NewMemoryRepository() *MemoryRepository

func (*MemoryRepository) CreateNewPayment

func (r *MemoryRepository) CreateNewPayment(payment entities.Payment) error

func (*MemoryRepository) GetMerchantDetails

func (r *MemoryRepository) GetMerchantDetails(merchantID string) (entities.Merchant, error)

func (*MemoryRepository) GetPayment

func (r *MemoryRepository) GetPayment(_, paymentID string) (entities.Payment, error)

func (*MemoryRepository) UpdatePayment

func (r *MemoryRepository) UpdatePayment(payment entities.Payment) error

type MerchantItem

type MerchantItem struct {
	PK             string `dynamodbav:"PK"` // merchantID
	SK             string `dynamodbav:"SK"` // MERCHANT
	AccountDetails AccountDetails
}

type PaymentsItem

type PaymentsItem struct {
	PK              string `dynamodbav:"PK"` // merchantID
	SK              string `dynamodbav:"SK"` // PAYMENTS#paymentID
	DATA            string `dynamodbav:"DATA"`
	CustomerID      string `dynamodbav:"CustomerID"`
	CardDetails     CardDetails
	Timestamp       int64 `dynamodbav:"Timestamp"`
	Refunded        bool  `dynamodbav:"Refunded"`
	RefundTimestamp int64 `dynamodbav:"RefundTimestamp"`
}

func NewPaymentsItemFromPayment

func NewPaymentsItemFromPayment(payment entities.Payment) PaymentsItem

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL