-
Notifications
You must be signed in to change notification settings - Fork 52
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] Implemented test cases for authorize #139
Open
ravirocx
wants to merge
12
commits into
pinpay
Choose a base branch
from
pinpay-auth-test
base: pinpay
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d43cdb5
Implemented and Optimised `authorize/3` function.
ravirocx b6958a9
Core Functions implemented
ravirocx 1e353b2
Fixed guard clause bug
ravirocx 32d6707
Optimised `purchase`, `capture`, 'refund`, `store` and their private …
ravirocx e3d7a28
Merge branch 'pinpay' of https://github.com/aviabird/gringotts into p…
ravirocx 50962f1
bug fixes and optimisation of core functions
ravirocx a7a01d7
Bug fixes and Documentation completed
ravirocx 02c1aef
Implemented test cases for authorize
ravirocx 8d6dd33
Modified test cases for
ravirocx 0fe6e43
improved code readability
ravirocx f8caa26
Revert "improved code readability"
ravirocx 26ede91
improved test cases, removed redundant
ravirocx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
defmodule Gringotts.Integration.Gateways.PinpaymentsTest do | ||
defmodule Gringotts.Integration.Gateways.PinPaymentsTest do | ||
# Integration tests for the Pinpayments | ||
|
||
use ExUnit.Case, async: true | ||
|
||
alias Gringotts.{ | ||
CreditCard, Address | ||
CreditCard, | ||
Address | ||
} | ||
|
||
alias Gringotts.Gateways.PinPayments, as: Gateway | ||
|
||
#@moduletag :integration | ||
@moduletag :integration | ||
|
||
@amount Money.new(420, :AUD) | ||
|
||
|
@@ -23,46 +24,33 @@ defmodule Gringotts.Integration.Gateways.PinpaymentsTest do | |
brand: "VISA" | ||
} | ||
|
||
@bad_card2 %CreditCard{ | ||
first_name: "Harry", | ||
last_name: "Potter", | ||
number: "4600000000000006", | ||
year: 2019, | ||
month: 12, | ||
verification_code: "123", | ||
brand: "VISA" | ||
} | ||
|
||
@good_card %CreditCard{ | ||
first_name: "Harry", | ||
last_name: "Potter", | ||
number: "4200000000000000", | ||
year: 2019, | ||
year: 2029, | ||
month: 12, | ||
verification_code: "123", | ||
brand: "VISA" | ||
} | ||
|
||
@add %Address{ | ||
|
||
street1: "OBH", | ||
street2: "AIT", | ||
city: "PUNE", | ||
region: "Maharashtra", | ||
region: "Maharashtra", | ||
country: "IN", | ||
postal_code: "411015", | ||
phone: "8007810916", | ||
|
||
phone: "8007810916" | ||
} | ||
|
||
@opts [ | ||
description: "hello", | ||
email: "[email protected]", | ||
ip_address: "1.1.1.1", | ||
config: %{apiKey: "c4nxgznanW4XZUaEQhxS6g", pass: ""} | ||
description: "hello", | ||
email: "[email protected]", | ||
ip_address: "1.1.1.1", | ||
config: %{apiKey: "c4nxgznanW4XZUaEQhxS6g"} | ||
] ++ [address: @add] | ||
|
||
] ++ [address: @add] | ||
|
||
test "[authorize] with CreditCard" do | ||
assert {:ok, response} = Gateway.authorize(@amount, @good_card, @opts) | ||
assert response.success == true | ||
|
@@ -74,11 +62,4 @@ defmodule Gringotts.Integration.Gateways.PinpaymentsTest do | |
assert response.success == false | ||
assert response.status_code == 400 | ||
end | ||
|
||
test "[authorize] with bad CreditCard 2" do | ||
assert {:error, response} = Gateway.authorize(@amount, @bad_card2, @opts) | ||
assert response.success == false | ||
assert response.status_code == 400 | ||
end | ||
|
||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I've already pointed out in an earlier comment that you should not concat lists like this. The second list has only one element, moreover, the first list is being defined right there. You can simply move
address: @add
inside.