Overview
To execute various toolkit features, the toolkit should be initialized. The initialize method will save different configuration values, which will get used by other toolkit methods and features.
Note! • To make it secured, credentials will be encripted and cached in the sqlite db. We are following symmetric encryption methodology.
Signature
Signature:
InitializeResponseDto initializeResponseDto = await _toolkitHandler.Initialize(initializeRequestDto);
public class InitializeRequestDto
{
public bool? SaveCredential { get; set; }
public bool? ResumeWithInvalidCache { get; set; }
public float? CachLookupDurationInHours { get; set; }
public int? MaximumSubmissionDocumentCount { get; set; }
public RetentionScheduleDto? RetentionSchedule { get; set; }
public ScheduleDto? SubmitSchedule { get; set; }
public ScheduleDto? SyncSchedule { get; set; }
}
public class InitializeResponseDto : BaseResponseDto
{
public static readonly InitializeResponseDto Success = new() { Initialized = true };
public bool Initialized { get; set; }
}
public class BaseResponseDto
{
public string? CorrelationId { get; set; }
public string? Target { get; set; }
public string? Code { get; set; }
public string? Message { get; set; }
public object? Details { get; set; }
}
Inputs
initializeRequestDto
object contains 4 simple properties followed by 3 complex objects for scheduling background services:
Input parameter | Type | Description | Value example |
---|---|---|---|
SaveCredential | bool | true to save the credentials in the local cache, otherwise false. | true / false |
ResumeWithInvalidCache | bool | true to allow working with expired cache, or false to raise error while performing issue / submit / sync activities | true / false |
CachLookupDurationInHours | float | it is a numerical configuration input value to set the cache lookups duration in hours. | 24 |
MaximumSubmissionDocumentCount | int | Maximum No. of receipts added to the submission when submitting to the invoicing portal. | 500 |
RetentionSchedule | complex | ||
SubmitSchedule | complex | ||
SyncSchedule | complex |
Note!
• In order to save the given credentials for future purposes, developer needs to set this value to true. Once it is saved, developer doesn't need to pass the client id, secret, pos details every time to get a token. Also background jobs will use the saved credetials to refresh lookups data. If credentials are not saved, developer needs to pass the client id, secret, pos details every time to get a token and refresh the lookups manually.
• MaximumSubmissionDocumentCount setting gives the ability to override No. of receipts in the submission. No. of receipts in the submission also decided based on file size and number of the issued receipts in the local database.
• RetentionSchedule, SubmitSchedule and SyncSchedule background jobs could be configured but those are not supported by Nuget / CLI integrations. Mentioned background jobs are only supported by Docker container API.
Retention Schedule
Based on this dynamic configuration, toolkit retention schedule background service will perform delete activity on local sqlite cache db data.
Retention Schedule DTO
public class RetentionScheduleDto : ScheduleDto
{
public string? StatusToDelete { get; set; }
public float? DeleteOlderThanInDays { get; set; }
}
Inputs
Input parameter | Type | Description | Value example |
---|---|---|---|
StatusToDelete | String | The status of the receipts that will be deleted after the configured scheduled period. Multiple values could be provided separated by comma (,). Validation error will be returned for invalid values, or if the same status is duplicated in the input string. Both integer inputs or string inputs are accepted. | Valid inputs are: 2, -1 (or) Valid, Exported etc., Invalid inputs are: Valid, Valid, Exported |
DeleteOlderThanInDays | float | configuration value to delete the local receipts. | 30 |
Submit Schedule
Locally issued receipts will be submitted based on this scheduled configuration. Only new and cancelled receipts will be submitted by the background service.
Inputs
Input parameter | Type | Description | Value example |
---|---|---|---|
Enabled | bool | true to enable the job and false to disable it. | true / false |
RunEveryUnit | String | Job occurance configuration. | Possible input “Minute”/”Hour”/”Day”. This value is case-sensitive. |
RunEvery | float | as per this numerical input value, job will run repeatedly | 24 |
Sync Schedule
As per the below dynamic configuration, Local receipts’ statuses and validations will be synchronized from the backend system.
Inputs
Input parameter | Type | Description | Value example |
---|---|---|---|
Enabled | bool | true to enable the job and false to disable it. | true / false |
RunEveryUnit | String | Job occurance configuration. | Possible input “Minute”/”Hour”/”Day”. This value is case-sensitive. |
RunEvery | float | as per this numerical input value, job will run repeatedly | 24 |
Outputs
Output parameter | Type | Description | Value example |
---|---|---|---|
initialized | Boolean | true if the initialization is successful, otherwise false | |
CorrelationId | String | In case of an error, this property will have a value. CorrelationId is a unique number for the request. | |
Target | String | In case of an error, this property will have a value. The error target. | |
Code | String | In case of an error, this property will have a value. Code is an error code. | 404 / 500 etc., |
Message | String | In case of an error, this property will have a value. Error message. | |
Details | String | In case of an error, this property will have a value. Details of the error. |