1 package com.srv4pos.server.api.activation; 2 3 import com.srv4pos.server.api.infrastructure.Constraints; 4 import com.srv4pos.server.api.infrastructure.Info; 5 import org.springframework.roo.addon.javabean.RooJavaBean; 6 import org.springframework.roo.addon.json.RooJson; 7 import org.springframework.roo.addon.tostring.RooToString; 8 9 import javax.validation.Valid; 10 import javax.validation.constraints.NotNull; 11 import javax.validation.constraints.Pattern; 12 import javax.validation.constraints.Size; 13 import java.util.Date; 14 import java.util.HashSet; 15 16 /** 17 * If current application does not have Activation the app uses this method to request (order) new one. 18 * <br/> 19 * Seller for the activation is identified by country and corporateId. 20 * <br/> 21 * Installation: 22 * <ul> 23 * <li>can be found as via registration (seller and cash register name); production number should be null or equal, application package should be null or equal</li> 24 * <li>can be found as via production number; application package should be null or equal</li> 25 * <li>can be null, if activation's application is ThinKassan; production number should be null</li> 26 * <li>can be null, if installation will be connected to this activation via connectionCode later</li> 27 * </ul> 28 * <br/> 29 * Registration will be found or created by seller and installation. 30 */ 31 @RooJavaBean 32 @RooToString 33 @RooJson(deepSerialize = true) 34 public class ActivationCreationInfo implements Info { 35 /** 36 * Country where seller with given {@link #corporateId} is registered. 37 */ 38 @NotNull 39 @Size(max = 2, min = 2) 40 private String country; 41 42 @NotNull 43 @Size(min = 1, max = 96) 44 @Pattern(regexp = Constraints.WINDOWS_FILENAME_REGEX) 45 private String corporateId; 46 47 /** 48 * Described in swedish regulations as "cash register designation". See <a href="http://srv4pos.com/developers/terms/">Terms</a> for more info. 49 */ 50 @NotNull 51 @Pattern(regexp = Constraints.CASH_REGISTER_NAME_REGEX) 52 private String cashRegisterName; 53 54 /** 55 * When activation starts being active. 56 */ 57 private Date validFrom; 58 59 /** 60 * When activation ends being active. 61 */ 62 private Date validTo; 63 64 /** 65 * List of features. 66 * Set of features, see {@link Feature} for more info. 67 */ 68 @NotNull 69 private java.util.Set<Feature> features = new HashSet<Feature>(); 70 71 /** 72 * Any information which user would like to tell to sales at srv4pos. 73 */ 74 @Size(max = 1024) 75 private String comment; 76 77 /** 78 * Information about person who orders an activation. So sales team can contact him with invoice. 79 */ 80 @Valid 81 private ContactInfo contactInfo; 82 83 /** 84 * Serial number of control unit. 85 * It is null if {@link #controlUnitLocation} == {@link ControlUnitLocation#REMOTE} or application doesn't support control units 86 */ 87 @Size(max = 20, min = 1) 88 private String controlUnitSerial; 89 90 /** 91 * Where control unit is connected and how. 92 */ 93 private ControlUnitLocation controlUnitLocation = ControlUnitLocation.REMOTE; 94 95 /** 96 * Where device (with control unit) is located. This information is sent to taxation authority 97 * This field is set when customer makes an order and {@link ActivationDetailsInfo#controlUnitLocation} == {@link ControlUnitLocation#DEVICE}. 98 * If this field is set and sales person makes an activation, he must check it's validity because it's content will be copied to controlUnit geolocation 99 * and will be applied for all the sellers connected to this control unit. 100 */ 101 @Valid 102 private GeolocationInfo controlUnitGeolocation; 103 104 /** 105 * Where cash register is located. This information is sent to taxation authority. 106 */ 107 @Valid 108 private GeolocationInfo registrationGeolocation; 109 110 /** 111 * A unique identifier of the software, but not it's version. For instance for Android it 112 * can be <a href="http://developer.android.com/reference/android/content/Context.html#getPackageName%28%29">getPackageName()</a> 113 */ 114 @Size(min = 1, max = 64) 115 private String applicationPackage; 116 117 118 /** 119 * <p>May be null. See <a href="http://srv4pos.com/developers/apikey/">spec</a> for more info about 120 * nullability of this field.</p> 121 * <p>ProductionNumber - serial number uniquely identifies instance of the Installation. It represents production number of cash register according 122 * to Swedish regulations. It has format "MK556{number}" where MK is mobilkassan, 556 is the beginning of the Produkt Poolen corporate ID, 123 * {number} - unique number within entire world</p> 124 * <p>According to swedish regulation, the definition is: Each cash register must have a production number. Production number is a globally unique 125 * serial number on physical cash registers. Production number has to be unique for each cash register from one vendor and should also indicate vendor 126 * as a part of the field.</p> 127 */ 128 @Size(max = 25) 129 private String productionNumber; 130 131 /** 132 * At which device this activation should work. 133 */ 134 @Valid 135 private InstallationCreationInfo installationCreationInfo; 136 137 /** 138 * You can create an activation without installation. 139 * This activation can be connected to a created installation, which is created after, via connection code. 140 */ 141 @Size(min = 4, max = 9) 142 private String connectionCode; 143 }