@Override public String getMessage() { return sPriceType + "-" + mZones + " " + mTime + " " + gNumbers[0] + gNumbers[1] + gNumbers[2] + "\n\n" + "E" + generateRandomAEOXString() + "\n" + "E" + generateRandomAEOXString() + "\n" + "E" + generateRandomAEOXString() + "\n" + "EEEEEEEEEE\n\n" + "SL biljett giltig till " + mTime + " " + mDate + "\n" + sPriceText + " " + iPrice + " kr ink 6% moms\n" + Utils.generateRandomString(11, false) + gNumbers[0] + gNumbers[1] + gNumbers[2] + "\n" + "m.sl.se"; }
@Override public void create(Bundle data) throws TicketException { Calendar cal = Calendar.getInstance(); mReduced = data.getBoolean("price_reduced"); if (data.getBoolean("zone_1")) { mZones += "1"; } if (data.getBoolean("zone_2")) { mZones += "2"; } if (data.getBoolean("zone_3")) { mZones += "3"; } if (data.getBoolean("zone_4")) { mZones += "4"; } if (data.getBoolean("zone_5")) { mZones += "5"; } int ulZones = mZones.length(); if (ulZones < 1) { throw new TicketException("Måste välja minst en zon i UL!"); // TODO: Translate } boolean slabc = data.getBoolean("zone_slabc"); boolean slc = data.getBoolean("zone_slc"); if (slabc && slc) { throw new TicketException("Kan inte både ha zon \"SL ABC\" och \"SL C\"!"); // TODO: Translate } if (slabc) { mZones += "SL"; } if (slc) { mZones += "SLC"; } for (int i = 0; i < mAllowedZoneCombinations.length; ) { if (mZones.compareTo(mAllowedZoneCombinations[i]) == 0) { break; } if (++i >= mAllowedZoneCombinations.length) { throw new TicketException("Ogiltig zonkombination!"); // TODO: Translate } } if (mReduced) { mPriceType = "UNGDOM"; mPrice = mRedZonePrice * ulZones; if (slabc) { mPrice += mRedSLabcPrice[ulZones - 1]; } if (slc) { mPrice += mRedSLcPrice[ulZones - 1]; } } else { mPriceType = "VUXEN"; mPrice = mZonePrice * ulZones; if (slabc) { mPrice += mSLabcPrice[ulZones - 1]; } if (slc) { mPrice += mSLcPrice[ulZones - 1]; } } int validMins = 75; if (ulZones == 2) { validMins = 90; } else if (ulZones > 2) { validMins = 120; } if (slabc || slc) { if (slabc && ulZones > 2) { validMins = 150; } validMins = 120; } cal.add(Calendar.MINUTE, validMins); mValidTime = new SimpleDateFormat("HH:mm").format(cal.getTime()); mValidDate = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()); uCode = Utils.generateNumberSequence(); uScanCode = Utils.aeoxScannerBlock(uCode); mSender = generateSenderNumber(); }