Files
monorepo/LCU.Api.Internal.CoreApiWrapper
2026-03-31 14:32:23 -05:00
..
2026-03-31 14:32:23 -05:00
2026-03-31 14:32:23 -05:00
2026-03-31 14:32:23 -05:00
2026-03-31 14:32:23 -05:00
2026-03-31 14:32:23 -05:00
2026-03-31 14:32:23 -05:00
2026-03-31 14:32:23 -05:00
2026-03-31 14:32:23 -05:00
2026-03-31 14:32:23 -05:00
2026-03-31 14:32:23 -05:00
2026-03-31 14:32:23 -05:00

Introduction

Core Api Wrapper was created to give us the ability to call the Core's Api and to query the Core's database.

Getting Started

  1. Set appsettings to local or lower environment settings(if possible).

Core Api Connection

To make a Core Api call it is required that we have a DNA Token. Currently the DNA Token expires every 15 mins but this can be increased by Application Support Team in the DNA config. The following steps are performed in the CoreConnection class to get/refresh a DNA Token.

  1. Check cache if coreapiconnection is set. a. Return if set.
  2. Else Refresh Connection Cache a. The STS Token is set by using Device Name, environment, user id, and password to call the sts end point. b. The prelogin data is set by using STS Token and ApiChannelId i. Note: ApiChannelId is pulled by the Application Support Team from the DNA application. c. Prelogin returns the EffectiveDate (PostingDate), Posting Date (PostingDate), and the cashbox. d. The DNA Token is set by using the Sts Token, ApiChannelId, BusinessTaskId, EffectiveDate, Posting Date, and CashboxNumber. i. Note: BusinessTaskId is a default given to us by DNA.
  3. Once a CoreApiConnection is fetched either by cache or refresh, the Core Api call is performed. a. CoreRequest Class can be used to make a core Api call. b. A new UnauthorizedRequestException is used to catch if a CoreApiConnection is no longer authorized. i. The amount of retries is set by ReTryLimit in the AppSettings.

Using DNA Api Notes

Endpoints

  • Occasionally there can be an Id in the endpoint path. This id is most often the primary key or "number" for the data trying to be retrieved. This can be seen in “/DNABusinessServices/Addresses/{AddressId}”. The AddressNumber is the AddressId.
  • There is also the possibility that the "id" in the path could be a guid generated by DNA. Example for this is “/DNABusinessServices/Accounts/{AccountId}/TransactionHistory/Query/AccountNumber”
  • In the TransactionHistory endpoint there is an AccountId this is a guid generated by DNA. To get this guid you must use the “/DNABusinessServices/Accounts/Query/AccountDetail” endpoint. This endpoint will return an Account model that contains an Id property. This Id property is the Guid required to be put into the “/DNABusinessServices/Accounts/{AccountId}/TransactionHistory/Query/AccountNumber” endpoint.
  • Using these parameters in the root of the endpoint path can be done by:
    1. Creating the RequestRootParameters string constant.
    2. Using the HttpUtilities.ReplaceRootParameter() method. a. HttpUtilities.ReplaceRootParameter uses the endpoint from the appsettings, the RequestRootParameter constant, and the parameter its replacing to help build out the endpoint.

General Request

  • In most cases when making a DNA request you are required to use a RequestHeader. RequestHeader can be used to add things like Include or PayeSize properties.
  • It has been found that when updating, we are required to use a model that has a MessageHeader and MessageBody. This can be done by using the CoreUpdateRequest.
  • A DNA response has been found to follow a format of MessageHeader and MessageBody. The model CoreApiResponse can be used to help deserialize. If the MessageHeader is not required then in the DAO class the MessageBody can just be used to return.

Updating

  • Updating requires using an UpdateKey to be present in the Request Header.
  • Steps to make an update. Update Address is our example.
    1. We need to use a get endpoint to get the model we are trying to update. a. The CoreApiResponse model can be used to help. b. CoreApiResponse has a MessageHeader and a MessageBody. a MessageHeader contains the property UpdateKey. b. MessageBody is a generic type. This would be assigned the Address model for example.
    2. Use the UpdateKey to fill out the CoreUpdateRequest model. a. CoreUpdateRequest has a MessageHeader and a MessageBody. a MessageHeader contains the property UpdateKey. b. MessageBody is a generic type. This would be assigned the Address model for example.
    3. Use DNA’s PUT endpoint with the required parameters and the CoreUpdateRequest.

Build and Test

Currently we are using unit tests.

Dictionary

  • SAF - Shared Application Framework
    • This appears to be a way DNA shares data/users across several of their application offerings. The SAF controller has been added to contain queries that help track users and data across applications.