repository

package
v1.10.11 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionRoyaltyReport        = "royalty_report"
	CollectionRoyaltyReportChanges = "royalty_report_changes"
)
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 (
	CollectionOrderView = "order_view"
)
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 AccountingEntryRepositoryInterface added in v1.3.0

type AccountingEntryRepositoryInterface interface {
	// Insert adds multiple accounting entries to the collection.
	MultipleInsert(context.Context, []*billingpb.AccountingEntry) error

	// GetCorrectionsForRoyaltyReport returns the account entries by merchant id, currency and dates.
	GetCorrectionsForRoyaltyReport(context.Context, string, string, time.Time, time.Time) ([]*billingpb.AccountingEntry, error)

	// GetRollingReservesForRoyaltyReport returns the account entries by merchant id, currency and dates with merchant_royalty_correction type.
	GetRollingReservesForRoyaltyReport(context.Context, string, string, []string, time.Time, time.Time) ([]*billingpb.AccountingEntry, error)

	// GetRollingReserveForBalance returns the account entries by merchant id, currency and types.
	GetRollingReserveForBalance(context.Context, string, string, []string, time.Time) ([]*pkg.ReserveQueryResItem, error)

	// GetById returns the account entry by unique identifier.
	GetById(context.Context, string) (*billingpb.AccountingEntry, error)

	// GetByTypeWithTaxes returns the account entries by type with none empty amount.
	GetByTypeWithTaxes(context.Context, []string) ([]*billingpb.AccountingEntry, error)

	// GetByObjectSource returns the account entries by object, source type and id.
	GetByObjectSource(context.Context, string, string, string) (*billingpb.AccountingEntry, error)

	// ApplyObjectSource fills the passed object with data from the search result (by object, source type and id).
	ApplyObjectSource(context.Context, string, string, string, string, *billingpb.AccountingEntry) (*billingpb.AccountingEntry, error)

	// GetDistinctBySourceId returns distinct source identities.
	GetDistinctBySourceId(context.Context) ([]string, error)

	// FindBySource returns the account entries by source type and id.
	FindBySource(context.Context, string, string) ([]*billingpb.AccountingEntry, error)

	// FindBySource returns the account entries by source type and id.
	DeleteBySource(context.Context, string, string) error

	// FindByTypeCountryDates returns the account entries by type, country and dates.
	FindByTypeCountryDates(context.Context, string, []string, time.Time, time.Time) ([]*billingpb.AccountingEntry, error)

	// BulkWrite writing account entries.
	BulkWrite(context.Context, []*billingpb.AccountingEntry) error
}

AccountingEntryRepositoryInterface is abstraction layer for working with accounting entry and representation in database.

func NewAccountingEntryRepository added in v1.3.0

func NewAccountingEntryRepository(db mongodb.SourceInterface) AccountingEntryRepositoryInterface

NewAccountingEntryRepository create and return an object for working with the accounting entry repository. The returned object implements the AccountingEntryRepositoryInterface interface.

type AutoincrementRepositoryInterface added in v1.5.0

type AutoincrementRepositoryInterface interface {
	GatPayoutAutoincrementId(ctx context.Context) (int64, error)
}

func NewAutoincrementRepository added in v1.5.0

func NewAutoincrementRepository(db mongodb.SourceInterface) AutoincrementRepositoryInterface

type BankBinRepositoryInterface added in v1.3.0

type BankBinRepositoryInterface interface {
	// Insert adds the price table to the collection.
	Insert(context.Context, *intPkg.BinData) error

	// MultipleInsert adds the multiple price groups to the collection.
	MultipleInsert(context.Context, []*intPkg.BinData) error

	// GetByBin returns the bank bin by bin number.
	GetByBin(context.Context, int32) (*intPkg.BinData, error)
}

BankBinRepositoryInterface is abstraction layer for working with bank bin and representation in database.

func NewBankBinRepository added in v1.3.0

func NewBankBinRepository(db mongodb.SourceInterface) BankBinRepositoryInterface

NewBankBinRepository create and return an object for working with the bank bin repository. The returned object implements the BankBinRepositoryInterface interface.

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 CustomerRepositoryInterface added in v1.3.0

type CustomerRepositoryInterface interface {
	// Insert adds the customer to the collection.
	Insert(context.Context, *billingpb.Customer) error

	// Update updates the customer in the collection.
	Update(context.Context, *billingpb.Customer) error

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

	// Find return customer by merchant id and token user (user id or email or phone).
	Find(context.Context, string, *billingpb.TokenUser) (*billingpb.Customer, error)

	//Return all customers
	FindAll(ctx context.Context) ([]*billingpb.Customer, error)

	//FindBy returns customers filter by query
	FindBy(ctx context.Context, query bson.M, opts ...*options.FindOptions) ([]*billingpb.Customer, error)

	//CountBy returns count of customers with filter by query
	CountBy(ctx context.Context, query bson.M) (int64, error)
}

CustomerRepositoryInterface is abstraction layer for working with customer and representation in database.

func NewCustomerRepository added in v1.3.0

func NewCustomerRepository(db mongodb.SourceInterface) CustomerRepositoryInterface

NewCustomerRepository create and return an object for working with the customer repository. The returned object implements the CustomerRepositoryInterface interface.

type Customers added in v1.8.0

type Customers struct {
	Id string `json:"_id" bson:"_id"`
}

type DashboardProcessorRepositoryInterface added in v1.3.0

type DashboardProcessorRepositoryInterface interface {
	ExecuteReport(ctx context.Context, out interface{}, fn func(context.Context, interface{}) (interface{}, error)) (interface{}, error)
	ExecuteGrossRevenueAndVatReports(ctx context.Context, out interface{}) (interface{}, error)
	ExecuteTotalTransactionsAndArpuReports(ctx context.Context, out interface{}) (interface{}, error)
	ExecuteRevenueDynamicReport(ctx context.Context, out interface{}) (interface{}, error)
	ExecuteRevenueByCountryReport(ctx context.Context, out interface{}) (interface{}, error)
	ExecuteSalesTodayReport(ctx context.Context, out interface{}) (interface{}, error)
	ExecuteSourcesReport(ctx context.Context, out interface{}) (interface{}, error)

	ExecuteCustomerLTV(ctx context.Context, out interface{}) (interface{}, interface{}, error)
	ExecuteCustomerARPU(ctx context.Context, customerId string) (interface{}, error)
	ExecuteCustomerAvgTransactionsCount(ctx context.Context, out interface{}) (interface{}, error)
	ExecuteCustomerTop20(ctx context.Context, out interface{}) (interface{}, error)
	ExecuteCustomers(ctx context.Context, out interface{}) (interface{}, error)
	ExecuteCustomersCount(ctx context.Context, out interface{}) (interface{}, error)
	ExecuteCustomersChart(ctx context.Context, startDate time.Time, end time.Time) (interface{}, error)
	ExecuteCustomerARPPU(ctx context.Context) (interface{}, error)
}

DashboardProcessorRepositoryInterface is abstraction layer for working with dashboard report and representation in database.

type DashboardReportProcessor added in v1.3.0

type DashboardReportProcessor struct {
	Db          mongodb.SourceInterface
	Collection  string
	Match       bson.M
	GroupBy     string
	DbQueryFn   func(ctx context.Context, receiver interface{}) (interface{}, error)
	Cache       database.CacheInterface
	CacheKey    string
	CacheExpire time.Duration
	Errors      map[string]*billingpb.ResponseErrorMessage
}

func (*DashboardReportProcessor) ExecuteCustomerARPPU added in v1.9.0

func (m *DashboardReportProcessor) ExecuteCustomerARPPU(ctx context.Context) (interface{}, error)

func (*DashboardReportProcessor) ExecuteCustomerARPU added in v1.8.0

func (m *DashboardReportProcessor) ExecuteCustomerARPU(ctx context.Context, customerId string) (interface{}, error)

func (*DashboardReportProcessor) ExecuteCustomerAvgTransactionsCount added in v1.8.0

func (m *DashboardReportProcessor) ExecuteCustomerAvgTransactionsCount(ctx context.Context, i interface{}) (interface{}, error)

func (*DashboardReportProcessor) ExecuteCustomerLTV added in v1.8.0

func (m *DashboardReportProcessor) ExecuteCustomerLTV(ctx context.Context, i interface{}) (interface{}, interface{}, error)

func (*DashboardReportProcessor) ExecuteCustomerTop20 added in v1.8.0

func (m *DashboardReportProcessor) ExecuteCustomerTop20(ctx context.Context, i interface{}) (interface{}, error)

func (*DashboardReportProcessor) ExecuteCustomers added in v1.8.0

func (m *DashboardReportProcessor) ExecuteCustomers(ctx context.Context, i interface{}) (interface{}, error)

func (*DashboardReportProcessor) ExecuteCustomersChart added in v1.8.0

func (m *DashboardReportProcessor) ExecuteCustomersChart(ctx context.Context, startDate time.Time, end time.Time) (interface{}, error)

func (*DashboardReportProcessor) ExecuteCustomersCount added in v1.8.0

func (m *DashboardReportProcessor) ExecuteCustomersCount(ctx context.Context, i interface{}) (interface{}, error)

func (*DashboardReportProcessor) ExecuteGrossRevenueAndVatReports added in v1.3.0

func (m *DashboardReportProcessor) ExecuteGrossRevenueAndVatReports(ctx context.Context, _ interface{}) (interface{}, error)

func (*DashboardReportProcessor) ExecuteReport added in v1.3.0

func (m *DashboardReportProcessor) ExecuteReport(
	ctx context.Context,
	receiver interface{},
	fn func(context.Context, interface{}) (interface{}, error),
) (interface{}, error)

func (*DashboardReportProcessor) ExecuteRevenueByCountryReport added in v1.3.0

func (m *DashboardReportProcessor) ExecuteRevenueByCountryReport(ctx context.Context, _ interface{}) (interface{}, error)

func (*DashboardReportProcessor) ExecuteRevenueDynamicReport added in v1.3.0

func (m *DashboardReportProcessor) ExecuteRevenueDynamicReport(ctx context.Context, receiver interface{}) (interface{}, error)

func (*DashboardReportProcessor) ExecuteSalesTodayReport added in v1.3.0

func (m *DashboardReportProcessor) ExecuteSalesTodayReport(ctx context.Context, receiver interface{}) (interface{}, error)

func (*DashboardReportProcessor) ExecuteSourcesReport added in v1.3.0

func (m *DashboardReportProcessor) ExecuteSourcesReport(ctx context.Context, receiver interface{}) (interface{}, error)

func (*DashboardReportProcessor) ExecuteTotalTransactionsAndArpuReports added in v1.3.0

func (m *DashboardReportProcessor) ExecuteTotalTransactionsAndArpuReports(ctx context.Context, _ interface{}) (interface{}, error)

type DashboardRepositoryInterface added in v1.3.0

type DashboardRepositoryInterface interface {
	GetMainReport(ctx context.Context, merchantId string, period string) (*billingpb.DashboardMainReport, error)
	GetRevenueDynamicsReport(ctx context.Context, merchantId string, period string) (*billingpb.DashboardRevenueDynamicReport, error)
	GetBaseReport(ctx context.Context, merchantId string, period string) (*billingpb.DashboardBaseReports, error)

	GetCustomersReport(ctx context.Context, merchantId string, period string) (*billingpb.DashboardCustomerReport, error)
	GetCustomerARPU(ctx context.Context, merchantId string, customerId string) (*billingpb.DashboardAmountItemWithChart, error)
}

DashboardRepositoryInterface is abstraction layer for working with dashboard report and representation in database.

func NewDashboardRepository added in v1.3.0

NewDashboardRepository create and return an object for working with the key repository. The returned object implements the DashboardRepositoryInterface interface.

type FeedbackRepositoryInterface added in v1.3.0

type FeedbackRepositoryInterface interface {
	// Insert adds the feedback to the collection.
	Insert(context.Context, *billingpb.PageReview) error

	// GetAll returns all feedback.
	GetAll(context.Context) ([]*billingpb.PageReview, error)
}

FeedbackRepositoryInterface is abstraction layer for working with feedback and representation in database.

func NewFeedbackRepository added in v1.3.0

func NewFeedbackRepository(db mongodb.SourceInterface) FeedbackRepositoryInterface

NewFeedbackRepository create and return an object for working with the feedback repository. The returned object implements the FeedbackRepositoryInterface interface.

type KeyProductRepositoryInterface added in v1.3.0

type KeyProductRepositoryInterface interface {
	// Upsert add or update the key product to the collection.
	Upsert(context.Context, *billingpb.KeyProduct) error

	// Update updates the key product in the collection.
	Update(context.Context, *billingpb.KeyProduct) error

	// GetById returns the key product by unique identity.
	GetById(context.Context, string) (*billingpb.KeyProduct, error)

	// CountByProjectIdSku return count the key products by project id and sku.
	CountByProjectIdSku(context.Context, string, string) (int64, error)

	// FindByIdsProjectId find and return the key products by list identifiers and project id.
	FindByIdsProjectId(context.Context, []string, string) ([]*billingpb.KeyProduct, error)

	// Find returns list of key products by merchant id, project id, sku, name and enabled with pagination.
	Find(context.Context, string, string, string, string, string, int64, int64) ([]*billingpb.KeyProduct, error)

	// FindCount returns count of key products by merchant id, project id, sku, name and enabled with pagination.
	FindCount(context.Context, string, string, string, string, string) (int64, error)
}

KeyProductRepositoryInterface is abstraction layer for working with key for product and representation in database.

func NewKeyProductRepository added in v1.3.0

func NewKeyProductRepository(db mongodb.SourceInterface) KeyProductRepositoryInterface

NewKeyProductRepository create and return an object for working with the key product repository. The returned object implements the KeyProductRepositoryInterface interface.

type KeyRepositoryInterface added in v1.3.0

type KeyRepositoryInterface interface {
	// Insert add the key to the collection.
	Insert(context.Context, *billingpb.Key) error

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

	// ReserveKey reserves the key for the specified time for the product, platform and order.
	ReserveKey(context.Context, string, string, string, int32) (*billingpb.Key, error)

	// CancelById cancels the key reserve.
	CancelById(context.Context, string) (*billingpb.Key, error)

	// FinishRedeemById marks the reserved key as successfully used.
	FinishRedeemById(context.Context, string) (*billingpb.Key, error)

	// CountKeysByProductPlatform returns the number of keys for the product and the specified platform.
	CountKeysByProductPlatform(context.Context, string, string) (int64, error)

	// FindUnfinished returns a list of keys that have not been revoked or used.
	FindUnfinished(context.Context) ([]*billingpb.Key, error)
}

KeyRepositoryInterface is abstraction layer for working with key and representation in database.

func NewKeyRepository added in v1.3.0

func NewKeyRepository(db mongodb.SourceInterface) KeyRepositoryInterface

NewKeyRepository create and return an object for working with the key repository. The returned object implements the KeyRepositoryInterface 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 MerchantDocumentRepositoryInterface added in v1.9.0

type MerchantDocumentRepositoryInterface interface {
	// Insert adds the merchant document to the collection.
	Insert(context.Context, *billingpb.MerchantDocument) error

	// GetById get merchant document by identity
	GetById(context.Context, string) (*billingpb.MerchantDocument, error)

	// GetByMerchantId return documents for merchant
	GetByMerchantId(context.Context, string, int64, int64) ([]*billingpb.MerchantDocument, error)

	// CountByMerchantId return count documents for merchant
	CountByMerchantId(context.Context, string) (int64, error)
}

MerchantDocumentRepositoryInterface is abstraction layer for working with merchant documents in database.

func NewMerchantDocumentRepository added in v1.9.0

func NewMerchantDocumentRepository(db mongodb.SourceInterface) MerchantDocumentRepositoryInterface

NewMerchantDocumentRepository create and return an object for working with the merchant document repository. The returned object implements the MerchantDocumentRepositoryInterface interface.

type MerchantPaymentMethodHistoryRepositoryInterface added in v1.3.0

type MerchantPaymentMethodHistoryRepositoryInterface interface {
	// Insert adds the merchant payment method history to the collection.
	Insert(context.Context, *billingpb.MerchantPaymentMethodHistory) error
}

MerchantPaymentMethodHistoryRepositoryInterface is abstraction layer for working with merchant payment method history and representation in database.

func NewMerchantPaymentMethodHistoryRepository added in v1.3.0

func NewMerchantPaymentMethodHistoryRepository(db mongodb.SourceInterface) MerchantPaymentMethodHistoryRepositoryInterface

NewMerchantPaymentMethodHistoryRepository create and return an object for working with the merchant tariffs settings repository. The returned object implements the MerchantPaymentMethodHistoryRepositoryInterface interface.

type MerchantPaymentTariffsInterface added in v1.3.0

type MerchantPaymentTariffsInterface interface {
	// MultipleInsert adds the multiple merchant payment tariffs to the collection.
	MultipleInsert(context.Context, []*billingpb.MerchantTariffRatesPayment) error

	// Find return merchant payment tariffs by home region, payer region, mcc code, min amount and max amount.
	Find(context.Context, string, string, string, float64, float64) ([]*billingpb.MerchantTariffRatesPayment, error)
}

MerchantPaymentTariffsInterface is abstraction layer for working with merchant payment tariffs and representation in database.

func NewMerchantPaymentTariffsRepository added in v1.3.0

func NewMerchantPaymentTariffsRepository(db mongodb.SourceInterface, cache database.CacheInterface) MerchantPaymentTariffsInterface

NewMerchantTariffsSettingsRepository create and return an object for working with the merchant payment tariffs repository. The returned object implements the MerchantTariffsSettingsInterface 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 MerchantTariffsSettingsInterface added in v1.3.0

type MerchantTariffsSettingsInterface interface {
	// Insert add the merchant tariffs settings to the collection.
	Insert(ctx context.Context, merchant *billingpb.MerchantTariffRatesSettings) error

	// GetByMccCode returns the merchant tariffs settings by mcc code.
	GetByMccCode(ctx context.Context, code string) (*billingpb.MerchantTariffRatesSettings, error)
}

MerchantTariffsSettingsInterface is abstraction layer for working with merchant tariffs settings and representation in database.

func NewMerchantTariffsSettingsRepository added in v1.3.0

func NewMerchantTariffsSettingsRepository(db mongodb.SourceInterface, cache database.CacheInterface) MerchantTariffsSettingsInterface

NewMerchantTariffsSettingsRepository create and return an object for working with the merchant tariffs settings repository. The returned object implements the MerchantTariffsSettingsInterface interface.

type MoneyBackCostMerchantRepositoryInterface

type MoneyBackCostMerchantRepositoryInterface interface {
	// Insert adds the cost of merchant in money back to the collection.
	Insert(context.Context, *billingpb.MoneyBackCostMerchant) error

	// MultipleInsert adds the multiple cost of merchant in money back to the collection.
	MultipleInsert(context.Context, []*billingpb.MoneyBackCostMerchant) error

	// Update updates the cost of merchant in money back in the collection.
	Update(context.Context, *billingpb.MoneyBackCostMerchant) error

	// Find returns list of cost of merchant in money back by merchantId, name, payout currency, undo reason, region,
	// country, mcc code and payment stage.
	Find(context.Context, string, string, string, string, string, string, string, int32) ([]*internalPkg.MoneyBackCostMerchantSet, error)

	// GetById returns the cost of merchant in money back by unique identity.
	GetById(context.Context, string) (*billingpb.MoneyBackCostMerchant, error)

	// Delete deleting the cost of merchant in money back.
	Delete(context.Context, *billingpb.MoneyBackCostMerchant) error

	// GetAllForMerchant returns the list of merchant cost in money back by merchant id.
	GetAllForMerchant(context.Context, string) (*billingpb.MoneyBackCostMerchantList, error)

	// Update all merchant's tariffs
	DeleteAndInsertMany(ctx context.Context, merchantId string, tariffs []*billingpb.MoneyBackCostMerchant) error
}

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

type MoneyBackCostSystemRepositoryInterface interface {
	// Insert adds the cost of system in money back to the collection.
	Insert(context.Context, *billingpb.MoneyBackCostSystem) error

	// MultipleInsert adds the multiple cost of system in money back to the collection.
	MultipleInsert(context.Context, []*billingpb.MoneyBackCostSystem) error

	// Update updates the cost of system in money back in the collection.
	Update(context.Context, *billingpb.MoneyBackCostSystem) error

	// Find returns list of cost of system in money back by name, payout currency, undo reason, region, country,
	// mcc code, operating company id and payment stage.
	Find(context.Context, string, string, string, string, string, string, string, int32) ([]*internalPkg.MoneyBackCostSystemSet, error)

	// GetById returns the cost of system in money back by unique identity.
	GetById(context.Context, string) (*billingpb.MoneyBackCostSystem, error)

	// Delete deleting the cost of system in money back.
	Delete(context.Context, *billingpb.MoneyBackCostSystem) error

	// GetAllForMerchant returns the list of system cost in money back.
	GetAll(context.Context) (*billingpb.MoneyBackCostSystemList, error)
}

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)

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

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

	// UpdateOrderView updates orders into order view.
	UpdateOrderView(context.Context, []string) error

	// Return order by some conditions
	GetOneBy(ctx context.Context, filter bson.M, opts ...*options.FindOneOptions) (*billingpb.Order, error)

	// Mark orders as included to royalty report.
	IncludeOrdersToRoyaltyReport(ctx context.Context, royaltyReportId string, orderIds []primitive.ObjectID) error

	// Get first payment for merchant
	GetFirstPaymentForMerchant(ctx context.Context, merchantId string) (*billingpb.Order, error)

	// Return orders by some conditions and with options
	GetManyBy(ctx context.Context, filter bson.M, opts ...*options.FindOptions) ([]*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 OrderViewRepositoryInterface added in v1.3.0

type OrderViewRepositoryInterface interface {
	// GetById returns the order view by unique identity.
	GetById(context.Context, string) (*billingpb.OrderViewPublic, error)

	// CountTransactions returns count of transactions by dynamic query.
	CountTransactions(ctx context.Context, match bson.M) (n int64, err error)

	// GetTransactionsPublic returns list of public view transactions by dynamic query.
	GetTransactionsPublic(ctx context.Context, match bson.M, limit, offset int64) (result []*billingpb.OrderViewPublic, err error)

	// GetTransactionsPrivate returns list of private view transactions by dynamic query.
	GetTransactionsPrivate(ctx context.Context, match bson.M, limit, offset int64) (result []*billingpb.OrderViewPrivate, err error)

	// GetRoyaltySummary returns orders for summary royal report by merchant id, currency and dates with checking exists royalty report.
	GetRoyaltySummary(ctx context.Context, merchantId, currency string, from, to time.Time) (items []*billingpb.RoyaltyReportProductSummaryItem, total *billingpb.RoyaltyReportProductSummaryItem, ordersIds []primitive.ObjectID, err error)

	// GetPublicOrderBy returns orders for order identity, order public identity, merchant id.
	GetPublicOrderBy(ctx context.Context, id, uuid, merchantId string) (*billingpb.OrderViewPublic, error)

	// GetPrivateOrderBy returns orders for order identity, order private identity, merchant id.
	GetPrivateOrderBy(ctx context.Context, id, uuid, merchantId string) (*billingpb.OrderViewPrivate, error)

	// GetPaylinkStat returns orders for common paylink report by paylink id, merchant id and dates.
	GetPaylinkStat(ctx context.Context, paylinkId, merchantId string, from, to int64) (*billingpb.StatCommon, error)

	// GetPaylinkStatByCountry returns orders for country paylink report by paylink id, merchant id and dates.
	GetPaylinkStatByCountry(ctx context.Context, paylinkId, merchantId string, from, to int64) (result *billingpb.GroupStatCommon, err error)

	// GetPaylinkStatByReferrer returns orders for referrer paylink report by paylink id, merchant id and dates.
	GetPaylinkStatByReferrer(ctx context.Context, paylinkId, merchantId string, from, to int64) (result *billingpb.GroupStatCommon, err error)

	// GetPaylinkStatByDate returns orders for dates paylink report by paylink id, merchant id and dates.
	GetPaylinkStatByDate(ctx context.Context, paylinkId, merchantId string, from, to int64) (result *billingpb.GroupStatCommon, err error)

	// GetPaylinkStatByUtm returns orders for utm paylink report by paylink id, merchant id and dates.
	GetPaylinkStatByUtm(ctx context.Context, paylinkId, merchantId string, from, to int64) (result *billingpb.GroupStatCommon, err error)

	// GetPublicByOrderId returns the public order view by unique identity.
	GetPublicByOrderId(ctx context.Context, merchantId string) (*billingpb.OrderViewPublic, error)

	// GetVatSummary returns orders for summary vat report by operating company id, country, vat deduction and dates.
	GetVatSummary(context.Context, string, string, bool, time.Time, time.Time) ([]*pkg.VatReportQueryResItem, error)

	// GetTurnoverSummary returns orders for summary turnover report by operating company id, country, currency policy and dates.
	GetTurnoverSummary(context.Context, string, string, string, time.Time, time.Time) ([]*pkg.TurnoverQueryResItem, error)

	// GetRoyaltyForMerchants returns orders for merchants royal report by statuses and dates.
	GetRoyaltyForMerchants(context.Context, []string, time.Time, time.Time) ([]*pkg.RoyaltyReportMerchant, error)

	// Return orders by some conditions and with options
	GetManyBy(ctx context.Context, filter bson.M, opts ...*options.FindOptions) ([]*billingpb.OrderViewPrivate, error)

	// Return count of orders by some conditions and with options
	GetCountBy(ctx context.Context, filter bson.M, opts ...*options.CountOptions) (int64, error)

	// GetRoyaltySummary returns orders for summary royal report by merchant id, currency and dates with checking exists royalty report.
	GetRoyaltySummaryRoundedAmounts(ctx context.Context, merchantId, currency string, from, to time.Time) (items []*billingpb.RoyaltyReportProductSummaryItem, total *billingpb.RoyaltyReportProductSummaryItem, ordersIds []primitive.ObjectID, err error)
}

OrderViewRepositoryInterface is abstraction layer for working with view of order and representation in database.

func NewOrderViewRepository added in v1.3.0

func NewOrderViewRepository(db mongodb.SourceInterface) OrderViewRepositoryInterface

NewOrderViewRepository create and return an object for working with the order view repository. The returned object implements the OrderViewRepositoryInterface interface.

type PaylinkRepositoryInterface added in v1.3.0

type PaylinkRepositoryInterface interface {
	// Insert adds paylink to the collection.
	Insert(context.Context, *billingpb.Paylink) error

	// Update updates the paylink in the collection.
	Update(context.Context, *billingpb.Paylink) error

	// Delete deletes the paylink in the collection.
	Delete(context.Context, *billingpb.Paylink) error

	// GetById returns the paylink by unique identifier.
	GetById(context.Context, string) (*billingpb.Paylink, error)

	// GetByIdAndMerchant returns the paylink by unique identifier and merchant id.
	GetByIdAndMerchant(context.Context, string, string) (*billingpb.Paylink, error)

	// UpdateTotalStat updates data from orders to paylink statistics.
	UpdateTotalStat(context.Context, *billingpb.Paylink) error

	// List returns list of paylinks by merchant id and project id with pagination.
	Find(context.Context, string, string, int64, int64) ([]*billingpb.Paylink, error)

	// FindCount returns count of paylinks by merchant id and project id.
	FindCount(context.Context, string, string) (int64, error)
}

PaylinkRepositoryInterface is abstraction layer for working with paylink and representation in database.

func NewPaylinkRepository added in v1.3.0

NewPaylinkRepository create and return an object for working with the paylink repository. The returned object implements the PaylinkRepositoryInterface interface.

type PaylinkVisitRepositoryInterface added in v1.3.0

type PaylinkVisitRepositoryInterface interface {
	// CountPaylinkVisits counts and returns visits by identifier of paylink between days.
	CountPaylinkVisits(context.Context, string, int64, int64) (int64, error)

	// IncrVisits increment visit by paylink identifier.
	IncrVisits(ctx context.Context, id string) error
}

PaylinkVisitRepositoryInterface is abstraction layer for working with paylink visit and representation in database.

func NewPaylinkVisitRepository added in v1.3.0

func NewPaylinkVisitRepository(db mongodb.SourceInterface) PaylinkVisitRepositoryInterface

NewPaylinkVisitRepository create and return an object for working with the paylink visit repository. The returned object implements the PaylinkVisitRepositoryInterface interface.

type PaymentChannelCostMerchantRepositoryInterface added in v1.3.0

type PaymentChannelCostMerchantRepositoryInterface interface {
	// Insert adds the payment channel cost to the collection.
	Insert(context.Context, *billingpb.PaymentChannelCostMerchant) error

	// Insert adds the multiple payment channel costs to the collection.
	MultipleInsert(context.Context, []*billingpb.PaymentChannelCostMerchant) error

	// Update updates the payment channel cost in the collection.
	Update(context.Context, *billingpb.PaymentChannelCostMerchant) error

	// Delete вудуеу the payment channel cost in the collection.
	Delete(ctx context.Context, obj *billingpb.PaymentChannelCostMerchant) error

	// GetById returns the payment channel cost by unique identity.
	GetById(context.Context, string) (*billingpb.PaymentChannelCostMerchant, error)

	// GetAllForMerchant returns all payment channel costs for merchant.
	GetAllForMerchant(context.Context, string) ([]*billingpb.PaymentChannelCostMerchant, error)

	// GetActiveForMerchant returns active payment channel costs for merchant.
	GetActiveForMerchant(context.Context, string) ([]*billingpb.PaymentChannelCostMerchant, error)

	// Find returns the payment channel costs by merchant id, name, payout currency, region, country and mcc code.
	Find(context.Context, string, string, string, string, string, string) ([]*internalPkg.PaymentChannelCostMerchantSet, error)

	// Update all merchant's tariffs
	DeleteAndInsertMany(ctx context.Context, merchantId string, tariffs []*billingpb.PaymentChannelCostMerchant) error
}

PaymentChannelCostMerchantRepositoryInterface is abstraction layer for working with payment channel cost for merchant and representation in database.

func NewPaymentChannelCostMerchantRepository added in v1.3.0

func NewPaymentChannelCostMerchantRepository(db mongodb.SourceInterface, cache database.CacheInterface) PaymentChannelCostMerchantRepositoryInterface

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

type PaymentChannelCostSystemRepositoryInterface added in v1.3.0

type PaymentChannelCostSystemRepositoryInterface interface {
	// Insert adds the payment channel cost to the collection.
	Insert(context.Context, *billingpb.PaymentChannelCostSystem) error

	// Insert adds the multiple payment channel costs to the collection.
	MultipleInsert(context.Context, []*billingpb.PaymentChannelCostSystem) error

	// Update updates the payment channel cost in the collection.
	Update(context.Context, *billingpb.PaymentChannelCostSystem) error

	// Delete вудуеу the payment channel cost in the collection.
	Delete(ctx context.Context, obj *billingpb.PaymentChannelCostSystem) error

	// GetById returns the payment channel cost by unique identity.
	GetById(context.Context, string) (*billingpb.PaymentChannelCostSystem, error)

	// GetAllForMerchant returns all payment channel costs for merchant.
	GetAll(context.Context) ([]*billingpb.PaymentChannelCostSystem, error)

	// Find returns the payment channel costs by name, region, country, mcc code and operating company id.
	Find(context.Context, string, string, string, string, string) (*billingpb.PaymentChannelCostSystem, error)
}

PaymentChannelCostSystemRepositoryInterface is abstraction layer for working with payment channel cost for system and representation in database.

func NewPaymentChannelCostSystemRepository added in v1.3.0

func NewPaymentChannelCostSystemRepository(db mongodb.SourceInterface, cache database.CacheInterface) PaymentChannelCostSystemRepositoryInterface

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

type PaymentMethodRepositoryInterface added in v1.3.0

type PaymentMethodRepositoryInterface interface {
	// Insert adds the payment method to the collection.
	Insert(context.Context, *billingpb.PaymentMethod) error

	// MultipleInsert adds the multiple payment method to the collection.
	MultipleInsert(context.Context, []*billingpb.PaymentMethod) error

	// Update updates the payment method in the collection.
	Update(context.Context, *billingpb.PaymentMethod) error

	// Delete deleting the payment method.
	Delete(context.Context, *billingpb.PaymentMethod) error

	// GetById returns the payment method by unique identity.
	GetById(context.Context, string) (*billingpb.PaymentMethod, error)

	// GetAll returns the list of payment method.
	GetAll(ctx context.Context) ([]*billingpb.PaymentMethod, error)

	// GetByGroupAndCurrency returns the payment method by group and currency code.
	GetByGroupAndCurrency(ctx context.Context, isProduction bool, group string, currency string) (*billingpb.PaymentMethod, error)

	// GetByGroupAndCurrency returns the list of payment methods in order properties.
	ListByOrder(ctx context.Context, order *billingpb.Order) ([]*billingpb.PaymentMethod, error)

	// FindByName find by name and returns the list of payment methods.
	FindByName(context.Context, string, []string) ([]*billingpb.PaymentMethod, error)
}

PaymentMethodRepositoryInterface is abstraction layer for working with payment method and representation in database.

func NewPaymentMethodRepository added in v1.3.0

NewPaymentMethodRepository create and return an object for working with the payment method repository. The returned object implements the PaymentMethodRepositoryInterface interface.

type PaymentMinLimitSystemRepositoryInterface added in v1.3.0

type PaymentMinLimitSystemRepositoryInterface interface {
	// MultipleInsert adds the multiple payment min limits to the collection.
	MultipleInsert(context.Context, []*billingpb.PaymentMinLimitSystem) error

	// Upsert add or update the payment min limit in the collection.
	Upsert(context.Context, *billingpb.PaymentMinLimitSystem) error

	// GetByCurrency returns the payment min limit by currency code.
	GetByCurrency(context.Context, string) (*billingpb.PaymentMinLimitSystem, error)

	// GetAll returns all payment min limits.
	GetAll(context.Context) ([]*billingpb.PaymentMinLimitSystem, error)
}

PaymentMinLimitSystemRepositoryInterface is abstraction layer for working with payment min limit system and representation in database.

func NewPaymentMinLimitSystemRepository added in v1.3.0

func NewPaymentMinLimitSystemRepository(db mongodb.SourceInterface, cache database.CacheInterface) PaymentMinLimitSystemRepositoryInterface

NewPaymentMinLimitSystemRepository create and return an object for working with the payment min limit repository. The returned object implements the PaymentMinLimitSystemRepositoryInterface interface.

type PaymentSystemRepositoryInterface added in v1.3.0

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

	// MultipleInsert adds the multiple payment systems to the collection.
	MultipleInsert(context.Context, []*billingpb.PaymentSystem) error

	// Update updates the payment system in the collection.
	Update(context.Context, *billingpb.PaymentSystem) error

	// GetById returns the payment system by unique identifier.
	GetById(context.Context, string) (*billingpb.PaymentSystem, error)
}

PaymentSystemRepositoryInterface is abstraction layer for working with payment system and representation in database.

func NewPaymentSystemRepository added in v1.3.0

NewPaymentSystemRepository create and return an object for working with the payment system repository. The returned object implements the PaymentSystemRepositoryInterface interface.

type PayoutRepositoryInterface added in v1.3.0

type PayoutRepositoryInterface interface {
	// Insert adds the payout to the collection.
	Insert(context.Context, *billingpb.PayoutDocument, string, string) error

	// Update updates the payout in the collection.
	Update(context.Context, *billingpb.PayoutDocument, string, string) error

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

	// GetByIdMerchantId returns the payout by unique identity and merchant id.
	GetByIdMerchantId(context.Context, string, string) (*billingpb.PayoutDocument, error)

	// GetBalanceAmount returns balance amount by merchant id and currency code.
	GetBalanceAmount(context.Context, string, string) (float64, error)

	// GetLast returns the latest payout doc by merchant id and currency.
	GetLast(context.Context, string, string) (*billingpb.PayoutDocument, error)

	// Find payouts by merchant, statuses and dates from/to with pagination.
	Find(ctx context.Context, in *billingpb.GetPayoutDocumentsRequest) ([]*billingpb.PayoutDocument, error)

	// FindCount return count of payouts by merchant, statuses and dates from/to.
	FindCount(ctx context.Context, in *billingpb.GetPayoutDocumentsRequest) (int64, error)

	// Return all not paid payout invoices
	FindAll(ctx context.Context) ([]*billingpb.PayoutDocument, error)
}

PayoutRepositoryInterface is abstraction layer for working with payout and representation in database.

func NewPayoutRepository added in v1.3.0

NewPayoutRepository create and return an object for working with the payout repository. The returned object implements the PayoutRepositoryInterface 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)

	// GetAll 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 ProductRepositoryInterface added in v1.3.0

type ProductRepositoryInterface interface {
	// Insert adds the multiple products to the collection.
	MultipleInsert(context.Context, []*billingpb.Product) error

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

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

	// CountByProject return count the products by project id.
	CountByProject(context.Context, string) (int64, error)

	// CountByProjectSku return count the products by project id and sku.
	CountByProjectSku(context.Context, string, string) (int64, error)

	// List returns list of products by merchant id, project id, sku, name and enabled with pagination.
	Find(context.Context, string, string, string, string, int32, int64, int64) ([]*billingpb.Product, error)

	// FindCount returns count of products by merchant id, project id, sku, name and enabled.
	FindCount(context.Context, string, string, string, string, int32) (int64, error)
}

ProductRepositoryInterface is abstraction layer for working with product and representation in database.

func NewProductRepository added in v1.3.0

NewProductRepository create and return an object for working with the product repository. The returned object implements the ProductRepositoryInterface 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 RoyaltyReportFinance added in v1.3.0

type RoyaltyReportFinance struct {
	Items []*postmarkpb.PayloadAttachment `json:"items"`
}

type RoyaltyReportRepositoryInterface added in v1.3.0

type RoyaltyReportRepositoryInterface interface {
	// Insert add the royalty report to the collection.
	Insert(ctx context.Context, document *billingpb.RoyaltyReport, ip, source string) error

	// Update updates the royalty report in the collection.
	Update(ctx context.Context, document *billingpb.RoyaltyReport, ip, source string) error

	// UpdateMany updates multiplies royalty reports by dynamic criteria.
	UpdateMany(ctx context.Context, query bson.M, set bson.M) error

	// GetById returns the royalty report by unique identity.
	GetById(ctx context.Context, id string) (*billingpb.RoyaltyReport, error)

	// GetNonPayoutReports returns the royalty report by unique identity.
	GetNonPayoutReports(ctx context.Context, merchantId, currency string) ([]*billingpb.RoyaltyReport, error)

	// GetByPayoutId returns the royalty report by payout identity.
	GetByPayoutId(ctx context.Context, payoutId string) ([]*billingpb.RoyaltyReport, error)

	// GetBalanceAmount returns royalty balance amount for merchant and currency.
	GetBalanceAmount(ctx context.Context, merchantId, currency string) (float64, error)

	// GetReportExists returns exists a royalty reports by merchant id, currency and dates from/to.
	GetReportExists(ctx context.Context, merchantId, currency string, from, to time.Time) (report *billingpb.RoyaltyReport)

	// GetAll returns the all royalty reports.
	GetAll(ctx context.Context) ([]*billingpb.RoyaltyReport, error)

	// GetByPeriod returns the royalty reports by period of dates.
	GetByPeriod(context.Context, time.Time, time.Time) ([]*billingpb.RoyaltyReport, error)

	// GetByAcceptedExpireWithStatus returns the royalty reports by accepted expire dates with status by filter.
	GetByAcceptedExpireWithStatus(context.Context, time.Time, string) ([]*billingpb.RoyaltyReport, error)

	// GetRoyaltyHistoryById returns the history list of royalty report by report identifier.
	GetRoyaltyHistoryById(ctx context.Context, id string) ([]*billingpb.RoyaltyReportChanges, error)

	// FindByMerchantStatusDates returns the royalty reports by merchant id, status and dates from/to.
	FindByMerchantStatusDates(ctx context.Context, merchantId string, statuses []string, dateFrom, dateTo string, offset, limit int64, sort []string) ([]*billingpb.RoyaltyReport, error)

	// FindCountByMerchantStatusDates returns count of royalty reports by merchant id, status and dates from/to.
	FindCountByMerchantStatusDates(ctx context.Context, merchantId string, statuses []string, dateFrom, dateTo string) (int64, error)

	// Return saved extended form of royalty reports for accountant
	GetAllRoyaltyReportFinanceItems(royaltyReportId string) []*postmarkpb.PayloadAttachment

	// Remove saved extended royalty reports form
	RemoveRoyaltyReportFinanceItems(royaltyReportId string) error

	// Add extended form of royalty reports for accountant to storage
	SetRoyaltyReportFinanceItem(royaltyReportId string, item *postmarkpb.PayloadAttachment) ([]*postmarkpb.PayloadAttachment, error)
}

RoyaltyReportRepositoryInterface is abstraction layer for working with royalty report and representation in database.

func NewRoyaltyReportRepository added in v1.3.0

NewRoyaltyReportRepository create and return an object for working with the royalty report repository. The returned object implements the RoyaltyReportRepositoryInterface 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 VatReportRepositoryInterface added in v1.3.0

type VatReportRepositoryInterface interface {
	// Insert adds a vat report to the collection.
	Insert(context.Context, *billingpb.VatReport) error

	// Update updates a vat report in the collection.
	Update(context.Context, *billingpb.VatReport) error

	// GetById returns a vat report by unique identity.
	GetById(context.Context, string) (*billingpb.VatReport, error)

	// GetById returns list of a vat reports by country code.
	GetByCountry(context.Context, string, []string, int64, int64) ([]*billingpb.VatReport, error)

	// GetByStatus returns list of a vat reports by statuses.
	GetByStatus(context.Context, []string) ([]*billingpb.VatReport, error)

	// GetByCountryPeriod returns a vat report by country and period.
	GetByCountryPeriod(context.Context, string, time.Time, time.Time) (*billingpb.VatReport, error)
}

VatReportRepositoryInterface is abstraction layer for working with vat report and representation in database.

func NewVatReportRepository added in v1.3.0

func NewVatReportRepository(db mongodb.SourceInterface) VatReportRepositoryInterface

NewVatReportRepository create and return an object for working with the vat reports repository. The returned object implements the VatReportRepositoryInterface 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.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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