34 lines
1.3 KiB
Go
34 lines
1.3 KiB
Go
package transaction
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
)
|
|
|
|
type Service struct {
|
|
transactionStore TransactionStore
|
|
}
|
|
|
|
func NewService(transactionStore TransactionStore) *Service {
|
|
return &Service{
|
|
transactionStore: transactionStore,
|
|
}
|
|
}
|
|
|
|
func (s *Service) CreateShopTransaction(ctx context.Context, transaction domain.CreateShopTransaction) (domain.ShopTransaction, error) {
|
|
return s.transactionStore.CreateShopTransaction(ctx, transaction)
|
|
}
|
|
func (s *Service) GetShopTransactionByID(ctx context.Context, id int64) (domain.ShopTransaction, error) {
|
|
return s.transactionStore.GetShopTransactionByID(ctx, id)
|
|
}
|
|
func (s *Service) GetAllShopTransactions(ctx context.Context, filter domain.ShopTransactionFilter) ([]domain.ShopTransaction, error) {
|
|
return s.transactionStore.GetAllShopTransactions(ctx, filter)
|
|
}
|
|
func (s *Service) GetShopTransactionByBranch(ctx context.Context, id int64) ([]domain.ShopTransaction, error) {
|
|
return s.transactionStore.GetShopTransactionByBranch(ctx, id)
|
|
}
|
|
func (s *Service) UpdateShopTransactionVerified(ctx context.Context, id int64, verified bool, approvedBy int64, approverName string) error {
|
|
return s.transactionStore.UpdateShopTransactionVerified(ctx, id, verified, approvedBy, approverName)
|
|
}
|