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

[Checkout.com] Implementation of all functions with test cases #167

Open
wants to merge 24 commits into
base: dev
Choose a base branch
from

Conversation

ravirocx
Copy link

Implementation of :

  • Authorize/3
  • Capture/3
  • Purchase/3
  • void/2
  • refund/3

and its supportive private functions

oyeb and others added 22 commits April 22, 2018 16:56
* Fixes #1: Introducing `Response.t`

with docs

* [monei] Adapted for new `Response.t`

* Refactored `commit`, `respond` for readability

* [monei] Updated test cases

* Corrected specs

* [bogus] Adapted for Response.t
* Gringotts does not start any process now
* Removed `adapter` key from config as it was redundant.
* Updated docs and mix task.
- Updated dependency `xml_builder`. The new `generate/2` provides a
`format: :none | :indented` option.
- `:format` is set to `:none` to produce "minified" network requests.

* This is almost a complete rewrite to reduce code duplication.
  - check_response_type() was acting as guard that matched only against
some response types. It did not handle the scenario when a non-supported
response would be obtained. It really served no purpose
  - check_response_type -> extract_gateway_response
    + This guards as well as fetches, previously the fetch was being
done multiple times.
* Moved all response handling inside the `ResponseHandler`.
* Since we now have a struct, and want to deprecate `:success`, `Response.success/1` and `Response.error/1`, helpers now act on structs.
* `errorCode` and `errorText` are used to build `:reason`.

+ Removed pointless asserts from tests.
Also added CAVV result filed to the response which is nil for
MaasterCards (as per ANet docs).
* Fix Adapter moduledoc and bogus gateway

* Fixes #24
* bogus test also uses Money protocol now
* Changed validate_config docs

* Improved mix task docs (filename)

* Better module name suggestion
* Now, Filename can be specified on the CLI with the `-f` flag

* Added changelog and contributing guide.

* Also reworded README slightly

* Correct "amount" in examples to ex_money

* Replaced example bindings with links to `.iex.exs`

* Removed unused params from functions.

* Fix call to `downcase`
* Ignore some optional params for RF, RV, CP

Some optional params like billing, customer, merchant must not be
expanded in case of capture, refund and void.

* Improved mock tests, fixes #98

Mock tests now mostly check if the request is correctly built.
Since most requests have common parameters, they are not checked
everywhere.

* Improve integration tests (more cases), fixes #108

* Integration tests no longer use the worker as a workaround for #8
* Added more test cases, can possibly be improved using describe blocks with
local setup.
* There are almost no assertions and it is expected that errors will
bubble up to the pattern matches.
* Fixes #5 and #109
* Moved the stripe_test to integration.
* Fixed credo issue in money integration test

Changes to MONEI
* Removed unnecessary clauses from MONEI
* Re-formatted source.
* Trexle does not seem to provide fraud risk, AVS, CVV validation
results. There are no docs for this.
* Refactored ResponseHandler, updated Response.t
* CAMS now parses AVS and CVV response - that was missing till now.
* Removes unnecessary `parse` clause.
* Mock tests shouldn't use gringotts.ex
* Update travis config, add .formater.exs

* Migrate to CodeCov
* Travis will run the formatter check
* Add git-hooks and update contribution guide
* Changed credo lin-length config from 80 to 100
* Ran the formatter on the project
* Fix credo warnings
[global-collect] Layout, docs and code refactor
===============================================

New features
------------
Risk, AVS, CVS fields added in `Response` struct!

Layout, docs
-----------
* `credo` issues resolved.
* Corrected `amount` in examples
* Ran the elixir 1.6 code formatter
  - Used sigils in mocks

Code refactors
--------------
* Removed unnecessary functions
  - Reduced arity of `add_money`
* Refactored Timex usage
* Removed a test on `validate_config` as it is already tested.
* Bumped version to 1.1.0
* Not running integration tests on travis
* Added Changelog for release 1.1.0(refer CHANGELOG.md)
* New public methods: refund
* `store` has been removed because Paymill does not have a
  direct API integration for card token generation
* Improved docs and uses Money protocol

Refactors
----------
* refactored add_amount -> amount_params
* updated tests and clubbed a few parse clauses
* refactored commit and response functions

Tests
------
* Paymill mock (#159)
* Added mock test cases for paymill.
* Configured mock files to get compiled in `:test` env.
* Moved paymill responses in mocks folder.
* Add clause to catch/handle bad config format

Closes #150
Closes #136

* [ci-skip] Improve mock test template

* Since all mock tests are to be written using Bypass, removed mock file
as well as mention of `mock` library.
* Added setup and parse to the test template
@codecov-io
Copy link

codecov-io commented Apr 30, 2018

Codecov Report

Merging #167 into dev will decrease coverage by 6.98%.
The diff coverage is 77.1%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #167      +/-   ##
==========================================
- Coverage   77.33%   70.34%   -6.99%     
==========================================
  Files          14       15       +1     
  Lines         375      489     +114     
==========================================
+ Hits          290      344      +54     
- Misses         85      145      +60
Impacted Files Coverage Δ
lib/gringotts/response.ex 100% <ø> (ø) ⬆️
lib/mix/new.ex 0% <0%> (ø) ⬆️
lib/gringotts/gateways/wire_card.ex 0% <0%> (ø)
lib/gringotts/gateways/stripe.ex 0% <0%> (ø) ⬆️
lib/gringotts/credit_card.ex 100% <100%> (ø) ⬆️
lib/gringotts.ex 100% <100%> (ø) ⬆️
lib/gringotts/gateways/authorize_net.ex 97.56% <100%> (ø) ⬆️
lib/gringotts/gateways/paymill.ex 100% <100%> (ø) ⬆️
lib/gringotts/gateways/trexle.ex 100% <100%> (ø) ⬆️
lib/gringotts/gateways/global_collect.ex 100% <100%> (ø) ⬆️
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 73ea35e...6ff6f73. Read the comment docs.

@oyeb oyeb force-pushed the dev branch 2 times, most recently from e8323fd to 73ea35e Compare June 8, 2018 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants