v0.1.19 v0.1.19
Vernon Keenan 2021-01-19 09:45:58 -08:00
parent 60dd8c0342
commit c3d872fff1
2 changed files with 241 additions and 19 deletions

View File

@ -11,9 +11,21 @@ import (
// NewDeveloperWrapper wraps a contact, account, payment method and a user identifier (app.User) // NewDeveloperWrapper wraps a contact, account, payment method and a user identifier (app.User)
type NewDeveloperWrapper struct { type NewDeveloperWrapper struct {
Contact crm_models.Contact AccountName string
Account crm_models.Account BillingStreet string
PaymentMethod ops_models.PaymentMethod BillingCity string
BillingState string
BillingPostalCode string
Company string
Description string
Email string
FirstName string
LastName string
MobilePhone string
Name string
Phone string
Title string
Website string
APIKey string APIKey string
SagaID string SagaID string
SagaType string SagaType string
@ -30,7 +42,48 @@ func NewDeveloperWorkflow(
err := workflow.ExecuteActivity(ctx, err := workflow.ExecuteActivity(ctx,
StoreContactActivity, StoreContactActivity,
&app.ContactChannelWrapper{ &app.ContactChannelWrapper{
Obj: w.Contact, 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, APIKey: w.APIKey,
SagaID: w.SagaID, SagaID: w.SagaID,
SagaType: w.SagaType, SagaType: w.SagaType,
@ -41,7 +94,90 @@ func NewDeveloperWorkflow(
err = workflow.ExecuteActivity(ctx, err = workflow.ExecuteActivity(ctx,
StoreAccountActivity, StoreAccountActivity,
&app.AccountChannelWrapper{ &app.AccountChannelWrapper{
Obj: w.Account, 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,
@ -52,7 +188,34 @@ func NewDeveloperWorkflow(
err = workflow.ExecuteActivity(ctx, err = workflow.ExecuteActivity(ctx,
StorePaymentMethodActivity, StorePaymentMethodActivity,
&app.PaymentMethodChannelWrapper{ &app.PaymentMethodChannelWrapper{
Obj: w.PaymentMethod, 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,
@ -63,7 +226,16 @@ func NewDeveloperWorkflow(
err = workflow.ExecuteActivity(ctx, err = workflow.ExecuteActivity(ctx,
NotifyContactActivity, NotifyContactActivity,
&app.ContactChannelWrapper{ &app.ContactChannelWrapper{
Obj: w.Contact, 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,

View File

@ -10,14 +10,62 @@ import (
// NewLeadWrapper wraps a Lead and a user identifier (app.User) // NewLeadWrapper wraps a Lead and a user identifier (app.User)
type NewLeadWrapper struct { type NewLeadWrapper struct {
Lead crm_models.Lead // Address *crm_models.Address
Company string
Description string
Email string
FirstName string
ID string
LastName string
MobilePhone string
Name string
OwnerID string
PartnerAccountID string
Phone string
ProductID string
RefererURL string
Status string
TenantID string
Title string
Type string
UTMCampaign string
UTMContent string
UTMMedium string
UTMSource string
UTMTerm string
Website string
APIKey string APIKey string
SagaID string SagaID string
SagaType string SagaType string
} }
// NewLeadWorkflow is a Temporal workflow // NewLeadWorkflow is a Temporal workflow
func NewLeadWorkflow(ctx temporal_workflow.Context, payload *NewLeadWrapper) error { func NewLeadWorkflow(ctx temporal_workflow.Context, w *NewLeadWrapper) error {
obj := crm_models.Lead{
// Address: w.Address,
Company: w.Company,
Description: w.Description,
Email: w.Email,
FirstName: w.FirstName,
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,
Title: w.Title,
Type: w.Type,
UTMCampaign: w.UTMCampaign,
UTMContent: w.UTMContent,
UTMMedium: w.UTMMedium,
UTMSource: w.UTMSource,
UTMTerm: w.UTMTerm,
Website: w.Website,
}
ctx = temporal_workflow. ctx = temporal_workflow.
WithActivityOptions( WithActivityOptions(
ctx, ctx,
@ -29,8 +77,10 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, payload *NewLeadWrapper) err
ctx, ctx,
StoreLeadActivity, StoreLeadActivity,
&app.LeadChannelWrapper{ &app.LeadChannelWrapper{
Obj: payload.Lead, Obj: obj,
APIKey: payload.APIKey, SagaID: w.SagaID,
SagaType: w.SagaType,
APIKey: w.APIKey,
}).Get(ctx, nil) }).Get(ctx, nil)
if err != nil { if err != nil {
return err return err
@ -40,8 +90,8 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, payload *NewLeadWrapper) err
ctx, ctx,
NotifyLeadActivity, NotifyLeadActivity,
&app.LeadChannelWrapper{ &app.LeadChannelWrapper{
Obj: payload.Lead, Obj: obj,
APIKey: payload.APIKey, APIKey: w.APIKey,
}).Get(ctx, nil) }).Get(ctx, nil)
if err != nil { if err != nil {
return err return err