make it concrete
parent
7596d7e2da
commit
0b92ff9427
|
@ -2,16 +2,54 @@ package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// AccountActivityWrapper wraps the object with workflow params
|
// AccountActivityWrapper wraps the object with workflow params
|
||||||
type AccountActivityWrapper struct {
|
type AccountActivityWrapper struct {
|
||||||
Obj crm_models.Account
|
|
||||||
APIKey string
|
APIKey string
|
||||||
SagaID string
|
SagaID string
|
||||||
SagaType string
|
SagaType string
|
||||||
|
//
|
||||||
|
AccountSource string
|
||||||
|
AdministrativeLevel string
|
||||||
|
BillingAddress Address
|
||||||
|
BillingContactID string
|
||||||
|
BillingPreference string
|
||||||
|
BusinessAddress Address
|
||||||
|
CannabisCustomer bool
|
||||||
|
CompanyID string
|
||||||
|
CoordinateID string
|
||||||
|
CustomerID string
|
||||||
|
CustomerPriority string
|
||||||
|
DBA string
|
||||||
|
DefaultAddress Address
|
||||||
|
DefaultBackendID string
|
||||||
|
DefaultDeliveryContactID string
|
||||||
|
DefaultEndUserID string
|
||||||
|
Description string
|
||||||
|
EIN string
|
||||||
|
Email string
|
||||||
|
EnrollmentStatus string
|
||||||
|
Fax string
|
||||||
|
ISPCustomer bool
|
||||||
|
MSPCustomer bool
|
||||||
|
Name string
|
||||||
|
OrderContactID string
|
||||||
|
OrderEmail string
|
||||||
|
OwnerID string
|
||||||
|
ParentID string
|
||||||
|
Phone string
|
||||||
|
PlaceID string
|
||||||
|
PreparerID string
|
||||||
|
RatingEngineID string
|
||||||
|
Ref string
|
||||||
|
ShippingAddress Address
|
||||||
|
ShippingContactID string
|
||||||
|
Site string
|
||||||
|
TelecomCustomer bool
|
||||||
|
TenantID string
|
||||||
|
Type string
|
||||||
|
Website string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Account is a DB struct
|
// Account is a DB struct
|
||||||
|
|
|
@ -2,16 +2,45 @@ package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// CompanyActivityWrapper wraps the object with workflow params
|
// CompanyActivityWrapper wraps the object with workflow params
|
||||||
type CompanyActivityWrapper struct {
|
type CompanyActivityWrapper struct {
|
||||||
Obj crm_models.Company
|
|
||||||
APIKey string
|
APIKey string
|
||||||
SagaID string
|
SagaID string
|
||||||
SagaType string
|
SagaType string
|
||||||
|
//
|
||||||
|
AccountID string
|
||||||
|
AccountNumberPrefix string
|
||||||
|
BillingAddress Address
|
||||||
|
BillingAdvice string
|
||||||
|
BillingContactID string
|
||||||
|
BillingEmail string
|
||||||
|
BillingPhone string
|
||||||
|
BillingWebsite string
|
||||||
|
CoaTemplateID string
|
||||||
|
ColorAccent1 string
|
||||||
|
ColorAccent2 string
|
||||||
|
ColorPrimary string
|
||||||
|
CurrentPeriodID string
|
||||||
|
CustomerSuccessID string
|
||||||
|
DefaultAddress Address
|
||||||
|
DefaultCompany bool
|
||||||
|
FontBody string
|
||||||
|
FontHeading string
|
||||||
|
FontHeadingNarrow string
|
||||||
|
FontLink string
|
||||||
|
FontMono string
|
||||||
|
International bool
|
||||||
|
LastAccountNumber int64
|
||||||
|
LastTaxtypeNumber int64
|
||||||
|
Logo string
|
||||||
|
Name string
|
||||||
|
OwnerID string
|
||||||
|
PreparerID string
|
||||||
|
PricebookID string
|
||||||
|
TenantID string
|
||||||
|
UserTechLeadID string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Company is a DB struct
|
// Company is a DB struct
|
||||||
|
|
|
@ -2,8 +2,6 @@ package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewContactActivity is an activity identifier
|
// NewContactActivity is an activity identifier
|
||||||
|
@ -11,10 +9,38 @@ const NewContactActivity = "NEW_CONTACT_ACTIVITY"
|
||||||
|
|
||||||
// ContactActivityWrapper wraps the object with workflow params
|
// ContactActivityWrapper wraps the object with workflow params
|
||||||
type ContactActivityWrapper struct {
|
type ContactActivityWrapper struct {
|
||||||
Obj crm_models.Contact
|
|
||||||
APIKey string
|
APIKey string
|
||||||
SagaID string
|
SagaID string
|
||||||
SagaType string
|
SagaType string
|
||||||
|
//
|
||||||
|
AccountID string
|
||||||
|
AssistantName string
|
||||||
|
AssistantPhone string
|
||||||
|
BirthDate string
|
||||||
|
Department string
|
||||||
|
Description string
|
||||||
|
Email string
|
||||||
|
FirstName string
|
||||||
|
HomePhone string
|
||||||
|
LastName string
|
||||||
|
LeadSource string
|
||||||
|
Level string
|
||||||
|
LinkedIn string
|
||||||
|
MailingAddress Address
|
||||||
|
MobilePhone string
|
||||||
|
Name string
|
||||||
|
OtherAddress Address
|
||||||
|
OtherPhone string
|
||||||
|
OwnerID string
|
||||||
|
PersonalEmail string
|
||||||
|
Phone string
|
||||||
|
PhotoURL string
|
||||||
|
Ref string
|
||||||
|
ReportsToID string
|
||||||
|
Salutation string
|
||||||
|
Status string
|
||||||
|
Title string
|
||||||
|
Type string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Contact is a first-class object
|
// Contact is a first-class object
|
||||||
|
|
24
app/lead.go
24
app/lead.go
|
@ -2,16 +2,34 @@ package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// LeadActivityWrapper wraps the object with workflow params
|
// LeadActivityWrapper wraps the object with workflow params
|
||||||
type LeadActivityWrapper struct {
|
type LeadActivityWrapper struct {
|
||||||
Obj crm_models.Lead
|
|
||||||
APIKey string
|
APIKey string
|
||||||
SagaID string
|
SagaID string
|
||||||
SagaType string
|
SagaType string
|
||||||
|
//
|
||||||
|
Address Address
|
||||||
|
Company string
|
||||||
|
Description string
|
||||||
|
Email string
|
||||||
|
FirstName string
|
||||||
|
LastName string
|
||||||
|
MobilePhone string
|
||||||
|
Name string
|
||||||
|
Phone string
|
||||||
|
RefererURL string
|
||||||
|
Status string
|
||||||
|
TenantID string
|
||||||
|
Title string
|
||||||
|
Type string
|
||||||
|
UTMCampaign string
|
||||||
|
UTMContent string
|
||||||
|
UTMMedium string
|
||||||
|
UTMSource string
|
||||||
|
UTMTerm string
|
||||||
|
Website string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lead is a first-class object type
|
// Lead is a first-class object type
|
||||||
|
|
|
@ -2,16 +2,34 @@ package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// PaymentMethodActivityWrapper wraps the object with workflow params
|
// PaymentMethodActivityWrapper wraps the object with workflow params
|
||||||
type PaymentMethodActivityWrapper struct {
|
type PaymentMethodActivityWrapper struct {
|
||||||
Obj ops_models.PaymentMethod
|
|
||||||
APIKey string
|
APIKey string
|
||||||
SagaID string
|
SagaID string
|
||||||
SagaType string
|
SagaType string
|
||||||
|
//
|
||||||
|
AccountID string
|
||||||
|
AchAccountType string
|
||||||
|
AchBankAccount string
|
||||||
|
AchRouting string
|
||||||
|
Active bool
|
||||||
|
Autopay bool
|
||||||
|
BankName string
|
||||||
|
BillingContactID string
|
||||||
|
CCnumber string
|
||||||
|
CCtype string
|
||||||
|
ContractID string
|
||||||
|
Default bool
|
||||||
|
ExpirationMonth string
|
||||||
|
ExpirationYear string
|
||||||
|
Gateway string
|
||||||
|
GatewayKey string
|
||||||
|
Nickname string
|
||||||
|
RecordType string
|
||||||
|
Ref string
|
||||||
|
TenantID string
|
||||||
}
|
}
|
||||||
|
|
||||||
// PaymentMethod is a first class object type
|
// PaymentMethod is a first class object type
|
||||||
|
|
|
@ -2,16 +2,23 @@ package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/devops/devops_models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TenantActivityWrapper wraps the object with workflow params
|
// TenantActivityWrapper wraps the object with workflow params
|
||||||
type TenantActivityWrapper struct {
|
type TenantActivityWrapper struct {
|
||||||
Obj devops_models.Tenant
|
|
||||||
APIKey string
|
APIKey string
|
||||||
SagaID string
|
SagaID string
|
||||||
SagaType string
|
SagaType string
|
||||||
|
//
|
||||||
|
AccountID string
|
||||||
|
Active bool
|
||||||
|
Databases []Database
|
||||||
|
Roles []Role
|
||||||
|
Status string
|
||||||
|
TenantName string
|
||||||
|
TenantUsers []TenantUser
|
||||||
|
Type string
|
||||||
|
Version string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tenant is a first class object type
|
// Tenant is a first class object type
|
||||||
|
|
|
@ -13,9 +13,51 @@ const StoreAccountActivityID = "STORE_ACCOUNT_ACTIVITY"
|
||||||
|
|
||||||
// StoreAccountActivity posts a new account object to datastore
|
// StoreAccountActivity posts a new account object to datastore
|
||||||
func StoreAccountActivity(ctx workflow.Context, w app.AccountActivityWrapper) error { //nolint:gocritic // what we want
|
func StoreAccountActivity(ctx workflow.Context, w app.AccountActivityWrapper) error { //nolint:gocritic // what we want
|
||||||
|
obj := &crm_models.Account{
|
||||||
|
AccountSource: w.AccountSource,
|
||||||
|
AdministrativeLevel: w.AdministrativeLevel,
|
||||||
|
BillingAddress: w.BillingAddress.MarshalToCrm(),
|
||||||
|
BillingContactID: w.BillingContactID,
|
||||||
|
BillingPreference: w.BillingPreference,
|
||||||
|
BusinessAddress: w.BusinessAddress.MarshalToCrm(),
|
||||||
|
CannabisCustomer: w.CannabisCustomer,
|
||||||
|
CompanyID: w.CompanyID,
|
||||||
|
CoordinateID: w.CoordinateID,
|
||||||
|
CustomerID: w.CustomerID,
|
||||||
|
CustomerPriority: w.CustomerPriority,
|
||||||
|
DBA: w.DBA,
|
||||||
|
DefaultAddress: w.DefaultAddress.MarshalToCrm(),
|
||||||
|
DefaultBackendID: w.DefaultBackendID,
|
||||||
|
DefaultDeliveryContactID: w.DefaultDeliveryContactID,
|
||||||
|
DefaultEndUserID: w.DefaultEndUserID,
|
||||||
|
Description: w.Description,
|
||||||
|
EIN: w.EIN,
|
||||||
|
Email: w.Email,
|
||||||
|
EnrollmentStatus: w.EnrollmentStatus,
|
||||||
|
Fax: w.Fax,
|
||||||
|
ISPCustomer: w.ISPCustomer,
|
||||||
|
MSPCustomer: w.MSPCustomer,
|
||||||
|
Name: w.Name,
|
||||||
|
OrderContactID: w.OrderContactID,
|
||||||
|
OrderEmail: w.OrderEmail,
|
||||||
|
OwnerID: w.OwnerID,
|
||||||
|
ParentID: w.ParentID,
|
||||||
|
Phone: w.Phone,
|
||||||
|
PlaceID: w.PlaceID,
|
||||||
|
PreparerID: w.PreparerID,
|
||||||
|
RatingEngineID: w.RatingEngineID,
|
||||||
|
Ref: w.Ref,
|
||||||
|
ShippingAddress: w.ShippingAddress.MarshalToCrm(),
|
||||||
|
Site: w.Site,
|
||||||
|
TelecomCustomer: w.TelecomCustomer,
|
||||||
|
TenantID: w.TenantID,
|
||||||
|
Type: w.Type,
|
||||||
|
Website: w.Website,
|
||||||
|
}
|
||||||
|
|
||||||
postAccountParams := accounts.NewPostAccountsParamsWithTimeout(postTimeout)
|
postAccountParams := accounts.NewPostAccountsParamsWithTimeout(postTimeout)
|
||||||
postAccountParams.AccountRequest = &crm_models.AccountRequest{
|
postAccountParams.AccountRequest = &crm_models.AccountRequest{
|
||||||
Data: []*crm_models.Account{&w.Obj},
|
Data: []*crm_models.Account{obj},
|
||||||
}
|
}
|
||||||
_, err := crmClient.Accounts.PostAccounts(
|
_, err := crmClient.Accounts.PostAccounts(
|
||||||
postAccountParams,
|
postAccountParams,
|
||||||
|
|
|
@ -16,12 +16,42 @@ import (
|
||||||
|
|
||||||
// StoreContactActivity posts a new contact object to datastore
|
// StoreContactActivity posts a new contact object to datastore
|
||||||
func StoreContactActivity(ctx workflow.Context, w app.ContactActivityWrapper) error { //nolint:gocritic // what we want
|
func StoreContactActivity(ctx workflow.Context, w app.ContactActivityWrapper) error { //nolint:gocritic // what we want
|
||||||
postContactParams := contacts.NewPostContactsParamsWithTimeout(postTimeout)
|
obj := &crm_models.Contact{
|
||||||
if w.Obj.Name == "" {
|
AccountID: w.AccountID,
|
||||||
w.Obj.Name = w.Obj.FirstName + " " + w.Obj.LastName
|
AssistantName: w.AssistantName,
|
||||||
|
AssistantPhone: w.AssistantPhone,
|
||||||
|
BirthDate: w.BirthDate,
|
||||||
|
Department: w.Department,
|
||||||
|
Description: w.Description,
|
||||||
|
Email: w.Email,
|
||||||
|
FirstName: w.FirstName,
|
||||||
|
HomePhone: w.HomePhone,
|
||||||
|
LastName: w.LastName,
|
||||||
|
LeadSource: w.LeadSource,
|
||||||
|
Level: w.Level,
|
||||||
|
LinkedIn: w.LinkedIn,
|
||||||
|
MobilePhone: w.MobilePhone,
|
||||||
|
Name: w.Name,
|
||||||
|
OtherPhone: w.OtherPhone,
|
||||||
|
OwnerID: w.OwnerID,
|
||||||
|
PersonalEmail: w.PersonalEmail,
|
||||||
|
Phone: w.Phone,
|
||||||
|
PhotoURL: w.PhotoURL,
|
||||||
|
Ref: w.Ref,
|
||||||
|
ReportsToID: w.ReportsToID,
|
||||||
|
Salutation: w.Salutation,
|
||||||
|
Status: w.Status,
|
||||||
|
Title: w.Title,
|
||||||
|
Type: w.Type,
|
||||||
|
MailingAddress: w.MailingAddress.MarshalToCrm(),
|
||||||
|
OtherAddress: w.OtherAddress.MarshalToCrm(),
|
||||||
}
|
}
|
||||||
|
if obj.Name == "" {
|
||||||
|
obj.Name = obj.FirstName + " " + obj.LastName
|
||||||
|
}
|
||||||
|
postContactParams := contacts.NewPostContactsParamsWithTimeout(postTimeout)
|
||||||
postContactParams.ContactsRequest = &crm_models.ContactRequest{
|
postContactParams.ContactsRequest = &crm_models.ContactRequest{
|
||||||
Data: []*crm_models.Contact{&w.Obj},
|
Data: []*crm_models.Contact{obj},
|
||||||
}
|
}
|
||||||
_, err := crmClient.Contacts.PostContacts(postContactParams,
|
_, err := crmClient.Contacts.PostContacts(postContactParams,
|
||||||
httptransport.APIKeyAuth(
|
httptransport.APIKeyAuth(
|
||||||
|
@ -61,7 +91,7 @@ Alert! New Contact Inquiry from Taxnexus.io website.
|
||||||
emailParams.OutgoingEmailMessageRequest = &workflow_models.OutgoingEmailMessageRequest{
|
emailParams.OutgoingEmailMessageRequest = &workflow_models.OutgoingEmailMessageRequest{
|
||||||
Data: []*workflow_models.OutgoingEmailMessage{
|
Data: []*workflow_models.OutgoingEmailMessage{
|
||||||
{
|
{
|
||||||
Subject: "New lead from " + w.Obj.Name,
|
Subject: "New lead from " + w.Name,
|
||||||
ValidatedFromAddress: "support@taxnexus.net",
|
ValidatedFromAddress: "support@taxnexus.net",
|
||||||
ToAddress: "info@taxnexus.net",
|
ToAddress: "info@taxnexus.net",
|
||||||
FromName: "Taxnexus Onboarding",
|
FromName: "Taxnexus Onboarding",
|
||||||
|
|
|
@ -15,13 +15,35 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// StoreLeadActivity posts a new lead object to datastore
|
// StoreLeadActivity posts a new lead object to datastore
|
||||||
func StoreLeadActivity(ctx workflow.Context, w app.LeadActivityWrapper) error { //nolint:gocritic // what we want
|
func StoreLeadActivity(ctx workflow.Context, w app.LeadActivityWrapper) error { //nolint:gocritic // don't care
|
||||||
|
obj := &crm_models.Lead{
|
||||||
|
Address: w.Address.MarshalToCrm(),
|
||||||
|
Company: w.Company,
|
||||||
|
Description: w.Description,
|
||||||
|
Email: w.Email,
|
||||||
|
FirstName: w.FirstName,
|
||||||
|
LastName: w.LastName,
|
||||||
|
MobilePhone: w.MobilePhone,
|
||||||
|
Phone: w.Phone,
|
||||||
|
RefererURL: w.RefererURL,
|
||||||
|
Status: w.Status,
|
||||||
|
TenantID: w.TenantID,
|
||||||
|
Title: w.Title,
|
||||||
|
Type: w.Type,
|
||||||
|
UTMCampaign: w.UTMCampaign,
|
||||||
|
UTMContent: w.UTMContent,
|
||||||
|
UTMMedium: w.UTMMedium,
|
||||||
|
UTMSource: w.UTMSource,
|
||||||
|
UTMTerm: w.UTMTerm,
|
||||||
|
Website: w.Website,
|
||||||
|
Name: w.Name,
|
||||||
|
}
|
||||||
postLeadParams := leads.NewPostLeadsParamsWithTimeout(postTimeout)
|
postLeadParams := leads.NewPostLeadsParamsWithTimeout(postTimeout)
|
||||||
if w.Obj.Name == "" {
|
if obj.Name == "" {
|
||||||
w.Obj.Name = w.Obj.FirstName + " " + w.Obj.LastName
|
obj.Name = obj.FirstName + " " + obj.LastName
|
||||||
}
|
}
|
||||||
postLeadParams.LeadRequest = &crm_models.LeadRequest{
|
postLeadParams.LeadRequest = &crm_models.LeadRequest{
|
||||||
Data: []*crm_models.Lead{&w.Obj},
|
Data: []*crm_models.Lead{obj},
|
||||||
}
|
}
|
||||||
_, err := crmClient.Leads.PostLeads(postLeadParams,
|
_, err := crmClient.Leads.PostLeads(postLeadParams,
|
||||||
httptransport.APIKeyAuth(
|
httptransport.APIKeyAuth(
|
||||||
|
@ -61,7 +83,7 @@ Alert! New Lead Inquiry from Taxnexus.io website.
|
||||||
emailParams.OutgoingEmailMessageRequest = &workflow_models.OutgoingEmailMessageRequest{
|
emailParams.OutgoingEmailMessageRequest = &workflow_models.OutgoingEmailMessageRequest{
|
||||||
Data: []*workflow_models.OutgoingEmailMessage{
|
Data: []*workflow_models.OutgoingEmailMessage{
|
||||||
{
|
{
|
||||||
Subject: "New lead from " + w.Obj.Name,
|
Subject: "New lead from " + w.Name,
|
||||||
ValidatedFromAddress: "support@taxnexus.net",
|
ValidatedFromAddress: "support@taxnexus.net",
|
||||||
ToAddress: "info@taxnexus.net",
|
ToAddress: "info@taxnexus.net",
|
||||||
FromName: "Taxnexus Onboarding",
|
FromName: "Taxnexus Onboarding",
|
||||||
|
|
|
@ -3,8 +3,6 @@ package rules
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
|
|
||||||
"code.tnxs.net/taxnexus/lib/app"
|
"code.tnxs.net/taxnexus/lib/app"
|
||||||
"go.temporal.io/sdk/workflow"
|
"go.temporal.io/sdk/workflow"
|
||||||
)
|
)
|
||||||
|
@ -39,51 +37,17 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
|
||||||
err := workflow.ExecuteActivity(ctx,
|
err := workflow.ExecuteActivity(ctx,
|
||||||
StoreContactActivity,
|
StoreContactActivity,
|
||||||
app.ContactActivityWrapper{
|
app.ContactActivityWrapper{
|
||||||
Obj: crm_models.Contact{
|
Description: w.Description,
|
||||||
AccountID: "",
|
Email: w.Email,
|
||||||
AssistantName: "",
|
FirstName: w.FirstName,
|
||||||
AssistantPhone: "",
|
LastName: w.LastName,
|
||||||
BirthDate: "",
|
MobilePhone: w.MobilePhone,
|
||||||
Department: "",
|
Name: w.Name,
|
||||||
Description: w.Description,
|
Phone: w.Phone,
|
||||||
DoNotCall: false,
|
Title: w.Title,
|
||||||
Email: w.Email,
|
APIKey: w.APIKey,
|
||||||
EmailBounceDate: "",
|
SagaID: w.SagaID,
|
||||||
EmailBouncedReason: "",
|
SagaType: w.SagaType,
|
||||||
EnrollmentStatus: "",
|
|
||||||
Fax: "",
|
|
||||||
FirstName: w.FirstName,
|
|
||||||
HasOptedOutOfEmail: false,
|
|
||||||
HasOptedOutOfFax: false,
|
|
||||||
HomePhone: "",
|
|
||||||
IsEmailBounced: false,
|
|
||||||
IsProvisioned: false,
|
|
||||||
LastName: w.LastName,
|
|
||||||
LeadSource: "",
|
|
||||||
Level: "",
|
|
||||||
LinkedIn: "",
|
|
||||||
MailingAddress: &crm_models.Address{},
|
|
||||||
MailingLists: "",
|
|
||||||
MobilePhone: w.MobilePhone,
|
|
||||||
Name: w.Name,
|
|
||||||
OtherAddress: &crm_models.Address{},
|
|
||||||
OtherPhone: "",
|
|
||||||
OwnerID: "",
|
|
||||||
PersonalEmail: "",
|
|
||||||
Phone: w.Phone,
|
|
||||||
PhotoURL: "",
|
|
||||||
RecruitingStatus: "",
|
|
||||||
Ref: "",
|
|
||||||
ReportsToID: "",
|
|
||||||
Salutation: "",
|
|
||||||
Status: "",
|
|
||||||
TenantID: "",
|
|
||||||
Title: w.Title,
|
|
||||||
Type: "",
|
|
||||||
},
|
|
||||||
APIKey: w.APIKey,
|
|
||||||
SagaID: w.SagaID,
|
|
||||||
SagaType: w.SagaType,
|
|
||||||
}).Get(ctx, nil)
|
}).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -91,93 +55,13 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
|
||||||
err = workflow.ExecuteActivity(ctx,
|
err = workflow.ExecuteActivity(ctx,
|
||||||
StoreAccountActivity,
|
StoreAccountActivity,
|
||||||
&app.AccountActivityWrapper{
|
&app.AccountActivityWrapper{
|
||||||
Obj: crm_models.Account{
|
|
||||||
AccountNumber: "",
|
|
||||||
AccountSource: "",
|
|
||||||
Active: false,
|
|
||||||
AdministrativeLevel: "",
|
|
||||||
Amount: 0,
|
|
||||||
AmountInvoiced: 0,
|
|
||||||
AmountPaid: 0,
|
|
||||||
AnnualRevenue: 0,
|
|
||||||
Balance: 0,
|
|
||||||
BillingAddress: &crm_models.Address{City: w.BillingCity, Street: w.BillingStreet, State: w.BillingState, PostalCode: w.BillingPostalCode},
|
|
||||||
BillingContactID: "",
|
|
||||||
BillingPreference: "",
|
|
||||||
BusinessAddress: &crm_models.Address{},
|
|
||||||
CannabisCustomer: false,
|
|
||||||
ChannelProgramLevelName: "",
|
|
||||||
ChannelProgramName: "",
|
|
||||||
ClientEndDate: "",
|
|
||||||
ClientStartDate: "",
|
|
||||||
CompanyID: "",
|
|
||||||
CoordinateID: "",
|
|
||||||
CustomerID: "",
|
|
||||||
CustomerPriority: "",
|
|
||||||
DBA: "",
|
|
||||||
DUNSNumber: "",
|
|
||||||
DandBCompanyID: "",
|
|
||||||
DefaultAddress: &crm_models.Address{},
|
|
||||||
DefaultBackendID: "",
|
|
||||||
DefaultDeliveryContactID: "",
|
|
||||||
DefaultEndUserID: "",
|
|
||||||
Description: w.Description,
|
|
||||||
EIN: "",
|
|
||||||
Email: w.Email,
|
|
||||||
EnrollmentStatus: "",
|
|
||||||
Fax: "",
|
|
||||||
ISPCustomer: false,
|
|
||||||
Industry: "",
|
|
||||||
IsCustomerPortal: false,
|
|
||||||
IsPartner: false,
|
|
||||||
MSPCustomer: false,
|
|
||||||
NAICSCode: "",
|
|
||||||
NAICSDesc: "",
|
|
||||||
Name: w.AccountName,
|
|
||||||
NumberOfEmployees: 0,
|
|
||||||
NumberOfLocations: 0,
|
|
||||||
OpenCharges: 0,
|
|
||||||
OrderContactID: "",
|
|
||||||
OrderEmail: "",
|
|
||||||
OwnerID: "",
|
|
||||||
Ownership: "",
|
|
||||||
ParentFK: "",
|
|
||||||
ParentID: "",
|
|
||||||
Phone: "",
|
|
||||||
PlaceID: "",
|
|
||||||
PreparerID: "",
|
|
||||||
Rating: "",
|
|
||||||
RatingEngineID: "",
|
|
||||||
Ref: "",
|
|
||||||
RevenueBase: 0,
|
|
||||||
RevenueNet: 0,
|
|
||||||
RevenueNotTaxable: 0,
|
|
||||||
SIC: "",
|
|
||||||
SICDesc: "",
|
|
||||||
ShippingAddress: &crm_models.Address{},
|
|
||||||
ShippingCensusTract: "",
|
|
||||||
ShippingConactID: "",
|
|
||||||
ShippingCounty: "",
|
|
||||||
Site: "",
|
|
||||||
Status: "",
|
|
||||||
TaxExemption: "",
|
|
||||||
TaxOnTax: 0,
|
|
||||||
TelecomCustomer: false,
|
|
||||||
TenantID: "",
|
|
||||||
TickerSymbol: "",
|
|
||||||
TradeStyle: "",
|
|
||||||
Type: "",
|
|
||||||
UnappliedPayments: 0,
|
|
||||||
UnitBase: 0,
|
|
||||||
UpsellOpportunity: "",
|
|
||||||
WHMCSClientID: 0,
|
|
||||||
Website: "",
|
|
||||||
XeroContactID: "",
|
|
||||||
YearStarted: "",
|
|
||||||
},
|
|
||||||
APIKey: w.APIKey,
|
APIKey: w.APIKey,
|
||||||
SagaID: w.SagaID,
|
SagaID: w.SagaID,
|
||||||
SagaType: w.SagaType,
|
SagaType: w.SagaType,
|
||||||
|
//
|
||||||
|
Description: w.Description,
|
||||||
|
Email: w.Email,
|
||||||
|
Name: w.AccountName,
|
||||||
}).Get(ctx, nil)
|
}).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -185,37 +69,30 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
|
||||||
err = workflow.ExecuteActivity(ctx,
|
err = workflow.ExecuteActivity(ctx,
|
||||||
StorePaymentMethodActivity,
|
StorePaymentMethodActivity,
|
||||||
&app.PaymentMethodActivityWrapper{
|
&app.PaymentMethodActivityWrapper{
|
||||||
Obj: ops_models.PaymentMethod{
|
|
||||||
AccountID: "todo fix this",
|
|
||||||
AchAccountType: "",
|
|
||||||
AchBankAccount: "",
|
|
||||||
AchRouting: "",
|
|
||||||
Active: false,
|
|
||||||
Autopay: false,
|
|
||||||
BankName: "",
|
|
||||||
BillingContactID: "",
|
|
||||||
CCnumber: "",
|
|
||||||
CCtype: "",
|
|
||||||
CompanyID: "",
|
|
||||||
ContractID: "",
|
|
||||||
CreatedByID: "",
|
|
||||||
CreatedDate: "",
|
|
||||||
Default: false,
|
|
||||||
ExpirationDate: "",
|
|
||||||
ExpirationMonth: "",
|
|
||||||
ExpirationYear: "",
|
|
||||||
Gateway: "",
|
|
||||||
GatewayKey: "",
|
|
||||||
LastModifiedByID: "",
|
|
||||||
LastModifiedDate: "",
|
|
||||||
Nickname: "",
|
|
||||||
RecordType: "",
|
|
||||||
Ref: "",
|
|
||||||
TenantID: "",
|
|
||||||
},
|
|
||||||
APIKey: w.APIKey,
|
APIKey: w.APIKey,
|
||||||
SagaID: w.SagaID,
|
SagaID: w.SagaID,
|
||||||
SagaType: w.SagaType,
|
SagaType: w.SagaType,
|
||||||
|
//
|
||||||
|
AccountID: "todo fix this",
|
||||||
|
AchAccountType: "",
|
||||||
|
AchBankAccount: "",
|
||||||
|
AchRouting: "",
|
||||||
|
Active: false,
|
||||||
|
Autopay: false,
|
||||||
|
BankName: "",
|
||||||
|
BillingContactID: "",
|
||||||
|
CCnumber: "",
|
||||||
|
CCtype: "",
|
||||||
|
ContractID: "",
|
||||||
|
Default: false,
|
||||||
|
ExpirationMonth: "",
|
||||||
|
ExpirationYear: "",
|
||||||
|
Gateway: "",
|
||||||
|
GatewayKey: "",
|
||||||
|
Nickname: "",
|
||||||
|
RecordType: "",
|
||||||
|
Ref: "",
|
||||||
|
TenantID: "",
|
||||||
}).Get(ctx, nil)
|
}).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -223,19 +100,18 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
|
||||||
err = workflow.ExecuteActivity(ctx,
|
err = workflow.ExecuteActivity(ctx,
|
||||||
NotifyContactActivity,
|
NotifyContactActivity,
|
||||||
&app.ContactActivityWrapper{
|
&app.ContactActivityWrapper{
|
||||||
Obj: crm_models.Contact{
|
|
||||||
Description: w.Description,
|
|
||||||
Email: w.Email,
|
|
||||||
FirstName: w.FirstName,
|
|
||||||
LastName: w.LastName,
|
|
||||||
MobilePhone: w.MobilePhone,
|
|
||||||
Name: w.Name,
|
|
||||||
Phone: w.Phone,
|
|
||||||
Title: w.Title,
|
|
||||||
},
|
|
||||||
APIKey: w.APIKey,
|
APIKey: w.APIKey,
|
||||||
SagaID: w.SagaID,
|
SagaID: w.SagaID,
|
||||||
SagaType: w.SagaType,
|
SagaType: w.SagaType,
|
||||||
|
//
|
||||||
|
Description: w.Description,
|
||||||
|
Email: w.Email,
|
||||||
|
FirstName: w.FirstName,
|
||||||
|
LastName: w.LastName,
|
||||||
|
MobilePhone: w.MobilePhone,
|
||||||
|
Name: w.Name,
|
||||||
|
Phone: w.Phone,
|
||||||
|
Title: w.Title,
|
||||||
}).Get(ctx, nil)
|
}).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -3,7 +3,6 @@ package rules
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
|
||||||
"code.tnxs.net/taxnexus/lib/app"
|
"code.tnxs.net/taxnexus/lib/app"
|
||||||
temporal_workflow "go.temporal.io/sdk/workflow"
|
temporal_workflow "go.temporal.io/sdk/workflow"
|
||||||
)
|
)
|
||||||
|
@ -41,30 +40,27 @@ type NewLeadWorkflowWrapper struct {
|
||||||
|
|
||||||
// NewLeadWorkflow is a Temporal workflow
|
// NewLeadWorkflow is a Temporal workflow
|
||||||
func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) error { //nolint:gocritic // don't care
|
func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) error { //nolint:gocritic // don't care
|
||||||
obj := crm_models.Lead{
|
obj := app.LeadActivityWrapper{
|
||||||
// Address: w.Address,
|
// Address: w.Address,
|
||||||
Company: w.Company,
|
Company: w.Company,
|
||||||
Description: w.Description,
|
Description: w.Description,
|
||||||
Email: w.Email,
|
Email: w.Email,
|
||||||
FirstName: w.FirstName,
|
FirstName: w.FirstName,
|
||||||
LastName: w.LastName,
|
LastName: w.LastName,
|
||||||
MobilePhone: w.MobilePhone,
|
MobilePhone: w.MobilePhone,
|
||||||
Name: w.Name,
|
Name: w.Name,
|
||||||
OwnerID: w.OwnerID,
|
Phone: w.Phone,
|
||||||
PartnerAccountID: w.PartnerAccountID,
|
RefererURL: w.RefererURL,
|
||||||
Phone: w.Phone,
|
Status: w.Status,
|
||||||
ProductID: w.ProductID,
|
TenantID: w.TenantID,
|
||||||
RefererURL: w.RefererURL,
|
Title: w.Title,
|
||||||
Status: w.Status,
|
Type: w.Type,
|
||||||
TenantID: w.TenantID,
|
UTMCampaign: w.UTMCampaign,
|
||||||
Title: w.Title,
|
UTMContent: w.UTMContent,
|
||||||
Type: w.Type,
|
UTMMedium: w.UTMMedium,
|
||||||
UTMCampaign: w.UTMCampaign,
|
UTMSource: w.UTMSource,
|
||||||
UTMContent: w.UTMContent,
|
UTMTerm: w.UTMTerm,
|
||||||
UTMMedium: w.UTMMedium,
|
Website: w.Website,
|
||||||
UTMSource: w.UTMSource,
|
|
||||||
UTMTerm: w.UTMTerm,
|
|
||||||
Website: w.Website,
|
|
||||||
}
|
}
|
||||||
ctx = temporal_workflow.
|
ctx = temporal_workflow.
|
||||||
WithActivityOptions(
|
WithActivityOptions(
|
||||||
|
@ -76,12 +72,8 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) er
|
||||||
ExecuteActivity(
|
ExecuteActivity(
|
||||||
ctx,
|
ctx,
|
||||||
StoreLeadActivity,
|
StoreLeadActivity,
|
||||||
app.LeadActivityWrapper{
|
obj,
|
||||||
Obj: obj,
|
).Get(ctx, nil)
|
||||||
SagaID: w.SagaID,
|
|
||||||
SagaType: w.SagaType,
|
|
||||||
APIKey: w.APIKey,
|
|
||||||
}).Get(ctx, nil)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -89,10 +81,8 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) er
|
||||||
ExecuteActivity(
|
ExecuteActivity(
|
||||||
ctx,
|
ctx,
|
||||||
NotifyLeadActivity,
|
NotifyLeadActivity,
|
||||||
app.LeadActivityWrapper{
|
obj,
|
||||||
Obj: obj,
|
).Get(ctx, nil)
|
||||||
APIKey: w.APIKey,
|
|
||||||
}).Get(ctx, nil)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,32 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// StorePaymentMethodActivity posts a new paymentmethod object to datastore
|
// StorePaymentMethodActivity posts a new paymentmethod object to datastore
|
||||||
func StorePaymentMethodActivity(
|
func StorePaymentMethodActivity(ctx workflow.Context, w app.PaymentMethodActivityWrapper) error { //nolint:gocritic // don't care
|
||||||
ctx workflow.Context,
|
|
||||||
w app.PaymentMethodActivityWrapper, //nolint:gocritic // what we want
|
|
||||||
) error {
|
|
||||||
postPaymentMethodParams := payment_method.NewPostPaymentMethodsParamsWithTimeout(postTimeout)
|
postPaymentMethodParams := payment_method.NewPostPaymentMethodsParamsWithTimeout(postTimeout)
|
||||||
|
obj := &ops_models.PaymentMethod{
|
||||||
|
AccountID: w.AccountID,
|
||||||
|
AchAccountType: w.AchAccountType,
|
||||||
|
AchBankAccount: w.AchBankAccount,
|
||||||
|
AchRouting: w.AchRouting,
|
||||||
|
Active: w.Active,
|
||||||
|
Autopay: w.Autopay,
|
||||||
|
BankName: w.BankName,
|
||||||
|
BillingContactID: w.BillingContactID,
|
||||||
|
CCnumber: w.CCnumber,
|
||||||
|
CCtype: w.CCtype,
|
||||||
|
ContractID: w.ContractID,
|
||||||
|
Default: w.Default,
|
||||||
|
ExpirationMonth: w.ExpirationMonth,
|
||||||
|
ExpirationYear: w.ExpirationYear,
|
||||||
|
Gateway: w.Gateway,
|
||||||
|
GatewayKey: w.GatewayKey,
|
||||||
|
Nickname: w.Nickname,
|
||||||
|
RecordType: w.RecordType,
|
||||||
|
Ref: w.Ref,
|
||||||
|
TenantID: w.TenantID,
|
||||||
|
}
|
||||||
postPaymentMethodParams.PaymentMethodRequest = &ops_models.PaymentMethodRequest{
|
postPaymentMethodParams.PaymentMethodRequest = &ops_models.PaymentMethodRequest{
|
||||||
Data: []*ops_models.PaymentMethod{&w.Obj},
|
Data: []*ops_models.PaymentMethod{obj},
|
||||||
}
|
}
|
||||||
_, err := opsClient.PaymentMethod.PostPaymentMethods(postPaymentMethodParams,
|
_, err := opsClient.PaymentMethod.PostPaymentMethods(postPaymentMethodParams,
|
||||||
httptransport.APIKeyAuth(
|
httptransport.APIKeyAuth(
|
||||||
|
|
Loading…
Reference in New Issue