Skip to content

[PinPayments] capture function with test cases - #147

Open
ravirocx wants to merge 25 commits into
pinpayfrom
pinpay-capture
Open

[PinPayments] capture function with test cases#147
ravirocx wants to merge 25 commits into
pinpayfrom
pinpay-capture

Conversation

@ravirocx

@ravirocx ravirocx commented Mar 31, 2018

Copy link
Copy Markdown

PinPayments

capture/3

Implemented capture function:

Docs

Added docs for capture/3.

Tests

Added integration tests for capture/3, using ExVCR.

@codecov-io

codecov-io commented Mar 31, 2018

Copy link
Copy Markdown

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.

@oyeb oyeb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rebase your branch.

Comment thread lib/gringotts/gateways/pin_payments.ex Outdated
month: 12,
verification_code: "999",
brand: "VISA"}
iex> money = Money.new(10000, :USD)

Copy link
Copy Markdown
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.

|> respond
end

defp commit_short(method, url, opts) do

Copy link
Copy Markdown
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

Comment thread lib/gringotts/gateways/pin_payments.ex Outdated
"""
@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
Copy Markdown
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