customer

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BillingAddress added in v1.0.2

type BillingAddress struct {
	Line_1   string `json:"line_1,omitempty"`
	Line_2   string `json:"line_2,omitempty"`
	Country  string `json:"country,omitempty"`
	State    string `json:"state,omitempty"`
	Locality string `json:"locality,omitempty"`
	Zip      string `json:"zip,omitempty"`
}

type Card

type Card struct {
	Id               string          `json:"id"`
	CustomerId       string          `json:"customer_id"`
	MerchantID       string          `json:"merchant_id"`
	LocationId       string          `json:"location_id"`
	Type             string          `json:"type"`
	ThirdPartyCardId string          `json:"third_party_card_id,omitempty"`
	BillingAddress   *BillingAddress `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, merchantId string) (*Customer, error)

func (*Repository) GetCustomerByMobile added in v1.0.2

func (r *Repository) GetCustomerByMobile(ctx context.Context, mobile string, merchantId 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, sourceType string, merchantId string, locationId 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, customerId string, cardId string, isDefault bool) (*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, realmId string, appzId string, item *Customer) (*Customer, error)

CreateCustomer creates a new customer

func (*Service) CreateCustomerSquareCard added in v1.0.2

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

CreateCustomerCard create a customer card

func (*Service) CreateCustomerStripeCard added in v1.0.2

func (s *Service) CreateCustomerStripeCard(ctx context.Context, customerId string, thirdPartyCardId string, locationId string, merchantId string, stripeAccountId 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, merchantId string) (*Customer, error)

GetCustomer finds a customer by MerchantID and Id

func (*Service) GetCustomerByMobile added in v1.0.2

func (s *Service) GetCustomerByMobile(ctx context.Context, mobile string, merchantId string) (*Customer, error)

GetCustomer finds a customer by mobile

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, cardType string, mechantId string, locationId 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, customerId string, cardId string, isDefault bool, merchantId string, locationId string, cardType string) (*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