    >>> from Products.CMFPlone.tests import dummy
    >>> from Products.CMFCore.utils import getToolByName
    >>> wftool = getToolByName(portal, "portal_workflow")
    >>> types = getToolByName(portal, 'portal_types')
    >>> from zope.publisher.browser import TestRequest

Check PFGVerkkomaksut
----
    >>> adapter = types.getTypeInfo('PFGVerkkomaksut')
    >>> adapter.title
    'Verkkomaksut Payment Adapter'
    >>> adapter.description
    'Verkkomaksut Payment Adapter'
    >>> adapter.content_meta_type
    'PFGVerkkomaksut'
    >>> adapter.factory
    'addPFGVerkkomaksut'
    >>> adapter.immediate_view
    'base_view'
    >>> adapter.global_allow == False
    True
    >>> adapter.filter_content_types == False
    True
    >>> adapter.allowed_content_types
    ()
    >>> adapter.default_view
    'base_view'
    >>> 'base_view' in adapter.view_methods
    True

#    >>> adapter.getMethodAliases()
#    {'edit': 'base_edit', 'properties': 'base_metadata', 'sharing': 'folder_localrole_form', '(Default)': '(dynamic view)', 'view': '(selected layout)'}
#    >>> actions = adapter.listActions()
#    >>> for action in actions:
#    ...     (action.title, action.id, action.getActionExpression(), action.visible, action.permissions)
#    ('View', 'view', 'string:${object_url}/view', True, ('View',))
#    ('Edit', 'edit', 'string:${object_url}/edit', True, ('Modify portal content',))
#    ('Properties', 'metadata', 'string:${object_url}/properties', True, ('Modify portal content',))
#    ('References', 'references', 'string:${object_url}/reference_graph', True, ('Modify portal content', 'Review portal content'))

Creating PFGVerkkomaksut
----
    >>> from Products.PFGVerkkomaksut.content import PFGVerkkomaksut
    >>> adapter = PFGVerkkomaksut('adapter')
    >>> adapter
     <PFGVerkkomaksut at adapter>

#    >>> from Products.PloneFormGen.content.formMailerAdapter import FormMailerAdapter
#    >>> mailer = FormMailerAdapter('mailer')

#    >>> mailer.Schema().getSchemataNames()
#    ['default', 'categorization', 'dates', 'ownership', 'settings', 'addressing', 'message', 'template', 'encryption', 'overrides']
#    >>> adapter.Schema().getSchemataNames()
#    ['default', 'addressing', 'message', 'template', 'encryption', 'overrides', 'verkkomaksut', 'categorization', 'dates', 'ownership', 'settings']

#    >>> adapter.merchant_id = 111111
#    >>> adapter.getMerchant_id()
#    111111
#    >>> adapter.merchant_authentication_code = 'AIUEO'
#    >>> adapter.getMerchant_authentication_code()
#    'AIUEO'
#    >>> adapter.next_order_number = 10000
#    >>> adapter.getNext_order_number()
#    10000
#    >>> adapter.price_field = ('UID01', 'Title01')
#    >>> adapter.getPrice_field()
#    ('UID01', 'Title01')
#    >>> adapter.thanksPrologue = '<p>Thanks!!</p>'
#    >>> adapter.getthanksPrologue()
#    '<p>Thanks!!</p>'

    >>> adapter._at_rename_after_creation
    True

message schemata
====
    >>> adapter.Schema().getSchemataFields('message')
    [<Field msg_necessary(boolean:rw)>, <Field msg_subject(string:rw)>, <Field subject_field(string:rw)>, <Field body_pt(zpt:rw)>, <Field body_pre(text:rw)>, <Field body_post(text:rw)>, <Field body_footer(text:rw)>, <Field msg_attachments(lines:rw)>]


Field: msg_necessary
----
    >>> adapter.getField('msg_necessary')
    <Field msg_necessary(boolean:rw)>
    >>> adapter.getField('msg_necessary').schemata
    'message'
    >>> adapter.getField('msg_necessary').required == False
    True
    >>> adapter.getField('msg_necessary').searchable == False
    True
    >>> adapter.getField('msg_necessary').storage
    <Storage AnnotationStorage>
    >>> adapter.getField('msg_necessary').widget
    <Products.Archetypes.Widget.BooleanWidget object at ...>
    >>> adapter.getField('msg_necessary').widget.label
    u'Message Necessary'
    >>> adapter.getField('msg_necessary').widget.description
    u'If message after success of form input is necessary to send, please check this box.'

Field: msg_subject
----
    >>> adapter.getField('msg_subject')
    <Field msg_subject(string:rw)>
    >>> adapter.getField('msg_subject').schemata
    'message'
    >>> adapter.getField('msg_subject').required == False
    True
    >>> adapter.getField('msg_subject').searchable == False
    True
    >>> adapter.getField('msg_subject').storage
    <Storage AttributeStorage>
    >>> adapter.getField('msg_subject').widget
    <Products.Archetypes.Widget.StringWidget object at ...>
    >>> adapter.getField('msg_subject').widget.label
    'Subject'
    >>> adapter.getField('msg_subject').widget.description
    '\n                Subject line of message. This is used if you\n                do not specify a subject field or if the field\n                is empty.\n                '

Field: subject_field
----
    >>> adapter.getField('subject_field')
    <Field subject_field(string:rw)>
    >>> adapter.getField('subject_field').schemata
    'message'
    >>> adapter.getField('subject_field').required == False
    True
    >>> adapter.getField('subject_field').searchable == False
    True
    >>> adapter.getField('subject_field').storage
    <Storage AttributeStorage>
    >>> adapter.getField('subject_field').widget
    <Products.Archetypes.Widget.SelectionWidget object at ...>
    >>> adapter.getField('subject_field').widget.label
    'Extract Subject From'
    >>> adapter.getField('subject_field').widget.description
    '\n                Choose a form field from which you wish to extract\n                input for the mail subject line.\n                '

Field: body_pt
----
    >>> adapter.getField('body_pt')
    <Field body_pt(zpt:rw)>
    >>> adapter.getField('body_pt').schemata
    'message'
    >>> adapter.getField('body_pt').required == False
    True
    >>> adapter.getField('body_pt').searchable == False
    True
    >>> adapter.getField('body_pt').storage
    <Storage AttributeStorage>
    >>> adapter.getField('body_pt').write_permission
    'PloneFormGen: Edit TALES Fields'
    >>> adapter.getField('body_pt').default_method
    'getMailBodyDefault'
    >>> adapter.getField('body_pt').read_permission
    'Modify portal content'
    >>> adapter.getField('body_pt').validators
    (('zptvalidator', V_REQUIRED))
    >>> adapter.getField('body_pt').widget
    <Products.Archetypes.Widget.TextAreaWidget object at ...>
    >>> adapter.getField('body_pt').widget.label
    'Mail-Body Template'
    >>> adapter.getField('body_pt').widget.description
    "This is a Zope Page Template used for rendering of the mail-body. You don't need to modify it, but if you know TAL (Zope's Template Attribute Language) you have the full power to customize your outgoing mails."
    >>> adapter.getField('body_pt').widget.rows
    20

Field: body_pre
----
    >>> adapter.getField('body_pre')
    <Field body_pre(text:rw)>
    >>> adapter.getField('body_pre').schemata
    'message'
    >>> adapter.getField('body_pre').required == False
    True
    >>> adapter.getField('body_pre').searchable == False
    True
    >>> adapter.getField('body_pre').storage
    <Storage AttributeStorage>
    >>> adapter.getField('body_pre').widget
    <Products.Archetypes.Widget.TextAreaWidget object at ...>
    >>> adapter.getField('body_pre').widget.label
    'Body (prepended)'
    >>> adapter.getField('body_pre').widget.description
    'Text prepended to fields listed in mail-body'

Field: body_post
----
    >>> adapter.getField('body_post')
    <Field body_post(text:rw)>
    >>> adapter.getField('body_post').schemata
    'message'
    >>> adapter.getField('body_post').required == False
    True
    >>> adapter.getField('body_post').searchable == False
    True
    >>> adapter.getField('body_post').storage
    <Storage AttributeStorage>
    >>> adapter.getField('body_post').widget
    <Products.Archetypes.Widget.TextAreaWidget object at ...>
    >>> adapter.getField('body_post').widget.label
    'Body (appended)'
    >>> adapter.getField('body_post').widget.description
    'Text appended to fields listed in mail-body'

Field: body_footer
----
    >>> adapter.getField('body_footer')
    <Field body_footer(text:rw)>
    >>> adapter.getField('body_footer').schemata
    'message'
    >>> adapter.getField('body_footer').required == False
    True
    >>> adapter.getField('body_footer').searchable == False
    True
    >>> adapter.getField('body_footer').storage
    <Storage AttributeStorage>
    >>> adapter.getField('body_footer').widget
    <Products.Archetypes.Widget.TextAreaWidget object at ...>
    >>> adapter.getField('body_footer').widget.label
    'Body (signature)'
    >>> adapter.getField('body_footer').widget.description
    'Text used as the footer at bottom, delimited from the body by a dashed line.'

Field: msg_attachments
----
    >>> adapter.getField('msg_attachments')
    <Field msg_attachments(lines:rw)>
    >>> adapter.getField('msg_attachments').schemata
    'message'
    >>> adapter.getField('msg_attachments').required
    False
    >>> adapter.getField('msg_attachments').searchable
    False
    >>> adapter.getField('msg_attachments').storage
    <Storage AnnotationStorage>
    >>> adapter.getField('msg_attachments').vocabulary
    'attachments'
    >>> adapter.getField('msg_attachments').enforceVocabulary
    True
    >>> adapter.getField('msg_attachments').widget
    <Products.Archetypes.Widget.MultiSelectionWidget object at ...>
    >>> adapter.getField('msg_attachments').widget.label
    u'E-mail attachments before Verkkomaksut'
    >>> adapter.getField('msg_attachments').widget.description
    u'Please select the attachments to be sent with email when one has successfully finished inputs of the form.'

verkkomaksut schemata
====
    >>> adapter.Schema().getSchemataFields('verkkomaksut')
    [<Field merchant_id(integer:rw)>, <Field merchant_authentication_code(string:rw)>, <Field next_order_number(integer:rw)>, <Field price_field(string:rw)>, <Field order_description(lines:rw)>, <Field thanksPrologue(text:rw)>, <Field cancel_message(string:rw)>]


Field: merchant_id
----
    >>> adapter.getField('merchant_id')
    <Field merchant_id(integer:rw)>
    >>> adapter.getField('merchant_id').schemata
    'verkkomaksut'
    >>> adapter.getField('merchant_id').required
    True
    >>> adapter.getField('merchant_id').searchable
    False
    >>> adapter.getField('merchant_id').storage
    <Storage AnnotationStorage>
    >>> adapter.getField('merchant_id').size
    11
    >>> adapter.getField('merchant_id').default
    13466
    >>> adapter.getField('merchant_id').widget
    <Products.Archetypes.Widget.IntegerWidget object at ...>
    >>> adapter.getField('merchant_id').widget.label
    u'Merchant ID'
    >>> adapter.getField('merchant_id').widget.description
    u'Please input MERCHANT_ID provided by Verkkomaksut here. The default ID is for demo use which is 13466.'
    >>> adapter.getField('merchant_id').widget.maxlength
    11

Field: merchant_authentication_code
----
    >>> adapter.getField('merchant_authentication_code')
    <Field merchant_authentication_code(string:rw)>
    >>> adapter.getField('merchant_authentication_code').schemata
    'verkkomaksut'
    >>> adapter.getField('merchant_authentication_code').required
    True
    >>> adapter.getField('merchant_authentication_code').searchable
    False
    >>> adapter.getField('merchant_authentication_code').storage
    <Storage AnnotationStorage>
    >>> adapter.getField('merchant_authentication_code').default
    '6pKF4jkv97zmqBJ3ZL8gUw5DfT2NMQ'
    >>> adapter.getField('merchant_authentication_code').widget
    <Products.Archetypes.Widget.StringWidget object at ...>
    >>> adapter.getField('merchant_authentication_code').widget.label
    u'Merchant Authentication Code'
    >>> adapter.getField('merchant_authentication_code').widget.description
    u'Please input Merchant Authentication Code provided by Verkkomaksut here. The default ID is for demo use which is 6pKF4jkv97zmqBJ3ZL8gUw5DfT2NMQ.'
    >>> adapter.getField('merchant_authentication_code').widget.maxlength
    32

Field: next_order_number
----
    >>> adapter.getField('next_order_number')
    <Field next_order_number(integer:rw)>
    >>> adapter.getField('next_order_number').schemata
    'verkkomaksut'
    >>> adapter.getField('next_order_number').required
    True
    >>> adapter.getField('next_order_number').searchable
    False
    >>> adapter.getField('next_order_number').storage
    <Storage AnnotationStorage>
    >>> adapter.getField('next_order_number').size
    10
    >>> adapter.getField('next_order_number').default
    1
    >>> adapter.getField('next_order_number').widget
    <Products.Archetypes.Widget.IntegerWidget object at ...>
    >>> adapter.getField('next_order_number').widget.label
    u'Next Order Number'
    >>> adapter.getField('next_order_number').widget.description
    u'Please input the next order number here. This number will be automatically increased by one for each transaction and will be sent to Verkkomksut.'
    >>> adapter.getField('next_order_number').widget.maxlength
    64

Field: price_field
----
    >>> adapter.getField('price_field')
    <Field price_field(string:rw)>
    >>> adapter.getField('price_field').schemata
    'verkkomaksut'
    >>> adapter.getField('price_field').required
    True
    >>> adapter.getField('price_field').searchable
    False
    >>> adapter.getField('price_field').storage
    <Storage AnnotationStorage>
    >>> adapter.getField('price_field').vocabulary
    'price_fields'
    >>> adapter.getField('price_field').enforceVocabulary
    True
    >>> adapter.getField('price_field').widget
    <Products.Archetypes.Widget.SelectionWidget object at ...>
    >>> adapter.getField('price_field').widget.label
    u'Price Field'
    >>> adapter.getField('price_field').widget.description
    u'Please select the price field which will be used for Verkkomakusut. Remember to add fixed-point field or selection field with required option checked to the form folder first.'

Field: order_description
----
    >>> adapter.getField('order_description')
    <Field order_description(lines:rw)>
    >>> adapter.getField('order_description').schemata
    'verkkomaksut'
    >>> adapter.getField('order_description').required
    False
    >>> adapter.getField('order_description').searchable
    False
    >>> adapter.getField('order_description').storage
    <Storage AnnotationStorage>
    >>> adapter.getField('order_description').widget
    <Products.Archetypes.Widget.LinesWidget object at ...>
    >>> adapter.getField('order_description').widget.label
    u'Order Description'
    >>> adapter.getField('order_description').widget.description
    u'Please line up the ID of the field to be added to the ORDER_DESCRIPTION for verkkomaksut.'
    >>> adapter.getField('order_description').widget.cols
    20


Field: thanksPrologue
----
    >>> adapter.getField('thanksPrologue')
    <Field thanksPrologue(text:rw)>
    >>> adapter.getField('thanksPrologue').schemata
    'verkkomaksut'
    >>> adapter.getField('thanksPrologue').required
    False
    >>> adapter.getField('thanksPrologue').searchable
    False
    >>> adapter.getField('thanksPrologue').storage
    <Storage AttributeStorage>
    >>> adapter.getField('thanksPrologue').primary
    False
    >>> adapter.getField('thanksPrologue').validators
    (('isEmptyNoError', V_SUFFICIENT), ('isTidyHtmlWithCleanup', V_REQUIRED))
    >>> adapter.getField('thanksPrologue').default_output_type
    'text/x-html-safe'
    >>> adapter.getField('thanksPrologue').default_content_type
    'text/html'
    >>> adapter.getField('thanksPrologue').allowable_content_types
    ('text/structured', 'text/x-rst', 'text/html', 'text/plain')
    >>> adapter.getField('thanksPrologue').widget
    <Products.Archetypes.Widget.RichWidget object at ...>
    >>> adapter.getField('thanksPrologue').widget.label
    u'Thanks Text'
    >>> adapter.getField('thanksPrologue').widget.description
    u'This thanks text will be displayed when payment is successful.'
    >>> adapter.getField('thanksPrologue').widget.rows
    8
    >>> adapter.getField('thanksPrologue').widget.allow_file_upload
    True

Field: cancel_message
----
    >>> adapter.getField('cancel_message')
    <Field cancel_message(string:rw)>
    >>> adapter.getField('cancel_message').schemata
    'verkkomaksut'
    >>> adapter.getField('cancel_message').required
    False
    >>> adapter.getField('cancel_message').searchable
    False
    >>> adapter.getField('cancel_message').storage
    <Storage AnnotationStorage>
    >>> adapter.getField('cancel_message').widget
    <Products.Archetypes.Widget.StringWidget object at ...>
    >>> adapter.getField('cancel_message').widget.label
    u'Cancel Message'
    >>> adapter.getField('cancel_message').widget.description
    u'This message will be shown when one cancels Verkkomaksut payment.'
    >>> adapter.getField('cancel_message').widget.maxlength
    255
