pkrawat1

pkrawat1

Gringotts: A complete payment library for Elixir and Phoenix Framework

Hey guyz

We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it.
Have a look at it in development here https://github.com/aviabird/gringotts.

Thanks

Most Liked

michalmuskala

michalmuskala

I had a quick look at the library. I think this is an awesome project and something very needed in the community. I have some some remarks, though.

Why are floats used for money? This is a complete no-go for me since floating point arithmetic is inherently inacurate. I haven’t looked in depth if this is actually the case, but that’s what is presented in the examples.

Why is the project using GenServers in the middle? It should be perfectly enough to have “just” modules and functions. The worker process does not use the state in any way, so the only thing it does, is creating a bottleneck in the system.

16
Post #2
kip

kip

ex_cldr Core Team

There are a few libs that provide Money functions. money, ex_money and monetized (the first 3 on hex.pm) each seem to represent Money as a struct with a currency which is an ISO 4217 code and amount which is a Decimal.

It would be useful if Gringotts could support an abstraction for money types so that integration would be straight forward given than there’s a reasonable likelihood that someone using Gringotts is probably also using a Money lib. Maybe a Money protocol?

(disclaimer: I’m the author or ex_money)

11
Post #4
josevalim

josevalim

Creator of Elixir

Hi @pkrawat1 and team, I would like to reinforce the point above.

Using a GenServer when you don’t need one is an anti-pattern and it will actually have severe applications on the system performance, as you put all operations besides a single process which will become a bottleneck. We cover this in detail in Adopting Elixir and there is a thread about this particular topic in the forum.

Even if you may end-up using the worker for configuration, I would ask you to revisit that, because it should not be the place of libraries to impose a stateful configuration mechanism. Simply ask the users to pass the configuration every time the gateway is called. If the users of your library need to store this configuration somewhere, they can easily do so by using an Agent, application config, GenServer, etc.

kip

kip

ex_cldr Core Team

Just noting even “cents” needs care since an implied decimal place of fixed size (cents == 100) is also problematic for the 52 currencies that have no decimal places, the 6 that have 3 decimal places and the one that has 4 decimal places.

10
Post #7
AstonJ

AstonJ

Yup - decimals or integers.

Also worth checking out this post.

Where Next?

Popular in Libraries Top

zoltanszogyenyi
Hey everyone :wave: Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-source U...
New
sabiwara
Dune is a sandbox for Elixir and aims to safely evaluate user-provided code. You can try it out using this basic Elixir playground made ...
New
OvermindDL1
Been making an MLElixir thing (not released yet…) for fun in spare time in the past day. I’m just trying to see how much I can get an ML...
132 13487 106
New
jakub-zawislak
Hi everyone, I’m coming from the Symfony (PHP) framework. I like Phoenix, but it has a one thing that was build much better in the Symfo...
New
Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
Antrater
Hi everyone! I’m thrilled to announce a huge thing. We have been developing Elixir Moon Design System for quite a while. We are finally ...
New
ericlathrop
I built a silly site for Halloween that uses Phoenix Channels on the backend, and React on the frontend. I had many problems integrating ...
New
vic
Expat is a tiny experiment I did for extracting patterns and being able to reuse them (compose and share patterns between elixir librarie...
New
KallDrexx
For a good number of months I've been working on creating a very basic RTMP live video streaming server. Now that I have a very, very ba...
New
mischov
import Meeseeks.CSS html = HTTPoison.get!("https://news.ycombinator.com/").body for story <- Meeseeks.all(html, css("tr.athing")) do...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Sub Categories:

We're in Beta

About us Mission Statement