Skip to content
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8a01a40
added the config in config file and created authorize example for aut…
arjun289 Dec 14, 2017
d0d1e6d
made changes to constants
arjun289 Dec 14, 2017
78016d5
Merge branch 'dev' of bitbucket.org:aviabird/kuber_hex_examples into …
arjun289 Dec 14, 2017
5a115a1
added purchase, capture methods and credit card struct
arjun289 Dec 14, 2017
8679ede
changed version to 1.5.2
arjun289 Dec 14, 2017
b4b01ad
Merged in authorize_net (pull request #6)
arjun289 Dec 14, 2017
7c097da
add config
SagarKarwande Dec 15, 2017
2bca2f8
Merged in stripe (pull request #7)
Dec 15, 2017
3f8cc73
support for new card struct
SagarKarwande Dec 18, 2017
f30c70b
Merge branch 'dev' of bitbucket.org:aviabird/kuber_hex_examples into …
SagarKarwande Dec 18, 2017
bb368ec
Merged in paymill (pull request #8)
SagarKarwande Dec 18, 2017
39305d3
Merge pull request #1 from aviabird/dev
chandradot99 Dec 20, 2017
67ea98e
minor readme update
SagarKarwande Dec 20, 2017
bc37524
Merge branch 'dev' of github.com:aviabird/gringotts_example into trexle
jyotigautam Dec 21, 2017
58ff16d
trexle payment gateway addition
jyotigautam Dec 21, 2017
17ace8a
Merge branch 'master' of github.com:aviabird/gringotts_example into t…
jyotigautam Dec 22, 2017
d9f252e
capture,refund and store added in trexle payment gateway
jyotigautam Dec 22, 2017
c60b48e
passing required params using opts keyword list
jyotigautam Dec 23, 2017
2b092e1
using user defined structs instead of map
jyotigautam Jan 3, 2018
ce794da
remove unused alias for Worker and Gateways
jyotigautam Jan 5, 2018
f12c9ca
Money struct passed in amounts
jyotigautam Jan 17, 2018
590976b
money map passed in amount
jyotigautam Jan 17, 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gringotts Examples

Repository contains example usage for all the payment gateway integartions in [kuber hex](https://github.com/aviabird/gringotts)
Repository contains example usage for all the payment gateway integartions in [Gringotts](https://github.com/aviabird/gringotts)

Gringotts is a payment processing library for Elixir. Based on [Shopify's](http://shopify.com) [ActiveMerchant](http://github.com/Shopify/active_merchant) ruby gem.

Expand All @@ -9,6 +9,6 @@ Gringotts is a payment processing library for Elixir. Based on [Shopify's](http:
* `mix deps.get`
* `mix test`

## TODO's
## TODO's

* Add test cases
15 changes: 15 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,28 @@ config :gringotts, Gringotts.Gateways.Bogus,
api_key: "sk_test_mnrVg6z2G0HeDzwy5gxJfmfP",
default_currency: "USD"

config :gringotts, Gringotts.Gateways.Paymill,
adapter: Gringotts.Gateways.Paymill,
private_key: "8f16b021d4fb1f8d9263cbe346f32688",
public_key: "72294854039fcf7fd55eaeeb594577e7"

config :gringotts, Gringotts.Gateways.AuthorizeNet,
adapter: Gringotts.Gateways.AuthorizeNet,
name: "64jKa6NA",
transactionKey: "4vmE338dQmAN6m7B",
default_currency: "USD"

config :gringotts, Gringotts.Gateways.WireCard,
adapter: Gringotts.Gateways.WireCard,
login: "00000031629CA9FA",
password: "TestXAPTER",
signature: "00000031629CAFD5"

config :gringotts, Gringotts.Gateways.Trexle,
adapter: Gringotts.Gateways.Trexle,
api_key: "J5RGMpDlFlTfv9mEFvNWYoqHufyukPP4",
default_currency: "USD"

# It is also possible to import configuration files, relative to this
# directory. For example, you can emulate configuration per environment
# by uncommenting the line below and defining dev.exs, test.exs and such.
Expand Down
52 changes: 52 additions & 0 deletions lib/gringotts_examples/trexle.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
defmodule Gringotts.Examples.Trexle do

alias Gringotts, as: Billing
alias Billing.{CreditCard, Address, Worker, Gateways}
Copy link
Member

Choose a reason for hiding this comment

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

remove alias for Worker and Gateways as this is not been used.

alias Gringotts.Gateways.Trexle

@payment %CreditCard{
number: "5200828282828210",
month: 12,
year: 2018,
first_name: "John",
last_name: "Doe",
verification_code: "123",
brand: "visa"
}

@address %Address{
street1: "123 Main",
street2: "Suite 100",
city: "New York",
region: "NY",
country: "US",
postal_code: "11111",
phone: "(555)555-5555"
}

@options [ email: "john@trexle.com",
ip_address: "66.249.79.118",
billing_address: @address,
description: "Store Purchase 1437598192"]

def authorize() do
Billing.authorize(Trexle, 50, @payment, @options)
end

def purchase() do
Billing.purchase(Trexle, 50, @payment, @options)
end

def capture(charge_token) do
Billing.capture(Trexle, charge_token, 50)
end

def refund(charge_token) do
Billing.refund(Trexle, 50, charge_token, @options)
end

def store() do
Billing.store(Trexle, @payment, @options)
end

end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Gringotts.Examples.Mixfile do
[
app: :gringotts_examples,
version: "0.1.0",
elixir: "~> 1.5.2",
elixir: "~> 1.5.1",
start_permanent: Mix.env == :prod,
deps: deps()
]
Expand Down
24 changes: 12 additions & 12 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
%{"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [], [], "hexpm"},
"elixir_xml_to_map": {:hex, :elixir_xml_to_map, "0.1.1", "57e924cd11731947bfd245ce57d0b8dd8b7168bf8edb20cd156a2982ca96fdfa", [], [{:erlsom, "~>1.4", [hex: :erlsom, repo: "hexpm", optional: false]}], "hexpm"},
"erlsom": {:hex, :erlsom, "1.4.1", "53dbacf35adfea6f0714fd0e4a7b0720d495e88c5e24e12c5dc88c7b62bd3e49", [], [], "hexpm"},
"hackney": {:hex, :hackney, "1.10.1", "c38d0ca52ea80254936a32c45bb7eb414e7a96a521b4ce76d00a69753b157f21", [], [{:certifi, "2.0.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
"httpoison": {:hex, :httpoison, "0.13.0", "bfaf44d9f133a6599886720f3937a7699466d23bb0cd7a88b6ba011f53c6f562", [], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
"idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [], [], "hexpm"},
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [], [], "hexpm"},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [], [], "hexpm"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [], [], "hexpm"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [], [], "hexpm"},
"xml_builder": {:hex, :xml_builder, "0.1.2", "b48ab9ed0a24f43a6061e0c21deda88b966a2121af5c445d4fc550dd822e23dc", [], [], "hexpm"}}
%{"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"},
"elixir_xml_to_map": {:hex, :elixir_xml_to_map, "0.1.1", "57e924cd11731947bfd245ce57d0b8dd8b7168bf8edb20cd156a2982ca96fdfa", [:mix], [{:erlsom, "~>1.4", [hex: :erlsom, repo: "hexpm", optional: false]}], "hexpm"},
"erlsom": {:hex, :erlsom, "1.4.1", "53dbacf35adfea6f0714fd0e4a7b0720d495e88c5e24e12c5dc88c7b62bd3e49", [:rebar3], [], "hexpm"},
"hackney": {:hex, :hackney, "1.10.1", "c38d0ca52ea80254936a32c45bb7eb414e7a96a521b4ce76d00a69753b157f21", [:rebar3], [{:certifi, "2.0.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
"httpoison": {:hex, :httpoison, "0.13.0", "bfaf44d9f133a6599886720f3937a7699466d23bb0cd7a88b6ba011f53c6f562", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
"idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"},
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm"},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], [], "hexpm"},
"xml_builder": {:hex, :xml_builder, "0.1.2", "b48ab9ed0a24f43a6061e0c21deda88b966a2121af5c445d4fc550dd822e23dc", [:mix], [], "hexpm"}}