public class ActivationService extends Object
User: Kirill, Date: 01.10.13 11:21
.Modifier and Type | Field and Description |
---|---|
private static String |
ACTIVATION_ACCESS_URL |
private Credentials |
credentials |
private Transport |
transport |
private URL |
url |
Constructor and Description |
---|
ActivationService(URL url,
Credentials credentials,
Transport transport)
Constructs the service.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cashRegisterNameExists(CashRegisterNameExistsInfo cashRegisterNameExistsInfo)
Checks that cash register name is unique for particular seller.
|
ActivationConnectReplyInfo |
connect(ActivationConnectInfo activationConnectInfo)
Creates an activation.
|
String |
generateProductionNumber(InstallationOrderInfo installationOrderInfo)
If current application does not (yet) have a ProductionNumber, it uses this method to get a new one.
|
ActivationCodeInfo |
getActivationCode(Credentials credentials)
This method requires credentials and returns
ActivationCodeInfo for provided credentials. |
String |
orderActivation(ActivationOrderInfo activationOrderInfo)
If current application does not have Activation, or Activation expires soon, the app uses this method to request (order)
a new one.
|
private static final String ACTIVATION_ACCESS_URL
private URL url
private Credentials credentials
private Transport transport
public ActivationService(URL url, Credentials credentials, Transport transport)
url
- of the servercredentials
- to work with the servertransport
- to know the method to reach the serverpublic String generateProductionNumber(InstallationOrderInfo installationOrderInfo)
installationOrderInfo
- information about current installationInstallationOrderInfo.applicationPackage
fieldpublic String orderActivation(ActivationOrderInfo activationOrderInfo)
activationOrderInfo
- information about Activation neededReferenceNotFoundJsonException
- if device, installation or control unit are not foundNonUniqueJsonException
- if cash register name is not unique within a sellerInconsistentDataJsonException
- see:
InconsistentDataErrorType.PRODUCTION_NUMBER_AND_DEVICE_ID_MISMATCH
,
InconsistentDataErrorType.ACTIVATION_CODE_ALREADY_EXISTS
,
InconsistentDataErrorType.VALID_FROM_AND_VALID_TO_INCONSISTENCY
UnprocessableEntityJsonException
- see:
UnprocessableEntityErrorType.APPLICATION_PACKAGES_MISMATCH
,
UnprocessableEntityErrorType.AUTO_ACTIVATE_IS_NOT_POSSIBLE_ON_NEW_CU
,
UnprocessableEntityErrorType.COMPANY_NAME_MUST_BE_SET_IF_NO_SELLER
,
UnprocessableEntityErrorType.CU_LOCATION_MUST_BE_SET
,
UnprocessableEntityErrorType.CU_IS_MISSING_FOR_ACTIVATION
,
UnprocessableEntityErrorType.DEVICE_LOCATION_MUST_BE_SET
,
UnprocessableEntityErrorType.PRODUCTION_NUMBER_IS_OUT_OF_DATE
(@link UnprocessableEntityErrorType#ACTIVATION_IS_CLOSED_ALREADY)
(@link UnprocessableEntityErrorType#ACTIVATION_IS_ACTIVE_ALREADY)
(@link UnprocessableEntityErrorType#ACTIVATION_IS_WORKING_ALREADY)ValueNotValidJsonException
- see:
ValueNotValidErrorType.SHOULD_MATCH_CORPORATE_ID_VALIDATION_SWEDISH
,
ValueNotValidErrorType.SHOULD_MATCH_CORPORATE_ID_VALIDATION_LUHN
ReferenceNotFoundJsonException
- if there is no application specified in
ActivationOrderInfo#getInstallationOrderInfo()
InstallationOrderInfo.applicationPackage
fieldpublic boolean cashRegisterNameExists(CashRegisterNameExistsInfo cashRegisterNameExistsInfo)
cashRegisterNameExistsInfo
- see javadoc of members of this type for more infopublic ActivationCodeInfo getActivationCode(Credentials credentials)
ActivationCodeInfo
for provided credentials.
It must be authenticated by credentials initialized by Credentials#(String, String, String, String)
credentials
- to authenticate to pass activationSecurityToken as Credentials#(String, String, String, String)
ActivationDescriptorInfo
, it's signature and it's version (to correctly check digital signature)ForbiddenJsonException
- see:
ForbiddenErrorType.ACTIVATION_STILL_ISSUED
,
ForbiddenErrorType.WRONG_USERNAME_OR_PASSWORD
public ActivationConnectReplyInfo connect(ActivationConnectInfo activationConnectInfo)
activationConnectInfo
- information about Activation connection neededReferenceNotFoundJsonException
- if Activation not found by codeInconsistentDataJsonException
- see:
InconsistentDataErrorType.ACTIVATION_CODE_WRONG_LENGTH
,
InconsistentDataErrorType.PRODUCTION_NUMBER_AND_CONNECTION_MISMATCH
,
InconsistentDataErrorType.PRODUCTION_NUMBER_AND_DEVICE_ID_MISMATCH
UnprocessableEntityJsonException
- see:
UnprocessableEntityErrorType.APPLICATION_PACKAGES_MISMATCH
Copyright © 2016. All rights reserved.