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"
|
2021-01-19 01:50:45 +00:00
|
|
|
httptransport "github.com/go-openapi/runtime/client"
|
2021-01-13 02:41:43 +00:00
|
|
|
"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},
|
|
|
|
}
|
2021-01-19 01:50:45 +00:00
|
|
|
_, err := opsClient.PaymentMethod.PostPaymentMethods(postPaymentMethodParams,
|
|
|
|
httptransport.APIKeyAuth(
|
|
|
|
"X-API-Key",
|
|
|
|
"header",
|
|
|
|
w.APIKey,
|
|
|
|
))
|
2021-01-13 02:41:43 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
sugar.Info("rules.storePaymentMethod: 👍 📤")
|
|
|
|
return nil
|
|
|
|
}
|