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

[Mercadopago] Implemented purchase #154

Closed
wants to merge 60 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 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
99850ab
Introduces `Response.t` with docs (#119)
oyeb Feb 6, 2018
1920ced
Removes payment worker.
oyeb Feb 5, 2018
8622ded
Removed offending (now useless) test case
oyeb Feb 5, 2018
6aa6a86
Removed GenServer import. Fixes #8.
oyeb Feb 15, 2018
3768649
Refactored ResponseHandler, for new Response.t
oyeb Feb 9, 2018
e16fe72
Refactored `commit` and corrected avs, cvc result
oyeb Feb 9, 2018
6eef8ef
Correct a few doc examples
oyeb Feb 9, 2018
e3c86ce
Adds changelog, contributing guide and improves mix task (#117)
oyeb Mar 15, 2018
71a5bc3
[monei] Test fixes (#116)
oyeb Mar 15, 2018
cf39d54
Fix gringotts.new Option.parse call. (#125)
oyeb Mar 19, 2018
a9b76db
Adapts Stripe with the money protocol
oyeb Jan 29, 2018
f99f258
Adapted Trexle for new `Response.t`
oyeb Feb 9, 2018
a91deec
[CAMS] Adapt for new Response.t (#120)
oyeb Mar 21, 2018
7bf1857
Format project and migrate to CodeCov (#135)
oyeb Mar 22, 2018
a4082cb
[global-collect] Layout, docs improvements and code refactors (#111)
jyotigautam Mar 30, 2018
a444179
Initial Commit \n Implemented Authorize
subpal Mar 20, 2018
ea9c912
Implemented authorize
subpal Mar 20, 2018
2127fe9
Refined authorize function
subpal Mar 21, 2018
d7d74b9
Implemented authorize
subpal Mar 21, 2018
b776dc9
jgkg
subpal Mar 26, 2018
4a99128
Modification in authorize/3, and implemented capture
subpal Mar 26, 2018
a6b4298
Modification in authorize/3, and implemented capture
subpal Mar 26, 2018
94f5b1c
Modification in authorize/3, and implemented capture
subpal Mar 26, 2018
1d46184
Modification in authorize/3, and implemented capture
subpal Mar 26, 2018
5956d5b
Updated authorize/3
subpal Mar 27, 2018
fd135db
Updated authorize/3
subpal Mar 27, 2018
e7349da
Updated authorize/3
subpal Mar 28, 2018
5eabe34
Updated authorize/3
subpal Mar 31, 2018
b51e7f1
Authorize integration test cases created
subpal Mar 31, 2018
d0277b2
Authorize integration test cases created
subpal Mar 31, 2018
0e159ab
Authorize integration test cases created
subpal Mar 31, 2018
d0bda62
Applied elixer formatter.
subpal Apr 17, 2018
1357aa8
Capture and test cases
subpal Apr 17, 2018
699876f
Added test cases for capture
subpal Apr 17, 2018
3254c54
Implemented purchase
subpal Apr 17, 2018
8b75261
Applied mix formatter.
subpal Apr 18, 2018
7b2b36a
1. Updated purchase function.
subpal Apr 18, 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
2 changes: 1 addition & 1 deletion .credo.exs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

{Credo.Check.Readability.FunctionNames},
{Credo.Check.Readability.LargeNumbers},
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 80},
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 100},
{Credo.Check.Readability.ModuleAttributeNames},
{Credo.Check.Readability.ModuleDoc},
{Credo.Check.Readability.ModuleNames},
Expand Down
7 changes: 7 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
inputs: [
"{lib,config}/**/*.{ex,exs}", # lib and config
"test/**/*.{ex,exs}", # tests
"mix.exs"
]
]
20 changes: 20 additions & 0 deletions .scripts/inch_report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -e
bold=$(tput bold)
purple='\e[106m'
normal=$(tput sgr0)
allowed_branches="^(master)|(develop)$"

echo -e "${bold}${purple}"
if [ $TRAVIS_PULL_REQUEST = false ]; then
if [[ $TRAVIS_BRANCH =~ $allowed_branches ]]; then
env MIX_ENV=docs mix deps.get
env MIX_ENV=docs mix inch.report
else
echo "Skipping Inch CI report because this branch does not match on /$allowed_branches/"
fi
else
echo "Skipping Inch CI report because this is a PR build"
fi
echo -e "${normal}"
12 changes: 12 additions & 0 deletions .scripts/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
#
# Runs credo and the formatter on the staged files, after the commit is made
# This is purely for notification and will not halt/change your commit.

RED='\033[1;31m'
LGRAY='\033[1;30m'
NC='\033[0m' # No Color

printf "${RED}Running 'mix credo --strict --format=oneline' on project...${NC}\n"
mix credo --strict --format=oneline
echo
50 changes: 50 additions & 0 deletions .scripts/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".

if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --bool hooks.allownonascii)

# Redirect output to stderr.
exec 1>&2

# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.

This can cause problems if you want to work with people on other platforms.

To be portable it is advisable to rename the file.

If you know what you are doing you can disable this check using:

git config hooks.allownonascii true
EOF
exit 1
fi

# Also run the mix format task, just check though.
exec mix format --check-formatted

26 changes: 20 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
language: elixir
elixir:
- 1.5.2

otp_release:
- 20.1
- 20.2
before_install:
- mix local.hex --force
- mix local.rebar --force
- mix deps.get
script:
- mix coveralls.travis --include integration
- set -e
- MIX_ENV=test mix format --check-formatted
- set +e
- mix coveralls.json --include=integration
after_script:
- MIX_ENV=docs mix deps.get
- MIX_ENV=docs mix inch.report
- bash <(curl -s https://codecov.io/bash)
- bash .scripts/inch_report.sh

matrix:
include:
- elixir: "1.5.3"
script:
- mix coveralls.json --include=integration
- elixir: "1.6.2"

notifications:
email:
recipients:
- [email protected]
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# [`v1.1.0-alpha`][tag-1_1_0_alpha]

## Added

* [`ISS`][iss#80] [`PR`][pr#78]
Add a `Mix` task that generates a barebones gateway implementation and test suite.

## Changed

* [`ISS`][iss#62] [`PR`][pr#71] [`PR`][pr#86]
Deprecate use of `floats` for money amounts, introduce the `Gringotts.Money` protocol.

[iss#62]: https://github.com/aviabird/gringotts/issues/62
[iss#80]: https://github.com/aviabird/gringotts/issues/80

[pr#71]: https://github.com/aviabird/gringotts/pulls/71
[pr#78]:https://github.com/aviabird/gringotts/pulls/78
[pr#86]:https://github.com/aviabird/gringotts/pulls/86

# [`v1.0.2`][tag-1_0_2]

## Added

* New Gateway: **Trexle**

## Changed

* Reduced arity of public API calls by 1
- No need to pass the name of the `worker` as argument.

# [`v1.0.1`][tag-1_0_1]

## Added

* Improved documentation - made consistent accross gateways
* Improved test coverage

# [`v1.0.0`][tag-1_0_0]

* Initial public API release.
* Single worker architecture, config fetched from `config.exs`
* Supported Gateways:
- Stripe
- MONEI
- Paymill
- WireCard
- CAMS

[tag-1_1_0_alpha]: https://github.com/aviabird/gringotts/releases/tag/v1.1.0-alpha
[tag-1_0_2]: https://github.com/aviabird/gringotts/releases/tag/v1.0.2
[tag-1_0_1]: https://github.com/aviabird/gringotts/releases/tag/v1.0.1
[tag-1_0_0]: https://github.com/aviabird/gringotts/releases/tag/v1.0.0
126 changes: 126 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Contributing to [`gringotts`][gringotts]

There are many ways to contribute to `gringotts`,

1. [Integrate a new Payment Gateway][wiki-new-gateway].
2. Expanding the feature coverage of (partially) supported gateways.
3. Moving forward on the [roadmap][roadmap] or on tasks being tracked in the
[milestones][milestones].

We manage our development using [milestones][milestones] and issues so if you're
a first time contributor, look out for the [`good first issue`][first-issues]
and the [`hotlist: community-help`][ch-issues] labels on the [issues][issues]
page.

The docs are hosted on [hexdocs.pm][hexdocs] and are updated for each
release. **You must build the docs locally using `mix docs` to get the bleeding
edge developer docs.**

The article on [Gringott's Architecture][wiki-arch] explains how API calls are
processed.

:exclamation: ***Please base your work on the `dev` branch.***

[roadmap]: https://github.com/aviabird/gringotts/wiki/Roadmap
[wiki-arch]: https://github.com/aviabird/gringotts/wiki/Architecture

# Style Guidelines

We follow
[lexmag/elixir-style-guide](https://github.com/lexmag/elixir-style-guide) and
[rrrene/elixir-style-guide](https://github.com/rrrene/elixir-style-guide) (both
overlap a lot), and use the elixir formatter.

To enforce these, and also to make it easier for new contributors to adhere to
our style, we've provided a collection of handy `git-hooks` under the `.scripts/`
directory.

* `.scripts/pre-commit` Runs the `format --check-formatted` task.
* `.scripts/post-commit` Runs a customised `credo` check.

While we do not force you to use these hooks, you could write your
very own by taking inspiration from ours :smile:

To set the `git-hooks` as provided, go to the repo root,
```sh
cd path/to/gringotts/
```
and make these symbolic links:
```sh
ln -s .scripts/pre-commit .git/hooks/pre-commit
ln -s .scripts/post-commit .git/hooks/post-commit
```

> Note that our CI will fail your PR if you dont run `mix format` in the project
> root.

## General Rules

* Keep line length below 100 characters.
* Complex anonymous functions should be extracted into named functions.
* One line functions, should only take up one line!
* Pipes are great, but don't use them if they are less readable than brackets!

## Writing documentation

All our docs are inline and built using [`ExDocs`][exdocs]. Please take a look
at how the docs are structured for the [MONEI gateway][src-monei] for
inspiration.

[exdocs]: https://github.com/elixir-lang/ex_doc
[src-monei]: https://github.com/aviabird/gringotts/blob/dev/lib/gringotts/gateways/monei.ex

## Writing test cases

> This is WIP.

`gringotts` has mock and integration tests. We have currently used
[`bypass`][bypass] and [`mock`][mock] for mock tests, but we don't recommed
using `mock` as it constrains tests to run serially. Use [`mox`][mox] instead.\
Take a look at [MONEI's mock tests][src-monei-tests] for inspiration.

# PR submission checklist

Each PR should introduce a *focussed set of changes*, and ideally not span over
unrelated modules.

* [ ] Format the project with the Elixir formatter.
```sh
cd path/to/gringotts/
mix format
```
* [ ] Run the edited files through [credo][credo] with the `--strict` flag.
```sh
cd path/to/gringotts/
mix credo --strict
```
* [ ] Check the test coverage by running `mix coveralls`. 100% coverage is not
strictly required.
* [ ] If the PR introduces a new Gateway or just Gateway specific changes,
please format the title like so,\
`[<gateway-name>] <the-title>`

> **Note**
> You can skip the first two steps if you have set up `git-hooks` as we have
> provided!

[gringotts]: https://github.com/aviabird/gringotts
[milestones]: https://github.com/aviabird/gringotts/milestones
[issues]: https://github.com/aviabird/gringotts/issues
[first-issues]: https://github.com/aviabird/gringotts/issues?q=is%3Aissue+is%3Aopen+label%3A"good+first+issue"
[ch-issues]: https://github.com/aviabird/gringotts/issues?q=is%3Aissue+is%3Aopen+label%3A"hotfix%3A+community-help"
[hexdocs]: https://hexdocs.pm/gringotts
[credo]: https://github.com/rrrene/credo

--------------------------------------------------------------------------------

> **Where to next?**
> Wanna add a new gateway? Head to our [guide][wiki-new-gateway] for that.

[wiki-new-gateway]: https://github.com/aviabird/gringotts/wiki/Adding-a-new-Gateway
[bypass]: https://github.com/pspdfkit-labs/bypass
[mock]: https://github.com/jjh42/mock
[mox]: https://github.com/plataformatec/mox
[src-monei-tests]: https://github.com/aviabird/gringotts/blob/dev/test/gateways/monei_test.exs
[gringotts]: https://github.com/aviabird/gringotts
[docs]: https://hexdocs.pm/gringotts/Gringotts.html
Loading