repository

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CollectionCountry is name of table for collection the country.
	CollectionCountry = "country"
)
View Source
const (
	CollectionMerchant = "merchant"
)
View Source
const (
	// CollectionOrder is name of table for collection the order.
	CollectionOrder = "order"
)
View Source
const (
	// CollectionRefund is name of table for collection the refund.
	CollectionRefund = "refund"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CountryRepositoryInterface

type CountryRepositoryInterface interface {
	// Insert adds country to the collection.
	Insert(context.Context, *billingpb.Country) error

	// Insert adds multiple countries to the collection.
	MultipleInsert(context.Context, []*billingpb.Country) error

	// Update updates the country in the collection.
	Update(context.Context, *billingpb.Country) error

	// GetByIsoCodeA2 returns the country using a two-letter code according to the ISO standard.
	GetByIsoCodeA2(context.Context, string) (*billingpb.Country, error)

	// GetAll returns all countries.
	GetAll(context.Context) (*billingpb.CountriesList, error)

	// FindByHighRisk returns countries by high risk criteria.
	FindByHighRisk(ctx context.Context, isHighRiskOrder bool) (*billingpb.CountriesList, error)

	// IsTariffRegionSupported checks if the region is supported by country settings.
	IsTariffRegionSupported(string) bool

	// FindByVatEnabled returns countries with enabled vat (except the US).
	FindByVatEnabled(context.Context) (*billingpb.CountriesList, error)
}

CountryRepositoryInterface is abstraction layer for working with country and representation in database.

func NewCountryRepository

NewCountryRepository create and return an object for working with the country repository. The returned object implements the CountryRepositoryInterface interface.

type MerchantBalanceRepositoryInterface

type MerchantBalanceRepositoryInterface interface {
	// Insert adds the price group to the collection.
	Insert(context.Context, *billingpb.MerchantBalance) error

	// GetByIdAndCurrency get latest balance for merchant by currency
	GetByIdAndCurrency(context.Context, string, string) (*billingpb.MerchantBalance, error)

	// CountByIdAndCurrency return count balance records for merchant and currency
	CountByIdAndCurrency(context.Context, string, string) (int64, error)
}

MerchantBalanceRepositoryInterface is abstraction layer for working with merchant balance and representation in database.

func NewMerchantBalanceRepository

NewMerchantBalanceRepository create and return an object for working with the merchant balance repository. The returned object implements the MerchantBalanceRepositoryInterface interface.

type MerchantRepositoryInterface

type MerchantRepositoryInterface interface {
	// Insert add the merchant to the collection.
	Insert(ctx context.Context, merchant *billingpb.Merchant) error

	// MultipleInsert adds the multiple merchants to the collection.
	MultipleInsert(ctx context.Context, merchants []*billingpb.Merchant) error

	// Update updates the merchant in the collection.
	Update(ctx context.Context, merchant *billingpb.Merchant) error

	// Upsert add or update the merchant to the collection.
	Upsert(ctx context.Context, merchant *billingpb.Merchant) error

	// UpdateTariffs update payment tariffs.
	UpdateTariffs(context.Context, string, *billingpb.PaymentChannelCostMerchant) error

	// GetById returns the merchant by unique identity.
	GetById(ctx context.Context, id string) (*billingpb.Merchant, error)

	// GetByUserId returns the merchant by user identifier.
	GetByUserId(ctx context.Context, id string) (*billingpb.Merchant, error)

	// GetCommonById returns the common merchant information by unique identity.
	GetCommonById(ctx context.Context, id string) (*billingpb.MerchantCommon, error)

	// GetMerchantsWithAutoPayouts return list of merchants with the automatic payments option is turned off.
	GetMerchantsWithAutoPayouts(ctx context.Context) ([]*billingpb.Merchant, error)

	// GetAll returns all merchants.
	GetAll(ctx context.Context) ([]*billingpb.Merchant, error)

	// Find returns list of merchants by criteria.
	Find(context.Context, bson.M, []string, int64, int64) ([]*billingpb.Merchant, error)

	// FindCount returns count of merchants by criteria.
	FindCount(context.Context, bson.M) (int64, error)
}

MerchantRepositoryInterface is abstraction layer for working with merchant and representation in database.

func NewMerchantRepository

NewMerchantRepository create and return an object for working with the merchant repository. The returned object implements the MerchantRepositoryInterface interface.

type MoneyBackCostMerchantRepositoryInterface

MoneyBackCostMerchantRepositoryInterface is abstraction layer for working with cost of merchant in money back case and representation in database.

func NewMoneyBackCostMerchantRepository

func NewMoneyBackCostMerchantRepository(db mongodb.SourceInterface, cache database.CacheInterface) MoneyBackCostMerchantRepositoryInterface

NewMoneyBackCostMerchantRepository create and return an object for working with the cost of merchant for money back. The returned object implements the MoneyBackCostMerchantRepositoryInterface interface.

type MoneyBackCostSystemRepositoryInterface

MoneyBackCostSystemRepositoryInterface is abstraction layer for working with cost of system in money back case and representation in database.

func NewMoneyBackCostSystemRepository

func NewMoneyBackCostSystemRepository(db mongodb.SourceInterface, cache database.CacheInterface) MoneyBackCostSystemRepositoryInterface

moneyBackCostSystemRepository create and return an object for working with the cost of system for money back. The returned object implements the MoneyBackCostSystemRepositoryInterface interface.

type NotificationRepositoryInterface

type NotificationRepositoryInterface interface {
	// Insert adds the price table to the collection.
	Insert(context.Context, *billingpb.Notification) error

	// Insert adds the price table to the collection.
	Update(context.Context, *billingpb.Notification) error

	// GetById returns the price table by unique identifier.
	GetById(context.Context, string) (*billingpb.Notification, error)

	// Find notifications by merchant, user id and type with pagination and sortable.
	Find(context.Context, string, string, int32, []string, int64, int64) ([]*billingpb.Notification, error)

	// Find return count of notifications by merchant, user id and type.
	FindCount(context.Context, string, string, int32) (int64, error)
}

NotificationRepositoryInterface is abstraction layer for working with notification and representation in database.

func NewNotificationRepository

func NewNotificationRepository(db mongodb.SourceInterface) NotificationRepositoryInterface

NewNotificationRepository create and return an object for working with the notification repository. The returned object implements the NotificationRepositoryInterface interface.

type NotifyRegionRepositoryInterface

type NotifyRegionRepositoryInterface interface {
	// Insert adds the notify new region to the collection.
	Insert(context.Context, *billingpb.NotifyUserNewRegion) error

	// FindByEmail returns the notify new region by email.
	FindByEmail(context.Context, string) ([]*billingpb.NotifyUserNewRegion, error)
}

NotifyRegionRepositoryInterface is abstraction layer for working with notify new region and representation in database.

func NewNotifyRegionRepository

func NewNotifyRegionRepository(db mongodb.SourceInterface) NotifyRegionRepositoryInterface

NewNotifyRegionRepository create and return an object for working with the notify new region repository. The returned object implements the NotifyRegionRepositoryInterface interface.

type NotifySalesRepositoryInterface

type NotifySalesRepositoryInterface interface {
	// Insert adds the notify sales to the collection.
	Insert(context.Context, *billingpb.NotifyUserSales) error

	// FindByEmail returns the notify sales by email.
	FindByEmail(context.Context, string) ([]*billingpb.NotifyUserSales, error)
}

NotifySalesRepositoryInterface is abstraction layer for working with notify sales and representation in database.

func NewNotifySalesRepository

func NewNotifySalesRepository(db mongodb.SourceInterface) NotifySalesRepositoryInterface

NewNotifySalesRepository create and return an object for working with the notify sales repository. The returned object implements the NotifySalesRepositoryInterface interface.

type OperatingCompanyRepositoryInterface

type OperatingCompanyRepositoryInterface interface {
	// GetById returns the operating company by unique identifier.
	GetById(ctx context.Context, id string) (oc *billingpb.OperatingCompany, err error)

	// GetByPaymentCountry returns the operating company by country code.
	GetByPaymentCountry(ctx context.Context, countryCode string) (oc *billingpb.OperatingCompany, err error)

	// GetAll returns all operating companies.
	GetAll(ctx context.Context) (result []*billingpb.OperatingCompany, err error)

	// Upsert add or update the operating company to the collection.
	Upsert(ctx context.Context, oc *billingpb.OperatingCompany) (err error)

	// Exists is check exists the operating company by unique identifier.
	Exists(ctx context.Context, id string) bool
}

OperatingCompanyRepositoryInterface is abstraction layer for working with operating company and representation in database.

func NewOperatingCompanyRepository

NewOperatingCompanyRepository create and return an object for working with the operating company repository. The returned object implements the OperatingCompanyRepositoryInterface interface.

type OrderRepositoryInterface

type OrderRepositoryInterface interface {
	// Insert adds order to the collection.
	Insert(context.Context, *billingpb.Order) error

	// Update updates the order in the collection.
	Update(context.Context, *billingpb.Order) error

	// GetById returns a order by its identifier.
	GetById(context.Context, string) (*billingpb.Order, error)

	// GetByUuid returns a order by its public (uuid) identifier.
	GetByUuid(context.Context, string) (*billingpb.Order, error)

	// GetByRefundReceiptNumber returns a order by its receipt number.
	GetByRefundReceiptNumber(context.Context, string) (*billingpb.Order, error)

	// GetByProjectOrderId returns a order by project and order identifiers.
	GetByProjectOrderId(context.Context, string, string) (*billingpb.Order, error)
}

OrderRepositoryInterface is abstraction layer for working with order and representation in database.

func NewOrderRepository

func NewOrderRepository(db mongodb.SourceInterface) OrderRepositoryInterface

NewOrderRepository create and return an object for working with the order repository. The returned object implements the OrderRepositoryInterface interface.

type PriceGroupRepositoryInterface

type PriceGroupRepositoryInterface interface {
	// Insert adds the price group to the collection.
	Insert(context.Context, *billingpb.PriceGroup) error

	// Insert adds the multiple price groups to the collection.
	MultipleInsert(context.Context, []*billingpb.PriceGroup) error

	// Update updates the price group in the collection.
	Update(context.Context, *billingpb.PriceGroup) error

	// GetById returns the price group by unique identity.
	GetById(context.Context, string) (*billingpb.PriceGroup, error)

	// GetByRegion returns the price group by region name.
	GetByRegion(context.Context, string) (*billingpb.PriceGroup, error)

	// GetByRegion returns all price groups.
	GetAll(context.Context) ([]*billingpb.PriceGroup, error)
}

PriceGroupRepositoryInterface is abstraction layer for working with price group and representation in database.

func NewPriceGroupRepository

NewPriceGroupRepository create and return an object for working with the price group repository. The returned object implements the PriceGroupRepositoryInterface interface.

type PriceTableRepositoryInterface

type PriceTableRepositoryInterface interface {
	// Insert adds the price table to the collection.
	Insert(context.Context, *billingpb.PriceTable) error

	// GetByRegion returns the price table by region name.
	GetByRegion(context.Context, string) (*billingpb.PriceTable, error)
}

PriceTableRepositoryInterface is abstraction layer for working with price table and representation in database.

func NewPriceTableRepository

func NewPriceTableRepository(db mongodb.SourceInterface) PriceTableRepositoryInterface

NewPriceTableRepository create and return an object for working with the price table repository. The returned object implements the PriceTableRepositoryInterface interface.

type ProjectRepositoryInterface

type ProjectRepositoryInterface interface {
	// Insert adds the project to the collection.
	Insert(context.Context, *billingpb.Project) error

	// Insert adds the multiple projects to the collection.
	MultipleInsert(context.Context, []*billingpb.Project) error

	// Update updates the project in the collection.
	Update(context.Context, *billingpb.Project) error

	// GetById returns the project by unique identity.
	GetById(context.Context, string) (*billingpb.Project, error)

	// Count return count of projects by merchant identifier.
	CountByMerchantId(context.Context, string) (int64, error)

	// Find projects by merchant, quick search and statuses with pagination and sortable.
	Find(context.Context, string, string, []int32, int64, int64, []string) ([]*billingpb.Project, error)

	// FindCount return count of projects by merchant, quick search and statuses.
	FindCount(context.Context, string, string, []int32) (int64, error)
}

ProjectRepositoryInterface is abstraction layer for working with project and representation in database.

func NewProjectRepository

NewProjectRepository create and return an object for working with the price group repository. The returned object implements the ProjectRepositoryInterface interface.

type RefundRepositoryInterface

type RefundRepositoryInterface interface {
	// Insert adds refund to the collection.
	Insert(context.Context, *billingpb.Refund) error

	// Update updates the refund in the collection.
	Update(context.Context, *billingpb.Refund) error

	// GetById returns a refund by its identifier.
	GetById(context.Context, string) (*billingpb.Refund, error)

	// FindByOrderUuid returns a list of refunds by the public identifier of the purchase order.
	FindByOrderUuid(context.Context, string, int64, int64) ([]*billingpb.Refund, error)

	// CountByOrderUuid returns the number of refunds by the public identifier of the purchase order.
	CountByOrderUuid(context.Context, string) (int64, error)

	// GetAmountByOrderId returns the amount of refunds produced by order ID.
	GetAmountByOrderId(context.Context, string) (float64, error)
}

RefundRepositoryInterface is abstraction layer for working with refund and representation in database.

func NewRefundRepository

func NewRefundRepository(db mongodb.SourceInterface) RefundRepositoryInterface

NewRefundRepository create and return an object for working with the refund repository. The returned object implements the RefundRepositoryInterface interface.

type TurnoverRepositoryInterface

type TurnoverRepositoryInterface interface {
	// Upsert add or update an annual turnover to the collection.
	Upsert(context.Context, *billingpb.AnnualTurnover) error

	// GetByZipAndCountry get record by full zip code and country.
	Get(context.Context, string, string, int) (*billingpb.AnnualTurnover, error)

	// CountAll return count elements in annual turnover documents.
	CountAll(context.Context) (int64, error)
}

TurnoverRepositoryInterface is abstraction layer for working with annual turnover and representation in database.

func NewTurnoverRepository

NewTurnoverRepository create and return an object for working with the annual turnover repository. The returned object implements the TurnoverRepositoryInterface interface.

type UserProfileRepositoryInterface

type UserProfileRepositoryInterface interface {
	// Add adds user profile to the collection.
	Add(context.Context, *billingpb.UserProfile) error

	// Update updates the user profile in the collection.
	Update(context.Context, *billingpb.UserProfile) error

	// Upsert add or update the user profile in the collection.
	Upsert(ctx context.Context, profile *billingpb.UserProfile) error

	// GetById returns the user profile by unique identity.
	GetById(context.Context, string) (*billingpb.UserProfile, error)

	// GetByUserId returns the user profile by user identity.
	GetByUserId(context.Context, string) (*billingpb.UserProfile, error)
}

UserProfileRepositoryInterface is abstraction layer for working with user profile information and representation in database.

func NewUserProfileRepository

func NewUserProfileRepository(db mongodb.SourceInterface) UserProfileRepositoryInterface

NewUserProfileRepository create and return an object for working with the user profile repository. The returned object implements the UserProfileRepositoryInterface interface.

type UserRoleRepositoryInterface

type UserRoleRepositoryInterface interface {
	// AddMerchantUser add user role to the merchant collection.
	AddMerchantUser(context.Context, *billingpb.UserRole) error

	// AddAdminUser add user role to the system collection.
	AddAdminUser(context.Context, *billingpb.UserRole) error

	// UpdateMerchantUser update user role in the merchant collection.
	UpdateMerchantUser(context.Context, *billingpb.UserRole) error

	// UpdateAdminUser update user role in the system collection.
	UpdateAdminUser(context.Context, *billingpb.UserRole) error

	// GetMerchantUserByEmail get merchant user role by merchant ID and user email.
	GetMerchantUserByEmail(context.Context, string, string) (*billingpb.UserRole, error)

	// GetAdminUserByEmail get system user role by user email.
	GetAdminUserByEmail(context.Context, string) (*billingpb.UserRole, error)

	// GetMerchantUserById get merchant user role by user role identifier.
	GetMerchantUserById(context.Context, string) (*billingpb.UserRole, error)

	// GetAdminUserById get system user role by user role identifier.
	GetAdminUserById(context.Context, string) (*billingpb.UserRole, error)

	// GetMerchantUserByUserId get merchant user role by merchant ID and user ID.
	GetMerchantUserByUserId(context.Context, string, string) (*billingpb.UserRole, error)

	// GetAdminUserByUserId get system user role by user ID.
	GetAdminUserByUserId(context.Context, string) (*billingpb.UserRole, error)

	// GetUsersForMerchant get list of merchant user roles by merchant ID.
	GetUsersForMerchant(context.Context, string) ([]*billingpb.UserRole, error)

	// GetUsersForAdmin get list of system users roles.
	GetUsersForAdmin(context.Context) ([]*billingpb.UserRole, error)

	// GetMerchantsForUser get list of merchant user roles by user ID.
	GetMerchantsForUser(context.Context, string) ([]*billingpb.UserRole, error)

	// DeleteAdminUser delete system user role from the collection.
	DeleteAdminUser(context.Context, *billingpb.UserRole) error

	// DeleteMerchantUser delete merchant user role from the collection.
	DeleteMerchantUser(context.Context, *billingpb.UserRole) error

	// GetSystemAdmin get user role with system admin role.
	GetSystemAdmin(context.Context) (*billingpb.UserRole, error)

	// GetMerchantOwner get user role with merchant owner role by merchant ID.
	GetMerchantOwner(context.Context, string) (*billingpb.UserRole, error)
}

UserRoleRepositoryInterface is abstraction layer for working with user role and representation in database.

func NewUserRoleRepository

NewUserRoleRepository create and return an object for working with the user role repository. The returned object implements the UserRoleRepositoryInterface interface.

type ZipCodeRepositoryInterface

type ZipCodeRepositoryInterface interface {
	// Insert adds zip code to the collection.
	Insert(context.Context, *billingpb.ZipCode) error

	// GetByZipAndCountry get record by full zip code and country.
	GetByZipAndCountry(context.Context, string, string) (*billingpb.ZipCode, error)

	// FindByZipAndCountry find multiple records by part of zip code and full country code.
	FindByZipAndCountry(context.Context, string, string, int64, int64) ([]*billingpb.ZipCode, error)

	// CountByZip find records by part of zip code and full country code and return found count.
	CountByZip(context.Context, string, string) (int64, error)
}

ZipCodeRepositoryInterface is abstraction layer for working with zip code and representation in database.

func NewZipCodeRepository

NewZipCodeRepository create and return an object for working with the zip codes repository. The returned object implements the ZipCodeRepositoryInterface interface.

Jump to

Keyboard shortcuts

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