|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.tootsville.WebUtil
public class WebUtil
WebUtil contains business logic methods called by the Membership And Billing front-end JSP pages. This isolates the more complex logic from the presentation-level code in the JSP files.
This, however, turned into a mess of spaghetti code that was mostly
split up into more appropriate places, including funnelling most of
it into MBSession.
| Field Summary | |
|---|---|
private static WebUtil |
singleton
singleton for hook impl |
(package private) UserEnrolment |
subscription
This is the really critical stage of the billing process, and one in which we've historically had a lot of trouble. |
| Constructor Summary | |
|---|---|
private |
WebUtil()
noop ctor is private for singleton impl |
| Method Summary | |
|---|---|
static void |
applyPeanutCodeToNewUser(MBSession session,
Toot newToot)
Apply a Peanut code to a new user account |
void |
beforePage(MBSession mbSession,
javax.servlet.jsp.PageContext context)
WRITEME: Document this method brpocock@star-hope.org |
private static String |
checkIBC(Object ibcCode,
User sessionUser)
twheys@gmail.com Feb 2, 2010 |
void |
configureMembershipAndBilling()
This performs some start-up configuration of the generic, Romance M&B system for working with Tootsville, particularly. |
static void |
cookieMonster(javax.servlet.http.HttpServletRequest request)
Process cookies and set session values. |
static Promotion |
createNewEventPromotion(String prefix,
int numberOfCodes,
int minValue,
int maxValue)
twheys@gmail.com Jan 7, 2010 |
void |
doAfterEnrolmentAfterLapse(MBSession session,
User user,
Enrolment enrolment,
UserEnrolment userEnrolment,
Payment payment)
|
void |
doAfterEnrolmentRenewal(MBSession session,
User user,
Enrolment enrolment,
UserEnrolment userEnrolment,
Payment payment)
|
void |
doAfterFirstTimeEnrolment(MBSession session,
User user,
Enrolment enrolment,
UserEnrolment userEnrolment,
Payment payment)
|
static WebUtil |
get()
|
static Vector<GameWorldMessage> |
getRecentTootbookPosts(int offset,
int limit)
Get a collection of recent TootsBook postings. |
private void |
giveCouponForEnrolment(MBSession session,
User user,
Payment payment)
WRITEME: Document this method brpocock@star-hope.org |
static void |
go()
Syntactic sugar function for embedding the set-up step in JSP pages |
static void |
log(String blah)
Deprecated. use AppiusClaudiusCaecus.blather(String) |
void |
postParentRegistration(MBSession session,
Parent newUser)
|
void |
postUserRegistration(MBSession session,
User newUser)
|
static void |
renewSubscription(javax.servlet.ServletRequest request)
Verifies POST data to ensure ... |
static Vector<AbstractPerson> |
searchUsers(String searchParams)
find users who ... |
void |
translateParameters(MBSession session,
javax.servlet.ServletRequest request)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static WebUtil singleton
UserEnrolment subscription
This is the really critical stage of the billing process, and one in which we've historically had a lot of trouble.
This method takes the user-provided credit-card/billing
information from the web payment form, and attempts to process
the credit-card transaction through the PaymentGateway
and add a UserEnrolment to the user's record.
There are a lot of things going on in here, and a lot of values being passed around. As a result, this is a very long, very linear patch of code, of the type I (BRP) dislike seeing immensely; however, I don't see any legitimately effective way to break this down into subroutines, since most of the values are being passed around in a huge bulk of separate things.
XXX Eventually, this should be using some more high-level objects that will check their own values in a more reasonable way; e.g. an Address object smart enough to parse and validate its own component values and return detailed exceptions that can be propagated to the end-user.
Due to lack of time, I'm afraid I need to just refer the interested user to the source code comments.
WRITEME: There should be more detail in this JavaDoc!
above vapidly poor documentation by brpocock@star-hope.org
| Constructor Detail |
|---|
private WebUtil()
| Method Detail |
|---|
public static void applyPeanutCodeToNewUser(MBSession session,
Toot newToot)
session - user's session objectnewToot - the user account just registered
private static String checkIBC(Object ibcCode,
User sessionUser)
throws GameLogicException
twheys@gmail.com Feb 2, 2010
Check an IBC code / Chase-It / prepaid card token …
ibcCode - prepaid membership card tokensessionUser - the user claiming the card's benefits
GameLogicException - WRITEMEpublic static void cookieMonster(javax.servlet.http.HttpServletRequest request)
request - the HTTP request passed through the servlet.
public static Promotion createNewEventPromotion(String prefix,
int numberOfCodes,
int minValue,
int maxValue)
twheys@gmail.com Jan 7, 2010
Create a new promotional programme code series. These are the “peanut codes” that can be printed on promotional materials such as post-cards or hang-tags and distributed to kids, and then later redeemed for in-game peanuts. The promotional codes will consist of a given prefix (which can be used for tracking the users redeeming them later) and a series of random codes following it.
Prefix codes should all be 4-character alphabetic and avoid the use of the letters “O” and “I” if their usage might be ambiguous in-situ.
prefix - The unique 4-character code representing the
promotional programme; this will be prefaced onto each
generated code.numberOfCodes - The number of promotional codes to be
generatedminValue - The minimum number of peanuts to be awarded for
each codemaxValue - The maximum number of peanuts to be awarded for
each code
public static WebUtil get()
public static Vector<GameWorldMessage> getRecentTootbookPosts(int offset,
int limit)
Get a collection of recent TootsBook postings.
This returns a set of TootsBook messages (wall posts). It will return only “wall postings,” where the user set their own status; it will not return comments upon this, nor another user's postings.
XXX: contains SQL
offset - The first message to be returned, in negative
timewise order (newest-first)limit - The number of messages to be returned, starting at
offset, in negative timewise order (newest-first)
public static void go()
@Deprecated public static void log(String blah)
AppiusClaudiusCaecus.blather(String)
AppiusClaudiusCaecus.blather(String)
blah - string to logAppiusClaudiusCaecus.blather(String),
AppiusClaudiusCaecus.blather(String, String, String, String,
boolean)
public static void renewSubscription(javax.servlet.ServletRequest request)
throws DataException,
UnsupportedEncodingException
Verifies POST data to ensure ... something? ... WRITEME ... and then it renews the subscription
WRITEME: this must be the Authorize.net Silent-POST handler?
FIXME: This stuff belongs in AuthorizeNetGateway
request - servlet request from the user... or from
Authorize.Net ... ?
DataException - if the validation keys aren't present
UnsupportedEncodingException - WRITEMEpublic static Vector<AbstractPerson> searchUsers(String searchParams)
XXX: It looks like this is going to fetch up users and parents based upon ID's that could potentially be the same ??
Note, Nomenclator.getUserByLogin(String) understands # +
user ID. So user names of the form "#123" are acceptable... I
don't think Nomenclator.getParentByMail(String) has an
analogous method, though.
searchParams - WRITEME
public void beforePage(MBSession mbSession,
javax.servlet.jsp.PageContext context)
BeforePageHook
beforePage in interface BeforePageHookBeforePageHook.beforePage(org.starhope.appius.mb.MBSession,
javax.servlet.jsp.PageContext)public void configureMembershipAndBilling()
public void doAfterEnrolmentAfterLapse(MBSession session,
User user,
Enrolment enrolment,
UserEnrolment userEnrolment,
Payment payment)
doAfterEnrolmentAfterLapse in interface PostPaymentHookPostPaymentHook.doAfterEnrolmentAfterLapse(org.starhope.appius.mb.MBSession,
org.starhope.appius.user.User,
org.starhope.appius.mb.Enrolment,
org.starhope.appius.mb.UserEnrolment,
org.starhope.appius.mb.Payment)
public void doAfterEnrolmentRenewal(MBSession session,
User user,
Enrolment enrolment,
UserEnrolment userEnrolment,
Payment payment)
doAfterEnrolmentRenewal in interface PostPaymentHookPostPaymentHook.doAfterEnrolmentRenewal(org.starhope.appius.mb.MBSession,
org.starhope.appius.user.User,
org.starhope.appius.mb.Enrolment,
org.starhope.appius.mb.UserEnrolment,
org.starhope.appius.mb.Payment)
public void doAfterFirstTimeEnrolment(MBSession session,
User user,
Enrolment enrolment,
UserEnrolment userEnrolment,
Payment payment)
doAfterFirstTimeEnrolment in interface PostPaymentHookPostPaymentHook.doAfterFirstTimeEnrolment(org.starhope.appius.mb.MBSession,
org.starhope.appius.user.User,
org.starhope.appius.mb.Enrolment,
org.starhope.appius.mb.UserEnrolment,
org.starhope.appius.mb.Payment)
private void giveCouponForEnrolment(MBSession session,
User user,
Payment payment)
session - WRITEMEuser - WRITEMEpayment - WRITEME
public void postParentRegistration(MBSession session,
Parent newUser)
postParentRegistration in interface PostParentRegistrationHookPostParentRegistrationHook.postParentRegistration(org.starhope.appius.mb.MBSession,
org.starhope.appius.user.Parent)
public void postUserRegistration(MBSession session,
User newUser)
postUserRegistration in interface PostUserRegistrationHookPostUserRegistrationHook.postUserRegistration(org.starhope.appius.mb.MBSession,
org.starhope.appius.user.User)
public void translateParameters(MBSession session,
javax.servlet.ServletRequest request)
translateParameters in interface MBParamTranslatorMBParamTranslator.translateParameters(MBSession,
ServletRequest)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||