Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name='unit-python-sdk',
packages=['unit', 'unit.api', 'unit.models', 'unit.utils'],
version="1.3.0",
version="1.3.1",
license='Mozilla Public License 2.0',
description='This library provides a python wrapper to http://unit.co API. See https://docs.unit.co/',
author='unit.co',
Expand Down
13 changes: 10 additions & 3 deletions unit/models/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from unit.utils import date_utils

AuthorizationStatus = Literal["Authorized", "Completed", "Canceled", "Declined"]
CardDecisionSource = Literal["Org", "Unit", "Network", "TimeoutApprove", "TimeoutDecline", "DefaultApprove",
"InternalError", "IssuerStandIn"]


class AuthorizationDTO(object):
Expand All @@ -14,7 +16,9 @@ def __init__(self, id: str, created_at: datetime, amount: int, card_last_4_digit
card_network: Optional[str], tags: Optional[Dict[str, str]],
relationships: Optional[Dict[str, Relationship]], merchant_id: Optional[str],
decline_reason: Optional[str], cash_withdrawal_amount: Optional[int], summary: Optional[str],
currency_conversion: Optional[CurrencyConversion], rich_merchant_data: Optional[RichMerchantData]
currency_conversion: Optional[CurrencyConversion], rich_merchant_data: Optional[RichMerchantData],
card_decision_source: Optional[CardDecisionSource], decline_description: Optional[str],
declined_by: Optional[str]
):
self.id = id
self.type = "authorization"
Expand All @@ -26,7 +30,8 @@ def __init__(self, id: str, created_at: datetime, amount: int, card_last_4_digit
"cardVerificationData": card_verification_data, "cardNetwork": card_network, "tags": tags,
"declineReason": decline_reason, "cashWithdrawalAmount": cash_withdrawal_amount,
"summary": summary, "currencyConversion": currency_conversion,
"richMerchantData": rich_merchant_data}
"richMerchantData": rich_merchant_data, "cardDecisionSource": card_decision_source,
"declineDescription": decline_description, "declinedBy": declined_by}
self.relationships = relationships

@staticmethod
Expand All @@ -41,7 +46,9 @@ def from_json_api(_id, _type, attributes, relationships):
attributes.get("declineReason"), attributes.get("cashWithdrawalAmount"),
attributes.get("summary"),
CurrencyConversion.from_json_api(attributes.get("currencyConversion")),
RichMerchantData.from_json_api(attributes.get("richMerchantData"))
RichMerchantData.from_json_api(attributes.get("richMerchantData")),
attributes.get("cardDecisionSource"), attributes.get("declineDescription"),
attributes.get("declinedBy")
)


Expand Down
2 changes: 1 addition & 1 deletion unit/utils/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def get_headers(self):
return {
"content-type": "application/vnd.api+json",
"authorization": f"Bearer {self.token}",
"X-UNIT-SDK": f"unit-python-sdk@v1.3.0"
"X-UNIT-SDK": f"unit-python-sdk@v1.3.1"
}

def set_api_url(self, api_url):
Expand Down
Loading