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

Commit 69337a0

Browse files
committed
fix: quick pay button
1 parent 16c4d06 commit 69337a0

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public class PaymentHistory extends BaseProcessor implements PactsConstants {
6363
public static final String XLS_FORMAT = "xls";
6464
public static final String FULL_LIST = "full_list";
6565
public static final String PAYMENTS = "payments";
66+
public static final String OWED_PAYMENTS = "owedPayments";
67+
public static final String TOTAL_OWED_PAYMENTS = "totalOwedPayments";
6668

6769
/**
6870
* <p>A <code>String</code> providing the name for request attribute holding the ID of a payment method preferred by
@@ -150,9 +152,17 @@ protected void businessProcessing() throws TCWebException {
150152

151153
List<BasePayment> removeNonPending = new ArrayList<BasePayment>();
152154

155+
List<Long> owedPayments = new ArrayList<Long>();
156+
double totalOwedPayments = 0.0;
157+
Date currentDate = new Date();
158+
153159
for (BasePayment payment : payments) {
154160
if (payment.getPaymentType() == 3 || payment.getPaymentType() == 5) {
155161
removePayments.add(payment);
162+
} else if ((payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.OWED_PAYMENT_STATUS))) &&
163+
!(payment.getDueDate().after(currentDate))) {
164+
owedPayments.add(payment.getId());
165+
totalOwedPayments += payment.getNetAmount();
156166
} else {
157167
if (!(payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.OWED_PAYMENT_STATUS))) &&
158168
!(payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.ENTERED_INTO_PAYMENT_SYSTEM_PAYMENT_STATUS))) &&
@@ -184,6 +194,8 @@ protected void businessProcessing() throws TCWebException {
184194
getRequest().setAttribute("NUM_TOTAL", payments.size());
185195
getRequest().setAttribute("NUM_PER_PAGE", numRecords);
186196
getRequest().setAttribute("NUM_PENDING", pendingPayments);
197+
getRequest().setAttribute("OWED_PAYMENTS", owedPayments);
198+
getRequest().setAttribute("TOTAL_OWED_PAYMENTS", totalOwedPayments);
187199

188200
if (exportToExcel) {
189201
produceXLS(payments);

src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
<c:set value="<%=request.getAttribute("NUM_TOTAL")%>" var="numTotal" />
5757
<c:set value="<%=request.getAttribute("NUM_PER_PAGE")%>" var="numPerPage" />
5858
<c:set value="<%=request.getAttribute("NUM_PENDING")%>" var="numPending" />
59+
<c:set value="<%=request.getAttribute("OWED_PAYMENTS")%>" var="owedPayments" />
60+
<c:set value="<%=request.getAttribute("TOTAL_OWED_PAYMENTS")%>" var="totalOwedPayments" />
5961
<c:set value="<%=DataAccessConstants.SORT_COLUMN%>" var="sortColumn"/>
6062
<c:set value="<%=DataAccessConstants.SORT_DIRECTION%>" var="sortDirection"/>
6163

@@ -81,6 +83,9 @@
8183
MINIMUM_PAYMENT_ACCRUAL_AMOUNT = ${MINIMUM_PAYMENT_ACCRUAL_AMOUNT};
8284
PAY_ME_CONFIRMATION_TEMPLATE = '${paymentConfirmationTemplate}';
8385
86+
var owedPayments = ${owedPayments};
87+
var totalOwedPayments = ${totalOwedPayments};
88+
8489
function next() {
8590
var myForm = document.f;
8691
myForm.<%=DataAccessConstants.START_RANK%>.value = ${requestScope[defaults][startRank]} + parseInt(myForm.<%=DataAccessConstants.NUMBER_RECORDS%>.value);
@@ -229,6 +234,12 @@
229234
</c:if>
230235

231236
<c:if test="${isReskin}">
237+
<div class="above-tabs">
238+
<div align="right" class="pay-me-btn">
239+
<input type="button" value="Pay Me" id="quickPayMe"/>
240+
</div>
241+
</div>
242+
232243
<%-- desktop tabs --%>
233244
<nav class="tabs paymentHistoryTabs">
234245
<c:if test="${fullList}" >

0 commit comments

Comments
 (0)