==============================================================================
Doctest generated Wed Sep 24 2008 19:09:56 GMT-0300 (ART)
==============================================================================

Create the browser object we'll be using.

    >>> from Products.Five.testbrowser import Browser
    >>> browser = Browser()
    >>> browser.handleErrors = False
    >>> browser.open(portal.absolute_url())
    >>> 'Welcome to Plone' in browser.contents
    True

Preparing the site to test for anonymous and logged in users behaviour of
address book in checkout

     >>> membership = self.portal.portal_membership
     >>> membership.addMember('testmanager', 'secret',
     ...             ['Member', 'Manager'], [])
     >>> membership.getMemberById('testmanager').setMemberProperties({'email':'testmember@getpaid.org','location':'here on earth'})
     >>> browser.getLink('Log in').click()
     >>> browser.getControl('Login Name').value = 'testmanager'
     >>> browser.getControl('Password').value = 'secret'
     >>> browser.getControl('Log in').click()

     >>> self.portal.portal_quickinstaller.installProduct('PloneGetPaid')
     'Installing Dependencies\n'
     >>> browser.getLink('Home').click()
 
Setting required settings. (Especially anonymous checkout)

    >>> browser.getLink('Site Setup').click()
    >>> browser.getLink('GetPaid').click()
    >>> browser.getLink('Site Profile').click()
    >>> browser.getControl('Contact Email').value = 'info@plonegetpaid.com'
    >>> browser.getControl( name="form.store_name").value = 'Test this fake company'
    >>> browser.getControl('Contact Country').value = ['US']
    >>> browser.getControl('Apply').click()
    >>> browser.getLink('GetPaid').click()
    >>> browser.getLink('Content Types').click()
    >>> browser.getLink('GetPaid').click()
    >>> browser.getLink('Payment Options').click()
    >>> browser.getControl(name = 'form.payment_processor').displayValue = ['Testing Processor']
    >>> browser.getControl(name = 'form.allow_anonymous_checkout.used').value = 'on'
    >>> browser.getControl(name = 'form.allow_anonymous_checkout').value = True
    >>> browser.getControl('Apply').click()
    >>> browser.getLink('GetPaid').click()
    >>> browser.getLink('Payment Processor Settings').click()
    >>> browser.getControl(name="form.allow_authorization").displayValue = ['allow_authorization']
    >>> browser.getControl(name="form.allow_capture").displayValue = ['allow_capture']
    >>> browser.getControl(name="form.allow_refunds").displayValue = ['allow_refund']    
    >>> browser.getControl('Apply').click()
    >>> browser.getLink('GetPaid').click()
    >>> browser.getLink('Email Notifications').click()
    >>> browser.getControl(name='form.merchant_email_notification').displayValue = ['Do not send merchant email notification of a completed transaction']
    >>> browser.getControl('Apply').click()
    >>> browser.getLink('GetPaid').click()
    >>> browser.getLink('Legal Disclaimers').click()
    >>> browser.getControl(name='form.disclaimer').value = 'Test disclaimer'
    >>> browser.getControl(name='form.privacy_policy').value = 'Test privacy policy'
    >>> browser.getControl('Apply').click()
    >>> browser.getLink('GetPaid').click() 
    >>> 'Test this fake company' in browser.contents
    True
    >>> browser.getLink('Payment Options').click()
    >>> browser.getControl(name ='form.allow_anonymous_checkout').value
    True

Here we are setting the buyable types for use in the following tests
  
    >>> from Products.PloneGetPaid.interfaces import IGetPaidManagementOptions
    >>> options = IGetPaidManagementOptions(self.portal)
    >>> options.buyable_types = ['Document']
    >>> options.donate_types = ['Document']
    >>> options.shippable_types = ['Document']

Here we set up the Credit cards accepted for payment:

   >>> options.accepted_credit_cards = ["Visa"]

Add a buyable document.

    >>> browser.getLink('Home').click()
    >>> browser.getLink('Make Buyable').click()
    >>> browser.getControl('Product Code').value = 'PAY-ME'
    >>> browser.getControl('Price').value = '42.17'
    >>> browser.getControl('Activate').click()

And now, lets generate some orders

    >>> browser.open(portal.absolute_url() +  '/manage')
    >>> self.portal.manage_addProduct['ExternalMethod'].manage_addExternalMethod(id='create_orders',
    ...                                 title='create_orders',
    ...                                 function='createOrders',
    ...                                 module='Products.PloneGetPaid.gen_order')
    >>> browser.open(portal.absolute_url() + '/create_orders')
    >>> browser.open(portal.absolute_url() + '/@@manage-getpaid-orders')
    >>> browser.getControl('Fulfillment').value = ['NEW']
    >>> browser.getControl('Filter').click()
    >>> browser.getLink('2').click()
    >>> browser.getControl('Fulfillment').value
    ['NEW']

And yes, it keeps the filter value, am I awesome or not :D
