Skip to content
Closed
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ And then add the artifact `incognia-api-client` **or** `incognia-api-client-shad
<dependency>
<groupId>com.incognia</groupId>
<artifactId>incognia-api-client</artifactId>
<version>3.14.0</version>
<version>3.15.0</version>
</dependency>
```
```xml
<dependency>
<groupId>com.incognia</groupId>
<artifactId>incognia-api-client-shaded</artifactId>
<version>3.14.0</version>
<version>3.15.0</version>
</dependency>
```

Expand All @@ -47,13 +47,13 @@ repositories {
And then add the dependency
```gradle
dependencies {
implementation 'com.incognia:incognia-api-client:3.14.0'
implementation 'com.incognia:incognia-api-client:3.15.0'
}
```
OR
```gradle
dependencies {
implementation 'com.incognia:incognia-api-client-shaded:3.14.0'
implementation 'com.incognia:incognia-api-client-shaded:3.15.0'
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "com.incognia"
version = "3.14.0"
version = "3.15.0"

task createProjectVersionFile {
def projectVersionDir = "$projectDir/src/main/java/com/incognia/api"
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/incognia/api/IncogniaAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ public void registerFeedback(
.externalId(identifiers.getExternalId())
.requestToken(identifiers.getRequestToken())
.personId(identifiers.getPersonId())
.financialAccount(identifiers.getFinancialAccount())
.expiresAt(
Optional.ofNullable(identifiers.getExpiresAt()).map(Instant::toString).orElse(null))
.build();
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/com/incognia/common/HolderTaxID.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.incognia.common;

import lombok.Builder;
import lombok.Value;

@Value
@Builder
public class HolderTaxID implements TypedValue {
String type;
String value;

public static HolderTaxID ofCPF(String cpfValue) {
return HolderTaxID.builder().type("cpf").value(cpfValue).build();
}

public static HolderTaxID ofSSN(String ssnValue) {
return HolderTaxID.builder().type("ssn").value(ssnValue).build();
}

public static HolderTaxID ofEIN(String einValue) {
return HolderTaxID.builder().type("ein").value(einValue).build();
}

public static HolderTaxID ofCNPJ(String cnpjValue) {
return HolderTaxID.builder().type("cnpj").value(cnpjValue).build();
Comment on lines +16 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why were these methods created? they're not being used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are facilitators for the usage of each of these identifiers. We already had them for CPF and I added for the other ones to maintain the pattern.

}
}
2 changes: 1 addition & 1 deletion src/main/java/com/incognia/common/PersonID.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

@Value
@Builder
public class PersonID {
public class PersonID implements TypedValue {
String type;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
TypedValue.getType
; it is advisable to add an Override annotation.
String value;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
TypedValue.getValue
; it is advisable to add an Override annotation.

public static PersonID ofCPF(String cpfValue) {
return PersonID.builder().type("cpf").value(cpfValue).build();
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/incognia/common/TypedValue.java
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove this interface

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.incognia.common;

public interface TypedValue {
String getType();

String getValue();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.incognia.feedback;

import com.incognia.common.PersonID;
import com.incognia.transaction.payment.BankAccountInfo;
import java.time.Instant;
import lombok.Builder;
import lombok.Value;
Expand All @@ -18,4 +19,5 @@ public class FeedbackIdentifiers {
String externalId;
Instant expiresAt;
PersonID personId;
BankAccountInfo financialAccount;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.incognia.feedback;

import com.incognia.common.PersonID;
import com.incognia.transaction.payment.BankAccountInfo;
import lombok.Builder;
import lombok.Value;

Expand All @@ -19,4 +20,5 @@ public class PostFeedbackRequestBody {
String signupId;
String expiresAt;
PersonID personId;
BankAccountInfo financialAccount;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.incognia.transaction.payment;

import com.incognia.common.PersonID;
import com.incognia.common.HolderTaxID;
import java.util.Collections;
import java.util.List;
import lombok.Builder;
Expand All @@ -12,7 +12,7 @@ public class BankAccountInfo {
String accountType;
String accountPurpose;
String holderType;
PersonID holderTaxId;
HolderTaxID holderTaxId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a breaking change

String country;
String ispbCode;
String branchCode;
Expand Down
13 changes: 12 additions & 1 deletion src/test/java/com/incognia/api/IncogniaAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.incognia.api.clients.TokenAwareDispatcher;
import com.incognia.common.Address;
import com.incognia.common.Coordinates;
import com.incognia.common.HolderTaxID;
import com.incognia.common.Location;
import com.incognia.common.PersonID;
import com.incognia.common.Reason;
Expand Down Expand Up @@ -835,7 +836,7 @@ void testRegisterPayment_whenDataIsValid(Boolean eval) {
.accountType("checking")
.accountPurpose("general")
.holderType("individual")
.holderTaxId(PersonID.builder().type("cpf").value("12345678901").build())
.holderTaxId(HolderTaxID.builder().type("cpf").value("12345678901").build())
.country("BR")
.ispbCode("12345678")
.branchCode("0000")
Expand Down Expand Up @@ -983,6 +984,14 @@ void testRegisterFeedback_whenDataIsValid(boolean dryRun) {
String signupId = UUID.randomUUID().toString();
Instant timestamp = Instant.now();
PersonID personId = PersonID.ofCPF("12345678901");
HolderTaxID holderTaxID = HolderTaxID.ofCPF("12345678901");
BankAccountInfo financialAccount =
BankAccountInfo.builder()
.accountNumber("123456")
.branchCode("1234")
.holderTaxId(holderTaxID)
.holderType("individual")
.build();

dispatcher.setExpectedFeedbackRequestBody(
PostFeedbackRequestBody.builder()
Expand All @@ -993,6 +1002,7 @@ void testRegisterFeedback_whenDataIsValid(boolean dryRun) {
.event(FeedbackEvent.ACCOUNT_TAKEOVER)
.timestamp(timestamp.toEpochMilli())
.personId(personId)
.financialAccount(financialAccount)
.build());
mockServer.setDispatcher(dispatcher);
client.registerFeedback(
Expand All @@ -1004,6 +1014,7 @@ void testRegisterFeedback_whenDataIsValid(boolean dryRun) {
.externalId(externalId)
.signupId(signupId)
.personId(personId)
.financialAccount(financialAccount)
.build(),
dryRun);
}
Expand Down
Loading