Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc service method to get all webhook endpoints #790

Merged
merged 4 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make api vesion a constant
  • Loading branch information
etsai2-stripe committed Nov 29, 2021
commit bc47794d85841d86a070ae9f47113fd5dbf20ced
2 changes: 1 addition & 1 deletion pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ func getEndpointsFromAPI(ctx context.Context, secretKey, apiBaseURL string) requ
apiBaseURL = stripe.DefaultAPIBaseURL
}

return requests.WebhookEndpointsList(ctx, apiBaseURL, "2019-03-14", secretKey, &config.Profile{})
return requests.WebhookEndpointsList(ctx, apiBaseURL, stripe.ApiVersion, secretKey, &config.Profile{})
}

func buildEndpointRoutes(endpoints requests.WebhookEndpointList, forwardURL, forwardConnectURL string, forwardHeaders []string, forwardConnectHeaders []string) ([]EndpointRoute, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/rpcservice/webhook_endpoints_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (srv *RPCService) WebhookEndpointsList(ctx context.Context, req *rpc.Webhoo
return nil, err
}

endpoints := requests.WebhookEndpointsList(ctx, stripe.DefaultAPIBaseURL, "2019-03-14", key, &userConfig.Profile)
endpoints := requests.WebhookEndpointsList(ctx, stripe.DefaultAPIBaseURL, stripe.ApiVersion, key, &userConfig.Profile)

formattedEndpoints := make([]*rpc.WebhookEndpointsListResponse_WebhookEndpointData, 0, len(endpoints.Data))
for _, v := range endpoints.Data {
Expand Down
3 changes: 3 additions & 0 deletions pkg/stripe/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const DefaultAPIBaseURL = "https://api.stripe.com"
// DefaultDashboardBaseURL is the default base URL for dashboard requests
const DefaultDashboardBaseURL = "https://dashboard.stripe.com"

// ApiVersion is API version used in CLI
const ApiVersion = "2019-03-14"

// Client is the API client used to sent requests to Stripe.
type Client struct {
// The base URL (protocol + hostname) used for all requests sent by this
Expand Down