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

Separate IgnoredEventHandler behavior for connect and platform events. #647

Merged
merged 1 commit into from
Jan 19, 2017

Conversation

begedin
Copy link
Contributor

@begedin begedin commented Jan 19, 2017

What's in this PR?

This PR changes behavior of the IgnoredEventHandler module to work separately for connect platform events. This allows us, for example, to ignore a certain event type when it hits the platform webhook, while still handling it on the connect webhook, or vice-versa.

It also allows us to have separate ignore reasons for different endpoints.

Finally, it adds an explicit ignore for the "customer.updated" event on the connect webhook. The event is still being handled normally on the platform webhook.

References

Fixes #645

defp get_platform_reason("customer.source.created"), do: "Cards are only created from the client. No need to handle"
defp get_platform_reason("customer.subscription.created"), do: "Subscriptions are only created from the client."
defp get_platform_reason("invoice.created"), do: "We prefer to handle other lifecycle events for invoices, like payment_succeeded."
defp get_platform_reason("plan.created"), do: "Plans are only created from the client."
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm aware there is some code duplication here and we could reduce it but I feel it's clearer to keep the mapping of messages to event types separate. It also allows us to change the actual text based on the type of webhook that got hit.

@begedin begedin merged commit 339e94d into develop Jan 19, 2017
@begedin begedin deleted the 645-split-up-event-handler branch January 19, 2017 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants