Skip to content

Commit

Permalink
Add appVersion to request body for Login/SignUp/Payment
Browse files Browse the repository at this point in the history
  • Loading branch information
soareswallace committed Jan 29, 2025
1 parent 3b2ba57 commit 94f8d67
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 5 deletions.
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.1.0</version>
<version>3.2.0</version>
</dependency>
```
```xml
<dependency>
<groupId>com.incognia</groupId>
<artifactId>incognia-api-client-shaded</artifactId>
<version>3.1.0</version>
<version>3.2.0</version>
</dependency>
```

Expand All @@ -47,13 +47,13 @@ repositories {
And then add the dependency
```gradle
dependencies {
implementation 'com.incognia:incognia-api-client:3.1.0'
implementation 'com.incognia:incognia-api-client:3.2.0'
}
```
OR
```gradle
dependencies {
implementation 'com.incognia:incognia-api-client-shaded:3.1.0'
implementation 'com.incognia:incognia-api-client-shaded:3.2.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.1.0"
version = "3.2.0"

task createProjectVersionFile {
def projectVersionDir = "$projectDir/src/main/java/com/incognia/api"
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/incognia/api/IncogniaAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public SignupAssessment registerSignup(RegisterSignupRequest request) throws Inc
PostSignupRequestBody.builder()
.installationId(request.getInstallationId())
.requestToken(request.getRequestToken())
.appVersion(request.getAppVersion())
.addressLine(address.map(Address::getAddressLine).orElse(null))
.structuredAddress(address.map(Address::getStructuredAddress).orElse(null))
.addressCoordinates(address.map(Address::getCoordinates).orElse(null))
Expand Down Expand Up @@ -195,6 +196,7 @@ public TransactionAssessment registerLogin(RegisterLoginRequest request)
PostTransactionRequestBody.builder()
.installationId(request.getInstallationId())
.requestToken(request.getRequestToken())
.appVersion(request.getAppVersion())
.accountId(request.getAccountId())
.externalId(request.getExternalId())
.policyId(request.getPolicyId())
Expand Down Expand Up @@ -392,6 +394,7 @@ public TransactionAssessment registerPayment(RegisterPaymentRequest request)
PostTransactionRequestBody.builder()
.installationId(request.getInstallationId())
.requestToken(request.getRequestToken())
.appVersion(request.getAppVersion())
.accountId(request.getAccountId())
.externalId(request.getExternalId())
.policyId(request.getPolicyId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class PostSignupRequestBody {
String sessionToken;
String requestToken;
String addressLine;
String appVersion;
StructuredAddress structuredAddress;
Coordinates addressCoordinates;
String externalId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
public class RegisterSignupRequest {
String installationId;
String requestToken;
String appVersion;
@Nullable Address address;
String externalId;
String policyId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
public class PostTransactionRequestBody {
String installationId;
String requestToken;
String appVersion;
String accountId;
String sessionToken;
String policyId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class RegisterLoginRequest {
String accountId;
String externalId;
String policyId;
String appVersion;
Map<String, Object> customProperties;

@Getter(AccessLevel.NONE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
public class RegisterPaymentRequest {
String installationId;
String requestToken;
String appVersion;
String accountId;
String externalId;
String policyId;
Expand Down
9 changes: 9 additions & 0 deletions src/test/java/com/incognia/api/IncogniaAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,15 @@ void testRegisterSignup_withEmptyAddress() {
String accountId = "my-account";
String policyId = UUID.randomUUID().toString();
String externalId = "external-id";
String appVersion = "1.4.3";

TokenAwareDispatcher dispatcher = new TokenAwareDispatcher(token, CLIENT_ID, CLIENT_SECRET);
dispatcher.setExpectedAddressLine(null);
dispatcher.setExpectedRequestToken(requestToken);
dispatcher.setExpectedExternalId(externalId);
dispatcher.setExpectedPolicyId(policyId);
dispatcher.setExpectedAccountId(accountId);
dispatcher.setExpectedAppVersion(appVersion);
dispatcher.setExpectedCustomProperties(null);
mockServer.setDispatcher(dispatcher);
RegisterSignupRequest registerSignupRequest =
Expand All @@ -169,6 +171,7 @@ void testRegisterSignup_withEmptyAddress() {
.accountId(accountId)
.policyId(policyId)
.externalId(externalId)
.appVersion(appVersion)
.customProperties(null)
.build();
SignupAssessment signupAssessment = client.registerSignup(registerSignupRequest);
Expand Down Expand Up @@ -301,6 +304,7 @@ void testRegisterLogin_whenDataIsValid(Boolean eval) {
String token = TokenCreationFixture.createToken();
String requestToken = "request-token";
String accountId = "account-id";
String appVersion = "1.4.3";
String externalId = "external-id";
String policyId = "policy-id";
Map<String, Object> map = new HashMap<>();
Expand All @@ -311,6 +315,7 @@ void testRegisterLogin_whenDataIsValid(Boolean eval) {
PostTransactionRequestBody.builder()
.requestToken(requestToken)
.externalId(externalId)
.appVersion(appVersion)
.accountId(accountId)
.type("login")
.addresses(null)
Expand All @@ -323,6 +328,7 @@ void testRegisterLogin_whenDataIsValid(Boolean eval) {
RegisterLoginRequest.builder()
.requestToken(requestToken)
.accountId(accountId)
.appVersion(appVersion)
.externalId(externalId)
.evaluateTransaction(eval)
.policyId(policyId)
Expand Down Expand Up @@ -413,6 +419,7 @@ void testRegisterPayment_whenDataIsValid(Boolean eval) {
String token = TokenCreationFixture.createToken();
String requestToken = "request-token";
String accountId = "account-id";
String appVersion = "appVersion";
String externalId = "external-id";
String policyId = "policy-id";
Address address =
Expand Down Expand Up @@ -456,6 +463,7 @@ void testRegisterPayment_whenDataIsValid(Boolean eval) {
RegisterPaymentRequest.builder()
.requestToken(requestToken)
.accountId(accountId)
.appVersion(appVersion)
.externalId(externalId)
.policyId(policyId)
.addresses(Collections.singletonMap(AddressType.SHIPPING, address))
Expand All @@ -469,6 +477,7 @@ void testRegisterPayment_whenDataIsValid(Boolean eval) {
.externalId(externalId)
.policyId(policyId)
.accountId(accountId)
.appVersion(appVersion)
.type("payment")
.addresses(transactionAddresses)
.paymentValue(paymentValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class TokenAwareDispatcher extends Dispatcher {
@Setter private String expectedInstallationId;
@Setter private String expectedExternalId;
@Setter private String expectedAccountId;
@Setter private String expectedAppVersion;
@Setter private String expectedPolicyId;
@Setter private String expectedAddressLine;
@Setter private Map<String, Object> expectedCustomProperties;
Expand Down Expand Up @@ -138,6 +139,7 @@ private MockResponse handlePostSignup(@NotNull RecordedRequest request)
assertThat(postSignupRequestBody.getInstallationId()).isEqualTo(expectedInstallationId);
assertThat(postSignupRequestBody.getRequestToken()).isEqualTo(expectedRequestToken);
assertThat(postSignupRequestBody.getAccountId()).isEqualTo(expectedAccountId);
assertThat(postSignupRequestBody.getAppVersion()).isEqualTo(expectedAppVersion);
assertThat(postSignupRequestBody.getExternalId()).isEqualTo(expectedExternalId);
assertThat(postSignupRequestBody.getPolicyId()).isEqualTo(expectedPolicyId);
assertThat(postSignupRequestBody.getAddressLine()).isEqualTo(expectedAddressLine);
Expand Down

0 comments on commit 94f8d67

Please sign in to comment.