Changeset 12690 for main/waeup.ikoba/branches/uli-payments
- Timestamp:
- 8 Mar 2015, 19:20:02 (10 years ago)
- Location:
- main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/browser.py
r12689 r12690 50 50 from waeup.ikoba.browser.interfaces import ICaptchaManager 51 51 from waeup.ikoba.mandates.mandate import PasswordMandate 52 from waeup.ikoba.payments.interfaces import IPaymentGatewayServicesLister 52 53 from waeup.ikoba.widgets.hrefwidget import HREFDisplayWidget 53 54 from waeup.ikoba.utils.helpers import ( … … 1513 1514 payment gateway. 1514 1515 """ 1515 from waeup.ikoba.payments.interfaces import IPaymentGatewayServicesLister1516 1516 lister = getUtility(IPaymentGatewayServicesLister) 1517 1517 for name, service in lister().items(): 1518 1518 yield {'name': name, 'title': service.title} 1519 1519 1520 def update(self, CANCEL=None ):1520 def update(self, CANCEL=None, gw=None): 1521 1521 if self.context.state != CREATED or not self.context.fee_based: 1522 1522 emit_lock_message(self) 1523 1523 return 1524 self.gw = gw 1524 1525 super(SelectPaymentMethodPage, self).update() 1525 1526 return … … 1529 1530 style='primary', warning=WARNING_CON,) 1530 1531 def confirm(self, **data): 1531 IWorkflowInfo(self.context).fireTransition('await') 1532 self.flash(_('Payment has been initiated.')) 1532 if self.gw is None: 1533 self.flash(_('Please pick a payment method.'), 1534 type='warning') 1535 else: 1536 IWorkflowInfo(self.context).fireTransition('await') 1537 self.flash(_('Payment has been initiated.')) 1533 1538 return 1534 1539 -
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/tests/test_browser.py
r12689 r12690 1501 1501 contract.product_options = [prodoption,] 1502 1502 1503 def test_select_payment(self): 1504 # select payment 1503 def prepare_payment_select(self): 1505 1504 IWorkflowState(self.customer).setState('approved') 1506 1505 IWorkflowState(self.document).setState('verified') … … 1513 1512 self.browser.getControl(name="form.password").value = 'cpwd' 1514 1513 self.browser.getControl("Login").click() 1515 # go to our contract 1514 1515 def test_select_payment(self): 1516 # select payment 1517 self.prepare_payment_select() 1516 1518 self.browser.open('%s/CON1/edit' % self.contracts_path) 1517 1519 self.browser.getControl("Proceed to checkout").click() … … 1520 1522 self.assertTrue( 1521 1523 'Credit Card (Demo Payments)' in self.browser.contents) 1524 1525 def test_select_payment_no_choice(self): 1526 # we get warned if no payment was selected 1527 self.prepare_payment_select() 1528 never_ending_button_text = ( 1529 'Select payment method and proceed to payment gateway' 1530 ' (final submission)') 1531 self.browser.open( 1532 '%s/CON1/select_payment_method' % self.contracts_path) 1533 self.browser.getControl(never_ending_button_text).click() 1534 self.assertTrue( 1535 'Please pick a payment method' in self.browser.contents) 1536 1537 def test_select_payment_demo_provider(self): 1538 # we can proceed with payments if we select a payment method 1539 self.prepare_payment_select() 1540 never_ending_button_text = ( 1541 'Select payment method and proceed to payment gateway' 1542 ' (final submission)') 1543 self.browser.open( 1544 '%s/CON1/select_payment_method' % self.contracts_path) 1545 radio_ctrl = self.browser.getControl(name='gw') 1546 radio_ctrl.displayValue = ['Credit Card (Demo Payments)'] 1547 self.browser.getControl(never_ending_button_text).click() 1548 self.assertTrue( 1549 'Payment has been initiated.' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.