Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f353a6d
Update Validation
OttiaDevsPT Apr 29, 2024
7ed8693
Add Support for VAT rate as decimal value to support new base VAT rat…
OttiaDevsPT Aug 27, 2024
652e317
Merge pull request #14 from paytrail/fix/addSupportForVatRateAsDecima…
kotivuori Oct 16, 2024
c9c8307
CreateMitPaymentAuthorizationHold
OttiaDevsPT Oct 18, 2024
3211d28
commit
OttiaDevsPT Apr 29, 2024
5827979
fix/refactor-exception
OttiaDevsPT Apr 29, 2024
580f684
CreateMitPaymentAuthorizationHold
OttiaDevsPT Oct 18, 2024
e5f792d
Merge remote-tracking branch 'origin/feature/tokenization' into featu…
OttiaDevsPT Nov 8, 2024
02ab1ff
Revert PaytrailPaymentMethodGroup from upper case to lower case
OttiaDevsPT Nov 18, 2024
4b11385
Update remove signature out of request of Add card form.
OttiaDevsPT Jan 21, 2025
c59b59f
Remove all param out of header in case add card form
OttiaDevsPT Feb 7, 2025
5dcc161
Update Unit test cases and some classes to fix test case return 200
OttiaDevsPT Feb 17, 2025
bc8f1f2
Update pom.xml file to add plugins for test and lint
OttiaDevsPT Feb 21, 2025
56e98a0
Update Unit test case
OttiaDevsPT Feb 24, 2025
49001e2
Add github action
OttiaDevsPT Feb 24, 2025
98a90e5
Merge branch 'feature/paytrail-java-sdk-github-workflow' of github_nc…
OttiaDevsPT Feb 24, 2025
a9abf02
Update github action - multi java version
OttiaDevsPT Feb 24, 2025
a31967b
Update github action - multi java version
OttiaDevsPT Feb 24, 2025
ec9497d
Add cache for maven
OttiaDevsPT Feb 24, 2025
e0355be
Add cache for maven
OttiaDevsPT Feb 24, 2025
b83b5ec
Update github action
OttiaDevsPT Feb 24, 2025
f1e5c08
Update github action
OttiaDevsPT Feb 24, 2025
a7985de
Update github action
OttiaDevsPT Feb 24, 2025
931cc09
Switch distribution to Oracle java
OttiaDevsPT Feb 24, 2025
aa8647b
Update github action
OttiaDevsPT Feb 24, 2025
c96bc06
Update lombok version to 1.18.30 for JDK 21
OttiaDevsPT Feb 24, 2025
d45c305
Update github action
OttiaDevsPT Feb 24, 2025
c98f21c
Update lombok version to 1.18.30 for JDK 21
OttiaDevsPT Feb 24, 2025
5290a66
Merge branch 'feature/paytrail-java-sdk-github-workflow' of https://g…
OttiaDevsPT Feb 24, 2025
a7474d9
Update lombok version to 1.18.36 for JDK 23
OttiaDevsPT Feb 24, 2025
934b529
Update lombok version to 1.18.36 for JDK 23
OttiaDevsPT Feb 24, 2025
96aa527
Update lombok version to 1.18.36 for JDK 23
OttiaDevsPT Feb 24, 2025
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
41 changes: 41 additions & 0 deletions .github/workflows/CI_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint and Test

on:
pull_request:
branches:
- develop
- main

jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java-version: [8,11,17,18,19,20,21,22,23]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: temurin
- name: Check current Java version
run: java -version

# Step 3: Validate Maven dependencies
- name: Validate Maven dependencies with Java ${{ matrix.java-version }}
working-directory: ./paytrailpayment-sdk
run: mvn dependency:resolve

# Step 4: Run Maven lint checks (Checkstyle, SpotBugs, etc.)
- name: Run Maven lint checks with Java ${{ matrix.java-version }}
working-directory: ./paytrailpayment-sdk
run: mvn checkstyle:check

# Step 5: Run Maven tests
- name: Run Maven tests with Java ${{ matrix.java-version }}
working-directory: ./paytrailpayment-sdk
run: mvn test
9 changes: 8 additions & 1 deletion paytrailpayment-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
<version>1.18.36</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -34,6 +35,12 @@
<artifactId>jackson-databind</artifactId>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>io.paytrailpayment</groupId>
<artifactId>paytrailpayment-sdk</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

</dependencies>

Expand Down
11 changes: 5 additions & 6 deletions paytrailpayment-app/src/main/java/io/paytrailpayment/Main.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package io.paytrailpayment;

import io.paytrailpayment.dto.request.CreatePaymentRequest;
import io.paytrailpayment.dto.request.model.CallbackUrl;
import io.paytrailpayment.dto.request.model.Customer;
import io.paytrailpayment.dto.request.model.Item;
import io.paytrailpayment.dto.request.model.*;
import io.paytrailpayment.dto.response.CreatePaymentResponse;
import io.paytrailpayment.utilites.ResponseMessage;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
Expand All @@ -19,16 +18,16 @@ public static void main(String[] args) {

req.setStamp(UUID.randomUUID().toString());
req.setReference("9187445");
req.setCurrency("EUR");
req.setLanguage("FI");
req.setCurrency(PaytrailCurrency.EUR);
req.setLanguage(PaytrailLanguage.FI);
req.setOrderId("12335");
req.setAmount(1590);

List<Item> items = new ArrayList<>();
Item item = new Item();
item.setUnitPrice(1590);
item.setUnits(1);
item.setVatPercentage(24);
item.setVatPercentage(new BigDecimal(24));
item.setProductCode("#927502759");
items.add(item);

Expand Down
55 changes: 54 additions & 1 deletion paytrailpayment-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
<version>1.18.36</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -55,11 +56,63 @@
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.12.0</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>

<!-- Maven Surefire Plugin for Running Unit Tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.2</version>
</plugin>

<!-- Checkstyle Plugin for Code Linting -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<configLocation>google_checks.xml</configLocation>
<failOnViolation>true</failOnViolation>
</configuration>
</plugin>
</plugins>
</build>


</project>
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package io.paytrailpayment;

import io.paytrailpayment.dto.request.CreatePaymentRequest;
import io.paytrailpayment.dto.request.CreateRefundRequest;
import io.paytrailpayment.dto.response.CreatePaymentResponse;
import io.paytrailpayment.dto.response.CreateRefundResponse;
import io.paytrailpayment.dto.response.GetPaymentResponse;
import io.paytrailpayment.dto.request.*;
import io.paytrailpayment.dto.response.*;

/**
* Defines methods for interacting with the Paytrail payment system.
Expand All @@ -27,6 +24,7 @@ public interface IPaytrail {
* Note! The transaction id needs to be sent on checkout-transaction-id header as well.
*
* @param transactionId The unique identifier for the transaction.
* @return GetPaymentResponse
* @see <a href="https://docs.paytrail.com/#/?id=get">Paytrail Documentation - Get Payment</a>
*/
GetPaymentResponse getPaymentInfo(String transactionId);
Expand All @@ -36,7 +34,82 @@ public interface IPaytrail {
*
* @param refundRequest The request object containing refund details.
* @param transactionId The unique identifier for the transaction to refund.
* @return CreateRefundResponse
* @see <a href="https://docs.paytrail.com/#/?id=refund">Paytrail Documentation - Create Refund Request</a>
*/
CreateRefundResponse createRefundRequest(CreateRefundRequest refundRequest, String transactionId);

/**
* HTTP POST /tokenization/addcard-form add card form.
*
* @param req The request object containing add card request
* @return AddCardFormResponse
* @see <a href="https://docs.paytrail.com/#/?id=add-card-form">Paytrail Documentation - Create Refund Request</a>
*/
AddCardFormResponse createAddCardFormRequest(AddCardFormRequest req);

/**
* HTTP POST /payments/token/mit/charge creates a new MIT payment charge.
* @param req
* @return CreateMitPaymentChargeResponse
* @see <a href="https://docs.paytrail.com/#/?id=create-authorization-hold-or-charge">Paytrail Documentation - Create authorization hold or charge
*/
CreateMitOrCitPaymentResponse createMitPaymentCharge(CreateMitOrCitPaymentRequest req);
/**
* HTTP POST /payments/token/mit/authorization-hold creates a new MIT authorization hold.
* @param createMitPaymentAuthorizationHold
* @return CreateMitPaymentChargeResponse
* @see <a href="https://docs.paytrail.com/#/?id=create-authorization-hold-or-charge">Paytrail Documentation - Create authorization hold or charge
*/
CreateMitOrCitPaymentResponse createMitPaymentAuthorizationHold(CreateMitOrCitPaymentRequest createMitPaymentAuthorizationHold);

/**
* HTTP POST /payments/{transactionId}/token/commit commits a MIT payment.
* @param req
* @param transactionId
* @return CreateMitOrCitPaymentResponse
* @see <a href="https://docs.paytrail.com/#/?id=commit-authorization-hold">Paytrail Documentation - Create MIT payment commit
*/
CreateMitOrCitPaymentResponse createMitPaymentCommit(CreateMitOrCitPaymentRequest req, String transactionId);

/**
* HTTP POST /payments/token/cit/charge creates a new CIT payment charge.
* @param req
* @return CreateMitOrCitPaymentResponse
* @see <a href="https://docs.paytrail.com/#/?id=create-authorization-hold-or-charge">Paytrail Documentation - Create authorization hold or charge
*/
CreateMitOrCitPaymentResponse createCitPaymentCharge(CreateMitOrCitPaymentRequest req);


/**
* HTTP POST /payments/token/cit/authorization-hold creates a new CIT authorization hold.
* @param req
* @return CreateMitOrCitPaymentResponse
* @see <a href="https://docs.paytrail.com/#/?id=create-authorization-hold-or-charge">Paytrail Documentation - Create CIT authorization hold
*/
CreateMitOrCitPaymentResponse createCitPaymentAuthorizationHold(CreateMitOrCitPaymentRequest req);

/**
* HTTP POST /payments/{transactionId}/token/commit commits a CIT payment.
* @param req
* @param transactionId
* @return CreateMitOrCitPaymentResponse
* @see <a href="https://docs.paytrail.com/#/?id=commit-authorization-hold">Paytrail Documentation - Create CIT payment commit
*/
CreateMitOrCitPaymentResponse createCitPaymentCommit(CreateMitOrCitPaymentRequest req, String transactionId);

/**
* HTTP POST /tokenization/pay-and-add-card pay and add card.
* @param req
* @return
*/
PayAddCardResponse payAndAddCard(PayAddCardRequest req);

/**
*
* HTTP POST /tokenization/get-token get token.
* @param req
* @return the actual card token which can then be used to make payments on the card
*/
GetTokenResponse createGetTokenRequest(GetTokenRequest req);
}
Loading