File: transparent_redirect.py

package info (click to toggle)
python-braintree 3.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,376 kB
  • ctags: 1,998
  • sloc: python: 13,634; makefile: 73; sh: 8
file content (37 lines) | stat: -rw-r--r-- 1,186 bytes parent folder | download | duplicates (5)
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
36
37
import braintree
from braintree.configuration import Configuration

class TransparentRedirect:
    """
    A class used for Transparent Redirect operations
    """

    class Kind(object):
        CreateCustomer = "create_customer"
        UpdateCustomer = "update_customer"
        CreatePaymentMethod = "create_payment_method"
        UpdatePaymentMethod = "update_payment_method"
        CreateTransaction = "create_transaction"

    @staticmethod
    def confirm(query_string):
        """
        Confirms a transparent redirect request. It expects the query string from the
        redirect request. The query string should _not_ include the leading "?" character. ::

            result = braintree.TransparentRedirect.confirm("foo=bar&id=12345")
        """
        return Configuration.gateway().transparent_redirect.confirm(query_string)


    @staticmethod
    def tr_data(data, redirect_url):
        return Configuration.gateway().transparent_redirect.tr_data(data, redirect_url)

    @staticmethod
    def url():
        """
        Returns the url for POSTing Transparent Redirect HTML forms
        """
        return Configuration.gateway().transparent_redirect.url()