Skip to content

Commit

Permalink
Release 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RytisRe committed Sep 28, 2022
1 parent a6ba53b commit 1ebc698
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 58 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/python-publish.py

This file was deleted.

5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ python setup.py install
## Usage
The library needs to be configured with your account's space id, user id, and secret key which are available in your [wallee
account dashboard](https://app-wallee.com/account/select). Set `space_id`, `user_id`, and `api_secret` to their values.
You can also optionally set `default_headers` to set some headers that will be sent to all requests

### Configuring a Service

Expand All @@ -48,9 +49,11 @@ from wallee.models import LineItem, LineItemType, TransactionCreate

space_id = 405

# default_headers is an optional param, that represents headers sent to all requests
config = Configuration(
user_id=512,
api_secret='FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ='
api_secret='FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=',
default_headers={'x-meta-custom-header': 'value-1', 'x-meta-custom-header-2': 'value-2'}
)
transaction_service = TransactionServiceApi(configuration=config)
transaction_payment_page_service = TransactionPaymentPageServiceApi(configuration=config)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
long_description = fh.read()

NAME = "wallee"
VERSION = "3.1.1"
VERSION = "3.2.0"

REQUIRES = [
"certifi>=2017.4.17",
Expand Down
3 changes: 2 additions & 1 deletion test/transaction_payment_page_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def setUp(self):
self.space_id = 405
config = Configuration(
user_id=512,
api_secret='FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ='
api_secret='FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=',
default_headers={'x-meta-custom-header': 'value-1', 'x-meta-custom-header-2': 'value-2'}
)
self.transaction_service = TransactionServiceApi(configuration=config)
self.transaction_payment_page_service = TransactionPaymentPageServiceApi(configuration=config)
Expand Down
20 changes: 18 additions & 2 deletions wallee/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Python SDK
OpenAPI spec version: 3.1.1
OpenAPI spec version: 3.2.0
"""

Expand All @@ -24,6 +24,7 @@
import tempfile
from enum import Enum
import six
import platform
from six.moves.urllib.parse import quote

from wallee.configuration import Configuration
Expand Down Expand Up @@ -55,11 +56,15 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self._pool = None
self.rest_client = rest.RESTClientObject(configuration)
self.default_headers = {}

for name, value in configuration.default_headers.items():
self.default_headers[name] = value;

if header_name is not None:
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'wallee/3.1.1/python'
self.user_agent = 'wallee/3.2.0/python'

def __del__(self):
if self._pool is not None:
Expand Down Expand Up @@ -95,8 +100,19 @@ def __call_api(

# header parameters
header_params = header_params or {}

# predefined default headers
default_headers = {
'x-meta-sdk-version': '3.2.0',
'x-meta-sdk-language': 'python',
'x-meta-sdk-provider': 'wallee',
'x-meta-sdk-language-version': platform.python_version()
}

header_params.update(self.default_headers)
header_params.update(default_headers)
header_params.update(self.get_auth_headers(resource_path=resource_path, query_params=query_params, method=method))

if self.cookie:
header_params['Cookie'] = self.cookie
if header_params:
Expand Down
8 changes: 5 additions & 3 deletions wallee/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Configuration:

_default = None

def __init__(self, user_id='', api_secret='', mac_version=1):
def __init__(self, user_id='', api_secret='', mac_version=1, default_headers={}):
if self._default:
for key in self._default.__dict__.keys():
self.__dict__[key] = copy.copy(self._default.__dict__[key])
Expand Down Expand Up @@ -85,6 +85,8 @@ def __init__(self, user_id='', api_secret='', mac_version=1):
# Safe chars for path_param
self.safe_chars_for_path_param = ''

self.default_headers=default_headers

@property
def api_secret(self):
return self._api_secret
Expand Down Expand Up @@ -252,6 +254,6 @@ def to_debug_report(self):
return "Python SDK Debug Report:\n"\
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 3.1.1\n"\
"SDK Package Version: 3.1.1".\
"Version of the API: 3.2.0\n"\
"SDK Package Version: 3.2.0".\
format(env=sys.platform, pyversion=sys.version)
30 changes: 29 additions & 1 deletion wallee/models/transaction_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class TransactionCompletion(TransactionAwareEntity):
'remaining_line_items': 'list[LineItem]',
'space_view_id': 'int',
'state': 'TransactionCompletionState',
'statement_descriptor': 'str',
'succeeded_on': 'datetime',
'tax_amount': 'float',
'time_zone': 'str',
Expand All @@ -39,7 +40,7 @@ class TransactionCompletion(TransactionAwareEntity):
}

attribute_map = {
'amount': 'amount','base_line_items': 'baseLineItems','created_by': 'createdBy','created_on': 'createdOn','external_id': 'externalId','failed_on': 'failedOn','failure_reason': 'failureReason','invoice_merchant_reference': 'invoiceMerchantReference','labels': 'labels','language': 'language','last_completion': 'lastCompletion','line_item_version': 'lineItemVersion','line_items': 'lineItems','mode': 'mode','next_update_on': 'nextUpdateOn','payment_information': 'paymentInformation','planned_purge_date': 'plannedPurgeDate','processing_on': 'processingOn','processor_reference': 'processorReference','remaining_line_items': 'remainingLineItems','space_view_id': 'spaceViewId','state': 'state','succeeded_on': 'succeededOn','tax_amount': 'taxAmount','time_zone': 'timeZone','timeout_on': 'timeoutOn','version': 'version',
'amount': 'amount','base_line_items': 'baseLineItems','created_by': 'createdBy','created_on': 'createdOn','external_id': 'externalId','failed_on': 'failedOn','failure_reason': 'failureReason','invoice_merchant_reference': 'invoiceMerchantReference','labels': 'labels','language': 'language','last_completion': 'lastCompletion','line_item_version': 'lineItemVersion','line_items': 'lineItems','mode': 'mode','next_update_on': 'nextUpdateOn','payment_information': 'paymentInformation','planned_purge_date': 'plannedPurgeDate','processing_on': 'processingOn','processor_reference': 'processorReference','remaining_line_items': 'remainingLineItems','space_view_id': 'spaceViewId','state': 'state','statement_descriptor': 'statementDescriptor','succeeded_on': 'succeededOn','tax_amount': 'taxAmount','time_zone': 'timeZone','timeout_on': 'timeoutOn','version': 'version',
}


Expand All @@ -65,6 +66,7 @@ class TransactionCompletion(TransactionAwareEntity):
_remaining_line_items = None
_space_view_id = None
_state = None
_statement_descriptor = None
_succeeded_on = None
_tax_amount = None
_time_zone = None
Expand Down Expand Up @@ -96,6 +98,7 @@ def __init__(self, **kwargs):
self.remaining_line_items = kwargs.get('remaining_line_items', None)
self.space_view_id = kwargs.get('space_view_id', None)
self.state = kwargs.get('state', None)
self.statement_descriptor = kwargs.get('statement_descriptor', None)
self.succeeded_on = kwargs.get('succeeded_on', None)
self.tax_amount = kwargs.get('tax_amount', None)
self.time_zone = kwargs.get('time_zone', None)
Expand Down Expand Up @@ -618,6 +621,31 @@ def state(self, state):

self._state = state

@property
def statement_descriptor(self):
"""Gets the statement_descriptor of this TransactionCompletion.
The statement descriptor explain charges or payments on bank statements.
:return: The statement_descriptor of this TransactionCompletion.
:rtype: str
"""
return self._statement_descriptor

@statement_descriptor.setter
def statement_descriptor(self, statement_descriptor):
"""Sets the statement_descriptor of this TransactionCompletion.
The statement descriptor explain charges or payments on bank statements.
:param statement_descriptor: The statement_descriptor of this TransactionCompletion.
:type: str
"""
if statement_descriptor is not None and len(statement_descriptor) > 22:
raise ValueError("Invalid value for `statement_descriptor`, length must be less than or equal to `22`")

self._statement_descriptor = statement_descriptor

@property
def succeeded_on(self):
"""Gets the succeeded_on of this TransactionCompletion.
Expand Down
30 changes: 29 additions & 1 deletion wallee/models/transaction_completion_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ class TransactionCompletionRequest:
'invoice_merchant_reference': 'str',
'last_completion': 'bool',
'line_items': 'list[CompletionLineItemCreate]',
'statement_descriptor': 'str',
'transaction_id': 'int',
}

attribute_map = {
'external_id': 'externalId','invoice_merchant_reference': 'invoiceMerchantReference','last_completion': 'lastCompletion','line_items': 'lineItems','transaction_id': 'transactionId',
'external_id': 'externalId','invoice_merchant_reference': 'invoiceMerchantReference','last_completion': 'lastCompletion','line_items': 'lineItems','statement_descriptor': 'statementDescriptor','transaction_id': 'transactionId',
}


_external_id = None
_invoice_merchant_reference = None
_last_completion = None
_line_items = None
_statement_descriptor = None
_transaction_id = None

def __init__(self, **kwargs):
Expand All @@ -36,6 +38,7 @@ def __init__(self, **kwargs):
self.last_completion = kwargs.get('last_completion')

self.line_items = kwargs.get('line_items', None)
self.statement_descriptor = kwargs.get('statement_descriptor', None)
self.transaction_id = kwargs.get('transaction_id')


Expand Down Expand Up @@ -143,6 +146,31 @@ def line_items(self, line_items):

self._line_items = line_items

@property
def statement_descriptor(self):
"""Gets the statement_descriptor of this TransactionCompletionRequest.
The statement descriptor explain charges or payments on bank statements.
:return: The statement_descriptor of this TransactionCompletionRequest.
:rtype: str
"""
return self._statement_descriptor

@statement_descriptor.setter
def statement_descriptor(self, statement_descriptor):
"""Sets the statement_descriptor of this TransactionCompletionRequest.
The statement descriptor explain charges or payments on bank statements.
:param statement_descriptor: The statement_descriptor of this TransactionCompletionRequest.
:type: str
"""
if statement_descriptor is not None and len(statement_descriptor) > 22:
raise ValueError("Invalid value for `statement_descriptor`, length must be less than or equal to `22`")

self._statement_descriptor = statement_descriptor

@property
def transaction_id(self):
"""Gets the transaction_id of this TransactionCompletionRequest.
Expand Down

0 comments on commit 1ebc698

Please sign in to comment.