Skip to content

Commit

Permalink
LC-221 - Identity Opt-out and Opt-in endpoint for setting opt-in/opt-…
Browse files Browse the repository at this point in the history
…out (#828)
  • Loading branch information
SMaros authored Aug 15, 2023
1 parent da4dbdc commit 9e844ed
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,14 @@ IIdentity updateIdentity(String identityId, String externalId, int state, int ty
List<ILimit> limitCashPerMonth, List<ILimit> limitCashPer3Months, List<ILimit> limitCashPer12Months, List<ILimit> limitCashPerCalendarQuarter,
List<ILimit> limitCashPerCalendarYear, List<ILimit> limitCashTotalIdentity, String configurationCashCurrency);

/**
* Updates the marketing opt-in agreement for the identity identified by {@code identityId}).
*
* @param identityId public ID of an existing identity to be updated
* @param agreeWithMarketingOptIn True if the customer agrees to marketing opt-in, false otherwise.
*/
void updateIdentityMarketingOptIn(String identityId, boolean agreeWithMarketingOptIn);

/**
* @param customFieldDefinitionId use {@link CustomFieldDefinition#getId()} of a custom field to set
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ public IIdentity updateIdentity(String identityId, String externalId, int state,
return null;
}

@Override
public void updateIdentityMarketingOptIn(String identityId, boolean agreeWithMarketingOptIn) {
}

@Override
public void setIdentityCustomField(String identityPublicId,
long customFieldDefinitionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@ public String update(@FormParam("identityPublicId") String identityPublicId, @Fo
return updatedIdentity.getPublicId();
}

// curl -k -XPOST https://localhost:7743/extensions/identity-example/update-opt-in -d "identityPublicId=IE3BVEBUIIXZ3SZV&agreeWithMarketingOptIn=true"
@POST
@Path("/update-opt-in")
@Produces(MediaType.APPLICATION_JSON)
public void updateOptInAgreement(@FormParam("identityPublicId") String identityPublicId, @FormParam("agreeWithMarketingOptIn") boolean agreeWithMarketingOptIn) {
IExtensionContext ctx = IdentityExampleExtension.getExtensionContext();
IIdentity identity = ctx.findIdentityByIdentityId(identityPublicId);
if (identity == null) {
log.debug("Identity {} not found", identityPublicId);
return;
}
ctx.updateIdentityMarketingOptIn(identityPublicId, agreeWithMarketingOptIn);
}

// curl -k -XPOST https://localhost:7743/extensions/identity-example/getnotes -d "identityPublicId=IE3BVEBUIIXZ3SZV"
@POST
@Path("/getnotes")
Expand Down

0 comments on commit 9e844ed

Please sign in to comment.