customer

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	Id               string                 `json:"id"`
	CustomerId       string                 `json:"customer_id"`
	ThirdPartyCardId string                 `json:"third_party_card_id,omitempty"`
	BillingAddress   map[string]interface{} `json:"billing_address"`
	CardBrand        string                 `json:"card_brand"`
	ExpMonth         int64                  `json:"exp_month"`
	ExpYear          int64                  `json:"exp_year"`
	Last4            string                 `json:"last_4"`
	IsDefault        bool                   `json:"is_default"`
	CreatedAt        time.Time              `json:"created_at"`
	UpdatedAt        time.Time              `json:"updated_at"`
}

type CardThirdParty

type CardThirdParty struct {
	CardId           string    `json:"card_id"`
	ThirdPartyCardId string    `json:"third_party_card_id"`
	CustomerId       string    `json:"customer_id"`
	ThirdPartyName   string    `json:"third_party_name"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

type Customer

type Customer struct {
	Id          string    `json:"id"`
	MerchantId  string    `json:"merchant_id"`
	Mobile      string    `json:"mobile"`
	Email       string    `json:"email"`
	FirstName   string    `json:"first_name"`
	LastName    string    `json:"last_name"`
	DisplayName string    `json:"display_name"`
	Gender      string    `json:"gender"`
	Avatar      string    `json:"avatar"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

type CustomerThirdParty

type CustomerThirdParty struct {
	CustomerId           string    `json:"customer_id"`
	ThirdPartyName       string    `json:"third_party_name"`
	ThirdPartyCustomerId string    `json:"third_party_customer_id"`
	CreatedAt            time.Time `json:"created_at"`
	UpdatedAt            time.Time `json:"updated_at"`
}

type Repository

type Repository struct {
	*dbc.Psql
}

Repository is the data access object for simple

func (*Repository) CreateCustomer

func (r *Repository) CreateCustomer(ctx context.Context, item *Customer) (*Customer, error)

func (*Repository) CreateCustomerCard

func (r *Repository) CreateCustomerCard(ctx context.Context, item *Card) (*Card, error)

func (*Repository) CreateCustomerThirdParty

func (r *Repository) CreateCustomerThirdParty(ctx context.Context, item *CustomerThirdParty) (*CustomerThirdParty, error)

func (*Repository) DeleteCustomer

func (r *Repository) DeleteCustomer(ctx context.Context, Id string) error

func (*Repository) DeleteCustomerCard

func (r *Repository) DeleteCustomerCard(ctx context.Context, id string) error

func (*Repository) DeleteCustomerThirdParty

func (r *Repository) DeleteCustomerThirdParty(ctx context.Context, customerId string) error

func (*Repository) GetCustomer

func (r *Repository) GetCustomer(ctx context.Context, Id string) (*Customer, error)

func (*Repository) GetCustomerCard

func (r *Repository) GetCustomerCard(ctx context.Context, cardId string) (*Card, error)

func (*Repository) GetCustomerCardList

func (r *Repository) GetCustomerCardList(ctx context.Context, customerId string) ([]*Card, error)

func (*Repository) GetCustomerList

func (r *Repository) GetCustomerList(ctx context.Context, merchantId string) ([]*Customer, error)

func (*Repository) GetCustomerThirdParty

func (r *Repository) GetCustomerThirdParty(ctx context.Context, customerId string) (*CustomerThirdParty, error)

func (*Repository) UpdateCustomer

func (r *Repository) UpdateCustomer(ctx context.Context, item *Customer) (*Customer, error)

func (*Repository) UpdateCustomerCard

func (r *Repository) UpdateCustomerCard(ctx context.Context, item *Card) (*Card, error)

func (*Repository) UpdateCustomerThirdParty

func (r *Repository) UpdateCustomerThirdParty(ctx context.Context, item *CustomerThirdParty) (*CustomerThirdParty, error)

type Service

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

Service is the simple service

func New

func New() *Service

New creates a new simple service

func (*Service) CreateCustomer

func (s *Service) CreateCustomer(ctx context.Context, item *Customer) (*Customer, error)

CreateCustomer creates a new customer

func (*Service) CreateCustomerCard

func (s *Service) CreateCustomerCard(ctx context.Context, customerId string, thirdPartyCardId string, postalCode string, locationId string, merchantId string) (*Card, error)

CreateCustomerCard create a customer card

func (*Service) DeleteCustomer

func (s *Service) DeleteCustomer(ctx context.Context, id string) error

DeleteCustomer delete a customer by MerchantID and Id

func (*Service) DeleteCustomerCard

func (s *Service) DeleteCustomerCard(ctx context.Context, id string) error

DeleteCustomerCard delete a customer card by id

func (*Service) GetCustomer

func (s *Service) GetCustomer(ctx context.Context, id string) (*Customer, error)

GetCustomer finds a customer by MerchantID and Id

func (*Service) GetCustomerCard

func (s *Service) GetCustomerCard(ctx context.Context, id string) (*Card, error)

GetCustomerCard get a customer card by id

func (*Service) GetCustomerCardList

func (s *Service) GetCustomerCardList(ctx context.Context, customerId string) ([]*Card, error)

GetCustomerCardList get customer card list by customer id

func (*Service) GetCustomerList

func (s *Service) GetCustomerList(ctx context.Context, merchantID string) ([]*Customer, error)

GetCustomer finds a customer by MerchantID

func (*Service) UpdateCustomer

func (s *Service) UpdateCustomer(ctx context.Context, item *Customer) (*Customer, error)

UpdateCustomer update a customer by MerchantID and Id

func (*Service) UpdateCustomerCard

func (s *Service) UpdateCustomerCard(ctx context.Context, item *Card) (*Card, error)

UpdateCustomerCard update a customer card by id

Jump to

Keyboard shortcuts

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