Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit a88b0e1

Browse files
deedeeskyhit
authored andcommitted
fix registration end date while activating challenge (#280)
* fix registration end date while activating challenge
1 parent 92ac5ed commit a88b0e1

File tree

3 files changed

+121
-13
lines changed

3 files changed

+121
-13
lines changed

services/contest_service_facade/src/java/main/com/topcoder/service/facade/contest/ContestServiceFacade.java

+51-1
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,14 @@
272272
* <li>Added new createSoftwareContest and updateSoftwareContest methods to take an extra regEndDate argument</li>
273273
* </ul>
274274
*
275+
* Version 1.8.8: Fix end date for registration on activating challenge
276+
* <ul>
277+
* <li>Added {@link #purchaseActivateContestAndStartSpecReview(TCSubject, SoftwareCompetition, TCPurhcaseOrderPaymentData, Date, Date, boolean)}</li>
278+
* <li>Added {@link #processContestPurchaseOrderSale(TCSubject, SoftwareCompetition, TCPurhcaseOrderPaymentData, Date, Date, Date)}</li>
279+
* </ul>
280+
*
275281
* @author pulky, murphydog, waits, BeBetter, hohosky, isv, lmmortal, Veve, GreatKevin, deedee, TCSASSEMBLER, TCSCODER
276-
* @version 1.8.7
282+
* @version 1.8.8
277283
*/
278284
public interface ContestServiceFacade {
279285

@@ -415,6 +421,27 @@ public SoftwareContestPaymentResult processContestPurchaseOrderSale(TCSubject tc
415421
SoftwareCompetition competition, TCPurhcaseOrderPaymentData paymentData, Date multiRoundEndDate, Date endDate)
416422
throws ContestServiceException, PermissionServiceException;
417423

424+
/**
425+
* <p>
426+
* Processes the contest sale.
427+
* </p>
428+
*
429+
* @param tcSubject TCSubject instance contains the login security info for the current user
430+
* @param competition data that recognizes a contest.
431+
* @param paymentData payment information (credit card/po details) that need to be processed.
432+
* @param multiRoundEndDate the end date for registration phase.
433+
* @param multiRoundEndDate the end date for the multiround phase. No multiround if it's null.
434+
* @param endDate the end date for submission phase. Can be null if to use default.
435+
* @return a <code>SoftwareContestPaymentResult</code> result of the payment processing.
436+
* @throws ContestServiceException if an error occurs when interacting with the service layer.
437+
* @since Module Contest Service Software Contest Sales Assembly
438+
* @since 1.8.8
439+
*/
440+
public SoftwareContestPaymentResult processContestPurchaseOrderSale(TCSubject tcSubject,
441+
SoftwareCompetition competition, TCPurhcaseOrderPaymentData paymentData,
442+
Date regEndDate, Date multiRoundEndDate, Date endDate)
443+
throws ContestServiceException, PermissionServiceException;
444+
418445
/**
419446
* <p>
420447
* Processes the contest sale, activate the contest and start the specification review of the contest.
@@ -437,6 +464,29 @@ public SoftwareContestPaymentResult purchaseActivateContestAndStartSpecReview(TC
437464
Date multiRoundEndDate, Date endDate, boolean startSpecReviewNow)
438465
throws ContestServiceException, PermissionServiceException, SpecificationReviewServiceException;
439466

467+
/**
468+
* <p>
469+
* Processes the contest sale, activate the contest and start the specification review of the contest.
470+
* </p>
471+
*
472+
* @param tcSubject TCSubject instance contains the login security info for the current user
473+
* @param competition data that recognizes a contest.
474+
* @param paymentData payment information (TCSubject tcSubject,credit card/po details) that need to be processed.
475+
* @param regEndDate the end date for registration phase.
476+
* @param multiRoundEndDate the end date for the multiround phase. No multiround if it's null.
477+
* @param endDate the end date for submission phase. Can be null if to use default.
478+
* @param startSpecReviewNow the flag whether to start spec review now.
479+
* @return a <code>PaymentResult</code> result of the payment processing.
480+
* @throws ContestServiceException if an error occurs when interacting with the service layer.
481+
* @throws PermissionServiceException if there is error when assigning permission to user.
482+
* @throws SpecificationReviewServiceException if fail to start the spec review of the contest.
483+
* @since 1.8.8
484+
*/
485+
public SoftwareContestPaymentResult purchaseActivateContestAndStartSpecReview(TCSubject tcSubject,
486+
SoftwareCompetition competition, TCPurhcaseOrderPaymentData paymentData, Date regEndDate,
487+
Date multiRoundEndDate, Date endDate, boolean startSpecReviewNow) throws ContestServiceException,
488+
PermissionServiceException, SpecificationReviewServiceException;
489+
440490
/**
441491
* <p>
442492
* Returns a list containing all active <code>Categories</code>.

services/contest_service_facade/src/java/main/com/topcoder/service/facade/contest/ejb/ContestServiceFacadeBean.java

+68-10
Original file line numberDiff line numberDiff line change
@@ -899,9 +899,17 @@
899899
* <li>Added {@link #projectPaymentConfigFile}</li>
900900
* <li>Added {@link #MANUAL_PAYMENT}</li>
901901
* </ul>
902+
*
903+
* Version 3.10: Fix end date for registration on activating challenge
904+
* <ul>
905+
* <li>Added {@link #purchaseActivateContestAndStartSpecReview(TCSubject, SoftwareCompetition, TCPurhcaseOrderPaymentData, Date, Date, boolean)}</li>
906+
* <li>Added {@link #processContestPurchaseOrderSale(TCSubject, SoftwareCompetition, TCPurhcaseOrderPaymentData, Date, Date, Date)}</li>
907+
* <li>Updated {@link #processContestSaleInternal(TCSubject, SoftwareCompetition, PaymentData, Date, Date, Date)}</li>
908+
* </ul>
909+
*
902910
* @author snow01, pulky, murphydog, waits, BeBetter, hohosky, isv, tangzx, GreatKevin, lmmortal, minhu, GreatKevin, tangzx
903911
* @author isv, GreatKevin, Veve, deedee, TCSCODER, TCSASSEMBLER
904-
* @version 3.9
912+
* @version 3.10
905913
*/
906914
@Stateless
907915
@TransactionManagement(TransactionManagementType.CONTAINER)
@@ -2170,7 +2178,7 @@ public SoftwareContestPaymentResult processContestCreditCardSale(TCSubject tcSub
21702178
SoftwareCompetition competition, CreditCardPaymentData paymentData) throws ContestServiceException, PermissionServiceException {
21712179
logger.debug("processContestCreditCardSale");
21722180

2173-
return processContestSaleInternal(tcSubject, competition, paymentData, null, null);
2181+
return processContestSaleInternal(tcSubject, competition, paymentData, null, null, null);
21742182
}
21752183

21762184
/**
@@ -2194,7 +2202,7 @@ public SoftwareContestPaymentResult processContestCreditCardSale(TCSubject tcSub
21942202
SoftwareCompetition competition, CreditCardPaymentData paymentData, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException {
21952203
logger.debug("processContestCreditCardSale");
21962204

2197-
return processContestSaleInternal(tcSubject, competition, paymentData, multiRoundEndDate, endDate);
2205+
return processContestSaleInternal(tcSubject, competition, paymentData, null, multiRoundEndDate, endDate);
21982206
}
21992207

22002208
/**
@@ -2216,7 +2224,7 @@ public SoftwareContestPaymentResult processContestPurchaseOrderSale(TCSubject tc
22162224
SoftwareCompetition competition, TCPurhcaseOrderPaymentData paymentData) throws ContestServiceException, PermissionServiceException {
22172225
logger.debug("processPurchaseOrderSale");
22182226

2219-
return processContestSaleInternal(tcSubject, competition, paymentData, null, null);
2227+
return processContestSaleInternal(tcSubject, competition, paymentData, null, null, null);
22202228
}
22212229

22222230
/**
@@ -2240,9 +2248,33 @@ public SoftwareContestPaymentResult processContestPurchaseOrderSale(TCSubject tc
22402248
SoftwareCompetition competition, TCPurhcaseOrderPaymentData paymentData, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException {
22412249
logger.debug("processPurchaseOrderSale");
22422250

2243-
return processContestSaleInternal(tcSubject, competition, paymentData, multiRoundEndDate, endDate);
2251+
return processContestSaleInternal(tcSubject, competition, paymentData, null, multiRoundEndDate, endDate);
22442252
}
22452253

2254+
/**
2255+
* <p>
2256+
* Processes the contest sale.
2257+
* </p>
2258+
*
2259+
* @param tcSubject TCSubject instance contains the login security info for the current user
2260+
* @param competition data that recognizes a contest.
2261+
* @param paymentData payment information (credit card/po details) that need to be processed.
2262+
* @param multiRoundEndDate the end date for registration phase.
2263+
* @param multiRoundEndDate the end date for the multiround phase. No multiround if it's null.
2264+
* @param endDate the end date for submission phase. Can be null if to use default.
2265+
* @return a <code>SoftwareContestPaymentResult</code> result of the payment processing.
2266+
* @throws ContestServiceException if an error occurs when interacting with the service layer.
2267+
* @since Module Contest Service Software Contest Sales Assembly
2268+
* @since 3.10
2269+
*/
2270+
public SoftwareContestPaymentResult processContestPurchaseOrderSale(TCSubject tcSubject,
2271+
SoftwareCompetition competition, TCPurhcaseOrderPaymentData paymentData,
2272+
Date regEndDate, Date multiRoundEndDate, Date endDate)
2273+
throws ContestServiceException, PermissionServiceException {
2274+
logger.debug("processPurchaseOrderSale");
2275+
2276+
return processContestSaleInternal(tcSubject, competition, paymentData, regEndDate, multiRoundEndDate, endDate);
2277+
}
22462278

22472279
/**
22482280
* <p>
@@ -2262,13 +2294,38 @@ public SoftwareContestPaymentResult processContestPurchaseOrderSale(TCSubject tc
22622294
* @since 1.8.5
22632295
*/
22642296
public SoftwareContestPaymentResult purchaseActivateContestAndStartSpecReview(TCSubject tcSubject,
2265-
SoftwareCompetition competition, TCPurhcaseOrderPaymentData paymentData,
2297+
SoftwareCompetition competition, TCPurhcaseOrderPaymentData paymentData,
2298+
Date multiRoundEndDate, Date endDate, boolean startSpecReviewNow) throws ContestServiceException,
2299+
PermissionServiceException, SpecificationReviewServiceException {
2300+
return purchaseActivateContestAndStartSpecReview(tcSubject, competition, paymentData, null, multiRoundEndDate, endDate, startSpecReviewNow);
2301+
}
2302+
2303+
/**
2304+
* <p>
2305+
* Processes the contest sale, activate the contest and start the specification review of the contest.
2306+
* </p>
2307+
*
2308+
* @param tcSubject TCSubject instance contains the login security info for the current user
2309+
* @param competition data that recognizes a contest.
2310+
* @param paymentData payment information (TCSubject tcSubject,credit card/po details) that need to be processed.
2311+
* @param regEndDate the end date for registration phase.
2312+
* @param multiRoundEndDate the end date for the multiround phase. No multiround if it's null.
2313+
* @param endDate the end date for submission phase. Can be null if to use default.
2314+
* @param startSpecReviewNow the flag whether to start spec review now.
2315+
* @return a <code>PaymentResult</code> result of the payment processing.
2316+
* @throws ContestServiceException if an error occurs when interacting with the service layer.
2317+
* @throws PermissionServiceException if there is error when assigning permission to user.
2318+
* @throws SpecificationReviewServiceException if fail to start the spec review of the contest.
2319+
* @since 3.10
2320+
*/
2321+
public SoftwareContestPaymentResult purchaseActivateContestAndStartSpecReview(TCSubject tcSubject,
2322+
SoftwareCompetition competition, TCPurhcaseOrderPaymentData paymentData, Date regEndDate,
22662323
Date multiRoundEndDate, Date endDate, boolean startSpecReviewNow) throws ContestServiceException,
22672324
PermissionServiceException, SpecificationReviewServiceException {
22682325

22692326
// purchase the contest and activate it
22702327
final SoftwareContestPaymentResult softwareContestPaymentResult =
2271-
processContestSaleInternal(tcSubject, competition, paymentData, multiRoundEndDate, endDate);
2328+
processContestSaleInternal(tcSubject, competition, paymentData, regEndDate, multiRoundEndDate, endDate);
22722329

22732330
// check if the contest has specification review phase
22742331
final Set<com.topcoder.project.phases.Phase> allPhases =
@@ -2320,6 +2377,7 @@ public SoftwareContestPaymentResult purchaseActivateContestAndStartSpecReview(TC
23202377
* @param tcSubject TCSubject instance contains the login security info for the current user
23212378
* @param competition data that recognizes a contest.
23222379
* @param paymentData payment information (credit card/po details) that need to be processed.
2380+
* @param regEndDate the end date for registration phase.
23232381
* @param multiRoundEndDate the end date for the multiround phase. No multiround if it's null.
23242382
* @param endDate the end date for submission phase. Can be null if to use default.
23252383
* @return a <code>SoftwareContestPaymentResult</code> result of the payment processing.
@@ -2328,7 +2386,7 @@ public SoftwareContestPaymentResult purchaseActivateContestAndStartSpecReview(TC
23282386
* @since BUGR-1682 changed return value
23292387
*/
23302388
private SoftwareContestPaymentResult processContestSaleInternal(TCSubject tcSubject,
2331-
SoftwareCompetition competition, PaymentData paymentData, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException {
2389+
SoftwareCompetition competition, PaymentData paymentData, Date regEndDate, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException {
23322390
logger.info("SoftwareCompetition: " + competition);
23332391
logger.info("PaymentData: " + paymentData);
23342392
logger.info("tcSubject: " + tcSubject.getUserId());
@@ -2364,13 +2422,13 @@ private SoftwareContestPaymentResult processContestSaleInternal(TCSubject tcSubj
23642422

23652423
if (tobeUpdatedCompetition == null) {
23662424
tobeUpdatedCompetition =
2367-
createSoftwareContest(tcSubject, competition, competition.getProjectHeader().getTcDirectProjectId(), null, multiRoundEndDate, endDate);
2425+
createSoftwareContest(tcSubject, competition, competition.getProjectHeader().getTcDirectProjectId(), regEndDate, multiRoundEndDate, endDate);
23682426
competition.getProjectHeader().setProjectStatus(ProjectStatus.ACTIVE);
23692427
} else {
23702428
competition.setProjectHeaderReason("User Update");
23712429
competition.getProjectHeader().setProjectStatus(ProjectStatus.ACTIVE);
23722430
tobeUpdatedCompetition =
2373-
updateSoftwareContest(tcSubject, competition, competition.getProjectHeader().getTcDirectProjectId(), null, multiRoundEndDate, endDate);
2431+
updateSoftwareContest(tcSubject, competition, competition.getProjectHeader().getTcDirectProjectId(), regEndDate, multiRoundEndDate, endDate);
23742432
}
23752433

23762434
Project contest = tobeUpdatedCompetition.getProjectHeader();

src/java/main/com/topcoder/direct/services/view/action/contest/launch/SaveDraftContestAction.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,7 @@ private SoftwareCompetition activateSoftwareCompetition(SoftwareCompetition soft
16721672
if (getSpecReviewStartMode() == null || !(getSpecReviewStartMode().equals(START_MODE_NOW) || getSpecReviewStartMode().equals(START_MODE_LATER))) {
16731673
result = getContestServiceFacade().processContestPurchaseOrderSale(
16741674
getCurrentUser(), softwareCompetition, getPaymentData(softwareCompetition),
1675-
checkpointDate, endDate == null ? null : endDate.toGregorianCalendar().getTime());
1675+
regEndDate, checkpointDate, endDate == null ? null : endDate.toGregorianCalendar().getTime());
16761676
} else {
16771677
boolean startSpecReviewNow = false;
16781678

@@ -1681,7 +1681,7 @@ private SoftwareCompetition activateSoftwareCompetition(SoftwareCompetition soft
16811681
}
16821682

16831683
result = getContestServiceFacade().purchaseActivateContestAndStartSpecReview(
1684-
getCurrentUser(), softwareCompetition, getPaymentData(softwareCompetition),
1684+
getCurrentUser(), softwareCompetition, getPaymentData(softwareCompetition), regEndDate,
16851685
checkpointDate, endDate == null ? null : endDate.toGregorianCalendar().getTime(), startSpecReviewNow);
16861686
}
16871687

0 commit comments

Comments
 (0)