diff --git a/build.gradle b/build.gradle index 4dd155d4..24f6202a 100644 --- a/build.gradle +++ b/build.gradle @@ -108,11 +108,11 @@ dependencies { implementation group: 'org.tinylog', name: 'tinylog-impl', version: tinyLogVersion // JUnit test framework. - testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.11.2' + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.11.3' // Mocking libraries testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.14.2' - testImplementation group: 'org.wiremock', name: 'wiremock', version: '3.9.1' + testImplementation group: 'org.wiremock', name: 'wiremock', version: '3.9.2' // Wait test utility testImplementation group: 'org.awaitility', name: 'awaitility', version: '4.2.2' diff --git a/gradle.properties b/gradle.properties index a2161918..7c8630e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ # Main properties group=com.truelayer archivesBaseName=truelayer-java -version=15.0.0 +version=16.0.0 # Artifacts properties sonatype_repository_url=https://s01.oss.sonatype.org/service/local/ diff --git a/src/main/java/com/truelayer/java/merchantaccounts/entities/UpdateSweepingRequest.java b/src/main/java/com/truelayer/java/merchantaccounts/entities/UpdateSweepingRequest.java index f9a3c2c8..d32c8335 100644 --- a/src/main/java/com/truelayer/java/merchantaccounts/entities/UpdateSweepingRequest.java +++ b/src/main/java/com/truelayer/java/merchantaccounts/entities/UpdateSweepingRequest.java @@ -1,6 +1,5 @@ package com.truelayer.java.merchantaccounts.entities; -import com.truelayer.java.entities.CurrencyCode; import com.truelayer.java.merchantaccounts.entities.sweeping.Frequency; import lombok.Builder; import lombok.EqualsAndHashCode; @@ -14,7 +13,5 @@ public class UpdateSweepingRequest { private int maxAmountInMinor; - private CurrencyCode currency; - private Frequency frequency; } diff --git a/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/MerchantAccountPayment.java b/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/MerchantAccountPayment.java index d91b9b77..07cadc04 100644 --- a/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/MerchantAccountPayment.java +++ b/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/MerchantAccountPayment.java @@ -1,7 +1,10 @@ package com.truelayer.java.merchantaccounts.entities.transactions; +import com.fasterxml.jackson.annotation.JsonGetter; import com.truelayer.java.entities.CurrencyCode; import java.time.ZonedDateTime; +import java.util.Map; +import java.util.Optional; import lombok.EqualsAndHashCode; import lombok.Value; @@ -23,4 +26,11 @@ public class MerchantAccountPayment extends Transaction { PaymentSource paymentSource; String paymentId; + + Map metadata; + + @JsonGetter + public Optional> getMetadata() { + return Optional.ofNullable(metadata); + } } diff --git a/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/Payout.java b/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/Payout.java index 135a79f7..83e39603 100644 --- a/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/Payout.java +++ b/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/Payout.java @@ -5,6 +5,7 @@ import com.truelayer.java.entities.CurrencyCode; import com.truelayer.java.entities.beneficiary.Beneficiary; import java.time.ZonedDateTime; +import java.util.Map; import java.util.Optional; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -46,6 +47,13 @@ public class Payout extends Transaction { String payoutId; + Map metadata; + + @JsonGetter + public Optional> getMetadata() { + return Optional.ofNullable(metadata); + } + @JsonGetter public Optional getExecutedAt() { return Optional.ofNullable(executedAt); diff --git a/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/Refund.java b/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/Refund.java index 4e66a1d9..e4b56e5f 100644 --- a/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/Refund.java +++ b/src/main/java/com/truelayer/java/merchantaccounts/entities/transactions/Refund.java @@ -4,6 +4,7 @@ import com.truelayer.java.entities.CurrencyCode; import com.truelayer.java.entities.beneficiary.PaymentSource; import java.time.ZonedDateTime; +import java.util.Map; import java.util.Optional; import lombok.EqualsAndHashCode; import lombok.Value; @@ -36,6 +37,13 @@ public class Refund extends Transaction { String paymentId; + Map metadata; + + @JsonGetter + public Optional> getMetadata() { + return Optional.ofNullable(metadata); + } + @JsonGetter public Optional getExecutedAt() { return Optional.ofNullable(executedAt); diff --git a/src/test/java/com/truelayer/java/acceptance/MerchantAccountsAcceptanceTests.java b/src/test/java/com/truelayer/java/acceptance/MerchantAccountsAcceptanceTests.java index d6776af2..876ccd73 100644 --- a/src/test/java/com/truelayer/java/acceptance/MerchantAccountsAcceptanceTests.java +++ b/src/test/java/com/truelayer/java/acceptance/MerchantAccountsAcceptanceTests.java @@ -62,7 +62,6 @@ public void itShouldGetTheSweepingSettings() { UpdateSweepingRequest updateSweepingRequest = UpdateSweepingRequest.builder() .maxAmountInMinor(100) .frequency(Frequency.DAILY) - .currency(CurrencyCode.GBP) .build(); ApiResponse updateSweepingResponse = tlClient.merchantAccounts() .updateSweeping(getMerchantAccount(CurrencyCode.GBP).getId(), updateSweepingRequest) @@ -83,7 +82,6 @@ public void itShouldUpdateTheSweepingSettings() { UpdateSweepingRequest updateSweepingRequest = UpdateSweepingRequest.builder() .maxAmountInMinor(100) .frequency(Frequency.DAILY) - .currency(CurrencyCode.GBP) .build(); ApiResponse updateSweepingResponse = tlClient.merchantAccounts() .updateSweeping(getMerchantAccount(CurrencyCode.GBP).getId(), updateSweepingRequest) diff --git a/src/test/java/com/truelayer/java/integration/MerchantAccountsIntegrationTests.java b/src/test/java/com/truelayer/java/integration/MerchantAccountsIntegrationTests.java index 33bba027..48312406 100644 --- a/src/test/java/com/truelayer/java/integration/MerchantAccountsIntegrationTests.java +++ b/src/test/java/com/truelayer/java/integration/MerchantAccountsIntegrationTests.java @@ -8,7 +8,6 @@ import static org.junit.jupiter.api.Assertions.*; import com.truelayer.java.TestUtils.RequestStub; -import com.truelayer.java.entities.CurrencyCode; import com.truelayer.java.http.entities.ApiResponse; import com.truelayer.java.http.entities.Headers; import com.truelayer.java.merchantaccounts.entities.*; @@ -266,7 +265,6 @@ public void shouldUpdateSweepingSetup() { .build(); UpdateSweepingRequest updateSweepingRequest = UpdateSweepingRequest.builder() - .currency(CurrencyCode.EUR) .frequency(Frequency.DAILY) .maxAmountInMinor(100) .build(); diff --git a/src/test/java/com/truelayer/java/merchantaccounts/MerchantAccountsHandlerTests.java b/src/test/java/com/truelayer/java/merchantaccounts/MerchantAccountsHandlerTests.java index 17352206..1bd3ddec 100644 --- a/src/test/java/com/truelayer/java/merchantaccounts/MerchantAccountsHandlerTests.java +++ b/src/test/java/com/truelayer/java/merchantaccounts/MerchantAccountsHandlerTests.java @@ -7,12 +7,12 @@ import static org.mockito.Mockito.verify; import com.truelayer.java.Constants; -import com.truelayer.java.entities.CurrencyCode; import com.truelayer.java.entities.RequestScopes; import com.truelayer.java.http.entities.Headers; import com.truelayer.java.merchantaccounts.entities.ListPaymentSourcesQuery; import com.truelayer.java.merchantaccounts.entities.ListTransactionsQuery; import com.truelayer.java.merchantaccounts.entities.UpdateSweepingRequest; +import com.truelayer.java.merchantaccounts.entities.sweeping.Frequency; import com.truelayer.java.merchantaccounts.entities.transactions.TransactionTypeQuery; import java.time.LocalDate; import java.time.LocalTime; @@ -108,7 +108,7 @@ public void shouldCallListTransactionsEndpoint(ZonedDateTime from, ZonedDateTime @DisplayName("It should call the update sweeping endpoint with empty headers map") public void shouldCallUpdateSweepingEndpoint() { UpdateSweepingRequest request = - UpdateSweepingRequest.builder().currency(CurrencyCode.GBP).build(); + UpdateSweepingRequest.builder().frequency(Frequency.DAILY).build(); sut.updateSweeping(A_MERCHANT_ACCOUNT_ID, request); @@ -120,7 +120,7 @@ public void shouldCallUpdateSweepingEndpoint() { public void shouldCallUpdateSweepingEndpointWithCustomHeaders() { Headers customHeaders = buildTestHeaders(); UpdateSweepingRequest request = - UpdateSweepingRequest.builder().currency(CurrencyCode.GBP).build(); + UpdateSweepingRequest.builder().frequency(Frequency.DAILY).build(); sut.updateSweeping(customHeaders, A_MERCHANT_ACCOUNT_ID, request); diff --git a/src/test/java/com/truelayer/java/merchantaccounts/entities/transactions/TransactionTests.java b/src/test/java/com/truelayer/java/merchantaccounts/entities/transactions/TransactionTests.java index e59bb519..aa695cd4 100644 --- a/src/test/java/com/truelayer/java/merchantaccounts/entities/transactions/TransactionTests.java +++ b/src/test/java/com/truelayer/java/merchantaccounts/entities/transactions/TransactionTests.java @@ -22,7 +22,8 @@ public void shouldYieldTrueIfMerchantAccountPayment() { 100, ZonedDateTime.now(Clock.systemUTC()), new PaymentSource(UUID.randomUUID().toString(), null, null), - UUID.randomUUID().toString()); + UUID.randomUUID().toString(), + null); assertTrue(sut.isMerchantAccountPayment()); } @@ -37,7 +38,8 @@ public void shouldConvertToMerchantAccountPayment() { 100, ZonedDateTime.now(Clock.systemUTC()), null, - UUID.randomUUID().toString()); + UUID.randomUUID().toString(), + null); assertDoesNotThrow(sut::asMerchantAccountPayment); } @@ -80,7 +82,8 @@ public void shouldNotConvertToExternalPayment() { 100, ZonedDateTime.now(Clock.systemUTC()), null, - UUID.randomUUID().toString()); + UUID.randomUUID().toString(), + null); Throwable thrown = assertThrows(TrueLayerException.class, sut::asExternalPayment); @@ -99,7 +102,8 @@ public void shouldYieldTrueIfPayout() { ZonedDateTime.now(Clock.systemUTC()), null, Payout.ContextCode.INTERNAL, - UUID.randomUUID().toString()); + UUID.randomUUID().toString(), + null); assertTrue(sut.isPayout()); } @@ -116,7 +120,8 @@ public void shouldConvertToPayout() { ZonedDateTime.now(Clock.systemUTC()), null, Payout.ContextCode.INTERNAL, - UUID.randomUUID().toString()); + UUID.randomUUID().toString(), + null); assertDoesNotThrow(sut::asPayout); } @@ -130,7 +135,8 @@ public void shouldNotConvertToPayout() { 100, ZonedDateTime.now(Clock.systemUTC()), null, - UUID.randomUUID().toString()); + UUID.randomUUID().toString(), + null); Throwable thrown = assertThrows(TrueLayerException.class, sut::asPayout); @@ -150,7 +156,8 @@ public void shouldYieldTrueIfRefund() { null, Payout.ContextCode.INTERNAL, UUID.randomUUID().toString(), - UUID.randomUUID().toString()); + UUID.randomUUID().toString(), + null); assertTrue(sut.isRefund()); } @@ -168,7 +175,8 @@ public void shouldConvertToRefund() { null, Payout.ContextCode.INTERNAL, UUID.randomUUID().toString(), - UUID.randomUUID().toString()); + UUID.randomUUID().toString(), + null); assertDoesNotThrow(sut::asRefund); } @@ -182,7 +190,8 @@ public void shouldNotConvertToRefund() { 100, ZonedDateTime.now(Clock.systemUTC()), null, - UUID.randomUUID().toString()); + UUID.randomUUID().toString(), + null); Throwable thrown = assertThrows(TrueLayerException.class, sut::asRefund);