Changeset 12704 for main/waeup.ikoba/branches/uli-payments
- Timestamp:
- 9 Mar 2015, 06:34:58 (10 years ago)
- Location:
- main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/browser.py
r12690 r12704 18 18 """UI components for customers and related components. 19 19 """ 20 21 import sys22 20 import grok 23 import pytz24 21 import os 25 22 from urllib import urlencode 26 from datetime import datetime27 23 from zope.event import notify 28 24 from zope.i18n import translate 29 25 from zope.catalog.interfaces import ICatalog 30 26 from zope.component import queryUtility, getUtility, createObject 31 from zope.schema.interfaces import ConstraintNotSatisfied, RequiredMissing32 from zope.formlib.textwidgets import BytesDisplayWidget33 27 from zope.security import checkPermission 34 28 from hurry.workflow.interfaces import ( … … 42 36 from waeup.ikoba.browser.layout import ( 43 37 IkobaPage, IkobaEditFormPage, IkobaAddFormPage, IkobaDisplayFormPage, 44 IkobaForm, NullValidator, jsaction, action, UtilityView) 45 from waeup.ikoba.widgets.datewidget import ( 46 FriendlyDateWidget, FriendlyDateDisplayWidget, 47 FriendlyDatetimeDisplayWidget) 38 NullValidator, jsaction, action, UtilityView) 48 39 from waeup.ikoba.browser.pages import ContactAdminForm 49 40 from waeup.ikoba.browser.breadcrumbs import Breadcrumb 50 41 from waeup.ikoba.browser.interfaces import ICaptchaManager 51 42 from waeup.ikoba.mandates.mandate import PasswordMandate 52 from waeup.ikoba.payments.interfaces import IPaymentGatewayServicesLister 43 from waeup.ikoba.payments.payment import format_payment_item_values 44 from waeup.ikoba.payments.interfaces import ( 45 IPaymentGatewayServicesLister, IPaymentGatewayService, IPayer 46 ) 53 47 from waeup.ikoba.widgets.hrefwidget import HREFDisplayWidget 54 48 from waeup.ikoba.utils.helpers import ( 55 get_current_principal, to_timezone, now,format_date)49 get_current_principal, format_date) 56 50 from waeup.ikoba.customers.interfaces import ( 57 51 ICustomer, ICustomersContainer, ICustomerRequestPW, ICustomersUtils, 58 52 ICustomerDocument, ICustomerDocumentsContainer, ICustomerCreate, 59 53 ICustomerPDFDocument, IContractsContainer, IContract, 60 IContractSelectProduct, ISampleContract,54 IContractSelectProduct, 61 55 ) 62 56 from waeup.ikoba.customers.catalog import search 63 57 from waeup.ikoba.customers.workflow import PAYMENT_TRANSITIONS 58 from waeup.ikoba.customers.contracts import payment_items_from_contract 59 64 60 65 61 grok.context(IIkobaObject) … … 928 924 def createDocument(self, **data): 929 925 form = self.request.form 930 customer = self.context.__parent__931 926 doctype = form.get('doctype', None) 932 927 # Here we can create various instances of CustomerDocument derived … … 1099 1094 tableheader = [] 1100 1095 tabledata = [] 1101 contenttitle = []1102 1096 for i in range(1,3): 1103 1097 tabledata.append(sorted( … … 1135 1129 @property 1136 1130 def label(self): 1137 portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE1138 1131 return '%s of %s\nTitle: %s' % ( 1139 1132 self.context.translated_class_name, … … 1142 1135 1143 1136 def render(self): 1144 portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE1145 1137 customerview = CustomerBasePDFFormPage(self.context.customer, 1146 1138 self.request, self.omit_fields) … … 1158 1150 1159 1151 def render(self): 1160 portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE1161 1152 customerview = CustomerBasePDFFormPage(self.context.customer, 1162 1153 self.request, self.omit_fields) … … 1296 1287 def createContract(self, **data): 1297 1288 form = self.request.form 1298 customer = self.context.__parent__1299 1289 contype = form.get('contype', None) 1300 1290 # Here we can create various instances of Contract derived … … 1534 1524 type='warning') 1535 1525 else: 1526 1527 service = queryUtility(IPaymentGatewayService, name=self.gw) 1528 if service is None: 1529 self.flash(_('Invalid payment gateway.'), type='danger') 1530 return 1531 payer = IPayer(self.context) 1532 payment_items = payment_items_from_contract(self.context) 1533 payment = service.create_payment(payer, payment_items) 1534 payment, view_name = service.next_step(payment.payment_id) 1535 url = self.url(payment, view_name) 1536 self.flash(_('Payment has been initiated.')) 1536 1537 IWorkflowInfo(self.context).fireTransition('await') 1537 self.flash(_('Payment has been initiated.')) 1538 self.redirect(url) 1539 return 1540 1538 1541 return 1539 1542 … … 1618 1621 tableheader = [] 1619 1622 tabledata = [] 1620 contenttitle = []1621 1623 for i in range(1,3): 1622 1624 tabledata.append(sorted( … … 1673 1675 @property 1674 1676 def label(self): 1675 portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE1676 1677 return self.context.title 1677 1678 … … 1688 1689 1689 1690 def render(self): 1690 portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE1691 1691 customerview = CustomerBasePDFFormPage(self.context.customer, 1692 1692 self.request, self.omit_fields) -
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/demo_provider.py
r12701 r12704 1 1 import grok 2 2 from waeup.ikoba.interfaces import MessageFactory as _ 3 from waeup.ikoba.payments.interfaces import IPaymentGatewayService 3 from waeup.ikoba.browser.layout import IkobaPage 4 from waeup.ikoba.payments.interfaces import IPaymentGatewayService, IPayment 4 5 from waeup.ikoba.payments.payment import Payment, get_payment 6 7 8 grok.templatedir('templates') 5 9 6 10 … … 36 40 if payment is None: 37 41 return None, None 38 return payment, 'index' 42 return payment, 'demo_cc1' 43 44 45 class CreditCardStep1(IkobaPage): 46 grok.context(IPayment) 47 grok.name('demo_cc1') 48 grok.require('waeup.Public') 49 #grok.require('waeup.handleCustomer') 50 label = "Enter Credit Card Details" 51 grok.template('demo_cc_step1') 52 pnav = 0 53 54 def update(self): 55 print "UPDATE"
Note: See TracChangeset for help on using the changeset viewer.