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 @NotNull 58 private Date validFrom; 59 60 /** 61 * When activation ends being active. 62 */ 63 @NotNull 64 private Date validTo; 65 66 /** 67 * List of features. 68 * Set of features, see {@link Feature} for more info. 69 */ 70 @NotNull 71 private java.util.Set<Feature> features = new HashSet<Feature>(); 72 73 /** 74 * Any information which user would like to tell to sales at srv4pos. 75 */ 76 @Size(max = 1024) 77 private String comment; 78 79 /** 80 * Information about person who orders an activation. So sales team can contact him with invoice. 81 */ 82 @Valid 83 private ContactInfo contactInfo; 84 85 /** 86 * Serial number of control unit. 87 * It is null if {@link #controlUnitLocation} == {@link ControlUnitLocation#REMOTE} or application doesn't support control units 88 */ 89 @Size(max = 20, min = 1) 90 private String controlUnitSerial; 91 92 /** 93 * Where control unit is connected and how. 94 */ 95 private ControlUnitLocation controlUnitLocation = ControlUnitLocation.REMOTE; 96 97 /** 98 * Where device (with control unit) is located. This information is sent to taxation authority 99 * This field is set when customer makes an order and {@link ActivationDetailsInfo#controlUnitLocation} == {@link ControlUnitLocation#DEVICE}. 100 * 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 101 * and will be applied for all the sellers connected to this control unit. 102 */ 103 @Valid 104 private GeolocationInfo controlUnitGeolocation; 105 106 /** 107 * A unique identifier of the software, but not it's version. For instance for Android it 108 * can be <a href="http://developer.android.com/reference/android/content/Context.html#getPackageName%28%29">getPackageName()</a> 109 */ 110 @Size(min = 1, max = 64) 111 private String applicationPackage; 112 113 114 /** 115 * <p>May be null. See <a href="http://srv4pos.com/developers/apikey/">spec</a> for more info about 116 * nullability of this field.</p> 117 * <p>ProductionNumber - serial number uniquely identifies instance of the Installation. It represents production number of cash register according 118 * to Swedish regulations. It has format "MK556{number}" where MK is mobilkassan, 556 is the beginning of the Produkt Poolen corporate ID, 119 * {number} - unique number within entire world</p> 120 * <p>According to swedish regulation, the definition is: Each cash register must have a production number. Production number is a globally unique 121 * serial number on physical cash registers. Production number has to be unique for each cash register from one vendor and should also indicate vendor 122 * as a part of the field.</p> 123 */ 124 @Size(max = 25) 125 private String productionNumber; 126 127 /** 128 * At which device this activation should work. 129 */ 130 @Valid 131 private InstallationCreationInfo installationCreationInfo; 132 133 /** 134 * You can create an activation without installation. 135 * This activation can be connected to a created installation, which is created after, via connection code. 136 */ 137 @Size(min = 4, max = 9) 138 private String connectionCode; 139 }