Initial support for Stripe (And Improve Paypal)
[hcoop/portal.git] / money.mlt
index 085c3aa..e846c3f 100644 (file)
--- a/money.mlt
+++ b/money.mlt
@@ -285,6 +285,11 @@ end %></textarea></td> </tr>
 
        %><h3>Payment transaction added.</h3>
 
+<% elseif $"cmd" = "stripeApply" then
+        val stripePmt = Money.lookupStripePayment ($"stripeId");
+        val txid = Money.applyStripePayment stripePmt;
+%><h3>Stripe Payment Processed (Transaction <% txid %>)</h3>
+
 <% elseif $"modPay" <> "" then
        Group.requireGroupName "money";
        showNormal := false;
@@ -663,8 +668,34 @@ Co-op balance: $<% #amount (Balance.lookupBalance (valOf (Balance.balanceNameToI
 <input name="rname"> <input type="submit" value="Look up">
 </form>
 
+<h3>Apply Stripe Payments</h3>
+
+<table>
+<tr><td><strong>Date</strong></td><td><strong>Member</strong></td>
+    <td><strong>Name on Card</strong></td>
+    <td><strong>Amount</strong> (After Fees)</td><td><td></td>
+</tr>
+<% foreach stripePmt in Money.listAllPendingStripePayments () do %>
+
+<tr>
+  <td><% #name (Init.lookupUser (#webuser_id stripePmt)) %></td>
+  <td><% #paid_on stripePmt %></td>
+  <td><% #card_name stripePmt %>
+  <td>$<% #net stripePmt %></td>
+  <td><form method="post">
+        <input type="hidden" name="cmd" value="stripeApply" />
+        <input type="hidden" name="stripeId" value="<% #charge_id stripePmt %>" />
+        <input type="submit" value="Apply to Balance" /> <!-- also, refund? -->
+      </form>
+  </td>
+</tr>
+<% end %>
+</table>
+
 <h3>Most recent transactions</h3>
 
+
+
 <table>
 <tr> <td><b>Date</b></td> <td><b>Description</b></td> <td><b>Amount</b></td> <td><b>Participants</b></td> <td><b>Replace</b></td> <td><b>Delete</b></td> </tr>
 <% foreach trn in Money.listTransactionsLimit 20 do %>