// New creates a new Stripe client with the appropriate secret key
// as well as providing the ability to override the backends as needed.
168398
func New(key string, backends *stripe.Backends) *API {
	api := API{}
	api.Init(key, backends)
	return &api
}
871174
func New(params *stripe.TopupParams) (*stripe.Topup, error) {
	return getC().New(params)
}
831823
func New(endpoints []string, ca, cert, key string) (*Client, error) {
	client := Client{Endpoints: endpoints}

	if ca != "" || cert != "" || key != "" {
		tlsInfo := transport.TLSInfo{
			CertFile:      cert,
			KeyFile:       key,
			TrustedCAFile: ca,
		}
		tlsConfig, err := tlsInfo.ClientConfig()
		if err != nil {
			return nil, err
		}
		client.TLS = tlsConfig
	}

	return &client, nil
}
447168
func New(params *stripe.CardParams) (*stripe.Card, error) {
	return getC().New(params)
}
818679
func New(params *stripe.FileParams) (*stripe.File, error) {
	return getC().New(params)
}
624300
func New(params *stripe.TransferParams) (*stripe.Transfer, error) {
	return getC().New(params)
}
968428
func (c Client) New(params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
	tr := &stripe.TaxRate{}
	err := c.B.Call(http.MethodPost, "/v1/tax_rates", c.Key, params, tr)
	return tr, err
}
534483
func New(config *Config) (SecretService, error) {
	var err error
	var keyBytes *[SecretKeyLength]byte
	var metricsClient metrics.Client

	// Read in key from KeyPath or if not given, try getting them from KeyBytes.
	if config.KeyPath != "" {
		if keyBytes, err = ReadKeyFromDisk(config.KeyPath); err != nil {
			return nil, err
		}
	} else {
		if config.KeyBytes == nil {
			return nil, errors.New("No key bytes provided.")
		}
		keyBytes = config.KeyBytes
	}

	// setup metrics service
	if config.EmitStats {
		// get hostname of box
		hostname, err := os.Hostname()
		if err != nil {
			return nil, fmt.Errorf("failed to obtain hostname: %v", err)
		}

		// build lemma prefix
		prefix := "lemma." + strings.Replace(hostname, ".", "_", -1)
		if config.StatsdPrefix != "" {
			prefix += "." + config.StatsdPrefix
		}

		// build metrics client
		hostport := fmt.Sprintf("%v:%v", config.StatsdHost, config.StatsdPort)
		metricsClient, err = metrics.NewWithOptions(hostport, prefix, metrics.Options{UseBuffering: true})
		if err != nil {
			return nil, err
		}
	} else {
		// if you don't want to emit stats, use the nop client
		metricsClient = metrics.NewNop()
	}

	return &Service{
		secretKey:     keyBytes,
		metricsClient: metricsClient,
	}, nil
}
610626
func New(params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) {
	return getC().New(params)
}
243450
func New(params *stripe.SKUParams) (*stripe.SKU, error) {
	return getC().New(params)
}
1052991
func (c Client) New(params *stripe.CardParams) (*stripe.Card, error) {
	if params == nil {
		return nil, errors.New("params should not be nil")
	}

	var path string
	if params.Account != nil {
		path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts",
			stripe.StringValue(params.Account))
	} else if params.Customer != nil {
		path = stripe.FormatURLPath("/v1/customers/%s/sources",
			stripe.StringValue(params.Customer))
	} else if params.Recipient != nil {
		path = stripe.FormatURLPath("/v1/recipients/%s/cards",
			stripe.StringValue(params.Recipient))
	} else {
		return nil, errors.New("Invalid card params: either account, customer or recipient need to be set")
	}

	body := &form.Values{}

	// Note that we call this special append method instead of the standard one
	// from the form package. We should not use form's because doing so will
	// include some parameters that are undesirable here.
	params.AppendToAsCardSourceOrExternalAccount(body, nil)

	// Because card creation uses the custom append above, we have to make an
	// explicit call using a form and CallRaw instead of the standard Call
	// (which takes a set of parameters).
	card := &stripe.Card{}
	err := c.B.CallRaw(http.MethodPost, path, c.Key, body, &params.Params, card)
	return card, err
}
1162915
func New(params *stripe.ApplePayDomainParams) (*stripe.ApplePayDomain, error) {
	return getC().New(params)
}
1272426
func New(key, secret string) *KrakenApi {
	return NewWithClient(key, secret, http.DefaultClient)
}
737334
func New(accessKeyID, secretAccessKey string) (c *Config, err error) {
	c, err = NewDefault()
	if err != nil {
		c = nil
		return
	}
	c.AccessKeyID = accessKeyID
	c.SecretAccessKey = secretAccessKey

	return
}
587069
func New(params *stripe.RefundParams) (*stripe.Refund, error) {
	return getC().New(params)
}
522147
func New(apiKey, apiSecret string) *Poloniex {
	client := NewClient(apiKey, apiSecret)
	return &Poloniex{client}
}
844327
func New(paymentConfig []config.PaymentProvider) {

	// init the payment providers
	for _, v := range paymentConfig {
		var p Interface
		var err error
		switch v.Provider {
		case paymentpb.PaymentProviderId_Stripe.String():
			p, err = stripe.NewProvider(&v)
			if err != nil {
				log.Panic(err)
			}
			// just for testing
		case "DigotaInternalTestOnly":
			p, err = internalTestOnly.NewProvider()
			if err != nil {
				log.Panic(err)
			}
		default:
			log.Panicf("Payment provider %s is not valid", v.Provider)
		}
		mtx.Lock()
		providers[p.ProviderId()] = p
		mtx.Unlock()
	}
}