2021-01-10 23:14:20 +00:00
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/taxnexus/go-force/force"
|
|
|
|
)
|
|
|
|
|
|
|
|
// InitForce creates a salesforce connection using serviceAccountName
|
|
|
|
func InitForce(serviceAccountName string) *force.API {
|
2021-01-12 22:37:03 +00:00
|
|
|
sugar.Infof("app.initForce: 📥 %s", serviceAccountName)
|
2021-01-10 23:14:20 +00:00
|
|
|
acct := GetServiceAccount(serviceAccountName)
|
|
|
|
theForce, err := force.Create(
|
2021-02-19 17:47:02 +00:00
|
|
|
"v49.0",
|
2021-01-10 23:14:20 +00:00
|
|
|
acct.ClientID,
|
|
|
|
acct.ClientSecret,
|
|
|
|
acct.Username,
|
|
|
|
acct.Password,
|
|
|
|
acct.SecurityToken,
|
|
|
|
"production",
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
sugar.Errorf("app.InitForce: salesforce error: %s", err.Error())
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
sugar.Info("app.InitForce: 👍 📤")
|
|
|
|
return theForce
|
|
|
|
}
|