index
int64 0
731k
| package
stringlengths 2
98
⌀ | name
stringlengths 1
76
| docstring
stringlengths 0
281k
⌀ | code
stringlengths 4
1.07M
⌀ | signature
stringlengths 2
42.8k
⌀ |
|---|---|---|---|---|---|
712,541
|
braintree.transaction_gateway
|
create
| null |
def create(self, params):
Resource.verify_keys(params, Transaction.create_signature())
self.__check_for_deprecated_attributes(params)
return self._post("/transactions", {"transaction": params})
|
(self, params)
|
712,542
|
braintree.transaction_gateway
|
credit
| null |
def credit(self, params):
if params is None:
params = {}
params["type"] = Transaction.Type.Credit
return self.create(params)
|
(self, params)
|
712,543
|
braintree.transaction_gateway
|
find
| null |
def find(self, transaction_id):
try:
if transaction_id is None or transaction_id.strip() == "":
raise NotFoundError()
response = self.config.http().get(self.config.base_merchant_path() + "/transactions/" + transaction_id)
return Transaction(self.gateway, response["transaction"])
except NotFoundError:
raise NotFoundError("transaction with id " + repr(transaction_id) + " not found")
|
(self, transaction_id)
|
712,544
|
braintree.transaction_gateway
|
hold_in_escrow
|
Holds an existing submerchant transaction for escrow. It expects a transaction_id. ::
result = braintree.Transaction.hold_in_escrow("my_transaction_id")
|
def hold_in_escrow(self, transaction_id):
"""
Holds an existing submerchant transaction for escrow. It expects a transaction_id. ::
result = braintree.Transaction.hold_in_escrow("my_transaction_id")
"""
response = self.config.http().put(self.config.base_merchant_path() + "/transactions/" + transaction_id + "/hold_in_escrow", {})
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"])
|
(self, transaction_id)
|
712,545
|
braintree.transaction_gateway
|
package_tracking
| null |
def package_tracking(self, transaction_id, params=None):
try:
if params is None:
params = {}
if transaction_id is None or transaction_id.strip() == "":
raise NotFoundError()
Resource.verify_keys(params, Transaction.package_tracking_signature())
response = self.config.http().post(self.config.base_merchant_path() + "/transactions/" + transaction_id + "/shipments", {"shipment": 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"])
except NotFoundError:
raise NotFoundError("transaction with id " + repr(transaction_id) + " not found")
|
(self, transaction_id, params=None)
|
712,546
|
braintree.transaction_gateway
|
refund
|
Refunds an existing transaction. It expects a transaction_id. ::
result = braintree.Transaction.refund("my_transaction_id")
|
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"])
|
(self, transaction_id, amount_or_options=None)
|
712,547
|
braintree.transaction_gateway
|
release_from_escrow
| null |
def release_from_escrow(self, transaction_id):
response = self.config.http().put(self.config.base_merchant_path() + "/transactions/" + transaction_id + "/release_from_escrow", {})
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"])
|
(self, transaction_id)
|
712,548
|
braintree.transaction_gateway
|
sale
| null |
def sale(self, params):
if "recurring" in params.keys():
warnings.warn("Use transaction_source parameter instead", DeprecationWarning)
params.update({"type": "sale"})
return self.create(params)
|
(self, params)
|
712,549
|
braintree.transaction_gateway
|
search
| null |
def search(self, *query):
if isinstance(query[0], list):
query = query[0]
response = self.config.http().post(self.config.base_merchant_path() + "/transactions/advanced_search_ids", {"search": self.__criteria(query)})
if "search_results" in response:
return ResourceCollection(query, response, self.__fetch)
else:
raise RequestTimeoutError("search timeout")
|
(self, *query)
|
712,550
|
braintree.transaction_gateway
|
submit_for_partial_settlement
| null |
def submit_for_partial_settlement(self, transaction_id, amount, params=None):
if params is None:
params = {}
Resource.verify_keys(params, Transaction.submit_for_settlement_signature())
transaction_params = {"amount": amount}
transaction_params.update(params)
response = self.config.http().post(self.config.base_merchant_path() + "/transactions/" + transaction_id + "/submit_for_partial_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"])
|
(self, transaction_id, amount, params=None)
|
712,551
|
braintree.transaction_gateway
|
submit_for_settlement
| null |
def submit_for_settlement(self, transaction_id, amount=None, params=None):
if params is 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"])
|
(self, transaction_id, amount=None, params=None)
|
712,552
|
braintree.transaction_gateway
|
update_details
| null |
def update_details(self, transaction_id, params=None):
if params is None:
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"])
|
(self, transaction_id, params=None)
|
712,553
|
braintree.transaction_gateway
|
void
| null |
def void(self, transaction_id):
response = self.config.http().put(self.config.base_merchant_path() + "/transactions/" + transaction_id + "/void")
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"])
|
(self, transaction_id)
|
712,554
|
braintree.transaction_line_item
|
TransactionLineItem
| null |
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)
|
(attributes)
|
712,555
|
braintree.transaction_line_item
|
__init__
| null |
def __init__(self, attributes):
AttributeGetter.__init__(self, attributes)
|
(self, attributes)
|
712,557
|
braintree.transaction_line_item
|
find_all
|
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")
|
@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)
|
(transaction_id)
|
712,558
|
braintree.transaction_search
|
TransactionSearch
| null |
class TransactionSearch:
billing_first_name = Search.TextNodeBuilder("billing_first_name")
billing_company = Search.TextNodeBuilder("billing_company")
billing_country_name = Search.TextNodeBuilder("billing_country_name")
billing_extended_address = Search.TextNodeBuilder("billing_extended_address")
billing_first_name = Search.TextNodeBuilder("billing_first_name")
billing_last_name = Search.TextNodeBuilder("billing_last_name")
billing_locality = Search.TextNodeBuilder("billing_locality")
billing_postal_code = Search.TextNodeBuilder("billing_postal_code")
billing_region = Search.TextNodeBuilder("billing_region")
billing_street_address = Search.TextNodeBuilder("billing_street_address")
credit_card_cardholder_name = Search.TextNodeBuilder("credit_card_cardholder_name")
currency = Search.TextNodeBuilder("currency")
customer_company = Search.TextNodeBuilder("customer_company")
customer_email = Search.TextNodeBuilder("customer_email")
customer_fax = Search.TextNodeBuilder("customer_fax")
customer_first_name = Search.TextNodeBuilder("customer_first_name")
customer_id = Search.TextNodeBuilder("customer_id")
customer_last_name = Search.TextNodeBuilder("customer_last_name")
customer_phone = Search.TextNodeBuilder("customer_phone")
customer_website = Search.TextNodeBuilder("customer_website")
id = Search.TextNodeBuilder("id")
order_id = Search.TextNodeBuilder("order_id")
payment_method_token = Search.TextNodeBuilder("payment_method_token")
processor_authorization_code = Search.TextNodeBuilder("processor_authorization_code")
europe_bank_account_iban = Search.TextNodeBuilder("europe_bank_account_iban")
settlement_batch_id = Search.TextNodeBuilder("settlement_batch_id")
shipping_company = Search.TextNodeBuilder("shipping_company")
shipping_country_name = Search.TextNodeBuilder("shipping_country_name")
shipping_extended_address = Search.TextNodeBuilder("shipping_extended_address")
shipping_first_name = Search.TextNodeBuilder("shipping_first_name")
shipping_last_name = Search.TextNodeBuilder("shipping_last_name")
shipping_locality = Search.TextNodeBuilder("shipping_locality")
shipping_postal_code = Search.TextNodeBuilder("shipping_postal_code")
shipping_region = Search.TextNodeBuilder("shipping_region")
shipping_street_address = Search.TextNodeBuilder("shipping_street_address")
paypal_payer_email = Search.TextNodeBuilder("paypal_payer_email")
paypal_payment_id = Search.TextNodeBuilder("paypal_payment_id")
paypal_authorization_id = Search.TextNodeBuilder("paypal_authorization_id")
sepa_debit_paypal_v2_order_id = Search.TextNodeBuilder("sepa_debit_paypal_v2_order_id")
credit_card_unique_identifier = Search.TextNodeBuilder("credit_card_unique_identifier")
store_id = Search.TextNodeBuilder("store_id")
credit_card_expiration_date = Search.EqualityNodeBuilder("credit_card_expiration_date")
credit_card_number = Search.PartialMatchNodeBuilder("credit_card_number")
user = Search.MultipleValueNodeBuilder("user")
ids = Search.MultipleValueNodeBuilder("ids")
merchant_account_id = Search.MultipleValueNodeBuilder("merchant_account_id")
payment_instrument_type = Search.MultipleValueNodeBuilder("payment_instrument_type")
store_ids = Search.MultipleValueNodeBuilder("store_ids")
created_using = Search.MultipleValueNodeBuilder(
"created_using",
Constants.get_all_constant_values_from_class(Transaction.CreatedUsing)
)
credit_card_card_type = Search.MultipleValueNodeBuilder(
"credit_card_card_type",
Constants.get_all_constant_values_from_class(CreditCard.CardType)
)
credit_card_customer_location = Search.MultipleValueNodeBuilder(
"credit_card_customer_location",
Constants.get_all_constant_values_from_class(CreditCard.CustomerLocation)
)
debit_network = Search.MultipleValueNodeBuilder(
"debit_network",
Constants.get_all_enum_values(CreditCard.DebitNetwork)
)
source = Search.MultipleValueNodeBuilder("source")
status = Search.MultipleValueNodeBuilder(
"status",
Constants.get_all_constant_values_from_class(Transaction.Status)
)
type = Search.MultipleValueNodeBuilder(
"type",
Constants.get_all_constant_values_from_class(Transaction.Type)
)
refund = Search.KeyValueNodeBuilder("refund")
amount = Search.RangeNodeBuilder("amount")
authorization_expired_at = Search.RangeNodeBuilder("authorization_expired_at")
authorized_at = Search.RangeNodeBuilder("authorized_at")
created_at = Search.RangeNodeBuilder("created_at")
disbursement_date = Search.RangeNodeBuilder("disbursement_date")
dispute_date = Search.RangeNodeBuilder("dispute_date")
failed_at = Search.RangeNodeBuilder("failed_at")
gateway_rejected_at = Search.RangeNodeBuilder("gateway_rejected_at")
processor_declined_at = Search.RangeNodeBuilder("processor_declined_at")
settled_at = Search.RangeNodeBuilder("settled_at")
submitted_for_settlement_at = Search.RangeNodeBuilder("submitted_for_settlement_at")
voided_at = Search.RangeNodeBuilder("voided_at")
ach_return_responses_created_at = Search.RangeNodeBuilder("ach_return_responses_created_at")
reason_code = Search.MultipleValueNodeBuilder('reason_code')
|
()
|
712,559
|
braintree.unknown_payment_method
|
UnknownPaymentMethod
| null |
class UnknownPaymentMethod(Resource):
def image_url(self):
return "https://assets.braintreegateway.com/payment_method_logo/unknown.png"
|
(gateway, attributes)
|
712,565
|
braintree.unknown_payment_method
|
image_url
| null |
def image_url(self):
return "https://assets.braintreegateway.com/payment_method_logo/unknown.png"
|
(self)
|
712,567
|
braintree.us_bank_account
|
UsBankAccount
| null |
class UsBankAccount(Resource):
@staticmethod
def find(token):
return Configuration.gateway().us_bank_account.find(token)
@staticmethod
def sale(token, transactionRequest):
transactionRequest["payment_method_token"] = token
if not "options" in transactionRequest:
transactionRequest["options"] = {}
transactionRequest["options"]["submit_for_settlement"] = True
return Configuration.gateway().transaction.sale(transactionRequest)
@staticmethod
def signature():
signature = [
"routing_number",
"last_4",
"account_type",
"account_holder_name",
"token",
"image_url",
"bank_name",
"ach_mandate"
]
return signature
def __init__(self, gateway, attributes):
Resource.__init__(self, gateway, attributes)
if attributes.get("ach_mandate") is not None:
self.ach_mandate = AchMandate(gateway, self.ach_mandate)
else:
self.ach_mandate = None
if attributes.get("verifications") is not None:
self.verifications = [UsBankAccountVerification(gateway, v) for v in self.verifications]
else:
self.verifications = None
|
(gateway, attributes)
|
712,571
|
braintree.us_bank_account
|
__init__
| null |
def __init__(self, gateway, attributes):
Resource.__init__(self, gateway, attributes)
if attributes.get("ach_mandate") is not None:
self.ach_mandate = AchMandate(gateway, self.ach_mandate)
else:
self.ach_mandate = None
if attributes.get("verifications") is not None:
self.verifications = [UsBankAccountVerification(gateway, v) for v in self.verifications]
else:
self.verifications = None
|
(self, gateway, attributes)
|
712,573
|
braintree.us_bank_account
|
find
| null |
@staticmethod
def find(token):
return Configuration.gateway().us_bank_account.find(token)
|
(token)
|
712,574
|
braintree.us_bank_account
|
sale
| null |
@staticmethod
def sale(token, transactionRequest):
transactionRequest["payment_method_token"] = token
if not "options" in transactionRequest:
transactionRequest["options"] = {}
transactionRequest["options"]["submit_for_settlement"] = True
return Configuration.gateway().transaction.sale(transactionRequest)
|
(token, transactionRequest)
|
712,575
|
braintree.us_bank_account
|
signature
| null |
@staticmethod
def signature():
signature = [
"routing_number",
"last_4",
"account_type",
"account_holder_name",
"token",
"image_url",
"bank_name",
"ach_mandate"
]
return signature
|
()
|
712,577
|
braintree.validation_error_collection
|
ValidationErrorCollection
|
A class representing a collection of validation errors.
For more information on ValidationErrors, see https://developer.paypal.com/braintree/docs/reference/general/validation-errors/overview/python
|
class ValidationErrorCollection(object):
"""
A class representing a collection of validation errors.
For more information on ValidationErrors, see https://developer.paypal.com/braintree/docs/reference/general/validation-errors/overview/python
"""
def __init__(self, data=None):
if data is None:
data = {"errors": []}
self.data = data
@property
def deep_errors(self):
"""
Return all :class:`ValidationErrors <braintree.validation_error.ValidationError>`, including nested errors.
"""
result = []
result.extend(self.errors)
for nested_error in self.__nested_errors.values():
result.extend(nested_error.deep_errors)
return result
def for_index(self, index):
return self.for_object("index_%s" % index)
def for_object(self, nested_key):
"""
Returns a :class:`ValidationErrorCollection <braintree.validation_error_collection.ValidationErrorCollection>`
It represents the errors at the nested level:::
error_result = Transaction.sale({"credit_card": {"number": "invalid"}})
print error_result.errors.for_object("transaction").for_object("credit_card").on("number")[0].code
"""
return self.__get_nested_errors(nested_key)
def on(self, attribute):
"""
Returns the list of errors
Restricted to a given attribute::
error_result = Transaction.sale({"credit_card": {"number": "invalid"}})
print [ error.code for error in error_result.errors.for_object("transaction").for_object("credit_card").on("number") ]
"""
return [error for error in self.errors if error.attribute == attribute]
@property
def deep_size(self):
"""Returns the number of errors on this object and any nested objects."""
size = len(self.errors)
for error in self.__nested_errors.values():
size += error.deep_size
return size
@property
def errors(self):
"""Returns a list of :class:`ValidationError <braintree.validation_error.ValidationError>` objects."""
return [ValidationError(error) for error in self.data["errors"]]
@property
def size(self):
"""Returns the number of errors on this object, without counting nested errors."""
return len(self.errors)
def __get_nested_errors(self, nested_key):
if nested_key in self.__nested_errors:
return self.__nested_errors[nested_key]
else:
return ValidationErrorCollection()
def __getitem__(self, index):
return self.errors[index]
def __len__(self):
return self.size
@property
def __nested_errors(self):
nested_errors = {}
for key in self.data:
if key == "errors":
continue
nested_errors[key] = ValidationErrorCollection(self.data[key])
return nested_errors
|
(data=None)
|
712,578
|
braintree.validation_error_collection
|
__get_nested_errors
| null |
def __get_nested_errors(self, nested_key):
if nested_key in self.__nested_errors:
return self.__nested_errors[nested_key]
else:
return ValidationErrorCollection()
|
(self, nested_key)
|
712,579
|
braintree.validation_error_collection
|
__getitem__
| null |
def __getitem__(self, index):
return self.errors[index]
|
(self, index)
|
712,580
|
braintree.validation_error_collection
|
__init__
| null |
def __init__(self, data=None):
if data is None:
data = {"errors": []}
self.data = data
|
(self, data=None)
|
712,582
|
braintree.validation_error_collection
|
for_index
| null |
def for_index(self, index):
return self.for_object("index_%s" % index)
|
(self, index)
|
712,583
|
braintree.validation_error_collection
|
for_object
|
Returns a :class:`ValidationErrorCollection <braintree.validation_error_collection.ValidationErrorCollection>`
It represents the errors at the nested level:::
error_result = Transaction.sale({"credit_card": {"number": "invalid"}})
print error_result.errors.for_object("transaction").for_object("credit_card").on("number")[0].code
|
def for_object(self, nested_key):
"""
Returns a :class:`ValidationErrorCollection <braintree.validation_error_collection.ValidationErrorCollection>`
It represents the errors at the nested level:::
error_result = Transaction.sale({"credit_card": {"number": "invalid"}})
print error_result.errors.for_object("transaction").for_object("credit_card").on("number")[0].code
"""
return self.__get_nested_errors(nested_key)
|
(self, nested_key)
|
712,584
|
braintree.validation_error_collection
|
on
|
Returns the list of errors
Restricted to a given attribute::
error_result = Transaction.sale({"credit_card": {"number": "invalid"}})
print [ error.code for error in error_result.errors.for_object("transaction").for_object("credit_card").on("number") ]
|
def on(self, attribute):
"""
Returns the list of errors
Restricted to a given attribute::
error_result = Transaction.sale({"credit_card": {"number": "invalid"}})
print [ error.code for error in error_result.errors.for_object("transaction").for_object("credit_card").on("number") ]
"""
return [error for error in self.errors if error.attribute == attribute]
|
(self, attribute)
|
712,585
|
braintree.venmo_account
|
VenmoAccount
|
A class representing Braintree Venmo accounts.
|
class VenmoAccount(Resource):
"""
A class representing Braintree Venmo accounts.
"""
def __init__(self, gateway, attributes):
Resource.__init__(self, gateway, attributes)
if "subscriptions" in attributes:
self.subscriptions = [braintree.subscription.Subscription(gateway, subscription) for subscription in self.subscriptions]
|
(gateway, attributes)
|
712,592
|
braintree.venmo_profile_data
|
VenmoProfileData
|
A class representing Braintree VenmoProfileData object.
|
class VenmoProfileData(Resource):
"""
A class representing Braintree VenmoProfileData object.
"""
def __init__(self, gateway, attributes):
Resource.__init__(self, gateway, attributes)
|
(gateway, attributes)
|
712,599
|
braintree.webhook_notification
|
WebhookNotification
| null |
class WebhookNotification(Resource):
class Kind(object):
AccountUpdaterDailyReport = "account_updater_daily_report"
Check = "check"
ConnectedMerchantPayPalStatusChanged = "connected_merchant_paypal_status_changed"
ConnectedMerchantStatusTransitioned = "connected_merchant_status_transitioned"
Disbursement = "disbursement"
DisbursementException = "disbursement_exception"
DisputeAccepted = "dispute_accepted"
DisputeAutoAccepted = "dispute_auto_accepted"
DisputeDisputed = "dispute_disputed"
DisputeExpired = "dispute_expired"
DisputeLost = "dispute_lost"
DisputeOpened = "dispute_opened"
DisputeUnderReview = "dispute_under_review"
DisputeWon = "dispute_won"
GrantedPaymentMethodRevoked = "granted_payment_method_revoked"
GrantorUpdatedGrantedPaymentMethod = "grantor_updated_granted_payment_method"
LocalPaymentCompleted = "local_payment_completed"
LocalPaymentExpired = "local_payment_expired"
LocalPaymentFunded = "local_payment_funded"
LocalPaymentReversed = "local_payment_reversed"
OAuthAccessRevoked = "oauth_access_revoked"
PartnerMerchantConnected = "partner_merchant_connected"
PartnerMerchantDeclined = "partner_merchant_declined"
PartnerMerchantDisconnected = "partner_merchant_disconnected"
PaymentMethodCustomerDataUpdated = "payment_method_customer_data_updated"
PaymentMethodRevokedByCustomer = "payment_method_revoked_by_customer"
RecipientUpdatedGrantedPaymentMethod = "recipient_updated_granted_payment_method"
SubMerchantAccountApproved = "sub_merchant_account_approved"
SubMerchantAccountDeclined = "sub_merchant_account_declined"
SubscriptionBillingSkipped = "subscription_billing_skipped"
SubscriptionCanceled = "subscription_canceled"
SubscriptionChargedSuccessfully = "subscription_charged_successfully"
SubscriptionChargedUnsuccessfully = "subscription_charged_unsuccessfully"
SubscriptionExpired = "subscription_expired"
SubscriptionTrialEnded = "subscription_trial_ended"
SubscriptionWentActive = "subscription_went_active"
SubscriptionWentPastDue = "subscription_went_past_due"
TransactionDisbursed = "transaction_disbursed"
TransactionReviewed = "transaction_reviewed"
TransactionSettled = "transaction_settled"
TransactionSettlementDeclined = "transaction_settlement_declined"
@staticmethod
def parse(signature, payload):
return Configuration.gateway().webhook_notification.parse(signature, payload)
@staticmethod
def verify(challenge):
return Configuration.gateway().webhook_notification.verify(challenge)
def __init__(self, gateway, attributes):
Resource.__init__(self, gateway, attributes)
if "source_merchant_id" not in attributes:
self.source_merchant_id = None
if "api_error_response" in attributes["subject"]:
node_wrapper = attributes["subject"]["api_error_response"]
else:
node_wrapper = attributes["subject"]
if "subscription" in node_wrapper:
self.subscription = Subscription(gateway, node_wrapper['subscription'])
elif "merchant_account" in node_wrapper:
self.merchant_account = MerchantAccount(gateway, node_wrapper['merchant_account'])
elif "transaction" in node_wrapper:
self.transaction = Transaction(gateway, node_wrapper['transaction'])
elif "transaction_review" in node_wrapper:
self.transaction_review = TransactionReview(node_wrapper['transaction_review'])
elif "connected_merchant_status_transitioned" in node_wrapper:
self.connected_merchant_status_transitioned = ConnectedMerchantStatusTransitioned(gateway, node_wrapper['connected_merchant_status_transitioned'])
elif "connected_merchant_paypal_status_changed" in node_wrapper:
self.connected_merchant_paypal_status_changed = ConnectedMerchantPayPalStatusChanged(gateway, node_wrapper['connected_merchant_paypal_status_changed'])
elif "partner_merchant" in node_wrapper:
self.partner_merchant = PartnerMerchant(gateway, node_wrapper['partner_merchant'])
elif "oauth_application_revocation" in node_wrapper:
self.oauth_access_revocation = OAuthAccessRevocation(node_wrapper["oauth_application_revocation"])
elif "disbursement" in node_wrapper:
self.disbursement = Disbursement(gateway, node_wrapper['disbursement'])
elif "dispute" in node_wrapper:
self.dispute = Dispute(node_wrapper['dispute'])
elif "account_updater_daily_report" in node_wrapper:
self.account_updater_daily_report = AccountUpdaterDailyReport(gateway, node_wrapper['account_updater_daily_report'])
elif "granted_payment_instrument_update" in node_wrapper:
self.granted_payment_instrument_update = GrantedPaymentInstrumentUpdate(gateway, node_wrapper["granted_payment_instrument_update"])
elif attributes["kind"] in [WebhookNotification.Kind.GrantedPaymentMethodRevoked, WebhookNotification.Kind.PaymentMethodRevokedByCustomer]:
self.revoked_payment_method_metadata = RevokedPaymentMethodMetadata(gateway, node_wrapper)
elif "local_payment" in node_wrapper and attributes["kind"] == WebhookNotification.Kind.LocalPaymentCompleted:
self.local_payment_completed = LocalPaymentCompleted(gateway, node_wrapper["local_payment"])
elif "local_payment_expired" in node_wrapper and attributes["kind"] == WebhookNotification.Kind.LocalPaymentExpired:
self.local_payment_expired = LocalPaymentExpired(gateway, node_wrapper["local_payment_expired"])
elif "local_payment_funded" in node_wrapper and attributes["kind"] == WebhookNotification.Kind.LocalPaymentFunded:
self.local_payment_funded = LocalPaymentFunded(gateway, node_wrapper["local_payment_funded"])
elif "local_payment_reversed" in node_wrapper and attributes["kind"] == WebhookNotification.Kind.LocalPaymentReversed:
self.local_payment_reversed = LocalPaymentReversed(gateway, node_wrapper["local_payment_reversed"])
elif "payment_method_customer_data_updated_metadata" in node_wrapper and attributes["kind"] == WebhookNotification.Kind.PaymentMethodCustomerDataUpdated:
self.payment_method_customer_data_updated_metadata = PaymentMethodCustomerDataUpdatedMetadata(gateway, node_wrapper["payment_method_customer_data_updated_metadata"])
if "errors" in node_wrapper:
self.errors = ValidationErrorCollection(node_wrapper['errors'])
self.message = node_wrapper['message']
|
(gateway, attributes)
|
712,603
|
braintree.webhook_notification
|
__init__
| null |
def __init__(self, gateway, attributes):
Resource.__init__(self, gateway, attributes)
if "source_merchant_id" not in attributes:
self.source_merchant_id = None
if "api_error_response" in attributes["subject"]:
node_wrapper = attributes["subject"]["api_error_response"]
else:
node_wrapper = attributes["subject"]
if "subscription" in node_wrapper:
self.subscription = Subscription(gateway, node_wrapper['subscription'])
elif "merchant_account" in node_wrapper:
self.merchant_account = MerchantAccount(gateway, node_wrapper['merchant_account'])
elif "transaction" in node_wrapper:
self.transaction = Transaction(gateway, node_wrapper['transaction'])
elif "transaction_review" in node_wrapper:
self.transaction_review = TransactionReview(node_wrapper['transaction_review'])
elif "connected_merchant_status_transitioned" in node_wrapper:
self.connected_merchant_status_transitioned = ConnectedMerchantStatusTransitioned(gateway, node_wrapper['connected_merchant_status_transitioned'])
elif "connected_merchant_paypal_status_changed" in node_wrapper:
self.connected_merchant_paypal_status_changed = ConnectedMerchantPayPalStatusChanged(gateway, node_wrapper['connected_merchant_paypal_status_changed'])
elif "partner_merchant" in node_wrapper:
self.partner_merchant = PartnerMerchant(gateway, node_wrapper['partner_merchant'])
elif "oauth_application_revocation" in node_wrapper:
self.oauth_access_revocation = OAuthAccessRevocation(node_wrapper["oauth_application_revocation"])
elif "disbursement" in node_wrapper:
self.disbursement = Disbursement(gateway, node_wrapper['disbursement'])
elif "dispute" in node_wrapper:
self.dispute = Dispute(node_wrapper['dispute'])
elif "account_updater_daily_report" in node_wrapper:
self.account_updater_daily_report = AccountUpdaterDailyReport(gateway, node_wrapper['account_updater_daily_report'])
elif "granted_payment_instrument_update" in node_wrapper:
self.granted_payment_instrument_update = GrantedPaymentInstrumentUpdate(gateway, node_wrapper["granted_payment_instrument_update"])
elif attributes["kind"] in [WebhookNotification.Kind.GrantedPaymentMethodRevoked, WebhookNotification.Kind.PaymentMethodRevokedByCustomer]:
self.revoked_payment_method_metadata = RevokedPaymentMethodMetadata(gateway, node_wrapper)
elif "local_payment" in node_wrapper and attributes["kind"] == WebhookNotification.Kind.LocalPaymentCompleted:
self.local_payment_completed = LocalPaymentCompleted(gateway, node_wrapper["local_payment"])
elif "local_payment_expired" in node_wrapper and attributes["kind"] == WebhookNotification.Kind.LocalPaymentExpired:
self.local_payment_expired = LocalPaymentExpired(gateway, node_wrapper["local_payment_expired"])
elif "local_payment_funded" in node_wrapper and attributes["kind"] == WebhookNotification.Kind.LocalPaymentFunded:
self.local_payment_funded = LocalPaymentFunded(gateway, node_wrapper["local_payment_funded"])
elif "local_payment_reversed" in node_wrapper and attributes["kind"] == WebhookNotification.Kind.LocalPaymentReversed:
self.local_payment_reversed = LocalPaymentReversed(gateway, node_wrapper["local_payment_reversed"])
elif "payment_method_customer_data_updated_metadata" in node_wrapper and attributes["kind"] == WebhookNotification.Kind.PaymentMethodCustomerDataUpdated:
self.payment_method_customer_data_updated_metadata = PaymentMethodCustomerDataUpdatedMetadata(gateway, node_wrapper["payment_method_customer_data_updated_metadata"])
if "errors" in node_wrapper:
self.errors = ValidationErrorCollection(node_wrapper['errors'])
self.message = node_wrapper['message']
|
(self, gateway, attributes)
|
712,605
|
braintree.webhook_notification
|
parse
| null |
@staticmethod
def parse(signature, payload):
return Configuration.gateway().webhook_notification.parse(signature, payload)
|
(signature, payload)
|
712,606
|
braintree.webhook_notification
|
verify
| null |
@staticmethod
def verify(challenge):
return Configuration.gateway().webhook_notification.verify(challenge)
|
(challenge)
|
712,608
|
braintree.webhook_notification_gateway
|
WebhookNotificationGateway
| null |
class WebhookNotificationGateway(object):
def __init__(self, gateway):
self.gateway = gateway
self.config = gateway.config
def parse(self, signature, payload):
if signature is None:
raise InvalidSignatureError("signature cannot be blank")
if payload is None:
raise InvalidSignatureError("payload cannot be blank")
if isinstance(payload, text_type):
payload = payload.encode('ascii')
if re.search(b"[^A-Za-z0-9+=/\n]", payload):
raise InvalidSignatureError("payload contains illegal characters")
self.__validate_signature(signature, payload)
attributes = XmlUtil.dict_from_xml(decodebytes(payload))
return WebhookNotification(self.gateway, attributes['notification'])
def verify(self, challenge):
if not re.match("^[a-f0-9]{20,32}$", challenge):
raise InvalidChallengeError("challenge contains non-hex characters")
digest = Crypto.sha1_hmac_hash(self.config.private_key, challenge)
return "%s|%s" % (self.config.public_key, digest)
def __matching_signature(self, signature_pairs):
for public_key, signature in signature_pairs:
if public_key == self.config.public_key:
return signature
return None
def __validate_signature(self, signature_string, payload):
signature_pairs = [pair.split("|") for pair in signature_string.split("&") if "|" in pair]
signature = self.__matching_signature(signature_pairs)
if not signature:
raise InvalidSignatureError("no matching public key")
if not any(self.__payload_matches(signature, p) for p in [payload, payload + b"\n"]):
raise InvalidSignatureError("signature does not match payload - one has been modified")
def __payload_matches(self, signature, payload):
payload_signature = Crypto.sha1_hmac_hash(self.config.private_key, payload)
return Crypto.secure_compare(payload_signature, signature)
|
(gateway)
|
712,609
|
braintree.webhook_notification_gateway
|
__matching_signature
| null |
def __matching_signature(self, signature_pairs):
for public_key, signature in signature_pairs:
if public_key == self.config.public_key:
return signature
return None
|
(self, signature_pairs)
|
712,610
|
braintree.webhook_notification_gateway
|
__payload_matches
| null |
def __payload_matches(self, signature, payload):
payload_signature = Crypto.sha1_hmac_hash(self.config.private_key, payload)
return Crypto.secure_compare(payload_signature, signature)
|
(self, signature, payload)
|
712,611
|
braintree.webhook_notification_gateway
|
__validate_signature
| null |
def __validate_signature(self, signature_string, payload):
signature_pairs = [pair.split("|") for pair in signature_string.split("&") if "|" in pair]
signature = self.__matching_signature(signature_pairs)
if not signature:
raise InvalidSignatureError("no matching public key")
if not any(self.__payload_matches(signature, p) for p in [payload, payload + b"\n"]):
raise InvalidSignatureError("signature does not match payload - one has been modified")
|
(self, signature_string, payload)
|
712,613
|
braintree.webhook_notification_gateway
|
parse
| null |
def parse(self, signature, payload):
if signature is None:
raise InvalidSignatureError("signature cannot be blank")
if payload is None:
raise InvalidSignatureError("payload cannot be blank")
if isinstance(payload, text_type):
payload = payload.encode('ascii')
if re.search(b"[^A-Za-z0-9+=/\n]", payload):
raise InvalidSignatureError("payload contains illegal characters")
self.__validate_signature(signature, payload)
attributes = XmlUtil.dict_from_xml(decodebytes(payload))
return WebhookNotification(self.gateway, attributes['notification'])
|
(self, signature, payload)
|
712,614
|
braintree.webhook_notification_gateway
|
verify
| null |
def verify(self, challenge):
if not re.match("^[a-f0-9]{20,32}$", challenge):
raise InvalidChallengeError("challenge contains non-hex characters")
digest = Crypto.sha1_hmac_hash(self.config.private_key, challenge)
return "%s|%s" % (self.config.public_key, digest)
|
(self, challenge)
|
712,615
|
braintree.webhook_testing
|
WebhookTesting
| null |
class WebhookTesting(object):
@staticmethod
def sample_notification(kind, id, source_merchant_id=None):
return Configuration.gateway().webhook_testing.sample_notification(kind, id, source_merchant_id)
|
()
|
712,616
|
braintree.webhook_testing
|
sample_notification
| null |
@staticmethod
def sample_notification(kind, id, source_merchant_id=None):
return Configuration.gateway().webhook_testing.sample_notification(kind, id, source_merchant_id)
|
(kind, id, source_merchant_id=None)
|
712,617
|
braintree.webhook_testing_gateway
|
WebhookTestingGateway
| null |
class WebhookTestingGateway(object):
def __init__(self, gateway):
self.gateway = gateway
self.config = gateway.config
def sample_notification(self, kind, id, source_merchant_id=None):
payload = encodebytes(self.__sample_xml(kind, id, source_merchant_id))
hmac_payload = Crypto.sha1_hmac_hash(self.gateway.config.private_key, payload)
signature = "%s|%s" % (self.gateway.config.public_key, hmac_payload)
return {'bt_signature': signature, 'bt_payload': payload}
def __sample_xml(self, kind, id, source_merchant_id):
timestamp = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
source_merchant_id_xml = ''
if source_merchant_id is not None:
source_merchant_id_xml = '<source-merchant-id>%s</source-merchant-id>' % source_merchant_id
sample_xml = """
<notification>
<timestamp type="datetime">%s</timestamp>
<kind>%s</kind>
%s
<subject>%s</subject>
</notification>
""" % (timestamp, kind, source_merchant_id_xml, self.__subject_sample_xml(kind, id))
return sample_xml.encode('utf-8')
def __subject_sample_xml(self, kind, id):
if kind == WebhookNotification.Kind.Check:
return self.__check_sample_xml()
if kind == WebhookNotification.Kind.ConnectedMerchantStatusTransitioned:
return self.__connected_merchant_status_transitioned_xml(id)
if kind == WebhookNotification.Kind.ConnectedMerchantPayPalStatusChanged:
return self.__connected_merchant_paypal_status_changed_xml(id)
if kind == WebhookNotification.Kind.SubMerchantAccountApproved:
return self.__merchant_account_approved_sample_xml(id)
elif kind == WebhookNotification.Kind.SubMerchantAccountDeclined:
return self.__merchant_account_declined_sample_xml(id)
elif kind == WebhookNotification.Kind.TransactionDisbursed:
return self.__transaction_disbursed_sample_xml(id)
elif kind == WebhookNotification.Kind.TransactionReviewed:
return self.__transaction_reviewed_sample_xml(id)
elif kind == WebhookNotification.Kind.TransactionSettled:
return self.__transaction_settled_sample_xml(id)
elif kind == WebhookNotification.Kind.TransactionSettlementDeclined:
return self.__transaction_settlement_declined_sample_xml(id)
elif kind == WebhookNotification.Kind.PartnerMerchantConnected:
return self.__partner_merchant_connected_sample_xml()
elif kind == WebhookNotification.Kind.PartnerMerchantDisconnected:
return self.__partner_merchant_disconnected_sample_xml()
elif kind == WebhookNotification.Kind.PartnerMerchantDeclined:
return self.__partner_merchant_declined_sample_xml()
elif kind == WebhookNotification.Kind.OAuthAccessRevoked:
return self.__oauth_access_revocation_sample_xml(id)
elif kind == WebhookNotification.Kind.DisbursementException:
return self.__disbursement_exception_sample_xml(id)
elif kind == WebhookNotification.Kind.Disbursement:
return self.__disbursement_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeAccepted:
return self.__dispute_accepted_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeAutoAccepted:
return self.__dispute_auto_accepted_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeDisputed:
return self.__dispute_disputed_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeExpired:
return self.__dispute_expired_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeLost:
return self.__dispute_lost_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeOpened:
return self.__dispute_opened_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeUnderReview:
return self.__dispute_under_review_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeWon:
return self.__dispute_won_sample_xml(id)
elif kind == WebhookNotification.Kind.SubscriptionBillingSkipped:
return self.__subscription_billing_skipped_sample_xml(id)
elif kind == WebhookNotification.Kind.SubscriptionChargedSuccessfully:
return self.__subscription_charged_successfully_sample_xml(id)
elif kind == WebhookNotification.Kind.SubscriptionChargedUnsuccessfully:
return self.__subscription_charged_unsuccessfully_sample_xml(id)
elif kind == WebhookNotification.Kind.AccountUpdaterDailyReport:
return self.__account_updater_daily_report_sample_xml()
elif kind == WebhookNotification.Kind.GrantorUpdatedGrantedPaymentMethod:
return self.__granted_payment_instrument_update()
elif kind == WebhookNotification.Kind.RecipientUpdatedGrantedPaymentMethod:
return self.__granted_payment_instrument_update()
elif kind == WebhookNotification.Kind.PaymentMethodRevokedByCustomer:
return self.__payment_method_revoked_by_customer(id)
elif kind == WebhookNotification.Kind.GrantedPaymentMethodRevoked:
return self.__granted_payment_method_revoked(id)
elif kind == WebhookNotification.Kind.LocalPaymentCompleted:
return self.__local_payment_completed()
elif kind == WebhookNotification.Kind.LocalPaymentExpired:
return self.__local_payment_expired()
elif kind == WebhookNotification.Kind.LocalPaymentFunded:
return self.__local_payment_funded()
elif kind == WebhookNotification.Kind.LocalPaymentReversed:
return self.__local_payment_reversed()
elif kind == WebhookNotification.Kind.PaymentMethodCustomerDataUpdated:
return self.__payment_method_customer_data_updated_sample_xml(id)
else:
return self.__subscription_sample_xml(id)
def __check_sample_xml(self):
return """
<check type="boolean">
true
</check>
"""
def __transaction_disbursed_sample_xml(self, id):
return """
<transaction>
<id>%s</id>
<amount>100</amount>
<tax-amount>10</tax-amount>
<disbursement-details>
<settlement-amount>100</settlement-amount>
<settlement-currency-exchange-rate>10</settlement-currency-exchange-rate>
<disbursement-date type="datetime">2013-07-09T18:23:29Z</disbursement-date>
</disbursement-details>
</transaction>
""" % id
def __transaction_reviewed_sample_xml(self, id):
return """
<transaction-review>
<transaction-id>%s</transaction-id>
<decision>a smart decision</decision>
<reviewer-email>hey@girl.com</reviewer-email>
<reviewer-note>I reviewed this</reviewer-note>
<reviewed-time type="datetime">2021-04-20T06:09:00Z</reviewed-time>
</transaction-review>
""" % id
def __transaction_settled_sample_xml(self, id):
return """
<transaction>
<id>%s</id>
<status>settled</status>
<type>sale</type>
<currency-iso-code>USD</currency-iso-code>
<amount>100.00</amount>
<merchant-account-id>ogaotkivejpfayqfeaimuktty</merchant-account-id>
<payment-instrument-type>us_bank_account</payment-instrument-type>
<us-bank-account>
<routing-number>123456789</routing-number>
<last-4>1234</last-4>
<account-type>checking</account-type>
<account-holder-name>Dan Schulman</account-holder-name>
</us-bank-account>
<tax-amount>0</tax-amount>
</transaction>
""" % id
def __transaction_settlement_declined_sample_xml(self, id):
return """
<transaction>
<id>%s</id>
<status>settlement_declined</status>
<type>sale</type>
<currency-iso-code>USD</currency-iso-code>
<amount>100.00</amount>
<merchant-account-id>ogaotkivejpfayqfeaimuktty</merchant-account-id>
<payment-instrument-type>us_bank_account</payment-instrument-type>
<us-bank-account>
<routing-number>123456789</routing-number>
<last-4>1234</last-4>
<account-type>checking</account-type>
<account-holder-name>Dan Schulman</account-holder-name>
</us-bank-account>
<tax-amount>0</tax-amount>
</transaction>
""" % id
def __disbursement_exception_sample_xml(self, id):
return """
<disbursement>
<id>%s</id>
<transaction-ids type="array">
<item>afv56j</item>
<item>kj8hjk</item>
</transaction-ids>
<success type="boolean">false</success>
<retry type="boolean">false</retry>
<merchant-account>
<id>merchant_account_token</id>
<currency-iso-code>USD</currency-iso-code>
<sub-merchant-account type="boolean">false</sub-merchant-account>
<status>active</status>
</merchant-account>
<amount>100.00</amount>
<disbursement-date type="date">2014-02-09</disbursement-date>
<exception-message>bank_rejected</exception-message>
<follow-up-action>update_funding_information</follow-up-action>
</disbursement>
""" % id
def __disbursement_sample_xml(self, id):
return """
<disbursement>
<id>%s</id>
<transaction-ids type="array">
<item>afv56j</item>
<item>kj8hjk</item>
</transaction-ids>
<success type="boolean">true</success>
<retry type="boolean">false</retry>
<merchant-account>
<id>merchant_account_token</id>
<currency-iso-code>USD</currency-iso-code>
<sub-merchant-account type="boolean">false</sub-merchant-account>
<status>active</status>
</merchant-account>
<amount>100.00</amount>
<disbursement-date type="date">2014-02-09</disbursement-date>
<exception-message nil="true"/>
<follow-up-action nil="true"/>
</disbursement>
""" % id
def __dispute_under_review_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_under_review_sample_xml(id)
else:
return self.__new_dispute_under_review_sample_xml(id)
def __dispute_opened_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_opened_sample_xml(id)
else:
return self.__new_dispute_opened_sample_xml(id)
def __dispute_lost_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_lost_sample_xml(id)
else:
return self.__new_dispute_lost_sample_xml(id)
def __dispute_won_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_won_sample_xml(id)
else:
return self.__new_dispute_won_sample_xml(id)
def __dispute_accepted_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_accepted_sample_xml(id)
else:
return self.__new_dispute_accepted_sample_xml(id)
def __dispute_auto_accepted_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_auto_accepted_sample_xml(id)
else:
return self.__new_dispute_auto_accepted_sample_xml(id)
def __dispute_disputed_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_disputed_sample_xml(id)
else:
return self.__new_dispute_disputed_sample_xml(id)
def __dispute_expired_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_expired_sample_xml(id)
else:
return self.__new_dispute_expired_sample_xml(id)
def __old_dispute_under_review_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>under_review</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __old_dispute_opened_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>open</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __old_dispute_lost_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>lost</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __old_dispute_won_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>won</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
<date-won type="date">2014-09-01</date-won>
</dispute>
""" % (id, id)
def __old_dispute_accepted_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>accepted</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __old_dispute_auto_accepted_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>auto_accepted</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __old_dispute_disputed_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>disputed</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __old_dispute_expired_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>expired</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __new_dispute_under_review_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>under_review</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>under_review</status>
<timestamp type="datetime">2017-06-15T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __new_dispute_opened_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>open</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __new_dispute_lost_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>lost</status>
<updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>lost</status>
<timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
</status-history>
</status-history>
<evidence type="array">
<evidence>
<id>rxtngk9j5j93tsrq</id>
<comments nil="true"/>
<created-at type="datetime">2017-06-21T20:44:42Z</created-at>
<sent-to-processor-at nil="true"/>
<url>s3.amazonaws.com/foo.jpg</url>
</evidence>
<evidence>
<id>88cfb8dd</id>
<comments>text evidence</comments>
<created-at type="datetime">2017-06-21T20:44:42Z</created-at>
<sent-to-processor-at nil="true"/>
<url nil="true"/>
</evidence>
</evidence>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __new_dispute_won_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>won</status>
<updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>won</status>
<timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
</status-history>
</status-history>
<evidence type="array">
<evidence>
<id>rxtngk9j5j93tsrq</id>
<comments nil="true"/>
<created-at type="datetime">2017-06-21T20:44:42Z</created-at>
<sent-to-processor-at nil="true"/>
<url>s3.amazonaws.com/foo.jpg</url>
</evidence>
<evidence>
<id>88cfb8dd</id>
<comments>text evidence</comments>
<created-at type="datetime">2017-06-21T20:44:42Z</created-at>
<sent-to-processor-at nil="true"/>
<url nil="true"/>
</evidence>
</evidence>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
<date-won type=\"date\">2014-09-01</date-won>
</dispute>
""" % (id, id)
def __new_dispute_accepted_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>accepted</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-15T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>accepted</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __new_dispute_auto_accepted_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>auto_accepted</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-15T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>auto_accepted</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __new_dispute_disputed_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>disputed</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-15T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>disputed</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __new_dispute_expired_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>expired</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-15T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>expired</status>
<timestamp type="datetime">2017-06-25T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
def __subscription_sample_xml(self, id):
return """
<subscription>
<id>%s</id>
<transactions type="array"></transactions>
<add_ons type="array"></add_ons>
<discounts type="array"></discounts>
</subscription>
""" % id
def __subscription_billing_skipped_sample_xml(self, id):
return """
<subscription>
<id>%s</id>
<transactions type="array"></transactions>
<add_ons type="array"></add_ons>
<discounts type="array"></discounts>
</subscription>
""" % id
def __subscription_charged_successfully_sample_xml(self, id):
return """
<subscription>
<id>%s</id>
<transactions type="array">
<transaction>
<id>%s</id>
<status>submitted_for_settlement</status>
<amount>49.99</amount>
<tax_amount></tax_amount>
</transaction>
</transactions>
<add_ons type="array"></add_ons>
<discounts type="array"></discounts>
</subscription>
""" % (id, id)
def __subscription_charged_unsuccessfully_sample_xml(self, id):
return """
<subscription>
<id>%s</id>
<transactions type="array">
<transaction>
<id>%s</id>
<status>failed</status>
<amount>49.99</amount>
<tax_amount></tax_amount>
</transaction>
</transactions>
<add_ons type="array"></add_ons>
<discounts type="array"></discounts>
</subscription>
""" % (id, id)
def __merchant_account_approved_sample_xml(self, id):
return """
<merchant-account>
<id>%s</id>
<status>active</status>
<master-merchant-account>
<id>master_ma_for_%s</id>
<status>active</status>
</master-merchant-account>
</merchant-account>
""" % (id, id)
def __merchant_account_declined_sample_xml(self, id):
return """
<api-error-response>
<message>Credit score is too low</message>
<errors>
<errors type="array"/>
<merchant-account>
<errors type="array">
<error>
<code>82621</code>
<message>Credit score is too low</message>
<attribute type="symbol">base</attribute>
</error>
</errors>
</merchant-account>
</errors>
<merchant-account>
<id>%s</id>
<status>suspended</status>
<master-merchant-account>
<id>master_ma_for_%s</id>
<status>suspended</status>
</master-merchant-account>
</merchant-account>
</api-error-response>
""" % (id, id)
def __partner_merchant_connected_sample_xml(self):
return """
<partner-merchant>
<partner-merchant-id>abc123</partner-merchant-id>
<public-key>public_key</public-key>
<private-key>private_key</private-key>
<merchant-public-id>public_id</merchant-public-id>
<client-side-encryption-key>cse_key</client-side-encryption-key>
</partner-merchant>
"""
def __partner_merchant_disconnected_sample_xml(self):
return """
<partner-merchant>
<partner-merchant-id>abc123</partner-merchant-id>
</partner-merchant>
"""
def __connected_merchant_status_transitioned_xml(self, id):
return """
<connected-merchant-status-transitioned>
<status>new_status</status>
<merchant-public-id>%s</merchant-public-id>
<oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
</connected-merchant-status-transitioned>
""" % id
def __connected_merchant_paypal_status_changed_xml(self, id):
return """
<connected-merchant-paypal-status-changed>
<action>link</action>
<merchant-public-id>%s</merchant-public-id>
<oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
</connected-merchant-paypal-status-changed>
""" % id
def __partner_merchant_declined_sample_xml(self):
return """
<partner-merchant>
<partner-merchant-id>abc123</partner-merchant-id>
</partner-merchant>
"""
def __oauth_access_revocation_sample_xml(self, id):
return """
<oauth-application-revocation>
<merchant-id>%s</merchant-id>
<oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
</oauth-application-revocation>
""" % id
def __account_updater_daily_report_sample_xml(self):
return """
<account-updater-daily-report>
<report-date type="date">2016-01-14</report-date>
<report-url>link-to-csv-report</report-url>
</account-updater-daily-report>
"""
def __granted_payment_instrument_update(self):
return """
<granted-payment-instrument-update>
<grant-owner-merchant-id>vczo7jqrpwrsi2px</grant-owner-merchant-id>
<grant-recipient-merchant-id>cf0i8wgarszuy6hc</grant-recipient-merchant-id>
<payment-method-nonce>
<nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</nonce>
<consumed type="boolean">false</consumed>
<locked type="boolean">false</locked>
</payment-method-nonce>
<token>abc123z</token>
<updated-fields type="array">
<item>expiration-month</item>
<item>expiration-year</item>
</updated-fields>
</granted-payment-instrument-update>
"""
def __granted_payment_method_revoked(self, id):
return self.__venmo_account_xml(id)
def __payment_method_revoked_by_customer(self, id):
return """
<paypal-account>
<billing-agreement-id>a-billing-agreement-id</billing-agreement-id>
<created-at type="datetime">2019-01-01T12:00:00Z</created-at>
<customer-id>a-customer-id</customer-id>
<default type="boolean">true</default>
<email>name@email.com</email>
<global-id>cGF5bWVudG1ldGhvZF9jaDZieXNz</global-id>
<image-url>https://assets.braintreegateway.com/payment_method_logo/paypal.png?environment=test</image-url>
<subscriptions type="array"/>
<token>%s</token>
<updated-at type="datetime">2019-01-02T12:00:00Z</updated-at>
<is-channel-initiated nil="true"/>
<payer-id>a-payer-id</payer-id>
<payer-info nil="true"/>
<limited-use-order-id nil="true"/>
<revoked-at type="datetime">2019-01-02T12:00:00Z</revoked-at>
</paypal-account>
""" % id
def __local_payment_completed(self):
return """
<local-payment>
<payment-id>a-payment-id</payment-id>
<payer-id>a-payer-id</payer-id>
<payment-method-nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</payment-method-nonce>
<transaction>
<id>1</id>
<status>authorizing</status>
<amount>10.00</amount>
<order-id>order1234</order-id>
</transaction>
</local-payment>
"""
def __local_payment_expired(self):
return """
<local-payment-expired>
<payment-id>a-payment-id</payment-id>
<payment-context-id>a-context-payment-id</payment-context-id>
</local-payment-expired>
"""
def __local_payment_funded(self):
return """
<local-payment-funded>
<payment-id>a-payment-id</payment-id>
<payment-context-id>a-context-payment-id</payment-context-id>
<transaction>
<id>1</id>
<status>settled</status>
<amount>10.00</amount>
<order-id>order1234</order-id>
</transaction>
</local-payment-funded>
"""
def __local_payment_reversed(self):
return """
<local-payment-reversed>
<payment-id>a-payment-id</payment-id>
</local-payment-reversed>
"""
def __payment_method_customer_data_updated_sample_xml(self, id):
return """
<payment-method-customer-data-updated-metadata>
<token>TOKEN-12345</token>
<payment-method>%s</payment-method>
<datetime-updated type='dateTime'>2022-01-01T21:28:37Z</datetime-updated>
<enriched-customer-data>
<fields-updated type='array'>
<item>username</item>
</fields-updated>
<profile-data>
<username>venmo_username</username>
<first-name>John</first-name>
<last-name>Doe</last-name>
<phone-number>1231231234</phone-number>
<email>john.doe@paypal.com</email>
<billing-address>
<street-address>Street Address</street-address>
<extended-address>Extended Address</extended-address>
<locality>Locality</locality>
<region>Region</region>
<postal-code >Postal Code</postal-code>
</billing-address>
<shipping-address>
<street-address>Street Address</street-address>
<extended-address>Extended Address</extended-address>
<locality>Locality</locality>
<region>Region</region>
<postal-code >Postal Code</postal-code>
</shipping-address>
</profile-data>
</enriched-customer-data>
</payment-method-customer-data-updated-metadata>
""" % self.__venmo_account_xml(id)
def __venmo_account_xml(self, id):
return """
<venmo-account>
<created-at type="datetime">2018-10-11T21:28:37Z</created-at>
<updated-at type="datetime">2018-10-11T21:28:37Z</updated-at>
<default type="boolean">true</default>
<image-url>https://assets.braintreegateway.com/payment_method_logo/venmo.png?environment=test</image-url>
<token>%s</token>
<source-description>Venmo Account: venmojoe</source-description>
<username>venmojoe</username>
<venmo-user-id>456</venmo-user-id>
<subscriptions type="array"/>
<customer-id>venmo_customer_id</customer-id>
<global-id>cGF5bWVudG1ldGhvZF92ZW5tb2FjY291bnQ</global-id>
</venmo-account>
""" % id
|
(gateway)
|
712,618
|
braintree.webhook_testing_gateway
|
__account_updater_daily_report_sample_xml
| null |
def __account_updater_daily_report_sample_xml(self):
return """
<account-updater-daily-report>
<report-date type="date">2016-01-14</report-date>
<report-url>link-to-csv-report</report-url>
</account-updater-daily-report>
"""
|
(self)
|
712,619
|
braintree.webhook_testing_gateway
|
__check_sample_xml
| null |
def __check_sample_xml(self):
return """
<check type="boolean">
true
</check>
"""
|
(self)
|
712,620
|
braintree.webhook_testing_gateway
|
__connected_merchant_paypal_status_changed_xml
| null |
def __connected_merchant_paypal_status_changed_xml(self, id):
return """
<connected-merchant-paypal-status-changed>
<action>link</action>
<merchant-public-id>%s</merchant-public-id>
<oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
</connected-merchant-paypal-status-changed>
""" % id
|
(self, id)
|
712,621
|
braintree.webhook_testing_gateway
|
__connected_merchant_status_transitioned_xml
| null |
def __connected_merchant_status_transitioned_xml(self, id):
return """
<connected-merchant-status-transitioned>
<status>new_status</status>
<merchant-public-id>%s</merchant-public-id>
<oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
</connected-merchant-status-transitioned>
""" % id
|
(self, id)
|
712,622
|
braintree.webhook_testing_gateway
|
__disbursement_exception_sample_xml
| null |
def __disbursement_exception_sample_xml(self, id):
return """
<disbursement>
<id>%s</id>
<transaction-ids type="array">
<item>afv56j</item>
<item>kj8hjk</item>
</transaction-ids>
<success type="boolean">false</success>
<retry type="boolean">false</retry>
<merchant-account>
<id>merchant_account_token</id>
<currency-iso-code>USD</currency-iso-code>
<sub-merchant-account type="boolean">false</sub-merchant-account>
<status>active</status>
</merchant-account>
<amount>100.00</amount>
<disbursement-date type="date">2014-02-09</disbursement-date>
<exception-message>bank_rejected</exception-message>
<follow-up-action>update_funding_information</follow-up-action>
</disbursement>
""" % id
|
(self, id)
|
712,623
|
braintree.webhook_testing_gateway
|
__disbursement_sample_xml
| null |
def __disbursement_sample_xml(self, id):
return """
<disbursement>
<id>%s</id>
<transaction-ids type="array">
<item>afv56j</item>
<item>kj8hjk</item>
</transaction-ids>
<success type="boolean">true</success>
<retry type="boolean">false</retry>
<merchant-account>
<id>merchant_account_token</id>
<currency-iso-code>USD</currency-iso-code>
<sub-merchant-account type="boolean">false</sub-merchant-account>
<status>active</status>
</merchant-account>
<amount>100.00</amount>
<disbursement-date type="date">2014-02-09</disbursement-date>
<exception-message nil="true"/>
<follow-up-action nil="true"/>
</disbursement>
""" % id
|
(self, id)
|
712,624
|
braintree.webhook_testing_gateway
|
__dispute_accepted_sample_xml
| null |
def __dispute_accepted_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_accepted_sample_xml(id)
else:
return self.__new_dispute_accepted_sample_xml(id)
|
(self, id)
|
712,625
|
braintree.webhook_testing_gateway
|
__dispute_auto_accepted_sample_xml
| null |
def __dispute_auto_accepted_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_auto_accepted_sample_xml(id)
else:
return self.__new_dispute_auto_accepted_sample_xml(id)
|
(self, id)
|
712,626
|
braintree.webhook_testing_gateway
|
__dispute_disputed_sample_xml
| null |
def __dispute_disputed_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_disputed_sample_xml(id)
else:
return self.__new_dispute_disputed_sample_xml(id)
|
(self, id)
|
712,627
|
braintree.webhook_testing_gateway
|
__dispute_expired_sample_xml
| null |
def __dispute_expired_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_expired_sample_xml(id)
else:
return self.__new_dispute_expired_sample_xml(id)
|
(self, id)
|
712,628
|
braintree.webhook_testing_gateway
|
__dispute_lost_sample_xml
| null |
def __dispute_lost_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_lost_sample_xml(id)
else:
return self.__new_dispute_lost_sample_xml(id)
|
(self, id)
|
712,629
|
braintree.webhook_testing_gateway
|
__dispute_opened_sample_xml
| null |
def __dispute_opened_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_opened_sample_xml(id)
else:
return self.__new_dispute_opened_sample_xml(id)
|
(self, id)
|
712,630
|
braintree.webhook_testing_gateway
|
__dispute_under_review_sample_xml
| null |
def __dispute_under_review_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_under_review_sample_xml(id)
else:
return self.__new_dispute_under_review_sample_xml(id)
|
(self, id)
|
712,631
|
braintree.webhook_testing_gateway
|
__dispute_won_sample_xml
| null |
def __dispute_won_sample_xml(self, id):
if id == "legacy_dispute_id":
return self.__old_dispute_won_sample_xml(id)
else:
return self.__new_dispute_won_sample_xml(id)
|
(self, id)
|
712,632
|
braintree.webhook_testing_gateway
|
__granted_payment_instrument_update
| null |
def __granted_payment_instrument_update(self):
return """
<granted-payment-instrument-update>
<grant-owner-merchant-id>vczo7jqrpwrsi2px</grant-owner-merchant-id>
<grant-recipient-merchant-id>cf0i8wgarszuy6hc</grant-recipient-merchant-id>
<payment-method-nonce>
<nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</nonce>
<consumed type="boolean">false</consumed>
<locked type="boolean">false</locked>
</payment-method-nonce>
<token>abc123z</token>
<updated-fields type="array">
<item>expiration-month</item>
<item>expiration-year</item>
</updated-fields>
</granted-payment-instrument-update>
"""
|
(self)
|
712,633
|
braintree.webhook_testing_gateway
|
__granted_payment_method_revoked
| null |
def __granted_payment_method_revoked(self, id):
return self.__venmo_account_xml(id)
|
(self, id)
|
712,634
|
braintree.webhook_testing_gateway
|
__local_payment_completed
| null |
def __local_payment_completed(self):
return """
<local-payment>
<payment-id>a-payment-id</payment-id>
<payer-id>a-payer-id</payer-id>
<payment-method-nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</payment-method-nonce>
<transaction>
<id>1</id>
<status>authorizing</status>
<amount>10.00</amount>
<order-id>order1234</order-id>
</transaction>
</local-payment>
"""
|
(self)
|
712,635
|
braintree.webhook_testing_gateway
|
__local_payment_expired
| null |
def __local_payment_expired(self):
return """
<local-payment-expired>
<payment-id>a-payment-id</payment-id>
<payment-context-id>a-context-payment-id</payment-context-id>
</local-payment-expired>
"""
|
(self)
|
712,636
|
braintree.webhook_testing_gateway
|
__local_payment_funded
| null |
def __local_payment_funded(self):
return """
<local-payment-funded>
<payment-id>a-payment-id</payment-id>
<payment-context-id>a-context-payment-id</payment-context-id>
<transaction>
<id>1</id>
<status>settled</status>
<amount>10.00</amount>
<order-id>order1234</order-id>
</transaction>
</local-payment-funded>
"""
|
(self)
|
712,637
|
braintree.webhook_testing_gateway
|
__local_payment_reversed
| null |
def __local_payment_reversed(self):
return """
<local-payment-reversed>
<payment-id>a-payment-id</payment-id>
</local-payment-reversed>
"""
|
(self)
|
712,638
|
braintree.webhook_testing_gateway
|
__merchant_account_approved_sample_xml
| null |
def __merchant_account_approved_sample_xml(self, id):
return """
<merchant-account>
<id>%s</id>
<status>active</status>
<master-merchant-account>
<id>master_ma_for_%s</id>
<status>active</status>
</master-merchant-account>
</merchant-account>
""" % (id, id)
|
(self, id)
|
712,639
|
braintree.webhook_testing_gateway
|
__merchant_account_declined_sample_xml
| null |
def __merchant_account_declined_sample_xml(self, id):
return """
<api-error-response>
<message>Credit score is too low</message>
<errors>
<errors type="array"/>
<merchant-account>
<errors type="array">
<error>
<code>82621</code>
<message>Credit score is too low</message>
<attribute type="symbol">base</attribute>
</error>
</errors>
</merchant-account>
</errors>
<merchant-account>
<id>%s</id>
<status>suspended</status>
<master-merchant-account>
<id>master_ma_for_%s</id>
<status>suspended</status>
</master-merchant-account>
</merchant-account>
</api-error-response>
""" % (id, id)
|
(self, id)
|
712,640
|
braintree.webhook_testing_gateway
|
__new_dispute_accepted_sample_xml
| null |
def __new_dispute_accepted_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>accepted</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-15T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>accepted</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,641
|
braintree.webhook_testing_gateway
|
__new_dispute_auto_accepted_sample_xml
| null |
def __new_dispute_auto_accepted_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>auto_accepted</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-15T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>auto_accepted</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,642
|
braintree.webhook_testing_gateway
|
__new_dispute_disputed_sample_xml
| null |
def __new_dispute_disputed_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>disputed</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-15T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>disputed</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,643
|
braintree.webhook_testing_gateway
|
__new_dispute_expired_sample_xml
| null |
def __new_dispute_expired_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>expired</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-15T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>expired</status>
<timestamp type="datetime">2017-06-25T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,644
|
braintree.webhook_testing_gateway
|
__new_dispute_lost_sample_xml
| null |
def __new_dispute_lost_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>lost</status>
<updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>lost</status>
<timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
</status-history>
</status-history>
<evidence type="array">
<evidence>
<id>rxtngk9j5j93tsrq</id>
<comments nil="true"/>
<created-at type="datetime">2017-06-21T20:44:42Z</created-at>
<sent-to-processor-at nil="true"/>
<url>s3.amazonaws.com/foo.jpg</url>
</evidence>
<evidence>
<id>88cfb8dd</id>
<comments>text evidence</comments>
<created-at type="datetime">2017-06-21T20:44:42Z</created-at>
<sent-to-processor-at nil="true"/>
<url nil="true"/>
</evidence>
</evidence>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,645
|
braintree.webhook_testing_gateway
|
__new_dispute_opened_sample_xml
| null |
def __new_dispute_opened_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>open</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,646
|
braintree.webhook_testing_gateway
|
__new_dispute_under_review_sample_xml
| null |
def __new_dispute_under_review_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>under_review</status>
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>under_review</status>
<timestamp type="datetime">2017-06-15T20:44:41Z</timestamp>
</status-history>
</status-history>
<evidence type="array"/>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,647
|
braintree.webhook_testing_gateway
|
__new_dispute_won_sample_xml
| null |
def __new_dispute_won_sample_xml(self, id):
return """
<dispute>
<id>%s</id>
<amount>100.00</amount>
<amount-disputed>100.00</amount-disputed>
<amount-won>95.00</amount-won>
<case-number>CASE-12345</case-number>
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
<currency-iso-code>USD</currency-iso-code>
<forwarded-comments nil="true"/>
<kind>chargeback</kind>
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
<reason>fraud</reason>
<reason-code nil="true"/>
<reason-description nil="true"/>
<received-date type="date">2016-02-15</received-date>
<reference-number>REF-9876</reference-number>
<reply-by-date type="date">2016-02-22</reply-by-date>
<status>won</status>
<updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
<original-dispute-id>9qde5qgp</original-dispute-id>
<status-history type="array">
<status-history>
<status>open</status>
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
</status-history>
<status-history>
<status>won</status>
<timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
</status-history>
</status-history>
<evidence type="array">
<evidence>
<id>rxtngk9j5j93tsrq</id>
<comments nil="true"/>
<created-at type="datetime">2017-06-21T20:44:42Z</created-at>
<sent-to-processor-at nil="true"/>
<url>s3.amazonaws.com/foo.jpg</url>
</evidence>
<evidence>
<id>88cfb8dd</id>
<comments>text evidence</comments>
<created-at type="datetime">2017-06-21T20:44:42Z</created-at>
<sent-to-processor-at nil="true"/>
<url nil="true"/>
</evidence>
</evidence>
<transaction>
<id>%s</id>
<amount>100.00</amount>
<created-at>2017-06-21T20:44:41Z</created-at>
<order-id nil="true"/>
<purchase-order-number nil="true"/>
<payment-instrument-subtype>Visa</payment-instrument-subtype>
</transaction>
<date-opened type=\"date\">2014-03-28</date-opened>
<date-won type=\"date\">2014-09-01</date-won>
</dispute>
""" % (id, id)
|
(self, id)
|
712,648
|
braintree.webhook_testing_gateway
|
__oauth_access_revocation_sample_xml
| null |
def __oauth_access_revocation_sample_xml(self, id):
return """
<oauth-application-revocation>
<merchant-id>%s</merchant-id>
<oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
</oauth-application-revocation>
""" % id
|
(self, id)
|
712,649
|
braintree.webhook_testing_gateway
|
__old_dispute_accepted_sample_xml
| null |
def __old_dispute_accepted_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>accepted</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,650
|
braintree.webhook_testing_gateway
|
__old_dispute_auto_accepted_sample_xml
| null |
def __old_dispute_auto_accepted_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>auto_accepted</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,651
|
braintree.webhook_testing_gateway
|
__old_dispute_disputed_sample_xml
| null |
def __old_dispute_disputed_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>disputed</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,652
|
braintree.webhook_testing_gateway
|
__old_dispute_expired_sample_xml
| null |
def __old_dispute_expired_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>expired</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,653
|
braintree.webhook_testing_gateway
|
__old_dispute_lost_sample_xml
| null |
def __old_dispute_lost_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>lost</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,654
|
braintree.webhook_testing_gateway
|
__old_dispute_opened_sample_xml
| null |
def __old_dispute_opened_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>open</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,655
|
braintree.webhook_testing_gateway
|
__old_dispute_under_review_sample_xml
| null |
def __old_dispute_under_review_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>under_review</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
</dispute>
""" % (id, id)
|
(self, id)
|
712,656
|
braintree.webhook_testing_gateway
|
__old_dispute_won_sample_xml
| null |
def __old_dispute_won_sample_xml(self, id):
return """
<dispute>
<amount>250.00</amount>
<currency-iso-code>USD</currency-iso-code>
<received-date type="date">2014-03-01</received-date>
<reply-by-date type="date">2014-03-21</reply-by-date>
<kind>chargeback</kind>
<status>won</status>
<reason>fraud</reason>
<id>%s</id>
<transaction>
<id>%s</id>
<amount>250.00</amount>
</transaction>
<date-opened type="date">2014-03-28</date-opened>
<date-won type="date">2014-09-01</date-won>
</dispute>
""" % (id, id)
|
(self, id)
|
712,657
|
braintree.webhook_testing_gateway
|
__partner_merchant_connected_sample_xml
| null |
def __partner_merchant_connected_sample_xml(self):
return """
<partner-merchant>
<partner-merchant-id>abc123</partner-merchant-id>
<public-key>public_key</public-key>
<private-key>private_key</private-key>
<merchant-public-id>public_id</merchant-public-id>
<client-side-encryption-key>cse_key</client-side-encryption-key>
</partner-merchant>
"""
|
(self)
|
712,658
|
braintree.webhook_testing_gateway
|
__partner_merchant_declined_sample_xml
| null |
def __partner_merchant_declined_sample_xml(self):
return """
<partner-merchant>
<partner-merchant-id>abc123</partner-merchant-id>
</partner-merchant>
"""
|
(self)
|
712,659
|
braintree.webhook_testing_gateway
|
__partner_merchant_disconnected_sample_xml
| null |
def __partner_merchant_disconnected_sample_xml(self):
return """
<partner-merchant>
<partner-merchant-id>abc123</partner-merchant-id>
</partner-merchant>
"""
|
(self)
|
712,660
|
braintree.webhook_testing_gateway
|
__payment_method_customer_data_updated_sample_xml
| null |
def __payment_method_customer_data_updated_sample_xml(self, id):
return """
<payment-method-customer-data-updated-metadata>
<token>TOKEN-12345</token>
<payment-method>%s</payment-method>
<datetime-updated type='dateTime'>2022-01-01T21:28:37Z</datetime-updated>
<enriched-customer-data>
<fields-updated type='array'>
<item>username</item>
</fields-updated>
<profile-data>
<username>venmo_username</username>
<first-name>John</first-name>
<last-name>Doe</last-name>
<phone-number>1231231234</phone-number>
<email>john.doe@paypal.com</email>
<billing-address>
<street-address>Street Address</street-address>
<extended-address>Extended Address</extended-address>
<locality>Locality</locality>
<region>Region</region>
<postal-code >Postal Code</postal-code>
</billing-address>
<shipping-address>
<street-address>Street Address</street-address>
<extended-address>Extended Address</extended-address>
<locality>Locality</locality>
<region>Region</region>
<postal-code >Postal Code</postal-code>
</shipping-address>
</profile-data>
</enriched-customer-data>
</payment-method-customer-data-updated-metadata>
""" % self.__venmo_account_xml(id)
|
(self, id)
|
712,661
|
braintree.webhook_testing_gateway
|
__payment_method_revoked_by_customer
| null |
def __payment_method_revoked_by_customer(self, id):
return """
<paypal-account>
<billing-agreement-id>a-billing-agreement-id</billing-agreement-id>
<created-at type="datetime">2019-01-01T12:00:00Z</created-at>
<customer-id>a-customer-id</customer-id>
<default type="boolean">true</default>
<email>name@email.com</email>
<global-id>cGF5bWVudG1ldGhvZF9jaDZieXNz</global-id>
<image-url>https://assets.braintreegateway.com/payment_method_logo/paypal.png?environment=test</image-url>
<subscriptions type="array"/>
<token>%s</token>
<updated-at type="datetime">2019-01-02T12:00:00Z</updated-at>
<is-channel-initiated nil="true"/>
<payer-id>a-payer-id</payer-id>
<payer-info nil="true"/>
<limited-use-order-id nil="true"/>
<revoked-at type="datetime">2019-01-02T12:00:00Z</revoked-at>
</paypal-account>
""" % id
|
(self, id)
|
712,662
|
braintree.webhook_testing_gateway
|
__sample_xml
| null |
def __sample_xml(self, kind, id, source_merchant_id):
timestamp = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
source_merchant_id_xml = ''
if source_merchant_id is not None:
source_merchant_id_xml = '<source-merchant-id>%s</source-merchant-id>' % source_merchant_id
sample_xml = """
<notification>
<timestamp type="datetime">%s</timestamp>
<kind>%s</kind>
%s
<subject>%s</subject>
</notification>
""" % (timestamp, kind, source_merchant_id_xml, self.__subject_sample_xml(kind, id))
return sample_xml.encode('utf-8')
|
(self, kind, id, source_merchant_id)
|
712,663
|
braintree.webhook_testing_gateway
|
__subject_sample_xml
| null |
def __subject_sample_xml(self, kind, id):
if kind == WebhookNotification.Kind.Check:
return self.__check_sample_xml()
if kind == WebhookNotification.Kind.ConnectedMerchantStatusTransitioned:
return self.__connected_merchant_status_transitioned_xml(id)
if kind == WebhookNotification.Kind.ConnectedMerchantPayPalStatusChanged:
return self.__connected_merchant_paypal_status_changed_xml(id)
if kind == WebhookNotification.Kind.SubMerchantAccountApproved:
return self.__merchant_account_approved_sample_xml(id)
elif kind == WebhookNotification.Kind.SubMerchantAccountDeclined:
return self.__merchant_account_declined_sample_xml(id)
elif kind == WebhookNotification.Kind.TransactionDisbursed:
return self.__transaction_disbursed_sample_xml(id)
elif kind == WebhookNotification.Kind.TransactionReviewed:
return self.__transaction_reviewed_sample_xml(id)
elif kind == WebhookNotification.Kind.TransactionSettled:
return self.__transaction_settled_sample_xml(id)
elif kind == WebhookNotification.Kind.TransactionSettlementDeclined:
return self.__transaction_settlement_declined_sample_xml(id)
elif kind == WebhookNotification.Kind.PartnerMerchantConnected:
return self.__partner_merchant_connected_sample_xml()
elif kind == WebhookNotification.Kind.PartnerMerchantDisconnected:
return self.__partner_merchant_disconnected_sample_xml()
elif kind == WebhookNotification.Kind.PartnerMerchantDeclined:
return self.__partner_merchant_declined_sample_xml()
elif kind == WebhookNotification.Kind.OAuthAccessRevoked:
return self.__oauth_access_revocation_sample_xml(id)
elif kind == WebhookNotification.Kind.DisbursementException:
return self.__disbursement_exception_sample_xml(id)
elif kind == WebhookNotification.Kind.Disbursement:
return self.__disbursement_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeAccepted:
return self.__dispute_accepted_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeAutoAccepted:
return self.__dispute_auto_accepted_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeDisputed:
return self.__dispute_disputed_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeExpired:
return self.__dispute_expired_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeLost:
return self.__dispute_lost_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeOpened:
return self.__dispute_opened_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeUnderReview:
return self.__dispute_under_review_sample_xml(id)
elif kind == WebhookNotification.Kind.DisputeWon:
return self.__dispute_won_sample_xml(id)
elif kind == WebhookNotification.Kind.SubscriptionBillingSkipped:
return self.__subscription_billing_skipped_sample_xml(id)
elif kind == WebhookNotification.Kind.SubscriptionChargedSuccessfully:
return self.__subscription_charged_successfully_sample_xml(id)
elif kind == WebhookNotification.Kind.SubscriptionChargedUnsuccessfully:
return self.__subscription_charged_unsuccessfully_sample_xml(id)
elif kind == WebhookNotification.Kind.AccountUpdaterDailyReport:
return self.__account_updater_daily_report_sample_xml()
elif kind == WebhookNotification.Kind.GrantorUpdatedGrantedPaymentMethod:
return self.__granted_payment_instrument_update()
elif kind == WebhookNotification.Kind.RecipientUpdatedGrantedPaymentMethod:
return self.__granted_payment_instrument_update()
elif kind == WebhookNotification.Kind.PaymentMethodRevokedByCustomer:
return self.__payment_method_revoked_by_customer(id)
elif kind == WebhookNotification.Kind.GrantedPaymentMethodRevoked:
return self.__granted_payment_method_revoked(id)
elif kind == WebhookNotification.Kind.LocalPaymentCompleted:
return self.__local_payment_completed()
elif kind == WebhookNotification.Kind.LocalPaymentExpired:
return self.__local_payment_expired()
elif kind == WebhookNotification.Kind.LocalPaymentFunded:
return self.__local_payment_funded()
elif kind == WebhookNotification.Kind.LocalPaymentReversed:
return self.__local_payment_reversed()
elif kind == WebhookNotification.Kind.PaymentMethodCustomerDataUpdated:
return self.__payment_method_customer_data_updated_sample_xml(id)
else:
return self.__subscription_sample_xml(id)
|
(self, kind, id)
|
712,664
|
braintree.webhook_testing_gateway
|
__subscription_billing_skipped_sample_xml
| null |
def __subscription_billing_skipped_sample_xml(self, id):
return """
<subscription>
<id>%s</id>
<transactions type="array"></transactions>
<add_ons type="array"></add_ons>
<discounts type="array"></discounts>
</subscription>
""" % id
|
(self, id)
|
712,665
|
braintree.webhook_testing_gateway
|
__subscription_charged_successfully_sample_xml
| null |
def __subscription_charged_successfully_sample_xml(self, id):
return """
<subscription>
<id>%s</id>
<transactions type="array">
<transaction>
<id>%s</id>
<status>submitted_for_settlement</status>
<amount>49.99</amount>
<tax_amount></tax_amount>
</transaction>
</transactions>
<add_ons type="array"></add_ons>
<discounts type="array"></discounts>
</subscription>
""" % (id, id)
|
(self, id)
|
712,666
|
braintree.webhook_testing_gateway
|
__subscription_charged_unsuccessfully_sample_xml
| null |
def __subscription_charged_unsuccessfully_sample_xml(self, id):
return """
<subscription>
<id>%s</id>
<transactions type="array">
<transaction>
<id>%s</id>
<status>failed</status>
<amount>49.99</amount>
<tax_amount></tax_amount>
</transaction>
</transactions>
<add_ons type="array"></add_ons>
<discounts type="array"></discounts>
</subscription>
""" % (id, id)
|
(self, id)
|
712,667
|
braintree.webhook_testing_gateway
|
__subscription_sample_xml
| null |
def __subscription_sample_xml(self, id):
return """
<subscription>
<id>%s</id>
<transactions type="array"></transactions>
<add_ons type="array"></add_ons>
<discounts type="array"></discounts>
</subscription>
""" % id
|
(self, id)
|
712,668
|
braintree.webhook_testing_gateway
|
__transaction_disbursed_sample_xml
| null |
def __transaction_disbursed_sample_xml(self, id):
return """
<transaction>
<id>%s</id>
<amount>100</amount>
<tax-amount>10</tax-amount>
<disbursement-details>
<settlement-amount>100</settlement-amount>
<settlement-currency-exchange-rate>10</settlement-currency-exchange-rate>
<disbursement-date type="datetime">2013-07-09T18:23:29Z</disbursement-date>
</disbursement-details>
</transaction>
""" % id
|
(self, id)
|
712,669
|
braintree.webhook_testing_gateway
|
__transaction_reviewed_sample_xml
| null |
def __transaction_reviewed_sample_xml(self, id):
return """
<transaction-review>
<transaction-id>%s</transaction-id>
<decision>a smart decision</decision>
<reviewer-email>hey@girl.com</reviewer-email>
<reviewer-note>I reviewed this</reviewer-note>
<reviewed-time type="datetime">2021-04-20T06:09:00Z</reviewed-time>
</transaction-review>
""" % id
|
(self, id)
|
712,670
|
braintree.webhook_testing_gateway
|
__transaction_settled_sample_xml
| null |
def __transaction_settled_sample_xml(self, id):
return """
<transaction>
<id>%s</id>
<status>settled</status>
<type>sale</type>
<currency-iso-code>USD</currency-iso-code>
<amount>100.00</amount>
<merchant-account-id>ogaotkivejpfayqfeaimuktty</merchant-account-id>
<payment-instrument-type>us_bank_account</payment-instrument-type>
<us-bank-account>
<routing-number>123456789</routing-number>
<last-4>1234</last-4>
<account-type>checking</account-type>
<account-holder-name>Dan Schulman</account-holder-name>
</us-bank-account>
<tax-amount>0</tax-amount>
</transaction>
""" % id
|
(self, id)
|
712,671
|
braintree.webhook_testing_gateway
|
__transaction_settlement_declined_sample_xml
| null |
def __transaction_settlement_declined_sample_xml(self, id):
return """
<transaction>
<id>%s</id>
<status>settlement_declined</status>
<type>sale</type>
<currency-iso-code>USD</currency-iso-code>
<amount>100.00</amount>
<merchant-account-id>ogaotkivejpfayqfeaimuktty</merchant-account-id>
<payment-instrument-type>us_bank_account</payment-instrument-type>
<us-bank-account>
<routing-number>123456789</routing-number>
<last-4>1234</last-4>
<account-type>checking</account-type>
<account-holder-name>Dan Schulman</account-holder-name>
</us-bank-account>
<tax-amount>0</tax-amount>
</transaction>
""" % id
|
(self, id)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.