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

        if self.settlement_amount is not None:
            self.settlement_amount = Decimal(self.settlement_amount)
        if self.settlement_currency_exchange_rate is not None:
            self.settlement_currency_exchange_rate = Decimal(self.settlement_currency_exchange_rate)
    def __init__(self, attributes):
        AttributeGetter.__init__(self, attributes)

        if self.amount is not None:
            self.amount = Decimal(self.amount)
        if "transaction" in attributes:
            self.transaction_details = TransactionDetails(attributes.pop("transaction"))
    def __init__(self, gateway, attributes):
        AttributeGetter.__init__(self, attributes)
        if "processor_response_code" not in attributes:
            self.processor_response_code = None
        if "processor_response_text" not in attributes:
            self.processor_response_text = None

        if "risk_data" in attributes:
            self.risk_data = RiskData(attributes["risk_data"])
        else:
            self.risk_data = None
Beispiel #4
0
    def __init__(self, attributes):
        AttributeGetter.__init__(self, attributes)

        if "amount" in attributes and self.amount is not None:
            self.amount = Decimal(self.amount)
        if "amount_disputed" in attributes and self.amount_disputed is not None:
            self.amount_disputed = Decimal(self.amount_disputed)
        if "amount_won" in attributes and self.amount_won is not None:
            self.amount_won = Decimal(self.amount_won)
        if "transaction" in attributes:
            self.transaction_details = TransactionDetails(attributes.pop("transaction"))
            self.transaction = self.transaction_details
        if "evidence" in attributes and self.evidence is not None:
            self.evidence = [DisputeEvidence(evidence) for evidence in self.evidence]
        if "status_history" in attributes and self.status_history is not None:
            self.status_history = [DisputeStatusHistory(status_history) for status_history in self.status_history]
    def __init__(self, gateway, attributes):
        AttributeGetter.__init__(self, attributes)

        if "amount" in attributes and self.amount:
            self.amount = Decimal(self.amount)
        else:
            self.amount = None

        if "currency_iso_code" not in attributes:
            self.currency_iso_code = None

        if "processor_response_code" not in attributes:
            self.processor_response_code = None
        if "processor_response_text" not in attributes:
            self.processor_response_text = None

        if "risk_data" in attributes:
            self.risk_data = RiskData(attributes["risk_data"])
        else:
            self.risk_data = None
Beispiel #6
0
    def test_backtrace_preserved_when_not_wrapping_exceptions(self):
        class Error(Exception):
            pass

        def raise_error(*_):
            raise Error

        http_strategy = AttributeGetter({"http_do": raise_error})
        config = AttributeGetter({
            "base_url": (lambda: ""),
            "has_access_token": (lambda: False),
            "has_client_credentials": (lambda: False),
            "http_strategy": (lambda: http_strategy),
            "public_key": "",
            "private_key": "",
            "wrap_http_exceptions": False
        })

        try:
            Http(config, "fake_environment").post("/example/path/to/reach")
        except Error:
            _, _, tb = sys.exc_info()
            self.assertEqual('raise_error', traceback.extract_tb(tb)[-1][2])
Beispiel #7
0
    def __init__(self, attributes):
        AttributeGetter.__init__(self, attributes)

        if "amount" in attributes and self.amount is not None:
            self.amount = Decimal(self.amount)
        if "amount_disputed" in attributes and self.amount_disputed is not None:
            self.amount_disputed = Decimal(self.amount_disputed)
        if "amount_won" in attributes and self.amount_won is not None:
            self.amount_won = Decimal(self.amount_won)
        if "transaction" in attributes:
            self.transaction_details = TransactionDetails(
                attributes.pop("transaction"))
            self.transaction = self.transaction_details
        if "evidence" in attributes and self.evidence is not None:
            self.evidence = [
                DisputeEvidence(evidence) for evidence in self.evidence
            ]
        if "status_history" in attributes and self.status_history is not None:
            self.status_history = [
                DisputeStatusHistory(status_history)
                for status_history in self.status_history
            ]
        if "processor_comments" in attributes and self.processor_comments is not None:
            self.forwarded_comments = self.processor_comments
Beispiel #8
0
 def __init__(self, attributes):
     AttributeGetter.__init__(self, attributes)
 def __init__(self, attributes):
     AttributeGetter.__init__(self, attributes)
     self.address_details = AddressDetails(attributes.get("address", {}))
Beispiel #10
0
 def __init__(self, gateway, attributes):
     AttributeGetter.__init__(self, attributes)
     if "processor_response_code" not in attributes:
         self.processor_response_code = None
     if "processor_response_text" not in attributes:
         self.processor_response_text = None
Beispiel #11
0
 def __init__(self, attributes):
     AttributeGetter.__init__(self, attributes)
Beispiel #12
0
 def __init__(self, attributes):
     if attributes.get("category") is not None:
         attributes["tag"] = attributes.pop("category")
     else:
         attributes["tag"] = None
     AttributeGetter.__init__(self, attributes)
 def __init__(self, gateway, attributes):
     AttributeGetter.__init__(self, attributes)
     if "processor_response_code" not in attributes:
         self.processor_response_code = None
     if "processor_response_text" not in attributes:
         self.processor_response_text = None
Beispiel #14
0
    def __init__(self, attributes):
        AttributeGetter.__init__(self, attributes)

        if self.amount is not None:
            self.amount = Decimal(self.amount)
    def __init__(self, attributes):
        AttributeGetter.__init__(self, attributes)

        if self.amount is not None:
            self.amount = Decimal(self.amount)
Beispiel #16
0
 def __init__(self, attributes):
     AttributeGetter.__init__(self, attributes)
     if hasattr(self, 'amount') and self.amount is not None:
         self.amount = Decimal(self.amount)
Beispiel #17
0
 def __init__(self, attributes):
     attributes["tag"] = attributes.get("category")
     AttributeGetter.__init__(self, attributes)
Beispiel #18
0
 def __init__(self, gateway, attributes):
     AttributeGetter.__init__(self, attributes)
     self.gateway = gateway
Beispiel #19
0
 def __init__(self, gateway, attributes):
     AttributeGetter.__init__(self, attributes)
     self.gateway = gateway
Beispiel #20
0
    def __init__(self, attributes):
        AttributeGetter.__init__(self, attributes)

        if getattr(self, "amount", None) is not None:
            self.amount = Decimal(self.amount)
Beispiel #21
0
 def __init__(self, attributes):
     AttributeGetter.__init__(self, attributes)
     self.address_details = AddressDetails(attributes.get("address", {}))