2021-01-13 02:41:43 +00:00
|
|
|
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"
|
|
|
|
"go.temporal.io/sdk/workflow"
|
|
|
|
)
|
|
|
|
|
|
|
|
// StorePaymentMethodActivity posts a new paymentmethod object to datastore
|
2021-01-13 05:09:16 +00:00
|
|
|
func StorePaymentMethodActivity(
|
|
|
|
ctx workflow.Context,
|
|
|
|
w app.PaymentMethodChannelWrapper, //nolint:gocritic // what we want
|
|
|
|
) error {
|
2021-01-13 02:41:43 +00:00
|
|
|
postPaymentMethodParams := payment_method.NewPostPaymentMethodsParamsWithTimeout(postTimeout)
|
|
|
|
postPaymentMethodParams.PaymentMethodRequest = &ops_models.PaymentMethodRequest{
|
|
|
|
Data: []*ops_models.PaymentMethod{&w.Obj},
|
|
|
|
}
|
|
|
|
_, err := opsClient.PaymentMethod.PostPaymentMethods(postPaymentMethodParams, w.Principal.Auth)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
sugar.Info("rules.storePaymentMethod: 👍 📤")
|
|
|
|
return nil
|
|
|
|
}
|