Realex - The low level module
=============================

The realex module should not be dependent on plone.

Create the Realex object

    >>> MerchantID = 'testmerch'
    >>> Secret = '123456789'
    >>> Testing = True

    >>> from getpaid.realex import realex
    >>> processor = realex.Realex(MerchantID, Secret, Testing)

Make sure the test requests succeed.

    >>> realex.TEST_RESPONSE = realex.TEST_RESPONSE_SUCCESS


Make a payment

    >>> orderid = '123456'
    >>> amount = 3400
    >>> card_number = '1234123412341234'
    >>> card_expdate = '1202'
    >>> card_chname = 'Test Card'
    >>> card_type = 'MC'
    >>> cvn = '234'
    >>> prodid = 'Test'
    >>> chargedescription = "My Company"
    >>> custipaddress = '127.0.0.1'
    >>> rebate_password = 'passit'

    >>> rv = processor.Authorise(orderid, amount, card_number, card_expdate,
    ...     card_chname, card_type, cvn, prodid, chargedescription, custipaddress)


    >>> print rv['orderid'] # doctest:+ELLIPSIS
    9876543...
    >>> print rv['authcode']
    999999
    >>> print rv['message']
    SUCCESS
    >>> print rv['result']
    0
    >>> print rv['pasref']
    8888888

Void the payment

    >>> void_rv = processor.Void(rv['orderid'], rv['pasref'], rv['authcode'], 'test void')
    >>> print void_rv['result']
    0
    >>> print void_rv['message']
    Test Void

Make a rebate

    >>> rebate_rv = processor.Rebate(rv['orderid'], rv['pasref'], rv['authcode'], '1000', rebate_password)
    >>> print rebate_rv['result']
    0
    >>> print rebate_rv['message']
    Test Rebate

