Skip to content

Commit

Permalink
chore: remove hubspot crm implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
Muchogoc committed Aug 25, 2021
1 parent 4a6f1ae commit 049ca2f
Show file tree
Hide file tree
Showing 27 changed files with 30 additions and 631 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -35,7 +35,7 @@ require (
github.com/vektah/gqlparser/v2 v2.1.0
gitlab.slade360emr.com/go/apiclient v0.0.14
gitlab.slade360emr.com/go/commontools/accounting v0.0.0-20210726041609-f5e1334c2640
gitlab.slade360emr.com/go/commontools/crm v0.0.0-20210726041609-f5e1334c2640
gitlab.slade360emr.com/go/commontools/crm v0.0.0-20210726041609-f5e1334c2640 // indirect
go.opencensus.io v0.23.0
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.21.0
go.opentelemetry.io/otel v1.0.0-RC1
Expand Down
1 change: 0 additions & 1 deletion go.sum
Expand Up @@ -97,7 +97,6 @@ github.com/brianvoe/gofakeit v3.18.0+incompatible h1:wDOmHc9DLG4nRjUVVaxA+CEglKO
github.com/brianvoe/gofakeit v3.18.0+incompatible/go.mod h1:kfwdRA90vvNhPutZWfH7WPaDzUjz+CZFqG+rPkOjGOc=
github.com/brianvoe/gofakeit/v5 v5.11.2 h1:Ny5Nsf4z2023ZvYP8ujW8p5B1t5sxhdFaQ/0IYXbeSA=
github.com/brianvoe/gofakeit/v5 v5.11.2/go.mod h1:/ZENnKqX+XrN8SORLe/fu5lZDIo1tuPncWuRD+eyhSI=
github.com/brianvoe/gofakeit/v6 v6.5.0 h1:zoWqGsuB8TB4MSwUZXtV3OwUSdzi8EHeXO8JfReRIHg=
github.com/brianvoe/gofakeit/v6 v6.5.0/go.mod h1:palrJUk4Fyw38zIFB/uBZqsgzW5VsNllhHKKwAebzew=
github.com/casbin/casbin/v2 v2.31.3 h1:NaPzGmLYWAtEgItUjqH8aGP6cvIYOY2X4HNMusCuuzY=
github.com/casbin/casbin/v2 v2.31.3/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg=
Expand Down
9 changes: 0 additions & 9 deletions pkg/onboarding/application/common/common.go
Expand Up @@ -79,12 +79,3 @@ const (
PartnerNavActionTitle = "Partners"
PartnerNavActionDescription = "Partner Navigation action"
)

// PubSub topic names
const (
// CreateCRMContact is the TopicID for CRM contact creation
CreateCRMContact = "crm.contact.create"

// UpdateCRMContact is the topicID for CRM contact updates
UpdateCRMContact = "crm.contact.update"
)
16 changes: 0 additions & 16 deletions pkg/onboarding/application/dto/input.go
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/savannahghi/profileutils"
"github.com/savannahghi/scalarutils"
dm "gitlab.slade360emr.com/go/commontools/accounting/pkg/domain"
CRMDomain "gitlab.slade360emr.com/go/commontools/crm/pkg/domain"
)

// UserProfileInput is used to create or update a user's profile.
Expand Down Expand Up @@ -303,21 +302,6 @@ type RegisterAdminInput struct {
RoleIDs []string `json:"roleIDs"`
}

// ContactLeadInput ...
type ContactLeadInput struct {
ContactType string `json:"contact_type,omitempty"`
ContactValue string `json:"contact_value,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
DateOfBirth scalarutils.Date `json:"date_of_birth,omitempty"`
IsSync bool `json:"isSync" firestore:"IsSync"`
TimeSync *time.Time `json:"timeSync" firestore:"TimeSync"`
OptOut CRMDomain.GeneralOptionType `json:"opt_out,omitempty"`
WantCover bool `json:"wantCover" firestore:"wantCover"`
ContactChannel string `json:"contact_channel,omitempty"`
IsRegistered bool `json:"is_registered,omitempty"`
}

// AgentFilterInput is used to supply filter parameters for agent filter inputs
type AgentFilterInput struct {
PhoneNumber string `json:"phoneNumber"`
Expand Down
12 changes: 0 additions & 12 deletions pkg/onboarding/application/dto/output.go
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/savannahghi/firebasetools"
"github.com/savannahghi/onboarding/pkg/onboarding/domain"
"github.com/savannahghi/profileutils"
crmDomain "gitlab.slade360emr.com/go/commontools/crm/pkg/domain"
)

// BusinessPartnerEdge is used to serialize GraphQL Relay edges for organization
Expand Down Expand Up @@ -134,17 +133,6 @@ type UserInfo struct {
UID string `json:"rawId,omitempty"`
}

// Segment represents the Segments data
type Segment struct {
Properties crmDomain.ContactProperties `json:"properties" firestore:"properties"`
Wing string `json:"wing" firestore:"wing"`
MessageSent string `json:"message_sent" firestore:"message_sent"`
IsSynced string `json:"is_synced" firestore:"is_synced"`
TimeSynced string `json:"time_synced" firestore:"time_synced"`
PayerSladeCode string `json:"payer_slade_code" firestore:"payersladecode"`
MemberNumber string `json:"member_number" firestore:"membernumber"`
}

// RoleOutput is the formatted output with scopes and permissions
type RoleOutput struct {
ID string `json:"id"`
Expand Down
11 changes: 0 additions & 11 deletions pkg/onboarding/domain/models.go
Expand Up @@ -100,17 +100,6 @@ type NHIFDetails struct {
NHIFCardPhotoID string `json:"nhifCardPhotoID" firestore:"nhifCardPhotoID"`
}

// CRMContact represents a stored CRM contact
type CRMContact struct {
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
DOB string `json:"dob,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"`
OptOut string `json:"opt_out,omitempty"`
TimeStamp string `json:"time_stamp,omitempty"`
IsSynced string `json:"is_synced,omitempty"`
}

// Microservice identifies a micro-service that conforms to the Apollo Graphqql
// federation specification. These microservices are composed by an Apollo
// Gateway into a single data graph.
Expand Down
7 changes: 0 additions & 7 deletions pkg/onboarding/infrastructure/database/fb/firebase.go
Expand Up @@ -47,7 +47,6 @@ const (
communicationsSettingsCollectionName = "communications_settings"
smsCollectionName = "incoming_sms"
firebaseExchangeRefreshTokenURL = "https://securetoken.googleapis.com/v1/token?key="
marketingDataCollectionName = "marketing_data"
rolesRevocationCollectionName = "role_revocations"
rolesCollectionName = "user_roles"
)
Expand Down Expand Up @@ -135,12 +134,6 @@ func (fr Repository) GetSMSCollectionName() string {
return suffixed
}

// GetMarketingDataCollectionName ...
func (fr Repository) GetMarketingDataCollectionName() string {
suffixed := firebasetools.SuffixCollection(marketingDataCollectionName)
return suffixed
}

// GetRolesCollectionName ...
func (fr Repository) GetRolesCollectionName() string {
suffixed := firebasetools.SuffixCollection(rolesCollectionName)
Expand Down
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/savannahghi/onboarding/pkg/onboarding/application/dto"
"github.com/savannahghi/onboarding/pkg/onboarding/application/utils"
"gitlab.slade360emr.com/go/commontools/crm/pkg/infrastructure/services/hubspot"

"fmt"

Expand Down Expand Up @@ -36,13 +35,10 @@ import (

"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/engagement"

crmExt "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/crm"
"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging"
pubsubmessaging "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub"
"github.com/savannahghi/onboarding/pkg/onboarding/presentation/interactor"
"github.com/savannahghi/onboarding/pkg/onboarding/usecases"
hubspotRepo "gitlab.slade360emr.com/go/commontools/crm/pkg/infrastructure/database/fs"
hubspotUsecases "gitlab.slade360emr.com/go/commontools/crm/pkg/usecases"
)

const (
Expand Down Expand Up @@ -86,7 +82,6 @@ func TestMain(m *testing.M) {
r.GetCustomerProfileCollectionName(),
r.GetExperimentParticipantCollectionName(),
r.GetKCYProcessCollectionName(),
r.GetMarketingDataCollectionName(),
r.GetNHIFDetailsCollectionName(),
r.GetProfileNudgesCollectionName(),
r.GetSMSCollectionName(),
Expand Down Expand Up @@ -148,26 +143,18 @@ func InitializeTestService(ctx context.Context) (*interactor.Interactor, error)
firestoreExtension := fb.NewFirestoreClientExtension(fsc)
fr := fb.NewFirebaseRepository(firestoreExtension, fbc)
engage := engagement.NewServiceEngagementImpl(engagementClient, ext)
// hubspot usecases
hubspotService := hubspot.NewHubSpotService()
hubspotfr, err := hubspotRepo.NewHubSpotFirebaseRepository(ctx, hubspotService)
if err != nil {
return nil, fmt.Errorf("failed to initialize hubspot crm repository: %w", err)
}
hubspotUsecases := hubspotUsecases.NewHubSpotUsecases(hubspotfr)
crmExt := crmExt.NewCrmService(hubspotUsecases)

ps, err := pubsubmessaging.NewServicePubSubMessaging(
pubSubClient,
ext,
crmExt,
fr,
)
if err != nil {
return nil, fmt.Errorf("unable to initialize new pubsub messaging service: %w", err)
}
mes := messaging.NewServiceMessagingImpl(ext)
pinExt := extension.NewPINExtensionImpl()
profile := usecases.NewProfileUseCase(fr, ext, engage, ps, crmExt)
profile := usecases.NewProfileUseCase(fr, ext, engage, ps)
supplier := usecases.NewSupplierUseCases(fr, profile, engage, mes, ext, ps)
login := usecases.NewLoginUseCases(fr, profile, ext, pinExt)
survey := usecases.NewSurveyUseCases(fr, ext)
Expand All @@ -183,7 +170,6 @@ func InitializeTestService(ctx context.Context) (*interactor.Interactor, error)
UserPIN: userpin,
Engagement: engage,
PubSub: ps,
CrmExt: crmExt,
}, nil
}

Expand Down
35 changes: 0 additions & 35 deletions pkg/onboarding/infrastructure/services/crm/mock/service_mock.go

This file was deleted.

48 changes: 0 additions & 48 deletions pkg/onboarding/infrastructure/services/crm/service.go

This file was deleted.

14 changes: 0 additions & 14 deletions pkg/onboarding/infrastructure/services/pubsub/mock/service_mock.go
Expand Up @@ -3,8 +3,6 @@ package mock
import (
"context"
"net/http"

"gitlab.slade360emr.com/go/commontools/crm/pkg/domain"
)

// FakeServicePubSub ...
Expand All @@ -29,8 +27,6 @@ type FakeServicePubSub struct {
r *http.Request,
)
AddEngagementPubsubNameSpaceFn func(topic string) string
NotifyCreateContactFn func(ctx context.Context, contact domain.CRMContact) error
NotifyUpdateContactFn func(ctx context.Context, contact domain.CRMContact) error
}

// AddPubSubNamespace ...
Expand Down Expand Up @@ -88,13 +84,3 @@ func (m *FakeServicePubSub) ReceivePubSubPushMessages(
func (m *FakeServicePubSub) AddEngagementPubsubNameSpace(topic string) string {
return m.AddEngagementPubsubNameSpaceFn(topic)
}

// NotifyCreateContact ..
func (m *FakeServicePubSub) NotifyCreateContact(ctx context.Context, contact domain.CRMContact) error {
return m.NotifyCreateContactFn(ctx, contact)
}

// NotifyUpdateContact ..
func (m *FakeServicePubSub) NotifyUpdateContact(ctx context.Context, contact domain.CRMContact) error {
return m.NotifyUpdateContactFn(ctx, contact)
}
42 changes: 0 additions & 42 deletions pkg/onboarding/infrastructure/services/pubsub/publisher.go

This file was deleted.

0 comments on commit 049ca2f

Please sign in to comment.