51 lines
1.6 KiB
Go
51 lines
1.6 KiB
Go
package rules
|
|
|
|
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"
|
|
)
|
|
|
|
// StorePaymentMethodActivity posts a new paymentmethod object to datastore
|
|
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{obj},
|
|
}
|
|
_, err := opsClient.PaymentMethod.PostPaymentMethods(postPaymentMethodParams,
|
|
httptransport.APIKeyAuth(
|
|
"X-API-Key",
|
|
"header",
|
|
w.APIKey,
|
|
))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
sugar.Info("rules.storePaymentMethod: 👍 📤")
|
|
return nil
|
|
}
|