32 lines
948 B
Go
32 lines
948 B
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.PaymentMethodChannelWrapper, //nolint:gocritic // what we want
|
|
) error {
|
|
postPaymentMethodParams := payment_method.NewPostPaymentMethodsParamsWithTimeout(postTimeout)
|
|
postPaymentMethodParams.PaymentMethodRequest = &ops_models.PaymentMethodRequest{
|
|
Data: []*ops_models.PaymentMethod{&w.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
|
|
}
|