swelham / cashier

Cashier is an Elixir library that aims to be an easy to use payment gateway, whilst offering the fault tolerance and scalability benefits of being built on top of Erlang/OTP
MIT License
49 stars 10 forks source link

Add async functions to the cashier module #18

Open swelham opened 7 years ago

swelham commented 7 years ago

Currently all available functions on the cashier module are sync functions that wait for the payment gateway to return a result before continuing. Adding an async interface will allow for more advanced usage of cashier such as payments over websockets.

Current thoughts are to add two async interfaces per function.

Example for the purchase function

def async_purchase(amount, card, fun)
def async_purchase(amount, card, module, fun)

Each of the function callbacks would receive the same result as the sync version.

An additional thought is to add an args parameter that would be passed into the callback function, however the payment gateway result would need to be appended to this in some form.