Skip to content

Instantly share code, notes, and snippets.

@oyeb
Created February 1, 2018 11:51
Show Gist options
  • Save oyeb/35b426a9aa3c141b3497d45eab293b6f to your computer and use it in GitHub Desktop.
Save oyeb/35b426a9aa3c141b3497d45eab293b6f to your computer and use it in GitHub Desktop.
Some frequently used bindings for GlobalCollect
# Handy bindings when developing the GlobalCollect 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 launche your `iex` sessions via `iex -S mix`.
alias Gringotts.{CreditCard, Response, Address}
alias Gringotts.Gateways.GlobalCollect
shippingAddress = %{
street: "Desertroad",
houseNumber: "1",
additionalInfo: "Suite II",
zip: "84536",
city: "Monument Valley",
state: "Utah",
countryCode: "US"
}
billingAddress = %{
street: "Desertroad",
houseNumber: "13",
additionalInfo: "b",
zip: "84536",
city: "Monument Valley",
state: "Utah",
countryCode: "US"
}
invoice = %{
invoiceNumber: "000000123",
invoiceDate: "20140306191500"
}
name = %{
title: "Miss",
firstName: "Road",
surname: "Runner"
}
auth = [secret_api_key: "Qtg9v4Q0G13sLRNcClWhHnvN1kVYWDcy4w9rG8T86XU=",
api_key_id: "e5743abfc360ed12",
merchant_id: "1226"]
card = %CreditCard{
number: "4567350000427977",
month: 12,
year: 43,
first_name: "John",
last_name: "Doe",
verification_code: "123",
brand: "VISA"
}
opts = [
config: auth
]
extra_opts = opts ++ [
description: "Store Purchase 1437598192",
merchantCustomerId: "234",
dob: "19490917",
company: "asma",
email: "[email protected]",
phone: "7765746563",
invoice: invoice,
billingAddress: billingAddress,
name: name,
skipAuthentication: "true"
]
amount = Money.new(100, :USD)
# GlobalCollect.authorize amount, card, extra_opts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment