示例#1
0
 def test_for_smoke(self):
     with mock.patch('paypal.gateway.post') as mock_post:
         mock_post.return_value = {
             'RESULT': '1',
             'RESPMSG': '',
             '_raw_request': '',
             '_raw_response': '',
             '_response_time': 1000
         }
         gateway.reference_transaction(order_number='12345',
                                       pnref='111222',
                                       amt=D('12.23'))
 def test_for_smoke(self):
     with mock.patch('paypal.gateway.post') as mock_post:
         mock_post.return_value = {
             'RESULT': '1',
             'RESPMSG': '',
             '_raw_request': '',
             '_raw_response': '',
             '_response_time': 1000
         }
         gateway.reference_transaction(order_number='12345',
                                       pnref='111222',
                                       amt=D('12.23'))
示例#3
0
def referenced_sale(order_number, pnref, amt):
    """
    Capture funds using the bank/address details of a previous transaction

    This is equivalent to a *sale* transaction but without the user having to
    enter their payment details.

    There are two main uses for this:

    1. This allows customers to checkout without having to re-enter their
       payment details.

    2. It allows an initial authorisation to be settled in multiple parts.  The
       first settle should use delayed_capture but any subsequent ones should
       use this method.

    :order_number: Order number.
    :pnref: PNREF of a previous transaction to use.
    :amt: The amount to settle for.
    """
    txn = gateway.reference_transaction(
        order_number, pnref, amt)
    if not txn.is_approved:
        raise exceptions.UnableToTakePayment(txn.respmsg)
    return txn
示例#4
0
def referenced_sale(order_number, pnref, amt):
    """
    Capture funds using the bank/address details of a previous transaction

    This is equivalent to a *sale* transaction but without the user having to
    enter their payment details.

    There are two main uses for this:

    1. This allows customers to checkout without having to re-enter their
       payment details.

    2. It allows an initial authorisation to be settled in multiple parts.  The
       first settle should use delayed_capture but any subsequent ones should
       use this method.

    :order_number: Order number.
    :pnref: PNREF of a previous transaction to use.
    :amt: The amount to settle for.
    """
    txn = gateway.reference_transaction(order_number, pnref, amt)
    if not txn.is_approved:
        raise exceptions.UnableToTakePayment(txn.respmsg)
    return txn