Skip to content

Commit 13beebd

Browse files
[ACL-243] Add creditableAt property to payment details response (#358)
1 parent fa33887 commit 13beebd

14 files changed

+37
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/).
77

8+
## [17.2.0] - 2025-04-16
9+
### Added
10+
* Add support for `deprecated_at` property to GET payment API response
11+
812
## [17.1.0] - 2025-03-14
913
### Added
1014
* Add support for PLN payouts

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
plugins {
22
id 'java-library'
33
// to unleash the lombok magic
4-
id "io.freefair.lombok" version "8.12.2.1"
4+
id "io.freefair.lombok" version "8.13.1"
55
// to make our tests output more fancy
66
id 'com.adarshr.test-logger' version '4.0.0'
77
// to publish packages
88
id 'maven-publish'
99
// code linting
10-
id "com.diffplug.spotless" version "7.0.2"
10+
id "com.diffplug.spotless" version "7.0.3"
1111
// test coverage
1212
id 'jacoco'
1313
id 'com.github.kt3k.coveralls' version '2.12.2'
@@ -108,11 +108,11 @@ dependencies {
108108
implementation group: 'org.tinylog', name: 'tinylog-impl', version: tinyLogVersion
109109

110110
// JUnit test framework.
111-
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.12.0'
111+
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.12.2'
112112
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
113113

114114
// Mocking libraries
115-
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.15.2'
115+
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.17.0'
116116
testImplementation group: 'org.wiremock', name: 'wiremock', version: '3.12.1'
117117

118118
// Wait test utility

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Main properties
22
group=com.truelayer
33
archivesBaseName=truelayer-java
4-
version=17.1.0
4+
version=17.2.0
55

66
# Artifacts properties
77
sonatype_repository_url=https://s01.oss.sonatype.org/service/local/

src/main/java/com/truelayer/java/payments/entities/paymentdetail/AuthorizedPaymentDetail.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.annotation.JsonGetter;
44
import com.truelayer.java.entities.AuthorizationFlowWithConfiguration;
55
import com.truelayer.java.entities.PaymentSource;
6+
import java.time.ZonedDateTime;
67
import java.util.Optional;
78
import lombok.*;
89

@@ -16,6 +17,8 @@ public class AuthorizedPaymentDetail extends PaymentDetail {
1617

1718
AuthorizationFlowWithConfiguration authorizationFlow;
1819

20+
ZonedDateTime creditableAt;
21+
1922
@JsonGetter
2023
public Optional<AuthorizationFlowWithConfiguration> getAuthorizationFlow() {
2124
return Optional.ofNullable(authorizationFlow);

src/main/java/com/truelayer/java/payments/entities/paymentdetail/ExecutedPaymentDetail.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public class ExecutedPaymentDetail extends PaymentDetail {
1717

1818
ZonedDateTime executedAt;
1919

20+
ZonedDateTime creditableAt;
21+
2022
AuthorizationFlowWithConfiguration authorizationFlow;
2123

2224
SettlementRisk settlementRisk;

src/main/java/com/truelayer/java/payments/entities/paymentdetail/FailedPaymentDetail.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public class FailedPaymentDetail extends PaymentDetail {
2121

2222
ZonedDateTime failedAt;
2323

24+
ZonedDateTime creditableAt;
25+
2426
FailureStage failureStage;
2527

2628
String failureReason;

src/main/java/com/truelayer/java/payments/entities/paymentdetail/SettledPaymentDetail.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public class SettledPaymentDetail extends PaymentDetail {
2525

2626
ZonedDateTime executedAt;
2727

28+
ZonedDateTime creditableAt;
29+
2830
AuthorizationFlowWithConfiguration authorizationFlow;
2931

3032
SettlementRisk settlementRisk;

src/test/java/com/truelayer/java/payments/entities/paymentdetail/PaymentDetailTests.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,17 @@ public void shouldNotConvertToAuthorizingPaymentDetail() {
6767
@Test
6868
@DisplayName("It should yield true if instance is of type AuthorizedPaymentDetail")
6969
public void shouldYieldTrueIfAuthorizedPaymentDetail() {
70-
PaymentDetail sut = new AuthorizedPaymentDetail(null, new AuthorizationFlowWithConfiguration(null));
70+
PaymentDetail sut = new AuthorizedPaymentDetail(
71+
null, new AuthorizationFlowWithConfiguration(null), ZonedDateTime.now(Clock.systemUTC()));
7172

7273
assertTrue(sut.isAuthorized());
7374
}
7475

7576
@Test
7677
@DisplayName("It should convert to an instance of class AuthorizedPaymentDetail")
7778
public void shouldConvertToAuthorizedPaymentDetail() {
78-
PaymentDetail sut = new AuthorizedPaymentDetail(null, new AuthorizationFlowWithConfiguration(null));
79+
PaymentDetail sut = new AuthorizedPaymentDetail(
80+
null, new AuthorizationFlowWithConfiguration(null), ZonedDateTime.now(Clock.systemUTC()));
7981

8082
assertDoesNotThrow(sut::asAuthorized);
8183
}
@@ -96,6 +98,7 @@ public void shouldYieldTrueIfFailedPaymentDetail() {
9698
PaymentDetail sut = new FailedPaymentDetail(
9799
null,
98100
ZonedDateTime.now(Clock.systemUTC()),
101+
ZonedDateTime.now(Clock.systemUTC()),
99102
FailedPaymentDetail.FailureStage.AUTHORIZATION_REQUIRED,
100103
"failed for some reason",
101104
null);
@@ -109,6 +112,7 @@ public void shouldConvertToFailedPaymentDetail() {
109112
PaymentDetail sut = new FailedPaymentDetail(
110113
null,
111114
ZonedDateTime.now(Clock.systemUTC()),
115+
ZonedDateTime.now(Clock.systemUTC()),
112116
FailedPaymentDetail.FailureStage.AUTHORIZATION_REQUIRED,
113117
"failed for some reason",
114118
null);
@@ -134,6 +138,7 @@ public void shouldYieldTrueIfSettledPaymentDetail() {
134138
ZonedDateTime.now(Clock.systemUTC()),
135139
ZonedDateTime.now(Clock.systemUTC()),
136140
ZonedDateTime.now(Clock.systemUTC()),
141+
ZonedDateTime.now(Clock.systemUTC()),
137142
null,
138143
null);
139144

@@ -148,6 +153,7 @@ public void shouldConvertToSettledPaymentDetail() {
148153
ZonedDateTime.now(Clock.systemUTC()),
149154
ZonedDateTime.now(Clock.systemUTC()),
150155
ZonedDateTime.now(Clock.systemUTC()),
156+
ZonedDateTime.now(Clock.systemUTC()),
151157
null,
152158
null);
153159

@@ -167,15 +173,17 @@ public void shouldNotConvertToSettledPaymentDetail() {
167173
@Test
168174
@DisplayName("It should yield true if instance is of type ExecutedPaymentDetail")
169175
public void shouldYieldTrueIfExecutedPaymentDetail() {
170-
PaymentDetail sut = new ExecutedPaymentDetail(null, ZonedDateTime.now(Clock.systemUTC()), null, null);
176+
PaymentDetail sut = new ExecutedPaymentDetail(
177+
null, ZonedDateTime.now(Clock.systemUTC()), ZonedDateTime.now(Clock.systemUTC()), null, null);
171178

172179
assertTrue(sut.isExecuted());
173180
}
174181

175182
@Test
176183
@DisplayName("It should convert to an instance of class ExecutedPaymentDetail")
177184
public void shouldConvertToExecutedPaymentDetail() {
178-
PaymentDetail sut = new ExecutedPaymentDetail(null, ZonedDateTime.now(Clock.systemUTC()), null, null);
185+
PaymentDetail sut = new ExecutedPaymentDetail(
186+
null, ZonedDateTime.now(Clock.systemUTC()), ZonedDateTime.now(Clock.systemUTC()), null, null);
179187

180188
assertDoesNotThrow(sut::asExecuted);
181189
}

src/test/resources/__files/payments/200.get_payment_by_id.bank_transfer.authorized.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
}
4848
},
4949
"created_at":"2022-01-17T17:13:18.214924Z",
50+
"creditable_at":"2022-01-18T17:13:18.214924Z",
5051
"status":"authorized",
5152
"authorization_flow":{
5253
"configuration":{

src/test/resources/__files/payments/200.get_payment_by_id.bank_transfer.executed.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"account_holder_name":"John Doe"
5151
},
5252
"executed_at":"2022-01-17T17:13:18.214924Z",
53+
"creditable_at":"2022-01-18T17:13:18.214924Z",
5354
"metadata": {
5455
"a_custom_key": "a-value"
5556
}

0 commit comments

Comments
 (0)