make it concrete

v0.1.22
Vernon Keenan 2021-01-19 13:18:59 -08:00
parent 7596d7e2da
commit 0b92ff9427
12 changed files with 352 additions and 237 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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",

View File

@ -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",

View File

@ -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,48 +37,14 @@ 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{
AccountID: "",
AssistantName: "",
AssistantPhone: "",
BirthDate: "",
Department: "",
Description: w.Description, Description: w.Description,
DoNotCall: false,
Email: w.Email, Email: w.Email,
EmailBounceDate: "",
EmailBouncedReason: "",
EnrollmentStatus: "",
Fax: "",
FirstName: w.FirstName, FirstName: w.FirstName,
HasOptedOutOfEmail: false,
HasOptedOutOfFax: false,
HomePhone: "",
IsEmailBounced: false,
IsProvisioned: false,
LastName: w.LastName, LastName: w.LastName,
LeadSource: "",
Level: "",
LinkedIn: "",
MailingAddress: &crm_models.Address{},
MailingLists: "",
MobilePhone: w.MobilePhone, MobilePhone: w.MobilePhone,
Name: w.Name, Name: w.Name,
OtherAddress: &crm_models.Address{},
OtherPhone: "",
OwnerID: "",
PersonalEmail: "",
Phone: w.Phone, Phone: w.Phone,
PhotoURL: "",
RecruitingStatus: "",
Ref: "",
ReportsToID: "",
Salutation: "",
Status: "",
TenantID: "",
Title: w.Title, Title: w.Title,
Type: "",
},
APIKey: w.APIKey, APIKey: w.APIKey,
SagaID: w.SagaID, SagaID: w.SagaID,
SagaType: w.SagaType, SagaType: w.SagaType,
@ -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,7 +69,10 @@ 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{ APIKey: w.APIKey,
SagaID: w.SagaID,
SagaType: w.SagaType,
//
AccountID: "todo fix this", AccountID: "todo fix this",
AchAccountType: "", AchAccountType: "",
AchBankAccount: "", AchBankAccount: "",
@ -196,26 +83,16 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
BillingContactID: "", BillingContactID: "",
CCnumber: "", CCnumber: "",
CCtype: "", CCtype: "",
CompanyID: "",
ContractID: "", ContractID: "",
CreatedByID: "",
CreatedDate: "",
Default: false, Default: false,
ExpirationDate: "",
ExpirationMonth: "", ExpirationMonth: "",
ExpirationYear: "", ExpirationYear: "",
Gateway: "", Gateway: "",
GatewayKey: "", GatewayKey: "",
LastModifiedByID: "",
LastModifiedDate: "",
Nickname: "", Nickname: "",
RecordType: "", RecordType: "",
Ref: "", Ref: "",
TenantID: "", TenantID: "",
},
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
@ -223,7 +100,10 @@ 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{ APIKey: w.APIKey,
SagaID: w.SagaID,
SagaType: w.SagaType,
//
Description: w.Description, Description: w.Description,
Email: w.Email, Email: w.Email,
FirstName: w.FirstName, FirstName: w.FirstName,
@ -232,10 +112,6 @@ func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) e
Name: w.Name, Name: w.Name,
Phone: w.Phone, Phone: w.Phone,
Title: w.Title, Title: w.Title,
},
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

View File

@ -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,7 +40,7 @@ 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,
@ -50,10 +49,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) er
LastName: w.LastName, LastName: w.LastName,
MobilePhone: w.MobilePhone, MobilePhone: w.MobilePhone,
Name: w.Name, Name: w.Name,
OwnerID: w.OwnerID,
PartnerAccountID: w.PartnerAccountID,
Phone: w.Phone, Phone: w.Phone,
ProductID: w.ProductID,
RefererURL: w.RefererURL, RefererURL: w.RefererURL,
Status: w.Status, Status: w.Status,
TenantID: w.TenantID, TenantID: w.TenantID,
@ -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
} }

View File

@ -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(