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

Adds the Money protocol and a mix task #110

Merged
merged 23 commits into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
961dfcb
Added project logo
pkrawat1 Dec 29, 2017
90e8b3e
Added version for inch_ex
oyeb Jan 2, 2018
907723b
test case added for network failure
jyotigautam Jan 2, 2018
609a92c
[ci skip] Get more Open Source Helpers
schneems Jan 2, 2018
41f1de5
Codeclimate fixes (#68)
sivagollapalli Jan 3, 2018
2680289
FIX# code style for large numbers (#67)
sivagollapalli Jan 3, 2018
6e402e9
Stripe gateway minor fixes and docs update (#75)
chandradot99 Jan 4, 2018
ea11367
Using Address and Credit Card struct (#74)
jyotigautam Jan 4, 2018
df44753
Cams : Added error response handling (#65)
gopalshimpi Jan 4, 2018
afdd12e
test authorize net
arjun289 Dec 25, 2017
d5fda24
Introducing the Money protocol (#71)
oyeb Jan 10, 2018
6fafa1d
Update README.md
pkrawat1 Jan 10, 2018
9a4c89b
Adds a super useful mix task: gringotts.new
oyeb Jan 9, 2018
365c3f1
[money-protocol] Expansion: `to_string` and `to_integer` (#86)
oyeb Jan 19, 2018
6d1828f
add mix task for tests, mocks and integration
arjun289 Jan 17, 2018
a135692
[monei] Implements optional/extra params (#79)
oyeb Jan 21, 2018
ce7c6bd
Money integration with ANet and Anet test modification (#82)
arjun289 Jan 21, 2018
db9190b
[ANet] Corrected use of money protocol and examples (#92)
oyeb Jan 25, 2018
5e748e7
[trexle] Adds Money protocol (#84)
jyotigautam Jan 25, 2018
f3c0d58
[CAMS] Adds money protocol (#89)
gopalshimpi Jan 25, 2018
f2796b4
Fix doc example typos, and mock tests (#93)
oyeb Jan 25, 2018
fa1cd11
[mix-task] Fixed arg order in capture (#94)
oyeb Jan 25, 2018
5b15d30
Global Collect payment gateway integration. (#95)
jyotigautam Jan 25, 2018
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
82 changes: 43 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
</p>

<p align="center">
Gringotts is a payment processing library in Elixir integrating various payment gateways, this draws motivation for shopify's <a href="https://github.com/activemerchant/active_merchant">activemerchant</a> gem.
Gringotts is a payment processing library in Elixir integrating various payment gateways, this draws motivation for shopify's <a href="https://github.com/activemerchant/active_merchant">activemerchant</a> gem. Checkout the <a href="https://gringottspay.herokuapp.com/" target="_">Demo</a> here.
</p>
<p align="center">
<a href="https://travis-ci.org/aviabird/gringotts"><img src="https://travis-ci.org/aviabird/gringotts.svg?branch=master" alt='Build Status' /></a> <a href='https://coveralls.io/github/aviabird/gringotts?branch=master'><img src='https://coveralls.io/repos/github/aviabird/gringotts/badge.svg?branch=master' alt='Coverage Status' /></a> <a href=""><img src="https://img.shields.io/hexpm/v/gringotts.svg"/></a> <a href="https://inch-ci.org/github/aviabird/gringotts"><img src="http://inch-ci.org/github/aviabird/gringotts.svg?branch=master" alt="Docs coverage"></img></a> <a href="https://gitter.im/aviabird/gringotts"><img src="https://badges.gitter.im/aviabird/gringotts.svg"/></a>
<a href="https://www.codetriage.com/aviabird/gringotts"><img src="https://www.codetriage.com/aviabird/gringotts/badges/users.svg" alt='Help Contribute to Open Source' /></a>
</p>

A simple and unified API to access dozens of different payment
Expand All @@ -24,7 +25,10 @@ Add gringotts to the list of dependencies.
```elixir
def deps do
[
{:gringotts, "~> 1.0"}
{:gringotts, "~> 1.0"},
# ex_money provides an excellent Money library, and integrates
# out-of-the-box with Gringotts
{:ex_money, "~> 1.1.0"}
]
end
```
Expand All @@ -45,59 +49,59 @@ This simple example demonstrates how a purchase can be made using a person's cre
Add configs in `config/config.exs` file.

```elixir
config :gringotts, Gringotts.Gateways.Stripe,
adapter: Gringotts.Gateways.Stripe,
secret_key: "YOUR_KEY",
default_currency: "USD"

config :gringotts, Gringotts.Gateways.Monei,
adapter: Gringotts.Gateways.Monei,
userId: "your_secret_user_id",
password: "your_secret_password",
entityId: "your_secret_channel_id"
```

Copy and paste this code in your module

```elixir
alias Gringotts.Gateways.Stripe
alias Gringotts.{CreditCard, Address, Worker, Gateways}
alias Gringotts.Gateways.Monei
alias Gringotts.{CreditCard}

card = %CreditCard{
first_name: "John",
last_name: "Smith",
number: "4242424242424242",
year: "2017",
month: "12",
verification_code: "123"
}

address = %Address{
street1: "123 Main",
city: "New York",
region: "NY",
country: "US",
postal_code: "11111"
first_name: "Harry",
last_name: "Potter",
number: "4200000000000000",
year: 2099, month: 12,
verification_code: "123",
brand: "VISA"
}

opts = [address: address, currency: "eur"]

case Gringotts.purchase(Stripe, 10, card, opts) do
{:ok, %{authorization: authorization}} ->
IO.puts("Payment authorized #{authorization}")
amount = Money.new(42, :USD)

{:error, %{code: :declined, reason: reason}} ->
IO.puts("Payment declined #{reason}")
case Gringotts.purchase(Monei, amount, card, opts) do
{:ok, %{id: id}} ->
IO.puts("Payment authorized, reference token: '#{id}'")

{:error, %{code: error}} ->
IO.puts("Payment error #{error}")
{:error, %{status_code: error, raw: raw_response}} ->
IO.puts("Error: #{error}\nRaw:\n#{raw_response}")
end
```

## Supported Gateways

* [Authorize.Net](http://www.authorize.net/) - AD, AT, AU, BE, BG, CA, CH, CY, CZ, DE, DK, ES, FI, FR, GB, GB, GI, GR, HU, IE, IT, LI, LU, MC, MT, NL, NO, PL, PT, RO, SE, SI, SK, SM, TR, US, VA
* [CAMS: Central Account Management System](https://www.centralams.com/) - AU, US
* [MONEI](http://www.monei.net/) - AD, AT, BE, BG, CA, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HU, IE, IL, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR, US, VA
* [PAYMILL](https://paymill.com) - AD, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HU, IE, IL, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR, VA
* [Stripe](https://stripe.com/) - AT, AU, BE, CA, CH, DE, DK, ES, FI, FR, GB, IE, IN, IT, LU, NL, NO, SE, SG, US
* [TREXLE](https://docs.trexle.com/) - AD, AE, AT, AU, BD, BE, BG, BN, CA, CH, CY, CZ, DE, DK, EE, EG, ES, FI, FR, GB, GI, GR, HK, HU, ID, IE, IL, IM, IN, IS, IT, JO, KW, LB, LI, LK, LT, LU, LV, MC, MT, MU, MV, MX, MY, NL, NO, NZ, OM, PH, PL, PT, QA, RO, SA, SE, SG, SI, SK, SM, TR, TT, UM, US, VA, VN, ZA
* [Wirecard](http://www.wirecard.com) - AD, CY, GI, IM, MT, RO, CH, AT, DK, GR, IT, MC, SM, TR, BE, EE, HU, LV, NL, SK, GB, BG, FI, IS, LI, NO, SI, VA, FR, IL, LT, PL, ES, CZ, DE, IE, LU, PT, SE
| Gateway | Supported countries |
| ------ | ----- |
| [Authorize.Net][anet] | AD, AT, AU, BE, BG, CA, CH, CY, CZ, DE, DK, ES, FI, FR, GB, GB, GI, GR, HU, IE, IT, LI, LU, MC, MT, NL, NO, PL, PT, RO, SE, SI, SK, SM, TR, US, VA |
| [CAMS][cams] | AU, US |
| [MONEI][monei] | DE, EE, ES, FR, IT, US |
| [PAYMILL][paymill] | AD, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HU, IE, IL, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR, VA |
| [Stripe][stripe] | AT, AU, BE, CA, CH, DE, DK, ES, FI, FR, GB, IE, IN, IT, LU, NL, NO, SE, SG, US |
| [TREXLE][trexle] | AD, AE, AT, AU, BD, BE, BG, BN, CA, CH, CY, CZ, DE, DK, EE, EG, ES, FI, FR, GB, GI, GR, HK, HU, ID, IE, IL, IM, IN, IS, IT, JO, KW, LB, LI, LK, LT, LU, LV, MC, MT, MU, MV, MX, MY, NL, NO, NZ, OM, PH, PL, PT, QA, RO, SA, SE, SG, SI, SK, SM, TR, TT, UM, US, VA, VN, ZA |
| [Wirecard][wirecard] | AD, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FR, GB, GI, GR, HU, IE, IL, IM, IS, IT, LI, LT, LU, LV, MC, MT, NL, NO, PL, PT, RO, SE, SI, SK, SM, TR, VA |

[anet]: http://www.authorize.net/
[cams]: https://www.centralams.com/
[monei]: http://www.monei.net/
[paymill]: https://www.paymill.com
[stripe]: https://www.stripe.com/
[trexle]: https://www.trexle.com/
[wirecard]: http://www.wirecard.com
[demo]: https://gringottspay.herokuapp.com/

## Road Map

Expand Down
Binary file added images/lg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading