Exemple #1
0
 def __init__(self, login_id, transaction_key, debug=True, test=False):
     self.login_id = login_id
     self.transaction_key = transaction_key
     self.debug = debug
     self.test = test
     self._transaction = TransactionAPI(login_id, transaction_key, debug,
                                        test)
     self._transaction_detail = TransactionDetailAPI(
         login_id, transaction_key, debug, test)
     self._recurring = RecurringAPI(login_id, transaction_key, debug, test)
     self._customer = CustomerAPI(login_id, transaction_key, debug, test)
Exemple #2
0
 def __init__(self, login_id, transaction_key, debug=True, test=False):
     self.login_id = login_id
     self.transaction_key = transaction_key
     self.debug = debug
     self.test = test
     self._transaction = TransactionAPI(login_id, transaction_key,
         debug, test)
     self._transaction_detail = TransactionDetailAPI(login_id, transaction_key,
         debug, test)
     self._recurring = RecurringAPI(login_id, transaction_key, debug, test)
     self._customer = CustomerAPI(login_id, transaction_key, debug, test)
Exemple #3
0
class AuthorizeClient(object):
    """
    Instantiate the client with your login ID and transaction key from
    Authorize.net.
    
    The ``debug`` option determines whether to use debug mode
    for the APIs. This should be ``True`` in development and staging, and
    should be ``False`` in production when you want to actually process credit
    cards. You will need to pass in the appropriate login credentials
    depending on debug mode. The ``test`` option determines whether to run
    the standard API in test mode, which should generally be left ``False``,
    even in development and staging environments.
    """
    def __init__(self, login_id, transaction_key, debug=True, test=False):
        self.login_id = login_id
        self.transaction_key = transaction_key
        self.debug = debug
        self.test = test
        self._transaction = TransactionAPI(login_id, transaction_key,
            debug, test)
        self._transaction_detail = TransactionDetailAPI(login_id, transaction_key,
            debug, test)
        self._recurring = RecurringAPI(login_id, transaction_key, debug, test)
        self._customer = CustomerAPI(login_id, transaction_key, debug, test)

    def card(self, credit_card, address=None):
        """
        To work with a credit card, pass in a
        :class:`CreditCard <authorize.data.CreditCard>` instance, and
        optionally an :class:`Address <authorize.data.Address>` instance. This
        will return an
        :class:`AuthorizeCreditCard <authorize.client.AuthorizeCreditCard>`
        instance you can then use to execute transactions.
        """
        return AuthorizeCreditCard(self, credit_card, address=address)

    def transaction(self, uid):
        """
        To perform an action on a previous transaction, pass in the ``uid`` of
        that transaction as a string. This will return an
        :class:`AuthorizeTransaction <authorize.client.AuthorizeTransaction>`
        instance you can then use to settle, credit or void that transaction.
        """
        txn = AuthorizeTransaction(self, uid)
        txn.full_response = self._transaction_detail.details(uid)
        return txn

    def saved_card(self, uid):
        """
        To create a new transaction from a saved card, pass in the ``uid`` of
        the saved card as a string. This will return an
        :class:`AuthorizeSavedCard <authorize.client.AuthorizeSavedCard>`
        instance you can then use to auth, capture, or create a credit.
        """
        return AuthorizeSavedCard(self, uid)

    def recurring(self, uid):
        """
        To update or cancel an existing recurring payment, pass in the ``uid``
        of the recurring payment as a string. This will return an
        :class:`AuthorizeRecurring <authorize.client.AuthorizeRecurring>`
        instance you can then use to udpate or cancel the payments.
        """
        return AuthorizeRecurring(self, uid)
Exemple #4
0
class AuthorizeClient(object):
    """
    Instantiate the client with your login ID and transaction key from
    Authorize.net.
    
    The ``debug`` option determines whether to use debug mode
    for the APIs. This should be ``True`` in development and staging, and
    should be ``False`` in production when you want to actually process credit
    cards. You will need to pass in the appropriate login credentials
    depending on debug mode. The ``test`` option determines whether to run
    the standard API in test mode, which should generally be left ``False``,
    even in development and staging environments.
    """
    def __init__(self, login_id, transaction_key, debug=True, test=False):
        self.login_id = login_id
        self.transaction_key = transaction_key
        self.debug = debug
        self.test = test
        self._transaction = TransactionAPI(login_id, transaction_key, debug,
                                           test)
        self._transaction_detail = TransactionDetailAPI(
            login_id, transaction_key, debug, test)
        self._recurring = RecurringAPI(login_id, transaction_key, debug, test)
        self._customer = CustomerAPI(login_id, transaction_key, debug, test)

    def card(self, credit_card, address=None):
        """
        To work with a credit card, pass in a
        :class:`CreditCard <authorize.data.CreditCard>` instance, and
        optionally an :class:`Address <authorize.data.Address>` instance. This
        will return an
        :class:`AuthorizeCreditCard <authorize.client.AuthorizeCreditCard>`
        instance you can then use to execute transactions.
        """
        return AuthorizeCreditCard(self, credit_card, address=address)

    def transaction(self, uid):
        """
        To perform an action on a previous transaction, pass in the ``uid`` of
        that transaction as a string. This will return an
        :class:`AuthorizeTransaction <authorize.client.AuthorizeTransaction>`
        instance you can then use to settle, credit or void that transaction.
        """
        txn = AuthorizeTransaction(self, uid)
        txn.full_response = self._transaction_detail.details(uid)
        return txn

    def saved_card(self, uid):
        """
        To create a new transaction from a saved card, pass in the ``uid`` of
        the saved card as a string. This will return an
        :class:`AuthorizeSavedCard <authorize.client.AuthorizeSavedCard>`
        instance you can then use to auth, capture, or create a credit.
        """
        return AuthorizeSavedCard(self, uid)

    def recurring(self, uid):
        """
        To update or cancel an existing recurring payment, pass in the ``uid``
        of the recurring payment as a string. This will return an
        :class:`AuthorizeRecurring <authorize.client.AuthorizeRecurring>`
        instance you can then use to udpate or cancel the payments.
        """
        return AuthorizeRecurring(self, uid)