0% found this document useful (0 votes)
16 views6 pages

Retrieve Fraud Details Workbook

The document outlines the implementation requirements for retrieving fraud details from ClaimCenter, including the addition of a new REST endpoint and specifications for accessing data stored in an S3 bucket. It details the validation process for incoming requests and provides a solution with code snippets for the FraudRestRouteBuilder class. The document is intended for students to understand how to set up and test the fraud details retrieval functionality.

Uploaded by

Shahid Khan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views6 pages

Retrieve Fraud Details Workbook

The document outlines the implementation requirements for retrieving fraud details from ClaimCenter, including the addition of a new REST endpoint and specifications for accessing data stored in an S3 bucket. It details the validation process for incoming requests and provides a solution with code snippets for the FraudRestRouteBuilder class. The document is intended for students to understand how to set up and test the fraud details retrieval functionality.

Uploaded by

Shahid Khan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Retrieve Fraud Details

Student Workbook
Retrieve Fraud Details - Student Workbook

Table of contents
Retrieve Fraud Details .............................................................................................................................................. 3
Implementation requirements............................................................................................................................... 3
Validation.............................................................................................................................................................. 4
Solution ................................................................................................................................................................ 4

Guidewire Proprietary & Confidential – DO NOT DISTRIBUTE


2
Retrieve Fraud Details - Student Workbook

Retrieve Fraud Details


The Hooli would like to be able to view Fraud Details from ClaimCenter.

Implementation requirements
Spec 1 Add another endpoint to [Link]

Spec 2 Add a REST get request that receives a claim number. The route should appear as
/fraud/details?claimNumber=xxxx in Swagger UI

Spec 3 The API returns JSON representing FraudDetails, retrieved from S3

Spec 4 The S3 bucket is named Ig_cc_nnnn_yyyymmdd where

 cc – is your company name

 nnnn is your first and last name

 yyyymmdd is the year, month, and day of the start of class

Spec 5 The S3 object key should be fraud/[Link] where:

• yyyy is the ClaimNumber from the FraudDetails

Below is the entire flow with the new route in green:

Guidewire Proprietary & Confidential – DO NOT DISTRIBUTE


3
Retrieve Fraud Details - Student Workbook

Validation
 Test the new route using Swagger UI to verify that the fraud details are returned from the S3 bucket.
o Start the Integration Gateway application in IntelliJ.
o Open chrome and navigate to [Link]
o Execute the /fraud/details?claimNumber=12345 request. Be sure that you have used claim
number 12345 from the SWIFT response in order to test this route.

Solution
The solution for the fraud route is as follows:

FraudRestRouteBuilder:

package [Link];

import [Link];

Guidewire Proprietary & Confidential – DO NOT DISTRIBUTE


4
Retrieve Fraud Details - Student Workbook

import [Link];
import [Link];
import [Link];
import [Link].aws2.s3.AWS2S3Constants;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

@Named
public class FraudRestRouteBuilder extends RouteBuilder {

public void validate(Exchange exchange) throws ValidationException {

FraudRequest fraudRequest = [Link]().getBody([Link]);

if (fraudRequest == null) {
throw new ValidationException(exchange, "Fraud Request is null");
}
if ([Link]() == null || [Link]().isEmpty()) {
throw new ValidationException(exchange, "Claim Number not provided");
}
if ([Link]() == null || [Link]().isEmpty()) {
throw new ValidationException(exchange, "LOB not provided");
}
if ([Link]().compareToIgnoreCase("case2") == 0) {
throw new NoXmlBodyValidationException(exchange);
}

@Override
public void configure() throws Exception {

onException([Link]).handled(true)
.setBody(exceptionMessage())
.setHeader(Exchange.HTTP_RESPONSE_CODE, constant(HttpsURLConnection.HTTP_BAD_REQUEST))
.log("Received body ")
.end();

rest()
.path("/fraud/request/")
.description("Fraud Request")
.post("fraudReport")
.bindingMode([Link])
.consumes(ContentType.APPLICATION_JSON.getMimeType())
.produces(ContentType.APPLICATION_JSON.getMimeType())
.type([Link])
.outType([Link])
.route()
.routeId("FraudRequestSM")
.process(this::validate)
.marshal().json()
.to("gwsqs://{{[Link]}}" +
"?useDefaultCredentialsProvider=true" +
"&messageDeduplicationIdStrategy=useContentBasedDeduplication" +
"&messageGroupIdStrategy=useConstant")
.endRest();

rest()
.path("/fraud/request/")
.description("Fraud Details")
.get("fraud/details?claimNumber={claimNumber}")

Guidewire Proprietary & Confidential – DO NOT DISTRIBUTE


5
Retrieve Fraud Details - Student Workbook

.param().name("claimNumber").type([Link]).endParam()
.produces(ContentType.APPLICATION_JSON.getMimeType())
.route()
.routeId("FrauDetails")
.process(this::getS3FileName)
.to("aws2-s3://ig-si-larry-jones-20221031" +
"?useDefaultCredentialsProvider=true" +
"&operation=getObject)
.endRest();

private void getS3FileName(Exchange exchange) {

String fileName = [Link]().getHeader("claimNumber", [Link]);


String key = "fraud/" + fileName + ".json";
[Link]().setHeader(AWS2S3Constants.BUCKET_NAME,
" ig-si-larry-jones-20221031");
[Link]().setHeader([Link], key);
[Link]("Retrieving S3 file:" + key);
}

[Link]:

[Link]= ig-si-larry-jones-20221031

Guidewire Proprietary & Confidential – DO NOT DISTRIBUTE


6

You might also like