Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The project consist of a new table and two new engines

Square Trade Order Table

The table (SQUARE_TRADE_ORDER) contains the information about the square trade order, primarily used to keep track of the current status and related dates.

...

Name

...

Description

...

ID

...

Standard rator id

...

WORKFLOW_ID

...

Id of any workflow to push

...

CODE

...

Type of order only CREATE, CHANGE and TERMINATE allowed.

...

STATUS_ID

...

Status of the order, supports 0 (new), 1 (waiting), 2 (success) and 5 (error)

...

SQUARE_TRADE_ID

...

Id of the order in square trade system, used for the inquiry call

...

CREATE_DATE

...

The date the order was created

...

LAST_CHECKED_DATE

...

The date the order was last inquired on the square trade system

...

ERROR_MESSAGE

...

Any errors received from square trade

...

engine, as it is heavily dependent generic order and custom logic in the customer project.

Square Trade Order Inquiry Engine

The engine (com.cdrator.insurance.handlerengineinquiryengine.SquareTradeOrderHandlerEngine) retrieves new square trade order entries and handles them.

EngineParameters

No specific parameters are needed.

EngineStartupCheck

Startup check implementation. No startup checks are required, so this just returns true. Exists to enable the implementation of startup checks if required.

EngineQueueLoader

Uses the broker to retrieve square trade orders where:

  • status id is 0 (new)

EngineHandler

The EngineHandler will:

  • Receive a list of square trade orders

  • Call specific hookpoints to retrieve the request object, based on the CODE (see below)

  • Send the request to Square Trade

  • Update the status of the square trade order to either waiting or error based on the response

Square Trade Order Inquiry Engine

The engine (com.cdrator.insurance.inquiryengine.SquareTradeOrderInquiryEngine) checks waiting square trade orders.SquareTradeOrderInquiryEngine) checks waiting generic orders with the partner code “SQUARE_TRADE”.
It used the response parameter “CHECK_DATE” set on the order to determine when to inquiry the specific order.

EngineParameters

One optional extra parameter exist:

Name

Description

Default value

SECONDS_BEFORE_CHECKING

Minimum amount of seconds passed before checking an order again.

300

EngineStartupCheck

Startup check implementation. No startup checks are required, so this just returns true. Exists to enable the implementation of startup checks if required.

EngineQueueLoader

Uses the broker to retrieve account payments generic orders where:

  • status id is 1 2 (waiting)processing)

  • partner code is “SQUARE_TRADE”

  • more than SECONDS_BEFORE_CHECKING have passed since the record was last checked

EngineHandler

The EngineHandler will:

  • Receive a list of square trade generic orders

  • Retrieve the status of the order from square trade

  • If response is either success or error, update the order and if there is a workflow on it, push the workflow

  • Regardless of the response, update the last checked date to sysdate

...

INSURANCE.SQUARE_TRADE

NAME

EXAMPLE VALUE

MANDATORY

DESCRIPTION

BASE_URL

api-stage4.squaretrade.com (test)

Yes

The base endpoint for the Telenor Wholesale REST API.

CLIENT_ID

N074R341V41u38u7C10533n0u9hR19h7

Yes

The value to use for the client_id part of the client_id:client_secret credentials that must be Base64-encoded and can then be used to call endpoint oauth/v2/token; see also parameter CLIENT_SECRET.

CLIENT_SECRET

4n07h3rF4k3V41u3

Yes

The value to use for the client_secret part of the client_id:client_secret credentials that must be Base64-encoded and can then be used to call endpoint oauth/v2/token; see also parameter CLIENT_ID.

USERNAME

api_F4k3V41u3

Yes

The value to use for the username argument in the call to endpoint oauth/v2/token; see also parameter PASSWORD.

PASSWORD

M0r3F4k3V41u3sF0r3v3r

Yes

The value to use for the password argument in the call to endpoint oauth/v2/token; see also parameter USERNAME.

TOKEN

No

If branded USERNAME,PASSWORD,CLIENT_ID, CLIENT_SECRET parameters are used, this parameter has to be created manually.

The currently valid token for authorization.

This will be automatically populated if there is only one set of credentials used. If multiple sets of credentials (USERNAME,PASSWORD,CLIENT_ID, CLIENT_SECRET) are used via branding of parameters, in combination with a set of non-branded/default credentials, this parameter has to be created beforehand, so as not to interfere with the non-branded/default one.

TOKEN_EXPIRY

No

If branded USERNAME,PASSWORD,CLIENT_ID, CLIENT_SECRET parameters are used, this parameter has to be created manually.

The point in time at which the current token will expire.

This will be automatically populated if there is only one set of credentials used. If multiple sets of credentials (USERNAME,PASSWORD,CLIENT_ID, CLIENT_SECRET) are used via branding of parameters, in combination with a set of non-branded/default credentials, this parameter has to be created beforehand, so as not to interfere with the non-branded/default one.

Hookpoints

Due to the amount of values that are needed in the api, but are not available in rator core, hookpoints are used to generate the requests:

Name

Hookpoint key

Description

Context

Result

Create

SQUARE_TRADE_CREATE_REQUEST

Used for creating insurances

A square trade order with key SQUARE_TRADE_ORDER

A com.cdrator.insurance.message.request.CreateInsuranceRequest with key SQUARE_TRADE_REQUEST

Change

SQUARE_TRADE_CHANGE_REQUEST

Used for changing between types of insurances

A square trade order with key SQUARE_TRADE_ORDER

A com.cdrator.insurance.message.request.ChangeInsuranceRequest with key SQUARE_TRADE_REQUEST

Terminate

SQUARE_TRADE_TERMINATE_REQUEST

Used for terminating an insurance

A square trade order with key SQUARE_TRADE_ORDER

A com.cdrator.insurance.message.request.TerminateInsuranceRequest with key SQUARE_TRADE_REQUEST