func (s Client) Update(id string, params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) { body := &stripe.RequestValues{} params.Source.AppendDetails(body, false) params.AppendTo(body) source := &stripe.PaymentSource{} var err error if len(params.Customer) > 0 { err = s.B.Call("POST", fmt.Sprintf("/customers/%v/sources/%v", params.Customer, id), s.Key, body, ¶ms.Params, source) } else { err = errors.New("Invalid source params: customer needs to be set") } return source, err }
func (s Client) Get(id string, params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) { var body *stripe.RequestValues var commonParams *stripe.Params if params != nil { commonParams = ¶ms.Params body = &stripe.RequestValues{} params.AppendTo(body) } source := &stripe.PaymentSource{} var err error if len(params.Customer) > 0 { err = s.B.Call("GET", fmt.Sprintf("/customers/%v/sources/%v", params.Customer, id), s.Key, body, commonParams, source) } else { err = errors.New("Invalid source params: customer needs to be set") } return source, err }