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

[PinPayments] capture function with test cases #147

Open
wants to merge 25 commits into
base: pinpay
Choose a base branch
from

Conversation

ravirocx
Copy link

@ravirocx ravirocx commented Mar 31, 2018

PinPayments

capture/3

Implemented capture function:

Docs

Added docs for capture/3.

Tests

Added integration tests for capture/3, using ExVCR.

@codecov-io
Copy link

codecov-io commented Mar 31, 2018

Codecov Report

Merging #147 into pinpay will increase coverage by 6.03%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           pinpay     #147      +/-   ##
==========================================
+ Coverage   60.04%   66.07%   +6.03%     
==========================================
  Files          15       15              
  Lines         498      510      +12     
==========================================
+ Hits          299      337      +38     
+ Misses        199      173      -26
Impacted Files Coverage Δ
lib/gringotts/gateways/pin_payments.ex 83.33% <83.33%> (+83.33%) ⬆️
lib/gringotts/gateways/global_collect.ex 100% <0%> (ø) ⬆️

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 69f0aca...bfe329c. Read the comment docs.

Copy link
Contributor

@oyeb oyeb left a comment

Choose a reason for hiding this comment

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

Rebase your branch.

month: 12,
verification_code: "999",
brand: "VISA"}
iex> money = Money.new(10000, :USD)
Copy link
Contributor

Choose a reason for hiding this comment

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

The doc says this example captures $10 but your Money struct indicates a capture of Ten Thousand dollars.

@@ -204,6 +240,18 @@ defmodule Gringotts.Gateways.PinPayments do
|> respond
end

defp commit_short(method, url, opts) do
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of a new function commit_short you should pattern match on the method, and keep the same function name: commit

"""
@spec capture(String.t(), Money.t(), keyword) :: {:ok | :error, Response}
def capture(payment_id, amount, opts) do
url = @test_url <> "charges/" <> payment_id <> "/capture"
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be more readable if we use string interpolation here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants