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

Developer may forward events normalized by compensated to a downstream endpoint #49

Open
2 of 3 tasks
zspencer opened this issue Mar 27, 2020 · 5 comments
Open
2 of 3 tasks
Labels
code Work that will require some amount of programming documentation Work that is intended to focus on improving documentation enhancement New feature or request epic Work that will will likely cover a number of use cases. help wanted Extra attention is needed infrastructure Work that will require some infrastructure engineering expertise test Work that will require testing skillz
Milestone

Comments

@zspencer
Copy link
Member

zspencer commented Mar 27, 2020

In Order to Use Compensated in Systems that are not written in Ruby
As a Client Developer
I would like to be able to use Compensated to forward the normalized events.

This Issue May Be Closed When

  • There is a compensated-proxy ruby gem that can be installed
  • The features/forwarding-proxy.feature file is created and fleshed out with the happy path (but not necessarily wired in)
  • The use case described has been tested by a Client Developer or a Maintainer

Scenarios

Scenario: Forwarding proxy forwards all events to Downstream Server
  Given there is a Downstream Listener running
  And I am running `compensated-proxy` with the following command line arguments:
  | argument | value |
  | --forward-to | {{ downstreamListener.compensatedEventHandlerURI }}|
  When each our Source Event Fixtures are delivered to the running compensated proxy
  Then the Downstream Listener receives each of our Standardized Event Fixtures

Context

Because compensated is currently only written in Ruby; and we are getting requests from folks who want to use it in python, node, and other languages we may want to provide a micro-service version of compensated that can listen for events from upstream payment processors; normalize their data; and forward the normalized data down.

Ideally, this would be done by executing a few simple commands; such as gem install compensated-proxy && compensated-proxy --forward-to=https://your-other-app.example.com/compensated_events or a Kubernetes/docker equivalent.

We'll probably want to rely on puma for the ruby webserver side of things; or it may be possible to package it up as a boring rack app. The Traveling Ruby package may give us what we need for packaging the full executable up. Or we can assume they can manage their own ruby and rely on executables in our gemspec.

@zspencer zspencer added enhancement New feature or request help wanted Extra attention is needed code Work that will require some amount of programming infrastructure Work that will require some infrastructure engineering expertise labels Mar 27, 2020
@ghost
Copy link

ghost commented Mar 27, 2020

Creating an abstraction interface and standard json spec for the interface as a first step

@jalcine
Copy link

jalcine commented May 5, 2020

It wouldn't have to be an explicitly JSON one. Something of a documented API would be enough. OpenAPI / Swagger is excellent for this (it can even reduce the amount of code needed to be written - but I have to check this)

@jalcine
Copy link

jalcine commented May 5, 2020

Eh, that actually proved to be more annoying to provide generated libraries - especially if they don't leverage language specific features. If we can produce a "spec" of the expected endpoints and responses though (still doable using something like Open API) then it'd be a living reference point.

@zspencer
Copy link
Member Author

zspencer commented May 5, 2020

@jalcine - I'm curious if the Spec documented in docs/README.md meets your needs?

That is the rough sketch of what data comes out of Compensated, and while I would love for fancier automated tooling; automated tooling often comes with a steep learning curve and carry cost.

@zspencer zspencer added epic Work that will will likely cover a number of use cases. documentation Work that is intended to focus on improving documentation test Work that will require testing skillz labels May 5, 2020
@zspencer
Copy link
Member Author

zspencer commented May 5, 2020

@lanegrant - This ticket seems to be really big, so I've added the "epic" label so it doesn't feel like something that needs to be done all at once.

If you have requests for support, creating a Github Issue and tagging me with it is the best way for me to know what specific supports you would expect are missing.

I am trying to thread the needle on being supportive without inflicting help and making space for folks to take ownership without throwing them in the deep end, and I am better at that when people "pull" my attention instead of me pushing it on them (and smothering them).

One way to do that, if you are comfortable doing so, is to post the output of each work session as a pull request (or new issue or comment) so that we can "katamari damacy" towards the full implementation as a team.

zspencer added a commit that referenced this issue May 10, 2020
See #49

Initializes gem folder structure and hooks the specs into CI
zspencer added a commit that referenced this issue May 17, 2020
See #49

Initializes gem folder structure and hooks the specs into CI
zspencer added a commit that referenced this issue May 18, 2020
* 🎉Sprout initial compensated-proxy gem

See #49

Initializes gem folder structure and hooks the specs into CI

* ✨Forward requests to the downstream endpoint

We're relying on the built in Net::HTTP class, because that keeps
our dependency graph down to zero.

* ♻️It felt odd to have a `Compensated::Proxy::Service`

* ♻️ Inline Forwarder class as it is no longer useful

It was useful when thinking about the problem, but
just adds clutter now that we have decent tests.

* Don't use hardcoded strings because they don't play nice with timezones

* 🎨 💡 Document the classes and apply linting

I'm not sold on rubocop, especially since rubyfmt is so close to  a production release.

However, I am not going to worry too much about it for now.

* 🚧✨ CLI app for forwarding formatted events (#69)

This is still pretty rough, but the general bones are there.

You can now use the executable compensated-proxy in place of
writing your own forwarder in Ruby.

This should make it a bit easier for folks who _do not_ want
to write their entire application in Ruby to do use compensated for
reformatting payment, invoice and subscription related events across payment providers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Work that will require some amount of programming documentation Work that is intended to focus on improving documentation enhancement New feature or request epic Work that will will likely cover a number of use cases. help wanted Extra attention is needed infrastructure Work that will require some infrastructure engineering expertise test Work that will require testing skillz
Projects
None yet
Development

No branches or pull requests

2 participants