Exemplo n.º 1
0
 def tr_data_for_update(tr_data, redirect_url):
     """
     Builds tr_data for CreditCard updating.
     """
     Resource.verify_keys(tr_data, ["payment_method_token", {"credit_card": CreditCard.update_signature()}])
     tr_data["kind"] = TransparentRedirect.Kind.UpdatePaymentMethod
     return TransparentRedirect.tr_data(tr_data, redirect_url)
Exemplo n.º 2
0
    def tr_data_for_create(tr_data, redirect_url):
        """
        Builds tr_data for CreditCard creation.
        """

        Resource.verify_keys(tr_data, [{"credit_card": CreditCard.create_signature()}])
        tr_data["kind"] = TransparentRedirect.Kind.CreatePaymentMethod
        return TransparentRedirect.tr_data(tr_data, redirect_url)
    def tr_data_for_sale(tr_data, redirect_url):
        """
        Builds tr_data for a Transaction of type Sale
        """

        if "transaction" not in tr_data:
            tr_data["transaction"] = {}
        tr_data["transaction"]["type"] = Transaction.Type.Sale
        Resource.verify_keys(tr_data, [{"transaction": Transaction.create_signature()}])
        tr_data["kind"] = TransparentRedirect.Kind.CreateTransaction
        return TransparentRedirect.tr_data(tr_data, redirect_url)
    def confirm_transparent_redirect(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.Transaction.confirm_transparent_redirect_request("foo=bar&id=12345")
        """

        warnings.warn("Please use TransparentRedirect.confirm instead", DeprecationWarning)
        id = TransparentRedirect.parse_and_validate_query_string(query_string)["id"][0]
        return Transaction._post("/transactions/all/confirm_transparent_redirect_request", {"id": id})
Exemplo n.º 5
0
    def confirm_transparent_redirect(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.CreditCard.confirm_transparent_redirect_request("foo=bar&id=12345")
        """

        warnings.warn("Please use TransparentRedirect.confirm instead", DeprecationWarning)
        id = TransparentRedirect.parse_and_validate_query_string(query_string)["id"][0]
        return CreditCard._post("/payment_methods/all/confirm_transparent_redirect_request", {"id": id})
Exemplo n.º 6
0
    def tr_data_for_sale(tr_data, redirect_url):
        """
        Builds tr_data for a Transaction of type Sale
        """

        if "transaction" not in tr_data:
            tr_data["transaction"] = {}
        tr_data["transaction"]["type"] = Transaction.Type.Sale
        Resource.verify_keys(tr_data,
                             [{
                                 "transaction": Transaction.create_signature()
                             }])
        tr_data["kind"] = TransparentRedirect.Kind.CreateTransaction
        return TransparentRedirect.tr_data(tr_data, redirect_url)
Exemplo n.º 7
0
    def tr_data_for_update(tr_data, redirect_url):
        """ Builds tr_data for updating a Customer. """

        Resource.verify_keys(tr_data, [{"customer": Customer.update_signature()}])
        tr_data["kind"] = TransparentRedirect.Kind.UpdateCustomer
        return TransparentRedirect.tr_data(tr_data, redirect_url)