Index: /WAeUP_SRP/trunk/skins/waeup_epayment/pay_by_sc.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_epayment/pay_by_sc.py	(revision 1389)
+++ /WAeUP_SRP/trunk/skins/waeup_epayment/pay_by_sc.py	(revision 1390)
@@ -69,20 +69,23 @@
 order_id = ds.get('pin_n')
 p_id = "p%s" % order_id
-now = DateTime.DateTime()
-info['date'] = now
-info['amount'] = "n/a"
-pin = info['order_id'] = ds.get('pin')
-info['type_code'] = "%s" % pin
-info['type_description'] = 'School Fee for Session 2006/2007'
-info['resp_code'] = "SC"
-info['resp_desc'] = "SC Payment Successful"
-payments.invokeFactory('Payment', p_id)
-payment = getattr(payments,p_id)
-wftool = context.portal_workflow
-wftool.doActionFor(payment,'open')
-payment.getContent().edit(mapping=info)
-wftool.doActionFor(payment,'close')
-wftool.doActionFor(student,'pay_school_fee')
-logger.info('"%s", "paid school fee by scratch card"' % student_id)
+if not hasattr(payments,p_id):
+    now = DateTime.DateTime()
+    info['date'] = now
+    info['amount'] = "n/a"
+    pin = info['order_id'] = ds.get('pin')
+    info['type_code'] = "%s" % pin
+    info['type_description'] = 'School Fee for Session 2006/2007'
+    info['resp_code'] = "SC"
+    info['resp_desc'] = "SC Payment Successful"
+    payments.invokeFactory('Payment', p_id)
+    payment = getattr(payments,p_id)
+    wftool = context.portal_workflow
+    wftool.doActionFor(payment,'open')
+    payment.getContent().edit(mapping=info)
+    wftool.doActionFor(payment,'close')
+    wftool.doActionFor(student,'pay_school_fee')
+    logger.info('"%s", "paid school fee by scratch card"' % student_id)
+else:
+    logger.info('"%s", "repeatedly paid school fee by scratch card"' % student_id)
 url = "%s/payments" % (student.absolute_url())
 request.RESPONSE.redirect(url)
