Skip to content

Instantly share code, notes, and snippets.

@oyeb
Last active February 1, 2018 12:16
Show Gist options
  • Save oyeb/055f40e9ad4102f5480febd2cfa00787 to your computer and use it in GitHub Desktop.
Save oyeb/055f40e9ad4102f5480febd2cfa00787 to your computer and use it in GitHub Desktop.
Some frequently used bindings for Trexle development
# Handy bindings when developing the Trexle gateway integration.
# Most of the bindings are for the `opts`
# Instructions
# Just rename this file to `.iex.exs` and save it in either,
# 1. the gringotts root directory
# 2. your applications root directory
# essentially the place where you launch your `iex` sessions via `iex -S mix`.
alias Gringotts.{CreditCard, Response, Address}
alias Gringotts.Gateways.Trexle
amount = Money.new("299", :EUR)
auth = %{api_key: "J5RGMpDlFlTfv9mEFvNWYoqHufyukPP4"}
card = %CreditCard{
first_name: "Harry",
last_name: "Potter",
number: "4200000000000000",
year: 2099, month: 12,
verification_code: "123",
brand: "VISA"}
address = %Address{
street1: "301, Gryffindor",
street2: "Hogwarts School of Witchcraft and Wizardry, Hogwarts Castle",
city: "Highlands",
region: "SL",
country: "GB",
postal_code: "11111",
phone: "(555)555-5555"}
opts = [
config: auth,
email: "[email protected]",
billing_address: address,
ip_address: "127.0.0.1",
description: "The Elder Wand"
]
# Trexle.authorize amount, card, opts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment