Skip to content
Open
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
16 changes: 14 additions & 2 deletions src/main/java/net/accelbyte/gdpr/sdk/GDPRHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@

package net.accelbyte.gdpr.sdk;

import net.accelbyte.gdpr.registered.v1.AccountInfo;
import net.accelbyte.gdpr.sdk.object.DataGenerationResult;

import java.util.List;

public interface GDPRHandler {

/**
* Process data generation for the requested user.
*
* The concrete implementation should put the data result into "data" property inside DataGenerationResult object.
* The "data" property (inside DataGenerationResult object) was in form of Map<ModuleId, byte[]>,
* The "data" property (inside DataGenerationResult object) was in form of Map&lt;ModuleId, byte[]&gt;,
* this allows the concrete implementation to categorized multiple data based on the modules they have.
* Example:
* Map<ModuleId, byte[]> = {
* Map&lt;ModuleId, byte[]&gt; = {
* entitlement: entitlementData,
* wallet: walletData,
* transaction: transactionData
Expand Down Expand Up @@ -50,4 +53,13 @@ public interface GDPRHandler {
* @param isPublisherNamespace indicate whether the "namespace" is a publisher namespace or game namespace
*/
void ProcessDataRestriction(String namespace, String userId, boolean restrict, boolean isPublisherNamespace);

/**
* Handle 3rd party platform account closure.
*
* @param platform 3rd party platform
* @param platformUserId 3rd party platform account id
* @param accounts linked AGS accounts in all namespaces(including publisher namespace)
*/
void ProcessPlatformAccountClosure(String platform, String platformUserId, List<AccountInfo> accounts);
}
29 changes: 29 additions & 0 deletions src/main/java/net/accelbyte/gdpr/sdk/GDPRService.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,33 @@ public void dataRestriction(DataRestrictionRequest request, StreamObserver<DataR
responseObserver.onCompleted();
}

@Override
public void platformAccountClosure(net.accelbyte.gdpr.registered.v1.PlatformAccountClosureRequest request,
io.grpc.stub.StreamObserver<net.accelbyte.gdpr.registered.v1.PlatformAccountClosureResponse> responseObserver) {
PlatformAccountClosureResponse.Builder responseBuilder = PlatformAccountClosureResponse.newBuilder();
if (Strings.isNullOrEmpty(request.getPlatform()) || Strings.isNullOrEmpty(request.getPlatformUserId()) || request.getAccountsList() == null || request.getAccountsList().size() == 0) {
log.error("[GDPRService.platformAccountClosure] empty required payload: platform or platformUserId or linked accounts.");
responseBuilder.setSuccess(false).setMessage("required payload is empty");
responseObserver.onNext(responseBuilder.build());
responseObserver.onCompleted();
return;
}

if (handler == null) {
responseBuilder.setSuccess(true);
} else {
log.info("[GDPRService.platformAccountClosure] start executing for platform [{}]",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggest to print platformUserId in log as well

request.getPlatform());
try {
handler.ProcessPlatformAccountClosure(request.getPlatform(), request.getPlatformUserId(), request.getAccountsList());
responseBuilder.setSuccess(true);
}catch (Exception ex) {
log.error("[GDPRService.platformAccountClosure] error: [{}]", ex.getMessage());
responseBuilder.setSuccess(false).setMessage(ex.getMessage());
}
}
responseObserver.onNext(responseBuilder.build());
responseObserver.onCompleted();
}

}
22 changes: 22 additions & 0 deletions src/main/proto/gdpr.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ service GDPR {
*/
rpc DataRestriction(DataRestrictionRequest) returns (DataRestrictionResponse) {};

/**
Platform Account Closure.
Used to inform the registered services to handle the 3rd party account closure.
*/
rpc PlatformAccountClosure(PlatformAccountClosureRequest) returns (PlatformAccountClosureResponse) {};

}

message DataGenerationRequest {
Expand Down Expand Up @@ -65,4 +71,20 @@ message DataRestrictionRequest {
message DataRestrictionResponse {
bool success = 1; // indicate restrict processing was success
string message = 2; // message from restrict processing
}

message AccountInfo {
string namespace = 1; // namespace
string userId = 2; // user id in the namespace
}

message PlatformAccountClosureRequest {
string platform = 1; // platform: psn, xbox, epicgames, etc
string platformUserId = 2; // third party account id
repeated AccountInfo accounts = 3; // account info in each namespace
}

message PlatformAccountClosureResponse {
bool success = 1; // indicates platform account closure was success
string message = 2; // message from platform account closure process
}