v0.1.15
Vernon Keenan 2021-01-18 17:50:45 -08:00
parent f5aa06ed82
commit 54392e385e
86 changed files with 450 additions and 342 deletions

View File

@ -9,7 +9,7 @@ import (
// AccountChannelWrapper wraps the object with workflow params
type AccountChannelWrapper struct {
Obj crm_models.Account
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// AccountingRuleChannelWrapper wraps the object with workflow params
type AccountingRuleChannelWrapper struct {
Obj ledger_models.AccountingRule
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// AccountingRulesetChannelWrapper wraps the object with workflow params
type AccountingRulesetChannelWrapper struct {
Obj ledger_models.AccountingRuleset
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// AccountingRulesetItemChannelWrapper wraps the object with workflow params
type AccountingRulesetItemChannelWrapper struct {
Obj ledger_models.AccountingRulesetItem
Principal User
APIKey string
SagaID string
SagaType string
}

27
app/auth.go Normal file
View File

@ -0,0 +1,27 @@
package app
import (
"code.tnxs.net/taxnexus/lib/api/auth/auth_client"
"code.tnxs.net/taxnexus/lib/api/auth/auth_client/user"
"code.tnxs.net/taxnexus/lib/api/auth/auth_models"
)
var authClient = auth_client.Default
// CheckAPIUser is exported
func CheckAPIUser(token *string) (*User, error) {
sugar.Debug("app.CheckAPIUser: 📥")
params := user.NewGetUsersParams()
params.Apikey = token
response, err := authClient.User.GetUsers(params, apiUsers["auth"].Auth)
if err != nil {
sugar.Warnf("app.CheckAPIUser: ❗ Access attempt with invalid API key: %s", *token)
return nil, err
}
var obj *auth_models.User
for _, itm := range response.Payload.Data { // single iteration execution
obj = itm
}
sugar.Debugf("app.CheckAPIUser: 📤 👍 ID = %s, Name = %s", obj.ID, obj.Name)
return MarshalAuthUserToSwagger(obj), nil
}

View File

@ -9,7 +9,7 @@ import (
// BackendChannelWrapper wraps the object with workflow params
type BackendChannelWrapper struct {
Obj regs_models.Backend
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// CashReceiptChannelWrapper wraps the object with workflow params
type CashReceiptChannelWrapper struct {
Obj ops_models.CashReceipt
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// ChargeChannelWrapper wraps the object with workflow params
type ChargeChannelWrapper struct {
Obj ops_models.Charge
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// ClusterChannelWrapper wraps the object with workflow params
type ClusterChannelWrapper struct {
Obj devops_models.Cluster
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// CompanyChannelWrapper wraps the object with workflow params
type CompanyChannelWrapper struct {
Obj crm_models.Company
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -12,7 +12,7 @@ const NewContactActivity = "NEW_CONTACT_ACTIVITY"
// ContactChannelWrapper wraps the object with workflow params
type ContactChannelWrapper struct {
Obj crm_models.Contact
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// CoordinateBasicChannelWrapper wraps the object with workflow params
type CoordinateBasicChannelWrapper struct {
Obj geo_models.CoordinateBasic
Principal User
APIKey string
SagaID string
SagaType string
}
@ -32,7 +32,7 @@ type CoordinateBasic struct {
// CoordinateChannelWrapper wraps the object with workflow params
type CoordinateChannelWrapper struct {
Obj geo_models.Coordinate
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// CountryChannelWrapper wraps the object with workflow params
type CountryChannelWrapper struct {
Obj geo_models.Country
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// CountyChannelWrapper wraps the object with workflow params
type CountyChannelWrapper struct {
Obj geo_models.County
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// DatabaseChannelWrapper wraps the object with workflow params
type DatabaseChannelWrapper struct {
Obj devops_models.Database
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -5,7 +5,7 @@ import "code.tnxs.net/taxnexus/lib/api/geo/geo_models"
// DomainChannelWrapper wraps the object with workflow params
type DomainChannelWrapper struct {
Obj geo_models.Domain
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// EftChannelWrapper wraps the object with workflow params
type EftChannelWrapper struct {
Obj ops_models.Eft
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// EftItemChannelWrapper wraps the object with workflow params
type EftItemChannelWrapper struct {
Obj ops_models.EftItem
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// EmailMessageChannelWrapper wraps the object with workflow params
type EmailMessageChannelWrapper struct {
Obj workflow_models.EmailMessage
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -7,7 +7,7 @@ import (
// EmailTemplateChannelWrapper wraps the object with workflow params
type EmailTemplateChannelWrapper struct {
// Obj workflow_models.EmailTemplate
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// FilingChannelWrapper wraps the object with workflow params
type FilingChannelWrapper struct {
Obj regs_models.Filing
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// FilingScheduleItemChannelWrapper wraps the object with workflow params
type FilingScheduleItemChannelWrapper struct {
Obj regs_models.FilingScheduleItem
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// FilingTypeChannelWrapper wraps the object with workflow params
type FilingTypeChannelWrapper struct {
Obj regs_models.FilingType
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// FilingTypeInstanceChannelWrapper wraps the object with workflow params
type FilingTypeInstanceChannelWrapper struct {
Obj regs_models.FilingTypeInstance
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -7,7 +7,7 @@ import (
// FolderChannelWrapper wraps the object with workflow params
type FolderChannelWrapper struct {
// Obj workflow_models.Folder
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// GlAccountChannelWrapper wraps the object with workflow params
type GlAccountChannelWrapper struct {
Obj ledger_models.GlAccount
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// GlBalanceChannelWrapper wraps the object with workflow params
type GlBalanceChannelWrapper struct {
Obj ledger_models.GlBalance
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// IngestChannelWrapper wraps the object with workflow params
type IngestChannelWrapper struct {
Obj devops_models.Ingest
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// InvoiceChannelWrapper wraps the object with workflow params
type InvoiceChannelWrapper struct {
Obj ops_models.Invoice
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// InvoiceItemChannelWrapper wraps the object with workflow params
type InvoiceItemChannelWrapper struct {
Obj ops_models.InvoiceItem
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// JobChannelWrapper wraps the object with workflow params
type JobChannelWrapper struct {
Obj devops_models.Job
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// JournalEntryChannelWrapper wraps the object with workflow params
type JournalEntryChannelWrapper struct {
Obj ledger_models.JournalEntry
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// JournalItemChannelWrapper wraps the object with workflow params
type JournalItemChannelWrapper struct {
Obj ledger_models.JournalItem
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// LeadChannelWrapper wraps the object with workflow params
type LeadChannelWrapper struct {
Obj crm_models.Lead
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// LicenseChannelWrapper wraps the object with workflow params
type LicenseChannelWrapper struct {
Obj regs_models.License
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// LicenseTypeChannelWrapper wraps the object with workflow params
type LicenseTypeChannelWrapper struct {
Obj regs_models.LicenseType
Principal User
APIKey string
SagaID string
SagaType string
}
@ -42,7 +42,7 @@ type LicenseType struct {
// GeoLicenseTypeInstanceChannelWrapper wraps the object with workflow params
type GeoLicenseTypeInstanceChannelWrapper struct {
Obj regs_models.GeoLicenseTypeInstance
Principal User
APIKey string
SagaID string
SagaType string
}
@ -67,7 +67,7 @@ type GeoLicenseTypeInstance struct {
// DomainLicenseTypeInstanceChannelWrapper wraps the object with workflow params
type DomainLicenseTypeInstanceChannelWrapper struct {
// Obj regs_models.DomainLicenseTypeInstance
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -5,7 +5,7 @@ import "database/sql"
// LogChannelWrapper wraps the object with workflow params
type LogChannelWrapper struct {
// Obj devops_models.AppLog
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// NotebookChannelWrapper wraps the object with workflow params
type NotebookChannelWrapper struct {
Obj regs_models.Notebook
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// NotebookItemChannelWrapper wraps the object with workflow params
type NotebookItemChannelWrapper struct {
Obj regs_models.NotebookItem
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// OrderChannelWrapper wraps the object with workflow params
type OrderChannelWrapper struct {
Obj ops_models.Order
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// OrderItemChannelWrapper wraps the object with workflow params
type OrderItemChannelWrapper struct {
Obj ops_models.OrderItem
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -5,7 +5,7 @@ import "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"
// OutgoingEmailMessageChannelWrapper wraps the object with workflow params
type OutgoingEmailMessageChannelWrapper struct {
Obj workflow_models.OutgoingEmailMessage
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -3,7 +3,7 @@ package app
// OutgoingEmailMessageReceiptChannelWrapper wraps the object with workflow params
type OutgoingEmailMessageReceiptChannelWrapper struct {
// Obj workflow_models.OutgoingEmailMessageReceipt
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// PaymentMethodChannelWrapper wraps the object with workflow params
type PaymentMethodChannelWrapper struct {
Obj ops_models.PaymentMethod
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -5,7 +5,7 @@ import "database/sql"
// PDFChannelWrapper wraps the object with workflow params
type PDFChannelWrapper struct {
// Obj stash_models.Pdf
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// PeriodChannelWrapper wraps the object with workflow params
type PeriodChannelWrapper struct {
Obj ledger_models.Period
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// PlaceChannelWrapper wraps the object with workflow params
type PlaceChannelWrapper struct {
Obj geo_models.Place
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// PurchaseOrderChannelWrapper wraps the object with workflow params
type PurchaseOrderChannelWrapper struct {
Obj ops_models.PurchaseOrder
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// PurchaseOrderItemChannelWrapper wraps the object with workflow params
type PurchaseOrderItemChannelWrapper struct {
Obj ops_models.PurchaseOrderItem
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// ProductChannelWrapper wraps the object with workflow params
type ProductChannelWrapper struct {
Obj ops_models.Product
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// QuoteChannelWrapper wraps the object with workflow params
type QuoteChannelWrapper struct {
Obj ops_models.Quote
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// QuoteItemChannelWrapper wraps the object with workflow params
type QuoteItemChannelWrapper struct {
Obj ops_models.QuoteItem
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -8,7 +8,7 @@ import (
// RatingengineChannelWrapper wraps the object with workflow params
type RatingengineChannelWrapper struct {
Obj regs_models.RatingEngine
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -8,7 +8,7 @@ import (
// RatingEngineItemChannelWrapper wraps the object with workflow params
type RatingEngineItemChannelWrapper struct {
Obj regs_models.RatingEngineItem
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// RoleChannelWrapper wraps the object with workflow params
type RoleChannelWrapper struct {
Obj devops_models.Role
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -7,6 +7,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/auth0/auth0_client"
"code.tnxs.net/taxnexus/lib/app/logger"
httptransport "github.com/go-openapi/runtime/client"
"github.com/spf13/viper"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
@ -17,6 +18,7 @@ var config = Configuration{}
var appViper = viper.New()
var auth0Client = auth0_client.Default
var configured = false
var apiUsers map[string]User
const getTimeout = 6 * time.Minute
const postTimeout = 6 * time.Minute
@ -48,12 +50,30 @@ func InitConfig(systemName string) {
sugar.Fatalf("app.InitConfig: 💣 ⛔ can't unmarshal system config: %w", err)
}
sugar = logger.New(GetLogLevel())
apiUsers = initAPIUsers()
sugar.Debugf("app.InitConfig: 👍 📤 serviceAccounts: %d", len(config.ServiceAccounts))
configured = true
}
// FirstClassObject is a struct
type FirstClassObject interface {
Marshal() interface{}
UnMarshal() interface{}
func initAPIUsers() map[string]User {
sugar.Info("board.initAPIUsers: 📥")
users := map[string]User{
"auth": {
APIKey: GetServiceAccount("auth").APIKey,
Auth: httptransport.APIKeyAuth(
"X-API-Key",
"header",
GetServiceAccount("auth").APIKey,
),
},
"test-service-account": {
APIKey: GetServiceAccount("test-service-account").APIKey,
Auth: httptransport.APIKeyAuth(
"X-API-Key",
"header",
GetServiceAccount("test-service-account").APIKey),
},
}
sugar.Debugf("board.initAPIUsers: 👍 📤")
return users
}

View File

@ -9,7 +9,7 @@ import (
// ServiceChannelWrapper wraps the object with workflow params
type ServiceChannelWrapper struct {
Obj devops_models.Service
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// StateChannelWrapper wraps the object with workflow params
type StateChannelWrapper struct {
Obj geo_models.State
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// SubmissionChannelWrapper wraps the object with workflow params
type SubmissionChannelWrapper struct {
Obj regs_models.Submission
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -7,7 +7,7 @@ import (
// TaskChannelWrapper wraps the object with workflow params
type TaskChannelWrapper struct {
// Obj workflow_models.Task
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -7,7 +7,7 @@ import (
// TaskRelationChannelWrapper wraps the object with workflow params
type TaskRelationChannelWrapper struct {
// Obj workflow_models.TaskRelation
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -7,7 +7,7 @@ import (
// TaskWhoRelationChannelWrapper wraps the object with workflow params
type TaskWhoRelationChannelWrapper struct {
// Obj workflow_models.TaskWhoRelation
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// TaxInstanceChannelWrapper wraps the object with workflow params
type TaxInstanceChannelWrapper struct {
Obj geo_models.TaxInstance
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// TaxnexusCodeChannelWrapper wraps the object with workflow params
type TaxnexusCodeChannelWrapper struct {
Obj geo_models.TaxnexusCode
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -5,7 +5,7 @@ import "code.tnxs.net/taxnexus/lib/api/geo/geo_models"
// TaxRateChannelWrapper wraps the object with workflow params
type TaxRateChannelWrapper struct {
Obj geo_models.TaxRate
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// TaxTransactionChannelWrapper wraps the object with workflow params
type TaxTransactionChannelWrapper struct {
Obj ops_models.TaxTransaction
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// TaxTypeChannelWrapper wraps the object with workflow params
type TaxTypeChannelWrapper struct {
Obj geo_models.TaxType
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// TaxTypeAccountChannelWrapper wraps the object with workflow params
type TaxTypeAccountChannelWrapper struct {
Obj regs_models.TaxTypeAccount
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// TemplateChannelWrapper wraps the object with workflow params
type TemplateChannelWrapper struct {
Obj devops_models.Template
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// TenantChannelWrapper wraps the object with workflow params
type TenantChannelWrapper struct {
Obj devops_models.Tenant
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -5,7 +5,7 @@ import "code.tnxs.net/taxnexus/lib/api/devops/devops_models"
// TenantUserChannelWrapper wraps the object with workflow params
type TenantUserChannelWrapper struct {
Obj devops_models.TenantUser
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -5,7 +5,7 @@ import "code.tnxs.net/taxnexus/lib/api/ops/ops_models"
// TotalChannelWrapper wraps the object with workflow params
type TotalChannelWrapper struct {
Obj ops_models.Total
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -5,7 +5,7 @@ import "code.tnxs.net/taxnexus/lib/api/ops/ops_models"
// TotalItemChannelWrapper wraps the object with workflow params
type TotalItemChannelWrapper struct {
Obj ops_models.TotalItem
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -5,7 +5,7 @@ import "code.tnxs.net/taxnexus/lib/api/ops/ops_models"
// TotalTaxItemChannelWrapper wraps the object with workflow params
type TotalTaxItemChannelWrapper struct {
Obj ops_models.TotalTaxItem
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -9,7 +9,7 @@ import (
// TransactionItemChannelWrapper wraps the object with workflow params
type TransactionItemChannelWrapper struct {
Obj regs_models.Transaction
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -8,7 +8,7 @@ import (
// UserChannelWrapper wraps the object with workflow params
type UserChannelWrapper struct {
Obj devops_models.User
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -5,7 +5,7 @@ import "code.tnxs.net/taxnexus/lib/api/devops/devops_models"
// UserRoleChannelWrapper wraps the object with workflow params
type UserRoleChannelWrapper struct {
Obj devops_models.UserRole
Principal User
APIKey string
SagaID string
SagaType string
}

View File

@ -4,6 +4,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/crm/crm_client/accounts"
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
"code.tnxs.net/taxnexus/lib/app"
httptransport "github.com/go-openapi/runtime/client"
"go.temporal.io/sdk/workflow"
)
@ -16,7 +17,13 @@ func StoreAccountActivity(ctx workflow.Context, w app.AccountChannelWrapper) err
postAccountParams.AccountRequest = &crm_models.AccountRequest{
Data: []*crm_models.Account{&w.Obj},
}
_, err := crmClient.Accounts.PostAccounts(postAccountParams, w.Principal.Auth)
_, err := crmClient.Accounts.PostAccounts(
postAccountParams,
httptransport.APIKeyAuth(
"X-API-Key",
"header",
w.APIKey,
))
if err != nil {
return err
}

View File

@ -8,6 +8,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/workflow/workflow_client/outgoing_email_message"
"code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"
"code.tnxs.net/taxnexus/lib/app"
httptransport "github.com/go-openapi/runtime/client"
"go.temporal.io/sdk/workflow"
)
@ -33,7 +34,12 @@ func StoreAuth0UserActivity(ctx workflow.Context, w app.UserChannelWrapper) erro
putUserParams.UserRequest = &devops_models.UserRequest{
Data: []*devops_models.User{&putUser},
}
_, err = devopsClient.User.PutUsers(putUserParams, w.Principal.Auth)
_, err = devopsClient.User.PutUsers(putUserParams,
httptransport.APIKeyAuth(
"X-API-Key",
"header",
w.APIKey,
))
if err != nil {
return err
}
@ -52,7 +58,11 @@ func StoreAuth0UserActivity(ctx workflow.Context, w app.UserChannelWrapper) erro
OutgoingEmailMessage.
PostOutgoingEmailMessages(
emailParams,
w.Principal.Auth,
httptransport.APIKeyAuth(
"X-API-Key",
"header",
w.APIKey,
),
)
if err != nil {
return err

View File

@ -10,6 +10,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/workflow/workflow_client/outgoing_email_message"
"code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"
"code.tnxs.net/taxnexus/lib/app"
httptransport "github.com/go-openapi/runtime/client"
"go.temporal.io/sdk/workflow"
)
@ -22,7 +23,12 @@ func StoreContactActivity(ctx workflow.Context, w app.ContactChannelWrapper) err
postContactParams.ContactsRequest = &crm_models.ContactRequest{
Data: []*crm_models.Contact{&w.Obj},
}
_, err := crmClient.Contacts.PostContacts(postContactParams, w.Principal.Auth)
_, err := crmClient.Contacts.PostContacts(postContactParams,
httptransport.APIKeyAuth(
"X-API-Key",
"header",
w.APIKey,
))
if err != nil {
return err
}
@ -64,7 +70,12 @@ Alert! New Contact Inquiry from Taxnexus.io website.
},
},
}
_, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams, w.Principal.Auth)
_, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams,
httptransport.APIKeyAuth(
"X-API-Key",
"header",
w.APIKey,
))
if err != nil {
return err
}

View File

@ -10,6 +10,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/workflow/workflow_client/outgoing_email_message"
"code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"
"code.tnxs.net/taxnexus/lib/app"
httptransport "github.com/go-openapi/runtime/client"
"go.temporal.io/sdk/workflow"
)
@ -22,7 +23,12 @@ func StoreLeadActivity(ctx workflow.Context, w app.LeadChannelWrapper) error { /
postLeadParams.LeadRequest = &crm_models.LeadRequest{
Data: []*crm_models.Lead{&w.Obj},
}
_, err := crmClient.Leads.PostLeads(postLeadParams, w.Principal.Auth)
_, err := crmClient.Leads.PostLeads(postLeadParams,
httptransport.APIKeyAuth(
"X-API-Key",
"header",
w.APIKey,
))
if err != nil {
return err
}
@ -64,7 +70,12 @@ Alert! New Lead Inquiry from Taxnexus.io website.
},
},
}
_, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams, w.Principal.Auth)
_, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams,
httptransport.APIKeyAuth(
"X-API-Key",
"header",
w.APIKey,
))
if err != nil {
return err
}

View File

@ -31,7 +31,7 @@ func NewDeveloperWorkflow(
StoreContactActivity,
&app.ContactChannelWrapper{
Obj: payload.Contact,
Principal: payload.Principal,
APIKey: payload.Principal.APIKey,
SagaID: payload.SagaID,
SagaType: payload.SagaType,
}).Get(ctx, nil)
@ -42,7 +42,7 @@ func NewDeveloperWorkflow(
StoreAccountActivity,
&app.AccountChannelWrapper{
Obj: payload.Account,
Principal: payload.Principal,
APIKey: payload.Principal.APIKey,
SagaID: payload.SagaID,
SagaType: payload.SagaType,
}).Get(ctx, nil)
@ -53,7 +53,7 @@ func NewDeveloperWorkflow(
StorePaymentMethodActivity,
&app.PaymentMethodChannelWrapper{
Obj: payload.PaymentMethod,
Principal: payload.Principal,
APIKey: payload.Principal.APIKey,
SagaID: payload.SagaID,
SagaType: payload.SagaType,
}).Get(ctx, nil)
@ -64,7 +64,7 @@ func NewDeveloperWorkflow(
NotifyContactActivity,
&app.ContactChannelWrapper{
Obj: payload.Contact,
Principal: payload.Principal,
APIKey: payload.Principal.APIKey,
SagaID: payload.SagaID,
SagaType: payload.SagaType,
}).Get(ctx, nil)

View File

@ -30,7 +30,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, payload *NewLeadWrapper) err
StoreLeadActivity,
&app.LeadChannelWrapper{
Obj: payload.Lead,
Principal: payload.Principal,
APIKey: payload.Principal.APIKey,
}).Get(ctx, nil)
if err != nil {
return err
@ -41,7 +41,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, payload *NewLeadWrapper) err
NotifyLeadActivity,
&app.LeadChannelWrapper{
Obj: payload.Lead,
Principal: payload.Principal,
APIKey: payload.Principal.APIKey,
}).Get(ctx, nil)
if err != nil {
return err

View File

@ -27,7 +27,7 @@ func NewUserWorkflow(ctx workflow.Context, payload *NewUserChannelWrapper) error
StoreUserActivity,
&app.UserChannelWrapper{
Obj: payload.User,
Principal: payload.Principal,
APIKey: payload.Principal.APIKey,
SagaID: payload.SagaID,
SagaType: payload.SagaType,
}).Get(ctx, nil)

View File

@ -4,6 +4,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_client/payment_method"
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
"code.tnxs.net/taxnexus/lib/app"
httptransport "github.com/go-openapi/runtime/client"
"go.temporal.io/sdk/workflow"
)
@ -16,7 +17,12 @@ func StorePaymentMethodActivity(
postPaymentMethodParams.PaymentMethodRequest = &ops_models.PaymentMethodRequest{
Data: []*ops_models.PaymentMethod{&w.Obj},
}
_, err := opsClient.PaymentMethod.PostPaymentMethods(postPaymentMethodParams, w.Principal.Auth)
_, err := opsClient.PaymentMethod.PostPaymentMethods(postPaymentMethodParams,
httptransport.APIKeyAuth(
"X-API-Key",
"header",
w.APIKey,
))
if err != nil {
return err
}

View File

@ -9,6 +9,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/auth0/auth0_models"
"code.tnxs.net/taxnexus/lib/api/devops/devops_client/user"
"code.tnxs.net/taxnexus/lib/api/devops/devops_models"
httptransport "github.com/go-openapi/runtime/client"
"code.tnxs.net/taxnexus/lib/api/workflow/workflow_client/outgoing_email_message"
"code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"
@ -25,7 +26,12 @@ func StoreUserActivity(ctx workflow.Context, w app.UserChannelWrapper) error { /
postUserParams.UserRequest = &devops_models.UserRequest{
Data: []*devops_models.User{&w.Obj},
}
devopsResponse, err := devopsClient.User.PostUsers(postUserParams, w.Principal.Auth)
devopsResponse, err := devopsClient.User.PostUsers(postUserParams,
httptransport.APIKeyAuth(
"X-API-Key",
"header",
w.APIKey,
))
if err != nil {
return err
}
@ -63,7 +69,12 @@ func StoreUserActivity(ctx workflow.Context, w app.UserChannelWrapper) error { /
putUserParams.UserRequest = &devops_models.UserRequest{
Data: []*devops_models.User{newUser},
}
_, err = devopsClient.User.PutUsers(putUserParams, w.Principal.Auth)
_, err = devopsClient.User.PutUsers(putUserParams,
httptransport.APIKeyAuth(
"X-API-Key",
"header",
w.APIKey,
))
if err != nil {
return err
}
@ -108,7 +119,12 @@ Alert! New User Inquiry from Taxnexus.io website.
},
},
}
_, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams, w.Principal.Auth)
_, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams,
httptransport.APIKeyAuth(
"X-API-Key",
"header",
w.APIKey,
))
if err != nil {
return err
}