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

Create maven.yml action config #76

Merged
merged 4 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Java CI with Maven

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
java-version: [8, 11]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
cache: maven

- name: Build and Test with Maven
run: mvn clean test
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

30 changes: 15 additions & 15 deletions src/test/java/io/paymenthighway/PaymentAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ private PaymentAPI createPaymentAPI() {
static private final String RESULT_CODE_OK = "100";
static private final String RESULT_CODE_SOFT_DECLINE = "400";

private static Card validTestCard = new Card("4153013999700321", "2023", "11", "321");
private static Card softDeclineCard = new Card("4153013999701170", "2023", "11", "170");
private static Card validTestCard = new Card("4153013999700321", "2026", "11", "321");
private static Card softDeclineCard = new Card("4153013999701170", "2026", "11", "170");

private UUID initTransaction(PaymentAPI paymentAPI) throws IOException {
InitTransactionResponse response = paymentAPI.initTransaction();
Expand Down Expand Up @@ -148,7 +148,7 @@ public void testDebitWithCard() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);
TransactionRequest transaction = new TransactionRequest(card, "9999", "EUR");
Expand Down Expand Up @@ -319,7 +319,7 @@ public void testCommitWithCardTransaction() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);

Expand Down Expand Up @@ -377,7 +377,7 @@ public void testRevertTransaction() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);

Expand Down Expand Up @@ -428,7 +428,7 @@ public void testRevertFullAmountTransaction() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);

Expand Down Expand Up @@ -493,7 +493,7 @@ public void testTransactionStatus() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);

Expand Down Expand Up @@ -561,7 +561,7 @@ public void testOrderSearch() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);
UUID orderId = UUID.randomUUID();
Expand Down Expand Up @@ -657,7 +657,7 @@ public void testCommit() {
submitParameters.add(new BasicNameValuePair("card_number_formatted", "4153 0139 9970 0024"));
submitParameters.add(new BasicNameValuePair("card_number", "4153013999700024"));
submitParameters.add(new BasicNameValuePair("expiration_month", "11"));
submitParameters.add(new BasicNameValuePair("expiration_year", "2023"));
submitParameters.add(new BasicNameValuePair("expiration_year", "2026"));
submitParameters.add(new BasicNameValuePair("expiry", "11 / 17"));
submitParameters.add(new BasicNameValuePair("cvv", "024"));

Expand Down Expand Up @@ -700,7 +700,7 @@ public void testCommit() {
assertEquals(commitResponse.getResult().getMessage(), "OK");
assertTrue(commitResponse.getCardToken().toString().length() == 36);
assertEquals(commitResponse.getCard().getPartialPan(), "0024");
assertEquals(commitResponse.getCard().getExpireYear(), "2023");
assertEquals(commitResponse.getCard().getExpireYear(), "2026");

}

Expand Down Expand Up @@ -737,7 +737,7 @@ public void testTokenize() {
submitParameters.add(new BasicNameValuePair("card_number_formatted", "4153 0139 9970 0024"));
submitParameters.add(new BasicNameValuePair("card_number", "4153013999700024"));
submitParameters.add(new BasicNameValuePair("expiration_month", "11"));
submitParameters.add(new BasicNameValuePair("expiration_year", "2023"));
submitParameters.add(new BasicNameValuePair("expiration_year", "2026"));
submitParameters.add(new BasicNameValuePair("expiry", "11 / 17"));
submitParameters.add(new BasicNameValuePair("cvv", "024"));

Expand Down Expand Up @@ -773,10 +773,10 @@ public void testTokenize() {
}

assertNotNull(tokenResponse);
assertEquals(tokenResponse.getCard().getExpireYear(), "2023");
assertEquals(tokenResponse.getCard().getExpireYear(), "2026");
assertTrue(tokenResponse.getCardToken().toString().length() == 36);
assertEquals(tokenResponse.getResult().getMessage(), "OK");
assertEquals(tokenResponse.getCard().getCvcRequired(), "no");
assertEquals(tokenResponse.getCard().getCvcRequired(), "not_tested");

}

Expand Down Expand Up @@ -812,7 +812,7 @@ public void testDebitWithToken() {
submitParameters.add(new BasicNameValuePair("card_number_formatted", "4153 0139 9970 0024"));
submitParameters.add(new BasicNameValuePair("card_number", "4153013999700024"));
submitParameters.add(new BasicNameValuePair("expiration_month", "11"));
submitParameters.add(new BasicNameValuePair("expiration_year", "2023"));
submitParameters.add(new BasicNameValuePair("expiration_year", "2026"));
submitParameters.add(new BasicNameValuePair("expiry", "11 / 17"));
submitParameters.add(new BasicNameValuePair("cvv", "024"));

Expand Down Expand Up @@ -848,7 +848,7 @@ public void testDebitWithToken() {
}

assertNotNull(tokenResponse);
assertEquals(tokenResponse.getCard().getExpireYear(), "2023");
assertEquals(tokenResponse.getCard().getExpireYear(), "2026");
assertTrue(tokenResponse.getCardToken().toString().length() == 36);
assertEquals(tokenResponse.getResult().getMessage(), "OK");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,6 @@ public void testGetFormSubmitResponse() {
assertTrue(matcher.find());
String formUri = matcher.group();

postCardFormAndReturnLastQueryString(this.serviceUrl, formUri, "4153013999700024", "11", "2023", "024");
postCardFormAndReturnLastQueryString(this.serviceUrl, formUri, "4153013999700024", "11", "2026", "024");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ public void testDebitTransaction5() {

TokenizationResponse tokenResponse = createAndTestTokenizationId("4153013999700024", "11", "2023", "024");

assertEquals("no", tokenResponse.getCard().getCvcRequired());
assertEquals("not_tested", tokenResponse.getCard().getCvcRequired());
assertEquals("debit", tokenResponse.getCard().getFunding());
assertEquals("unknown", tokenResponse.getCard().getCategory());

Expand Down Expand Up @@ -526,7 +526,7 @@ public void testDebitTransaction5() {
);
assertEquals("9999", statusResponse.getTransaction().getCurrentAmount());
assertEquals(transactionId, statusResponse.getTransaction().getId());
assertEquals("no", statusResponse.getTransaction().getCard().getCvcRequired());
assertEquals("not_tested", statusResponse.getTransaction().getCard().getCvcRequired());
checkAcquirerInfo(statusResponse.getTransaction(), "000");
}

Expand Down Expand Up @@ -822,7 +822,7 @@ public void testRevertTransaction4() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);

Expand Down Expand Up @@ -883,7 +883,7 @@ public void testRevertTransaction5() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);

Expand Down Expand Up @@ -951,7 +951,7 @@ public void testRevertTransaction6() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);

Expand Down Expand Up @@ -1018,7 +1018,7 @@ public void testTransactionStatus1() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);
Customer customer = new Customer("83.145.208.186");
Expand Down Expand Up @@ -1091,7 +1091,7 @@ public void testTransactionStatus2() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);
Customer customer = new Customer("83.145.208.186");
Expand Down Expand Up @@ -1162,7 +1162,7 @@ public void testOrderSearch1() {

String pan = "4153013999700024";
String cvc = "024";
String expiryYear = "2023";
String expiryYear = "2026";
String expiryMonth = "11";
Card card = new Card(pan, expiryYear, expiryMonth, cvc);
UUID orderId = UUID.randomUUID();
Expand Down Expand Up @@ -1312,7 +1312,7 @@ public void testTokenization() {
// 1. execute a new add_card request using our test form (target staging),
// 2. replace with the value of query parameter "sph-tokenization-id" found in success redirect URL,
// 3. adjust assertions.
UUID tokenizationId = UUID.fromString("475d49ec-2c37-4ae5-a6ef-33dc6b60ac71");
UUID tokenizationId = UUID.fromString("ffdd479c-f783-49fa-9c01-5bb60d3f9e57");

TokenizationResponse tokenResponse = null;
try {
Expand All @@ -1321,17 +1321,17 @@ public void testTokenization() {
e.printStackTrace();
}
assertNotNull(tokenResponse);
assertEquals("2017", tokenResponse.getCard().getExpireYear());
assertEquals("71435029-fbb6-4506-aa86-8529efb640b0", tokenResponse.getCardToken().toString());
assertEquals("no", tokenResponse.getCard().getCvcRequired());
assertEquals("2026", tokenResponse.getCard().getExpireYear());
assertEquals("feabf8e0-6836-4f9a-88e7-5e34e6c9320e", tokenResponse.getCardToken().toString());
assertEquals("not_tested", tokenResponse.getCard().getCvcRequired());
assertEquals("415301", tokenResponse.getCard().getBin());
assertEquals("debit", tokenResponse.getCard().getFunding());
assertEquals("unknown", tokenResponse.getCard().getCategory());
assertEquals("FI", tokenResponse.getCard().getCountryCode());
// Customer information from the time the tokenizationId was generated through the Form API add_card request
assertEquals("83.145.208.185", tokenResponse.getCustomer().getNetworkAddress()); // Manually updated :/
assertEquals("FI", tokenResponse.getCustomer().getCountryCode());
assertEquals("no", tokenResponse.getCardholderAuthentication());
assertEquals("attempted", tokenResponse.getCardholderAuthentication());
checkAcquirerInfo(tokenResponse, "060");
}

Expand Down