File: transaction_line_item.py

package info (click to toggle)
python-braintree 4.31.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,576 kB
  • sloc: python: 28,946; makefile: 9; sh: 8
file content (35 lines) | stat: -rw-r--r-- 1,241 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import braintree
import warnings

from braintree.attribute_getter import AttributeGetter
from braintree.resource import Resource
from braintree.configuration import Configuration

class TransactionLineItem(AttributeGetter):
    pass

    # NEXT_MAJOR_VERSION this can be an enum! they were added as of python 3.4 and we support 3.5+
    class Kind(object):
        """
        Constants representing transaction line item kinds. Available kinds are:

        * braintree.TransactionLineItem.Kind.Credit
        * braintree.TransactionLineItem.Kind.Debit
        """

        Credit = "credit"
        Debit = "debit"

    def __init__(self, attributes):
        AttributeGetter.__init__(self, attributes)

    @staticmethod
    def find_all(transaction_id):
        """
        Find all line items on a transaction, given a transaction_id. This returns an array of TransactionLineItems.
        This will raise a :class:`NotFoundError <braintree.exceptions.not_found_error.NotFoundError>` if the provided
        transaction_id is not found. ::

            transaction_line_items = braintree.TransactionLineItem.find_all("my_transaction_id")
        """
        return Configuration.gateway().transaction_line_item.find_all(transaction_id)