package service import ( "context" "fmt" "apskel-pos-be/internal/models" "apskel-pos-be/internal/processor" ) type CustomerPointsService interface { GetCustomerPoints(ctx context.Context, customerID string) (*models.GetCustomerPointsResponse, error) GetCustomerTokens(ctx context.Context, customerID string) (*models.GetCustomerTokensResponse, error) GetCustomerWallet(ctx context.Context, customerID string) (*models.GetCustomerWalletResponse, error) } type customerPointsService struct { customerPointsProcessor *processor.CustomerPointsProcessor } func NewCustomerPointsService(customerPointsProcessor *processor.CustomerPointsProcessor) CustomerPointsService { return &customerPointsService{ customerPointsProcessor: customerPointsProcessor, } } func (s *customerPointsService) GetCustomerPoints(ctx context.Context, customerID string) (*models.GetCustomerPointsResponse, error) { if customerID == "" { return nil, fmt.Errorf("customer ID is required") } response, err := s.customerPointsProcessor.GetCustomerTotalPointsAPI(ctx, customerID) if err != nil { return nil, fmt.Errorf("failed to get customer points: %w", err) } return response, nil } func (s *customerPointsService) GetCustomerTokens(ctx context.Context, customerID string) (*models.GetCustomerTokensResponse, error) { if customerID == "" { return nil, fmt.Errorf("customer ID is required") } response, err := s.customerPointsProcessor.GetCustomerTotalTokensAPI(ctx, customerID) if err != nil { return nil, fmt.Errorf("failed to get customer tokens: %w", err) } return response, nil } func (s *customerPointsService) GetCustomerWallet(ctx context.Context, customerID string) (*models.GetCustomerWalletResponse, error) { if customerID == "" { return nil, fmt.Errorf("customer ID is required") } response, err := s.customerPointsProcessor.GetCustomerWalletAPI(ctx, customerID) if err != nil { return nil, fmt.Errorf("failed to get customer wallet: %w", err) } return response, nil }