-
Notifications
You must be signed in to change notification settings - Fork 53
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
base: pinpay
Are you sure you want to change the base?
Conversation
`authorize/3` takes 3 parameters `amount`, `card` and `opts` addded documentations for `authorize/3` for merchants.
`def authorize(amount, card, opts) when is_binary(card) do`
…functions fucntions.
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
There was a problem hiding this 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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
PinPayments
capture/3
Implemented capture function:
Docs
Added docs for capture/3.
Tests
Added integration tests for capture/3, using ExVCR.