本文整理汇总了Python中braintree.transaction.Transaction类的典型用法代码示例。如果您正苦于以下问题:Python Transaction类的具体用法?Python Transaction怎么用?Python Transaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Transaction类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tr_data_for_credit
def tr_data_for_credit(self, tr_data, redirect_url):
if "transaction" not in tr_data:
tr_data["transaction"] = {}
tr_data["transaction"]["type"] = Transaction.Type.Credit
Resource.verify_keys(tr_data, [{"transaction": Transaction.create_signature()}])
tr_data["kind"] = TransparentRedirect.Kind.CreateTransaction
return self.gateway.transparent_redirect.tr_data(tr_data, redirect_url)
示例2: update_details
def update_details(self, transaction_id, params={}):
Resource.verify_keys(params, Transaction.update_details_signature())
response = self.config.http().put(self.config.base_merchant_path() + "/transactions/" + transaction_id + "/update_details",
{"transaction": params})
if "transaction" in response:
return SuccessfulResult({"transaction": Transaction(self.gateway, response["transaction"])})
elif "api_error_response" in response:
return ErrorResult(self.gateway, response["api_error_response"])
示例3: submit_for_settlement
def submit_for_settlement(self, transaction_id, amount=None, params={}):
Resource.verify_keys(params, Transaction.submit_for_settlement_signature())
transaction_params = {"amount": amount}
transaction_params.update(params)
response = self.config.http().put(self.config.base_merchant_path() + "/transactions/" + transaction_id + "/submit_for_settlement",
{"transaction": transaction_params})
if "transaction" in response:
return SuccessfulResult({"transaction": Transaction(self.gateway, response["transaction"])})
elif "api_error_response" in response:
return ErrorResult(self.gateway, response["api_error_response"])
示例4: refund
def refund(self, transaction_id, amount_or_options=None):
"""
Refunds an existing transaction. It expects a transaction_id. ::
result = braintree.Transaction.refund("my_transaction_id")
"""
if isinstance(amount_or_options, dict):
options = amount_or_options
else:
options = {
"amount": amount_or_options
}
Resource.verify_keys(options, Transaction.refund_signature())
response = self.config.http().post(self.config.base_merchant_path() + "/transactions/" + transaction_id + "/refund", {"transaction": options})
if "transaction" in response:
return SuccessfulResult({"transaction": Transaction(self.gateway, response["transaction"])})
elif "api_error_response" in response:
return ErrorResult(self.gateway, response["api_error_response"])
示例5: create
def create(self, params):
Resource.verify_keys(params, Transaction.create_signature())
return self._post("/transactions", {"transaction": params})
示例6: clone_transaction
def clone_transaction(self, transaction_id, params):
Resource.verify_keys(params, Transaction.clone_signature())
return self._post("/transactions/" + transaction_id + "/clone", {"transaction-clone": params})