make it concrete
parent
7596d7e2da
commit
0b92ff9427
|
@ -2,16 +2,54 @@ package app
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
||||
)
|
||||
|
||||
// AccountActivityWrapper wraps the object with workflow params
|
||||
type AccountActivityWrapper struct {
|
||||
Obj crm_models.Account
|
||||
APIKey string
|
||||
SagaID 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
|
||||
|
|
|
@ -2,16 +2,45 @@ package app
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
||||
)
|
||||
|
||||
// CompanyActivityWrapper wraps the object with workflow params
|
||||
type CompanyActivityWrapper struct {
|
||||
Obj crm_models.Company
|
||||
APIKey string
|
||||
SagaID 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
|
||||
|
|
|
@ -2,8 +2,6 @@ package app
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
||||
)
|
||||
|
||||
// NewContactActivity is an activity identifier
|
||||
|
@ -11,10 +9,38 @@ const NewContactActivity = "NEW_CONTACT_ACTIVITY"
|
|||
|
||||
// ContactActivityWrapper wraps the object with workflow params
|
||||
type ContactActivityWrapper struct {
|
||||
Obj crm_models.Contact
|
||||
APIKey string
|
||||
SagaID 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
|
||||
|
|
24
app/lead.go
24
app/lead.go
|
@ -2,16 +2,34 @@ package app
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
||||
)
|
||||
|
||||
// LeadActivityWrapper wraps the object with workflow params
|
||||
type LeadActivityWrapper struct {
|
||||
Obj crm_models.Lead
|
||||
APIKey string
|
||||
SagaID 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
|
||||
|
|
|
@ -2,16 +2,34 @@ package app
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
|
||||
)
|
||||
|
||||
// PaymentMethodActivityWrapper wraps the object with workflow params
|
||||
type PaymentMethodActivityWrapper struct {
|
||||
Obj ops_models.PaymentMethod
|
||||
APIKey string
|
||||
SagaID 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
|
||||
|
|
|
@ -2,16 +2,23 @@ package app
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"code.tnxs.net/taxnexus/lib/api/devops/devops_models"
|
||||
)
|
||||
|
||||
// TenantActivityWrapper wraps the object with workflow params
|
||||
type TenantActivityWrapper struct {
|
||||
Obj devops_models.Tenant
|
||||
APIKey string
|
||||
SagaID 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
|
||||
|
|
|
@ -13,9 +13,51 @@ const StoreAccountActivityID = "STORE_ACCOUNT_ACTIVITY"
|
|||
|
||||
// StoreAccountActivity posts a new account object to datastore
|
||||
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.AccountRequest = &crm_models.AccountRequest{
|
||||
Data: []*crm_models.Account{&w.Obj},
|
||||
Data: []*crm_models.Account{obj},
|
||||
}
|
||||
_, err := crmClient.Accounts.PostAccounts(
|
||||
postAccountParams,
|
||||
|
|
|
@ -16,12 +16,42 @@ import (
|
|||
|
||||
// StoreContactActivity posts a new contact object to datastore
|
||||
func StoreContactActivity(ctx workflow.Context, w app.ContactActivityWrapper) error { //nolint:gocritic // what we want
|
||||
postContactParams := contacts.NewPostContactsParamsWithTimeout(postTimeout)
|
||||
if w.Obj.Name == "" {
|
||||
w.Obj.Name = w.Obj.FirstName + " " + w.Obj.LastName
|
||||
obj := &crm_models.Contact{
|
||||
AccountID: w.AccountID,
|
||||
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{
|
||||
Data: []*crm_models.Contact{&w.Obj},
|
||||
Data: []*crm_models.Contact{obj},
|
||||
}
|
||||
_, err := crmClient.Contacts.PostContacts(postContactParams,
|
||||
httptransport.APIKeyAuth(
|
||||
|
@ -61,7 +91,7 @@ Alert! New Contact Inquiry from Taxnexus.io website.
|
|||
emailParams.OutgoingEmailMessageRequest = &workflow_models.OutgoingEmailMessageRequest{
|
||||
Data: []*workflow_models.OutgoingEmailMessage{
|
||||
{
|
||||
Subject: "New lead from " + w.Obj.Name,
|
||||
Subject: "New lead from " + w.Name,
|
||||
ValidatedFromAddress: "support@taxnexus.net",
|
||||
ToAddress: "info@taxnexus.net",
|
||||
FromName: "Taxnexus Onboarding",
|
||||
|
|
|
@ -15,13 +15,35 @@ import (
|
|||
)
|
||||
|
||||
// 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)
|
||||
if w.Obj.Name == "" {
|
||||
w.Obj.Name = w.Obj.FirstName + " " + w.Obj.LastName
|
||||
if obj.Name == "" {
|
||||
obj.Name = obj.FirstName + " " + obj.LastName
|
||||
}
|
||||
postLeadParams.LeadRequest = &crm_models.LeadRequest{
|
||||
Data: []*crm_models.Lead{&w.Obj},
|
||||
Data: []*crm_models.Lead{obj},
|
||||
}
|
||||
_, err := crmClient.Leads.PostLeads(postLeadParams,
|
||||
httptransport.APIKeyAuth(
|
||||
|
@ -61,7 +83,7 @@ Alert! New Lead Inquiry from Taxnexus.io website.
|
|||
emailParams.OutgoingEmailMessageRequest = &workflow_models.OutgoingEmailMessageRequest{
|
||||
Data: []*workflow_models.OutgoingEmailMessage{
|
||||
{
|
||||
Subject: "New lead from " + w.Obj.Name,
|
||||
Subject: "New lead from " + w.Name,
|
||||
ValidatedFromAddress: "support@taxnexus.net",
|
||||
ToAddress: "info@taxnexus.net",
|
||||
FromName: "Taxnexus Onboarding",
|
||||
|
|
|
@ -3,8 +3,6 @@ package rules
|
|||
import (
|
||||
"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"
|
||||
"go.temporal.io/sdk/workflow"
|
||||
)
|
||||
|
@ -39,48 +37,14 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
|
|||
err := workflow.ExecuteActivity(ctx,
|
||||
StoreContactActivity,
|
||||
app.ContactActivityWrapper{
|
||||
Obj: crm_models.Contact{
|
||||
AccountID: "",
|
||||
AssistantName: "",
|
||||
AssistantPhone: "",
|
||||
BirthDate: "",
|
||||
Department: "",
|
||||
Description: w.Description,
|
||||
DoNotCall: false,
|
||||
Email: w.Email,
|
||||
EmailBounceDate: "",
|
||||
EmailBouncedReason: "",
|
||||
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,
|
||||
|
@ -91,93 +55,13 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
|
|||
err = workflow.ExecuteActivity(ctx,
|
||||
StoreAccountActivity,
|
||||
&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,
|
||||
SagaID: w.SagaID,
|
||||
SagaType: w.SagaType,
|
||||
//
|
||||
Description: w.Description,
|
||||
Email: w.Email,
|
||||
Name: w.AccountName,
|
||||
}).Get(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -185,7 +69,10 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
|
|||
err = workflow.ExecuteActivity(ctx,
|
||||
StorePaymentMethodActivity,
|
||||
&app.PaymentMethodActivityWrapper{
|
||||
Obj: ops_models.PaymentMethod{
|
||||
APIKey: w.APIKey,
|
||||
SagaID: w.SagaID,
|
||||
SagaType: w.SagaType,
|
||||
//
|
||||
AccountID: "todo fix this",
|
||||
AchAccountType: "",
|
||||
AchBankAccount: "",
|
||||
|
@ -196,26 +83,16 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
|
|||
BillingContactID: "",
|
||||
CCnumber: "",
|
||||
CCtype: "",
|
||||
CompanyID: "",
|
||||
ContractID: "",
|
||||
CreatedByID: "",
|
||||
CreatedDate: "",
|
||||
Default: false,
|
||||
ExpirationDate: "",
|
||||
ExpirationMonth: "",
|
||||
ExpirationYear: "",
|
||||
Gateway: "",
|
||||
GatewayKey: "",
|
||||
LastModifiedByID: "",
|
||||
LastModifiedDate: "",
|
||||
Nickname: "",
|
||||
RecordType: "",
|
||||
Ref: "",
|
||||
TenantID: "",
|
||||
},
|
||||
APIKey: w.APIKey,
|
||||
SagaID: w.SagaID,
|
||||
SagaType: w.SagaType,
|
||||
}).Get(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -223,7 +100,10 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
|
|||
err = workflow.ExecuteActivity(ctx,
|
||||
NotifyContactActivity,
|
||||
&app.ContactActivityWrapper{
|
||||
Obj: crm_models.Contact{
|
||||
APIKey: w.APIKey,
|
||||
SagaID: w.SagaID,
|
||||
SagaType: w.SagaType,
|
||||
//
|
||||
Description: w.Description,
|
||||
Email: w.Email,
|
||||
FirstName: w.FirstName,
|
||||
|
@ -232,10 +112,6 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
|
|||
Name: w.Name,
|
||||
Phone: w.Phone,
|
||||
Title: w.Title,
|
||||
},
|
||||
APIKey: w.APIKey,
|
||||
SagaID: w.SagaID,
|
||||
SagaType: w.SagaType,
|
||||
}).Get(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -3,7 +3,6 @@ package rules
|
|||
import (
|
||||
"time"
|
||||
|
||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
||||
"code.tnxs.net/taxnexus/lib/app"
|
||||
temporal_workflow "go.temporal.io/sdk/workflow"
|
||||
)
|
||||
|
@ -41,7 +40,7 @@ type NewLeadWorkflowWrapper struct {
|
|||
|
||||
// NewLeadWorkflow is a Temporal workflow
|
||||
func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) error { //nolint:gocritic // don't care
|
||||
obj := crm_models.Lead{
|
||||
obj := app.LeadActivityWrapper{
|
||||
// Address: w.Address,
|
||||
Company: w.Company,
|
||||
Description: w.Description,
|
||||
|
@ -50,10 +49,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) er
|
|||
LastName: w.LastName,
|
||||
MobilePhone: w.MobilePhone,
|
||||
Name: w.Name,
|
||||
OwnerID: w.OwnerID,
|
||||
PartnerAccountID: w.PartnerAccountID,
|
||||
Phone: w.Phone,
|
||||
ProductID: w.ProductID,
|
||||
RefererURL: w.RefererURL,
|
||||
Status: w.Status,
|
||||
TenantID: w.TenantID,
|
||||
|
@ -76,12 +72,8 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) er
|
|||
ExecuteActivity(
|
||||
ctx,
|
||||
StoreLeadActivity,
|
||||
app.LeadActivityWrapper{
|
||||
Obj: obj,
|
||||
SagaID: w.SagaID,
|
||||
SagaType: w.SagaType,
|
||||
APIKey: w.APIKey,
|
||||
}).Get(ctx, nil)
|
||||
obj,
|
||||
).Get(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -89,10 +81,8 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) er
|
|||
ExecuteActivity(
|
||||
ctx,
|
||||
NotifyLeadActivity,
|
||||
app.LeadActivityWrapper{
|
||||
Obj: obj,
|
||||
APIKey: w.APIKey,
|
||||
}).Get(ctx, nil)
|
||||
obj,
|
||||
).Get(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -9,13 +9,32 @@ import (
|
|||
)
|
||||
|
||||
// StorePaymentMethodActivity posts a new paymentmethod object to datastore
|
||||
func StorePaymentMethodActivity(
|
||||
ctx workflow.Context,
|
||||
w app.PaymentMethodActivityWrapper, //nolint:gocritic // what we want
|
||||
) error {
|
||||
func StorePaymentMethodActivity(ctx workflow.Context, w app.PaymentMethodActivityWrapper) error { //nolint:gocritic // don't care
|
||||
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{
|
||||
Data: []*ops_models.PaymentMethod{&w.Obj},
|
||||
Data: []*ops_models.PaymentMethod{obj},
|
||||
}
|
||||
_, err := opsClient.PaymentMethod.PostPaymentMethods(postPaymentMethodParams,
|
||||
httptransport.APIKeyAuth(
|
||||
|
|
Loading…
Reference in New Issue