'Authorize and capture a payment for the given amount.
Authorize and immediately capture a payment for the given payment.token
record for the specified amount with reference as communication.
:param record token: the payment.token record that must be charged
:param str amount: transaction amount (up to 15 digits with decimal point)
:param str reference: used as "invoiceNumber" in the Authorize.net backend
:return: a dict containing the response code, transaction id and transaction type
:rtype: dict'

def auth_and_capture(self, token, amount, reference):

    root = self._base_tree('createTransactionRequest')
    tx = etree.SubElement(root, 'transactionRequest')
    etree.SubElement(tx, 'transactionType').text = 'authCaptureTransaction'
    etree.SubElement(tx, 'amount').text = str(amount)
    profile = etree.SubElement(tx, 'profile')
    etree.SubElement(profile, 'customerProfileId').text = token.authorize_profile
    payment_profile = etree.SubElement(profile, 'paymentProfile')
    etree.SubElement(payment_profile, 'paymentProfileId').text = token.acquirer_ref
    order = etree.SubElement(tx, 'order')
    etree.SubElement(order, 'invoiceNumber').text = reference
    response = self._authorize_request(root)
    res = dict()
    res['x_response_code'] = response.find('transactionResponse/responseCode').text
    res['x_trans_id'] = response.find('transactionResponse/transId').text
    res['x_type'] = 'auth_capture'
    return res
